326 lines
29 KiB
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Text;
namespace Infineon.Monitoring.MonA;
#pragma warning disable CS0436 // The type 'IMonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\IMonIn.cs' conflicts with the imported type 'IMonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\IMonIn.cs'.
public class MonIn : IMonIn, IDisposable
#pragma warning restore CS0436 // The type 'IMonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\IMonIn.cs' conflicts with the imported type 'IMonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\IMonIn.cs'.
{
private static readonly DateTime _Utc1970DateTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public const string MonInUrl = "http://moninhttp.{0}.infineon.com/input/text";
#pragma warning disable CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
private static readonly Dictionary<string, MonIn> _Instances = new();
#pragma warning restore CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
#pragma warning disable CS0436 // The type 'ExtWebClient' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\ExtWebClient.cs' conflicts with the imported type 'ExtWebClient' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\ExtWebClient.cs'.
private readonly ExtWebClient _WebClient;
#pragma warning restore CS0436 // The type 'ExtWebClient' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\ExtWebClient.cs' conflicts with the imported type 'ExtWebClient' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\ExtWebClient.cs'.
private readonly string _MonInUrl;
private static CultureInfo _CultureInfo;
#pragma warning disable CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
public static MonIn GetInstance(string url = "http://moninhttp.{0}.infineon.com/input/text")
#pragma warning restore CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
{
#pragma warning disable CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
MonIn instance;
#pragma warning restore CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
if (_Instances.ContainsKey(url))
{
instance = _Instances[url];
}
else
{
lock (_Instances)
{
if (!_Instances.ContainsKey(url))
{
#pragma warning disable CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
instance = new MonIn(url);
#pragma warning restore CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
_Instances.Add(url, instance);
}
else
instance = _Instances[url];
}
}
return instance;
}
private MonIn(string url)
{
#pragma warning disable CS0436 // The type 'ExtWebClient' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\ExtWebClient.cs' conflicts with the imported type 'ExtWebClient' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\ExtWebClient.cs'.
_WebClient = new ExtWebClient();
#pragma warning restore CS0436 // The type 'ExtWebClient' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\ExtWebClient.cs' conflicts with the imported type 'ExtWebClient' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\ExtWebClient.cs'.
_WebClient.Headers[HttpRequestHeader.ContentType] = "application/text";
_WebClient.Encoding = Encoding.UTF8;
_CultureInfo = new CultureInfo("en-US");
_MonInUrl = url;
}
public void SetBasicAuthentication(string username, string password)
{
_WebClient.PreAuthenticate = true;
_WebClient.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password));
}
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
public string SendStatus(string site, string resource, string stateName, State state) => SendStatus(site, new DateTime?(), resource, string.Empty, stateName, state, string.Empty);
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
public string SendStatus(
string site,
DateTime timeStamp,
string resource,
string stateName,
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
State state) => SendStatus(site, new DateTime?(timeStamp), resource, string.Empty, stateName, state, string.Empty);
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
public string SendStatus(
string site,
string resource,
string stateName,
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
State state,
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
string description) => SendStatus(site, new DateTime?(), resource, string.Empty, stateName, state, description);
public string SendStatus(
string site,
DateTime timeStamp,
string resource,
string stateName,
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
State state,
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
string description) => SendStatus(site, new DateTime?(timeStamp), resource, string.Empty, stateName, state, description);
public string SendStatus(
string site,
string resource,
string subresource,
string stateName,
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
State state) => SendStatus(site, new DateTime?(), resource, subresource, stateName, state, string.Empty);
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
public string SendStatus(
string site,
DateTime timeStamp,
string resource,
string subresource,
string stateName,
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
State state) => SendStatus(site, new DateTime?(timeStamp), resource, subresource, stateName, state, string.Empty);
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
public string SendStatus(
string site,
string resource,
string subresource,
string stateName,
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
State state,
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
string description) => SendStatus(site, new DateTime?(), resource, subresource, stateName, state, description);
public string SendStatus(
string site,
DateTime? timeStamp,
string resource,
string subresource,
string stateName,
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
State state,
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
string description)
{
string statusMessage = CreateStatusMessage(site, timeStamp, resource, subresource, stateName, state.ToString(), description);
lock (_WebClient)
return _WebClient.UploadString(string.Format(_MonInUrl, site), statusMessage);
}
public string SendPerformanceMessage(
string site,
string resource,
string performanceName,
double value) => SendPerformanceMessage(site, new DateTime?(), resource, string.Empty, performanceName, value, string.Empty, string.Empty, new int?());
public string SendPerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string performanceName,
double value) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, string.Empty, string.Empty, new int?());
public string SendPerformanceMessage(
string site,
string resource,
string performanceName,
double value,
string description) => SendPerformanceMessage(site, new DateTime?(), resource, string.Empty, performanceName, value, description, string.Empty, new int?());
public string SendPerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string performanceName,
double value,
string description) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, description, string.Empty, new int?());
public string SendPerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string performanceName,
double value,
int? interval) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, string.Empty, string.Empty, interval);
public string SendPerformanceMessage(
string site,
string resource,
DateTime? timeStamp,
string performanceName,
double value,
string unit) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, string.Empty, unit, new int?());
public string SendPerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string performanceName,
double value,
string unit,
int? interval) => SendPerformanceMessage(site, timeStamp, resource, string.Empty, performanceName, value, string.Empty, unit, interval);
public string SendPerformanceMessage(
string site,
string resource,
string subresource,
string performanceName,
double value) => SendPerformanceMessage(site, new DateTime?(), resource, subresource, performanceName, value, string.Empty, string.Empty, new int?());
public string SendPerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string subresource,
string performanceName,
double value) => SendPerformanceMessage(site, timeStamp, resource, subresource, performanceName, value, string.Empty, string.Empty, new int?());
public string SendPerformanceMessage(
string site,
string resource,
string subresource,
string performanceName,
double value,
string description) => SendPerformanceMessage(site, new DateTime?(), resource, subresource, performanceName, value, description, string.Empty, new int?());
public string SendPerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string subresource,
string performanceName,
double value,
int? interval) => SendPerformanceMessage(site, timeStamp, resource, subresource, performanceName, value, string.Empty, string.Empty, interval);
public string SendPerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string subresource,
string performanceName,
double value,
string unit) => SendPerformanceMessage(site, timeStamp, resource, subresource, performanceName, value, string.Empty, unit, new int?());
public string SendPerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string subresource,
string performanceName,
double value,
string description,
string unit,
int? interval)
{
string performanceMessage = CreatePerformanceMessage(site, timeStamp, resource, subresource, performanceName, value, description, unit, interval);
lock (_WebClient)
return _WebClient.UploadString(string.Format(_MonInUrl, site), performanceMessage);
}
private static string CreateStatusMessage(
string site,
DateTime? timeStamp,
string resource,
string subresource,
string stateName,
string state,
string description)
{
StringBuilder stringBuilder = new();
if (string.IsNullOrEmpty(subresource))
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} \n{5}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), stateName.Trim(), state.Trim(), description.Trim());
else
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} \n{6}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), stateName.Trim(), state.Trim(), description.Trim());
return stringBuilder.ToString();
}
private static string CreatePerformanceMessage(
string site,
DateTime? timeStamp,
string resource,
string subresource,
string performanceName,
double value,
string description,
string unit,
int? interval)
{
StringBuilder stringBuilder = new();
if (string.IsNullOrEmpty(subresource))
{
if (unit.Equals(string.Empty) && !interval.HasValue)
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} \n{5}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), performanceName.Trim(), value, description.Trim());
else
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} {5} {{interval={6}, unit={7}}}\n", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), performanceName.Trim(), value, description.Trim(), interval.HasValue ? interval.Value.ToString() : (object)string.Empty, unit.Trim());
}
else if (unit.Equals(string.Empty) && !interval.HasValue)
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} \n{6}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), performanceName.Trim(), value, description.Trim());
else
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} {6} {{interval={7}, unit={8}}}\n", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), performanceName.Trim(), value, description.Trim(), interval.HasValue ? interval.Value.ToString() : (object)string.Empty, unit.Trim());
return stringBuilder.ToString();
}
private static string GetDateTimeNowAsPosix(DateTime timeStamp)
{
if (timeStamp > DateTime.Now)
timeStamp = DateTime.Now;
return ((int)timeStamp.ToUniversalTime().Subtract(_Utc1970DateTime).TotalSeconds).ToString(CultureInfo.InvariantCulture);
}
public void Dispose()
{
#pragma warning disable CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
KeyValuePair<string, MonIn> keyValuePair = new();
#pragma warning restore CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
#pragma warning disable CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
foreach (KeyValuePair<string, MonIn> instance in _Instances)
{
if (instance.Value == this)
{
keyValuePair = instance;
break;
}
}
#pragma warning restore CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
_ = _Instances.Remove(keyValuePair.Key);
_WebClient?.Dispose();
}
}