初始化
This commit is contained in:
commit
76792ef9ad
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
null
|
5624
Externals/Rhino.Mocks.xml
vendored
Normal file
5624
Externals/Rhino.Mocks.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28655
Externals/log4net.xml
vendored
Normal file
28655
Externals/log4net.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22
README.md
Normal file
22
README.md
Normal file
@ -0,0 +1,22 @@
|
||||
# SERemoteControl
|
||||
|
||||
## 介绍
|
||||
梅特勒pH 调试工具
|
||||
|
||||
## 功能
|
||||
- Attach
|
||||
- Detach
|
||||
- GetStatus
|
||||
- getListOfMethods
|
||||
- getListOfSensors
|
||||
- getListOfModules
|
||||
- startMethod
|
||||
- terminateMethod
|
||||
- getSettings
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
711
SEClient/Commands.cs
Normal file
711
SEClient/Commands.cs
Normal file
@ -0,0 +1,711 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
|
||||
namespace SERemoteConnection
|
||||
{
|
||||
|
||||
public class CommandSimpleRequest : AbstractCommand
|
||||
{
|
||||
public MT.pHLab.SE.V1.Response_SimpleResultRecord m_record;
|
||||
string m_simpleRequest;
|
||||
|
||||
public CommandSimpleRequest(string simpleRequest)
|
||||
{
|
||||
m_simpleRequest = simpleRequest;
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SESimpleRequest request = new MT.pHLab.SE.V1.SESimpleRequest(GetRequestId(), m_simpleRequest);
|
||||
connection.Write(request.CreateTelegram());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_SimpleResultRecord))
|
||||
{
|
||||
m_record = new MT.pHLab.SE.V1.Response_SimpleResultRecord();
|
||||
m_record.ReadXml(reader);
|
||||
|
||||
success = true;
|
||||
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandGetState : AbstractCommand
|
||||
{
|
||||
public MT.pHLab.SE.V1.Response_StatusRecord m_record;
|
||||
|
||||
public CommandGetState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SESimpleRequest request = new MT.pHLab.SE.V1.SESimpleRequest(GetRequestId(), "connection.getStatus");
|
||||
connection.Write(request.CreateTelegram());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_StatusRecord))
|
||||
{
|
||||
m_record = (MT.pHLab.SE.V1.Response_StatusRecord)response.CreateInstance();
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandGetListOfModules : AbstractCommand
|
||||
{
|
||||
public MT.pHLab.SE.V1.moduleConfigParamRecord[] m_list;
|
||||
|
||||
public CommandGetListOfModules()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SESimpleRequest request = new MT.pHLab.SE.V1.SESimpleRequest(GetRequestId(), "module.get");
|
||||
connection.Write(request.CreateTelegram());
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_moduleGetRecord))
|
||||
{
|
||||
MT.pHLab.SE.V1.Response_moduleGetRecord record = new MT.pHLab.SE.V1.Response_moduleGetRecord();
|
||||
record.ReadXml(reader);
|
||||
m_list = record.m_moduleConfigs;
|
||||
success = true;
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandSetModule : AbstractCommand
|
||||
{
|
||||
|
||||
/*
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
<Request requestId="145623" requestType="module.set">
|
||||
<record type="Request_moduleSetRecord">
|
||||
<param-list>
|
||||
<param name="m_moduleId" type="wstring">A</param>
|
||||
<param name="m_sensorId" type="wstring">MTPHSensor</param>
|
||||
</param-list>
|
||||
</record>
|
||||
</Request>
|
||||
</Telegram>
|
||||
*/
|
||||
public MT.pHLab.SE.V1.Request_moduleSetRecord m_request;
|
||||
public MT.pHLab.SE.V1.Response_SimpleResultRecord m_response;
|
||||
|
||||
public CommandSetModule()
|
||||
{
|
||||
m_request = new MT.pHLab.SE.V1.Request_moduleSetRecord();
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
var record = m_request;
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_SimpleResultRecord))
|
||||
{
|
||||
m_response = new MT.pHLab.SE.V1.Response_SimpleResultRecord();
|
||||
m_response.ReadXml(reader);
|
||||
|
||||
success = m_response.m_bSuccess;
|
||||
|
||||
setResponse();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandTerminateMethod : AbstractCommand
|
||||
{
|
||||
public MT.pHLab.SE.V1.Request_terminateMethodRecord m_request;
|
||||
public MT.pHLab.SE.V1.Response_SimpleResultRecord m_response;
|
||||
|
||||
public short JobId { set; get; }
|
||||
|
||||
public CommandTerminateMethod()
|
||||
{
|
||||
m_request = new MT.pHLab.SE.V1.Request_terminateMethodRecord();
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
m_request.m_jobId = JobId;
|
||||
var record = m_request;
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_SimpleResultRecord))
|
||||
{
|
||||
m_response = new MT.pHLab.SE.V1.Response_SimpleResultRecord();
|
||||
m_response.ReadXml(reader);
|
||||
|
||||
success = m_response.m_bSuccess;
|
||||
|
||||
setResponse();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandGetListOfMethods : AbstractCommand
|
||||
{
|
||||
public string[] m_list;
|
||||
|
||||
public CommandGetListOfMethods()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
var record = new MT.pHLab.SE.V1.Request_setupGetItemListRecord();
|
||||
record.m_itemType = "Methods";
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_setupGetItemListRecord))
|
||||
{
|
||||
var record = new MT.pHLab.SE.V1.Response_setupGetItemListRecord();
|
||||
record.ReadXml(reader);
|
||||
m_list = record.m_itemList;
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandGetListOfSensors : AbstractCommand
|
||||
{
|
||||
public string[] m_list;
|
||||
|
||||
public CommandGetListOfSensors()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
var record = new MT.pHLab.SE.V1.Request_setupGetItemListRecord();
|
||||
record.m_itemType = "Sensors";
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_setupGetItemListRecord))
|
||||
{
|
||||
var record = new MT.pHLab.SE.V1.Response_setupGetItemListRecord();
|
||||
record.ReadXml(reader);
|
||||
m_list = record.m_itemList;
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandStartMethod : AbstractCommand
|
||||
{
|
||||
public string MethodId { set; get; }
|
||||
public string SampleId { set; get; }
|
||||
public string Comment { set; get; }
|
||||
|
||||
public bool success = false;
|
||||
public short m_JobId;
|
||||
|
||||
public CommandStartMethod()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
var record = new MT.pHLab.SE.V1.Request_methodParamsRecord();
|
||||
record.m_methodId = MethodId;
|
||||
record.m_sampleId = SampleId;
|
||||
record.m_comment = Comment;
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_startMethodRecord))
|
||||
{
|
||||
var record = new MT.pHLab.SE.V1.Response_startMethodRecord();
|
||||
record.ReadXml(reader);
|
||||
success = record.m_methodId == MethodId;
|
||||
m_JobId = record.m_jobId;
|
||||
} else
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_SimpleResultRecord))
|
||||
{
|
||||
var record = new MT.pHLab.SE.V1.Response_SimpleResultRecord();
|
||||
record.ReadXml(reader);
|
||||
|
||||
success = record.m_bSuccess;
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public enum EItemType
|
||||
{
|
||||
Sensors,
|
||||
Tables,
|
||||
Users,
|
||||
BufStd,
|
||||
Methods
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Modified XML writer that writes (almost) no namespaces out with pretty formatting
|
||||
/// </summary>
|
||||
/// <seealso cref="http://blogs.msdn.com/b/kaevans/archive/2004/08/02/206432.aspx"/>
|
||||
public class XmlNoNamespaceWriter : XmlTextWriter
|
||||
{
|
||||
private bool _SkipAttribute = false;
|
||||
//private int _EncounteredNamespaceCount = 0;
|
||||
|
||||
public XmlNoNamespaceWriter( TextWriter writer)
|
||||
: base(writer)
|
||||
{
|
||||
this.Formatting = System.Xml.Formatting.Indented;
|
||||
}
|
||||
|
||||
public override void WriteStartDocument()
|
||||
{
|
||||
// Do nothing (omit the declaration)
|
||||
}
|
||||
|
||||
public override void WriteStartElement(string prefix, string localName, string ns)
|
||||
{
|
||||
base.WriteStartElement(null, localName, null);
|
||||
}
|
||||
|
||||
public override void WriteStartAttribute(string prefix, string localName, string ns)
|
||||
{
|
||||
//If the prefix or localname are "xmlns", don't write it.
|
||||
//HOWEVER... if the 1st element (root?) has a namespace we will write it.
|
||||
if ((prefix.CompareTo("xmlns") == 0 ||
|
||||
localName.CompareTo("xmlns") == 0))
|
||||
{
|
||||
_SkipAttribute = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.WriteStartAttribute(null, localName, null);
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteString(string text)
|
||||
{
|
||||
//If we are writing an attribute, the text for the xmlns
|
||||
//or xmlns:prefix declaration would occur here. Skip
|
||||
//it if this is the case.
|
||||
if (!_SkipAttribute)
|
||||
{
|
||||
base.WriteString(text);
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteEndAttribute()
|
||||
{
|
||||
//If we skipped the WriteStartAttribute call, we have to
|
||||
//skip the WriteEndAttribute call as well or else the XmlWriter
|
||||
//will have an invalid state.
|
||||
if (!_SkipAttribute)
|
||||
{
|
||||
base.WriteEndAttribute();
|
||||
}
|
||||
//reset the boolean for the next attribute.
|
||||
_SkipAttribute = false;
|
||||
}
|
||||
|
||||
public override void WriteQualifiedName(string localName, string ns)
|
||||
{
|
||||
//Always write the qualified name using only the
|
||||
//localname.
|
||||
base.WriteQualifiedName(localName, null);
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandExportTable : AbstractCommand
|
||||
{
|
||||
|
||||
public bool success = false;
|
||||
protected EItemType m_eItemType;
|
||||
MT.pHLab.SE.V1.Response_SimpleResultRecord m_response;
|
||||
public byte[] Table { set; get; }
|
||||
|
||||
public CommandExportTable(EItemType eItemType)
|
||||
{
|
||||
m_eItemType = eItemType;
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
var record = new MT.pHLab.SE.V1.Request_setupExportRecord();
|
||||
record.m_itemGroup = m_eItemType.ToString();
|
||||
record.m_itemName = "";
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
reader.Read();
|
||||
if (reader.Name.Equals("pdk-db") && (reader.NodeType == XmlNodeType.Element))
|
||||
{
|
||||
XmlReader _reader = reader.ReadSubtree();
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(_reader);
|
||||
|
||||
StringWriter textWriter = new StringWriter();
|
||||
using (var xmlWriter = new XmlNoNamespaceWriter(textWriter))
|
||||
{
|
||||
doc.Save(xmlWriter);
|
||||
Console.WriteLine(textWriter.ToString() );
|
||||
Table = System.Text.Encoding.UTF8.GetBytes(textWriter.ToString());
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
else
|
||||
if (reader.Name.Equals("record") && (reader.NodeType == XmlNodeType.Element))
|
||||
{
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_SimpleResultRecord))
|
||||
{
|
||||
m_response = new MT.pHLab.SE.V1.Response_SimpleResultRecord();
|
||||
m_response.ReadXml(reader);
|
||||
|
||||
success = m_response.m_bSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandImportTable : AbstractCommand
|
||||
{
|
||||
|
||||
public bool success = false;
|
||||
protected EItemType m_eItemType;
|
||||
MT.pHLab.SE.V1.Response_SimpleResultRecord m_response;
|
||||
|
||||
public Byte[] Table { set; get; }
|
||||
|
||||
public CommandImportTable()
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Indent = false;
|
||||
settings.Encoding = new UTF8Encoding(false);
|
||||
using (MemoryStream output = new MemoryStream())
|
||||
{
|
||||
using (var writer = XmlWriter.Create(output, settings ))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("Telegram");
|
||||
writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema");
|
||||
writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
|
||||
writer.WriteStartElement("Request");
|
||||
writer.WriteAttributeString("requestType", "setup.import");
|
||||
writer.WriteAttributeString("requestId", GetRequestId().ToString());
|
||||
{
|
||||
string content = Encoding.UTF8.GetString(Table);
|
||||
string unformated = XElement.Parse(content).ToString(SaveOptions.DisableFormatting);
|
||||
Console.WriteLine(unformated);
|
||||
|
||||
writer.WriteRaw(unformated);
|
||||
}
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndDocument();
|
||||
}
|
||||
connection.Write(output.ToArray());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
//<Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
// <Response requestId="152015">
|
||||
// <record type="Response_SimpleResultRecord">
|
||||
// <param-list>
|
||||
// <param name="m_bSuccess" type="boolean">true</param>
|
||||
// <param name="m_errorReason" type="wstring" />
|
||||
// </param-list>
|
||||
// </record>
|
||||
// </Response>
|
||||
//</Telegram>
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
//reader.Read();
|
||||
//if (reader.Name.Equals("record") && (reader.NodeType == XmlNodeType.Element))
|
||||
{
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_SimpleResultRecord))
|
||||
{
|
||||
m_response = new MT.pHLab.SE.V1.Response_SimpleResultRecord();
|
||||
m_response.ReadXml(reader);
|
||||
|
||||
success = m_response.m_bSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandSettingGet : AbstractCommand
|
||||
{
|
||||
public string Setting { set; get; }
|
||||
public string Value { set; get; }
|
||||
|
||||
public CommandSettingGet()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
var record = new MT.pHLab.SE.V1.Request_getSettingRecord();
|
||||
record.m_settingName = Setting;
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_getSettingRecord))
|
||||
{
|
||||
var record = new MT.pHLab.SE.V1.Response_getSettingRecord();
|
||||
record.ReadXml(reader);
|
||||
Value = record.m_settingValue;
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandSettingSet : AbstractCommand
|
||||
{
|
||||
public string Setting { set; get; }
|
||||
public string Value { set; get; }
|
||||
|
||||
public CommandSettingSet()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
var record = new MT.pHLab.SE.V1.Request_setSettingRecord();
|
||||
record.m_settingName = Setting;
|
||||
record.m_settingValue = Value;
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_SimpleResultRecord))
|
||||
{
|
||||
var record = new MT.pHLab.SE.V1.Response_SimpleResultRecord();
|
||||
record.ReadXml(reader);
|
||||
success = record.m_bSuccess;
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class CommandScreenLogin : AbstractCommand
|
||||
{
|
||||
public string[] Usererlist{ set; get; }
|
||||
public string Username{ set; get; }
|
||||
public string Password{ set; get; }
|
||||
|
||||
public CommandScreenLogin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
<Request requestId="132440" requestType="login">
|
||||
<record type="Request_loginRecord">
|
||||
<param-list>
|
||||
<param name="m_usernames" type="sequence" sequenceType="wstring">
|
||||
<item>Tom</item>
|
||||
<item>Jerry</item>
|
||||
<item>Alex</item>
|
||||
</param>
|
||||
</param-list>
|
||||
</record>
|
||||
</Request>
|
||||
</Telegram>
|
||||
* */
|
||||
|
||||
public override bool Submit(SEConnection connection)
|
||||
{
|
||||
MT.pHLab.SE.V1.SEParamRequest request = new MT.pHLab.SE.V1.SEParamRequest(GetRequestId());
|
||||
var record = new MT.pHLab.SE.V1.Request_loginRecord();
|
||||
if (Usererlist != null)
|
||||
{
|
||||
record.m_usernames = Usererlist;
|
||||
}
|
||||
else
|
||||
{
|
||||
record.m_usernames = new string[] { };
|
||||
|
||||
}
|
||||
connection.Write(request.CreateTelegram(record));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_loginRecord))
|
||||
{
|
||||
var record = new MT.pHLab.SE.V1.Response_loginRecord();
|
||||
record.ReadXml(reader);
|
||||
Username = record.m_username;
|
||||
Password = record.m_password;
|
||||
}
|
||||
|
||||
setResponse();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
BIN
SEClient/Contract/SevenExcellence-Home.png
Normal file
BIN
SEClient/Contract/SevenExcellence-Home.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
SEClient/Contract/SevenExcellence-Home.xcf
Normal file
BIN
SEClient/Contract/SevenExcellence-Home.xcf
Normal file
Binary file not shown.
BIN
SEClient/Contract/SevenExcellence.png
Normal file
BIN
SEClient/Contract/SevenExcellence.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
14
SEClient/Contract/generateServices.bat
Normal file
14
SEClient/Contract/generateServices.bat
Normal file
@ -0,0 +1,14 @@
|
||||
call "%VS110COMNTOOLS%vsvars32.bat"
|
||||
|
||||
@pushd %cd%
|
||||
|
||||
@rem %~dp0 will give you the full path to the batch file (fixed)
|
||||
cd %~dp0
|
||||
|
||||
rem xsd.exe results_labx.xsd /classes /language:cs /n:MT.pHLab.SE.V1
|
||||
xsd.exe results_labxdirect.xsd /classes /n:MT.pHLab.SE.V1
|
||||
|
||||
|
||||
@popd
|
||||
|
||||
:Exit
|
72
SEClient/Contract/importer.xsd
Normal file
72
SEClient/Contract/importer.xsd
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- PLATFORM: $Revision: 1.1 $ of $Date: 2009/04/27 10:58:53 $ -->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="tf"
|
||||
targetNamespace="tf"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<xs:complexType name="method">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="unbounded" name="mf" type="tns:record" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="method" type="tns:method" />
|
||||
|
||||
<xs:complexType name="record">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" name="param-list" type="tns:param-list" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" name="sf-list" type="tns:sf-list"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="type" type="xs:string" use="required" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="record" type="tns:record" />
|
||||
|
||||
<xs:complexType name="param-list">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" name="param" type="tns:param" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="sf-list">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" name="sf" type="tns:record" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="param" mixed="true">
|
||||
<xs:choice>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element name="item" type="tns:item" />
|
||||
</xs:sequence>
|
||||
<xs:element name="record" type="tns:record" />
|
||||
<!-- @todo string is allowed too -->
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string" use="required" />
|
||||
<xs:attribute name="type" type="tns:pdk_datatypes" use="required" />
|
||||
<xs:attribute name="sequenceType" type="tns:pdk_datatypes" use="optional" />
|
||||
<xs:attribute name="recordType" type="xs:string" use="optional" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="item" mixed="true">
|
||||
<xs:choice>
|
||||
<xs:element name="record" type="tns:record" />
|
||||
<!-- @todo string is allowed too -->
|
||||
</xs:choice>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="pdk_datatypes">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="boolean" />
|
||||
<xs:enumeration value="short" />
|
||||
<xs:enumeration value="wstring" />
|
||||
<xs:enumeration value="decfloat" />
|
||||
<xs:enumeration value="long" />
|
||||
<xs:enumeration value="datetime" />
|
||||
<xs:enumeration value="sequence" />
|
||||
<xs:enumeration value="record" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
</xs:schema>
|
39
SEClient/Contract/result_types_platform.xsd
Normal file
39
SEClient/Contract/result_types_platform.xsd
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- PLATFORM: $Revision: 1.4 $ of $Date: 2009/07/07 12:59:33 $ -->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="tf"
|
||||
targetNamespace="tf"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- Platform Types -->
|
||||
<xs:simpleType name="EDecimalResultState">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="eDecimalResultState_Valid" />
|
||||
<xs:enumeration value="eDecimalResultState_NaN" />
|
||||
<xs:enumeration value="eDecimalResultState_INF" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="DecimalResult">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="timestamp" type="xs:dateTime" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="state" type="tns:EDecimalResultState" />
|
||||
<xs:element minOccurs="0" maxOccurs="1" nillable="false" name="value" type="tns:decfloat" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="IntegerResult">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="timestamp" type="xs:dateTime" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="value" type="xs:long" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="StringResult">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="timestamp" type="xs:dateTime" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="value" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
</xs:schema>
|
19069
SEClient/Contract/results_labx_2.cs
Normal file
19069
SEClient/Contract/results_labx_2.cs
Normal file
File diff suppressed because it is too large
Load Diff
19067
SEClient/Contract/results_labxdirect.cs
Normal file
19067
SEClient/Contract/results_labxdirect.cs
Normal file
File diff suppressed because it is too large
Load Diff
320
SEClient/Contract/results_labxdirect.xsd
Normal file
320
SEClient/Contract/results_labxdirect.xsd
Normal file
@ -0,0 +1,320 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="tf"
|
||||
targetNamespace="tf"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- Import PDK result types -->
|
||||
<xs:include schemaLocation="result_types_platform.xsd"/>
|
||||
<xs:include schemaLocation="service.xsd"/>
|
||||
<xs:include schemaLocation="importer.xsd"/>
|
||||
|
||||
<!-- TREASURE FLEET Types -->
|
||||
|
||||
<xs:simpleType name="EResultLimitState">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="eResultLimit_NotChecked"/>
|
||||
<xs:enumeration value="eResultLimit_InRange"/>
|
||||
<xs:enumeration value="eResultLimit_OutUpper"/>
|
||||
<xs:enumeration value="eResultLimit_OutLower"/>
|
||||
<xs:enumeration value="eResultLimit_min"/>
|
||||
<xs:enumeration value="eResultLimit_max"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="EResultQuality">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="eDraftValue"/>
|
||||
<xs:enumeration value="eDraftValue_Stable"/>
|
||||
<xs:enumeration value="eManualEndpoint"/>
|
||||
<xs:enumeration value="eAutoEndpoint_Strict"/>
|
||||
<xs:enumeration value="eAutoEndpoint_Normal"/>
|
||||
<xs:enumeration value="eAutoEndpoint_Fast"/>
|
||||
<xs:enumeration value="eAutoEndpoint_UserDef"/>
|
||||
<xs:enumeration value="eTimedEndpoint"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="ResultPh">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawValueUnit" type="tns:ECommonUnit " />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawTemperature" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="temperatureUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultQuality" type="tns:EResultQuality" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultLimitState" type="tns:EResultLimitState" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="timestamp" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultCnd">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawValueUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawTemperature" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="temperatureUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="usedCC" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="cndMode" type="tns:ECondMode" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultQuality" type="tns:EResultQuality" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultLimitState" type="tns:EResultLimitState" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="timestamp" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultDO">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawValueUnit" type="tns:ECommonUnit " />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawTemperature" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="temperatureUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawPressure" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="pressureUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultQuality" type="tns:EResultQuality" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultLimitState" type="tns:EResultLimitState" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="timestamp" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
<xs:complexType name="OUPData">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="doMgl" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="OxygenSaturation" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawTemperature" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rawPressure" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="sali" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="datetime" type="xs:dateTime" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="resultQuality" type="tns:EResultQuality" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="analysisAction" type="tns:EMFAnalysisAction" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="analysisStatus" type="tns:EAnalysisStatus" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ArrayOfOUPData">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" nillable="true" name="ArrayOfOUPData" type="tns:OUPData" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="ArrayOfOUPData" type="tns:ArrayOfOUPData" />
|
||||
|
||||
<xs:complexType name="BODResult">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="bottleBOD" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="bottleO2Depletion" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="elapsedSeconds" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="analysisAction" type="tns:EMFAnalysisAction" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ArrayOfBODResult">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" nillable="true" name="ArrayOfBODResult" type="tns:BODResult" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="ArrayOfBODResult" type="tns:ArrayOfBODResult" />
|
||||
|
||||
<xs:complexType name="ArrayOfDecfloat">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" nillable="true" name="ArrayOfDecfloat" type="tns:decfloat" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="ArrayOfDecfloat" type="tns:ArrayOfDecfloat" />
|
||||
|
||||
<xs:complexType name="ResultBcv">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="base" type="tns:ArrayOfOUPData" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="follow" type="tns:ArrayOfOUPData" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="result" type="tns:ArrayOfBODResult" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="standardDeviation" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="finalResult" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="doUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="tempUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="pressureUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="doResolution" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="bodResolution" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="timestamp" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultBcvBlank">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="BCVBlankResult" type="tns:ResultBcv" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultBcvSeed">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="BCVSeedResult" type="tns:ResultBcv" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="O2DepletionPercent" type="tns:ArrayOfDecfloat" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultBcvStandard">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="BCVStandardResult" type="tns:ResultBcv" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="seedCorrectFactor" type="tns:ArrayOfDecfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="blankCorrectFactor" type="tns:ArrayOfDecfloat" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultBODSample">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="BCVSampleResult" type="tns:ResultBcv" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="seedCorrectFactor" type="tns:ArrayOfDecfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="blankCorrectFactor" type="tns:ArrayOfDecfloat" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultMFCalibrationPHISFET">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="defaultSlope" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="calMode" type="xs:short" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="offsetLimitStates" type="tns:ArrayOfShort" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="slopeLimitStates" type="tns:ArrayOfShort" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="sensorCalPoints" type="tns:ArrayOfPHISFETCalPointData" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultMFCalibrationISE">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="defaultSlope" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="calibrationMode" type="xs:short" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="calibrationUnit" type="xs:short" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="ionType" type="xs:short" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="ionCharge" type="xs:byte" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="ionMolMass" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="offsetLimitStates" type="tns:ArrayOfShort" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="slopeLimitStates" type="tns:ArrayOfShort" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="sensorCalPoints" type="tns:ArrayOfISECalPointData" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultMFCalibrationCND">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="cellConstantLimitState" type="tns:ArrayOfShort" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="sensorCalPoints" type="tns:CondCalPointData" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultMFCalibrationDO">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="defaultSlope" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="slopeLimitState" type="xs:short" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="doSensorType" type="xs:short" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="salinityCorrectionFactor" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="sensorCalPoints" type="tns:ArrayOfDOCalPointData" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
|
||||
<xs:complexType name="ResultAdjustmentParameters">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="true" name="adjustParameters" type="tns:ArrayOfSensorAdjustParameter" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultISMStatisticsCommon">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="sensorSerialNumber" type="xs:string" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="temperatureUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="maxTemperatureValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="maxTemperatureDate" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultISMStatisticsPhDigital">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="sensorSerialNumber" type="xs:string" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="temperatureUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="maxTemperatureValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="maxTemperatureDate" type="xs:dateTime" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="averageTemperatureValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="measurementTimeUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="measurementTime" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="pHUnit" type="tns:ECommonUnit" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="averagePhValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="maxPhValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="maxPhDate" type="xs:dateTime" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="minPhValue" type="tns:decfloat" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="minPhDate" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="EAnalysisStatus">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="eAnalysisStatusid_AnalysisStatus_OK"/>
|
||||
<xs:enumeration value="eAnalysisStatusid_AnalysisStatus_OKStar"/>
|
||||
<xs:enumeration value="eAnalysisStatusid_AnalysisStatus_Failed"/>
|
||||
<xs:enumeration value="eAnalysisStatusid_AnalysisStatus_Error"/>
|
||||
<xs:enumeration value="eAnalysisStatusid_AnalysisStatus_CriticalError"/>
|
||||
<xs:enumeration value="eAnalysisStatusid_AnalysisStatus_Terminate"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="EndOfMethod">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="m_timestamp" type="xs:dateTime" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="m_eAnalysisStatus" type="tns:EAnalysisStatus" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="m_uiJobId" type="xs:short" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="m_user" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
<!-- Treasure Fleet AnyResult Container -->
|
||||
<xs:complexType name="TreasureFleetAnyResult">
|
||||
<xs:sequence>
|
||||
<xs:choice>
|
||||
<xs:element name="DecimalResult" type="tns:DecimalResult" />
|
||||
<xs:element name="IntegerResult" type="tns:IntegerResult" />
|
||||
<xs:element name="StringResult" type="tns:StringResult" />
|
||||
<xs:element name="ResultPh" type="tns:ResultPh" />
|
||||
<xs:element name="ResultCnd" type="tns:ResultCnd" />
|
||||
<xs:element name="ResultDO" type="tns:ResultDO" />
|
||||
<xs:element name="ResultMFCalibrationISE" type="tns:ResultMFCalibrationISE" />
|
||||
<xs:element name="ResultMFCalibrationPHISFET" type="tns:ResultMFCalibrationPHISFET" />
|
||||
<xs:element name="ResultMFCalibrationCND" type="tns:ResultMFCalibrationCND" />
|
||||
<xs:element name="ResultMFCalibrationDO" type="tns:ResultMFCalibrationDO" />
|
||||
<xs:element name="ResultBcvBlank" type="tns:ResultBcvBlank" />
|
||||
<xs:element name="ResultBcvSeed" type="tns:ResultBcvSeed" />
|
||||
<xs:element name="ResultBcvStandard" type="tns:ResultBcvStandard" />
|
||||
<xs:element name="ResultBODSample" type="tns:ResultBODSample" />
|
||||
<xs:element name="ResultAdjustmentParameters" type="tns:ResultAdjustmentParameters" />
|
||||
<xs:element name="ResultISMStatisticsCommon" type="tns:ResultISMStatisticsCommon" />
|
||||
<xs:element name="ResultISMStatisticsPhDigital" type="tns:ResultISMStatisticsPhDigital" />
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ResultMessage">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="rackid" type="xs:string" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="slotid" type="xs:string" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="groupid" type="xs:string" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="unit" type="xs:int" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="unitstring" type="xs:string" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="precision" type="xs:int" />
|
||||
<xs:element minOccurs="1" maxOccurs="1" nillable="false" name="result" type="tns:TreasureFleetAnyResult" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="ResultMessage" type="tns:ResultMessage"/>
|
||||
|
||||
<xs:complexType name="Telegram">
|
||||
<xs:sequence>
|
||||
<xs:choice>
|
||||
<xs:element name="ResultMessage" type="tns:ResultMessage" />
|
||||
<xs:element name="method" type="tns:method" />
|
||||
<xs:element name="EndOfMethod" type="tns:EndOfMethod" />
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="Telegram" type="tns:Telegram"/>
|
||||
|
||||
|
||||
</xs:schema>
|
3483
SEClient/Contract/service.xsd
Normal file
3483
SEClient/Contract/service.xsd
Normal file
File diff suppressed because it is too large
Load Diff
3146
SEClient/Contract/service.xsd.backup
Normal file
3146
SEClient/Contract/service.xsd.backup
Normal file
File diff suppressed because it is too large
Load Diff
306
SEClient/LancePdkXML.cs
Normal file
306
SEClient/LancePdkXML.cs
Normal file
@ -0,0 +1,306 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using log4net;
|
||||
using System.Xml;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SERemoteLib
|
||||
{
|
||||
/// <summary>
|
||||
/// The serializer to generate an XML document. This class offers some functions to create general xml-elements
|
||||
/// for the transfer of data over SOAP to a PDK instrument.
|
||||
/// </summary>
|
||||
public sealed class PdkXmlSerializer
|
||||
{
|
||||
private static IDictionary<Type, String> typeMappings;
|
||||
|
||||
/// <summary>
|
||||
/// The XmlElement name of a parameterlist-element.
|
||||
/// </summary>
|
||||
public static readonly String ParamlistElementname = "param-list";
|
||||
/// <summary>
|
||||
/// The XmlElement name of a parameter-element.
|
||||
/// </summary>
|
||||
public static readonly String ParamElementname = "param";
|
||||
/// <summary>
|
||||
/// The XmlElement name of a parameter-element.
|
||||
/// </summary>
|
||||
public static readonly String ItemElementname = "item";
|
||||
/// <summary>
|
||||
/// The XmlAttribute name of a type-attribute.
|
||||
/// </summary>
|
||||
public static readonly String TypeAttributename = "type";
|
||||
/// <summary>
|
||||
/// The XmlAttribute name of a sequence type-attribute.
|
||||
/// </summary>
|
||||
public static readonly String SequenceTypeAttributename = "sequenceType";
|
||||
/// <summary>
|
||||
/// The XmlAttribute name of a name-attribute.
|
||||
/// </summary>
|
||||
public static readonly String NameAttributename = "name";
|
||||
|
||||
/// <summary>
|
||||
/// The XmlElement name of a method-element.
|
||||
/// </summary>
|
||||
public static readonly String MethodElementname = "method";
|
||||
/// <summary>
|
||||
/// The XmlElement name of a methodfunction-element.
|
||||
/// </summary>
|
||||
public static readonly String MethodfunctionElementname = "mf";
|
||||
/// <summary>
|
||||
/// The XmlElement name of a record-element.
|
||||
/// </summary>
|
||||
public static readonly String RecordElementname = "record";
|
||||
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(PdkXmlSerializer));
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PdkXmlSerializer"/> class.
|
||||
/// </summary>
|
||||
private PdkXmlSerializer()
|
||||
{ }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the record <paramref name="record"/> into the PDK specific XML.
|
||||
/// </summary>
|
||||
/// <param name="record">The browsable screen record.</param>
|
||||
/// <returns></returns>
|
||||
public static string SerializeRecord(object record)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
XmlElement recordElement = CreateRecordElement(record, doc);
|
||||
doc.AppendChild(recordElement);
|
||||
|
||||
if (logger.IsDebugEnabled)
|
||||
{
|
||||
logger.Debug("Serialized " + record.GetType().ToString() + " into " + doc.InnerXml);
|
||||
}
|
||||
|
||||
return doc.InnerXml.Replace("\r\n", "
").Replace("\n", "
").Replace("\t", "	");
|
||||
}
|
||||
|
||||
private static XmlElement CreateRecordElement(object recordObject, XmlDocument doc)
|
||||
{
|
||||
XmlElement recordElement = doc.CreateElement(RecordElementname);
|
||||
|
||||
XmlAttribute recordTypeAttribute = doc.CreateAttribute(TypeAttributename);
|
||||
recordTypeAttribute.InnerText = recordObject.GetType().Name;
|
||||
recordElement.Attributes.Append(recordTypeAttribute);
|
||||
|
||||
XmlElement paramListElement = CreateParameterListElement(recordObject, doc);
|
||||
recordElement.AppendChild(paramListElement);
|
||||
|
||||
return recordElement;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the type-mapping dictonary.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "add collection members")]
|
||||
static PdkXmlSerializer()
|
||||
{
|
||||
typeMappings = new Dictionary<Type, String>();
|
||||
|
||||
typeMappings.Add(typeof(string), "wstring");
|
||||
typeMappings.Add(typeof(bool), "boolean");
|
||||
typeMappings.Add(typeof(short), "short");
|
||||
typeMappings.Add(typeof(DateTime), "datetime");
|
||||
typeMappings.Add(typeof(decimal), "decfloat");
|
||||
typeMappings.Add(typeof(int), "long");
|
||||
typeMappings.Add(typeof(byte), "octet");
|
||||
//typeMappings.Add(typeof(decfloat), "decfloat");
|
||||
typeMappings.Add(typeof(double), "double");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps a <paramref name="type"/> to the according PDK type.
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static String MapType(Type type)
|
||||
{
|
||||
if (typeMappings.ContainsKey(type))
|
||||
{
|
||||
return typeMappings[type];
|
||||
}
|
||||
else if (type.IsEnum)
|
||||
{
|
||||
return "short";
|
||||
}
|
||||
else if (type.IsArray)
|
||||
{
|
||||
return "sequence";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "record";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the <paramref name="val"/> value into the according XML representation.
|
||||
/// </summary>
|
||||
/// <param name="val">The value to serialize. MUST NOT be null</param>
|
||||
/// <returns>XML string representing the value.</returns>
|
||||
public static String SerializeValue(object val)
|
||||
{
|
||||
String returnValue = null;
|
||||
|
||||
if (val == null)
|
||||
{
|
||||
throw new ArgumentException("The argument val MUST NOT be null.");
|
||||
}
|
||||
|
||||
if (typeMappings.ContainsKey(val.GetType()))
|
||||
{
|
||||
if (val.GetType() == typeof(string))
|
||||
{
|
||||
returnValue = (string)val;
|
||||
}
|
||||
else if (val.GetType() == typeof(bool))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((bool)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(short))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((short)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(DateTime))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((DateTime)val, "yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
else if (val.GetType() == typeof(decimal))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((decimal)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(int))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((int)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(byte))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((byte)val);
|
||||
}
|
||||
//else if (val.GetType() == typeof(decfloat))
|
||||
//{
|
||||
// returnValue = ((decfloat)val).Value;
|
||||
//}
|
||||
else if (val.GetType() == typeof(double))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((double)val);
|
||||
}
|
||||
}
|
||||
else if (val.GetType().IsEnum)
|
||||
{
|
||||
returnValue = XmlConvert.ToString((int)val);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the element param-list element with all its param subelements. Each property of the <paramref name="paramObject"/>
|
||||
/// is added as a param elemment.
|
||||
/// </summary>
|
||||
/// <param name="paramObject"></param>
|
||||
/// <param name="doc"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes", MessageId = "System.Xml.XmlNode"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "object")]
|
||||
private static XmlElement CreateParameterListElement(object paramObject, XmlDocument doc)
|
||||
{
|
||||
XmlElement paramListElement = doc.CreateElement(ParamlistElementname);
|
||||
|
||||
//add parameters
|
||||
PropertyInfo[] properties = paramObject.GetType().GetProperties();
|
||||
foreach (PropertyInfo property in properties)
|
||||
{
|
||||
bool ignoreThisProperty = false;
|
||||
foreach (System.Xml.Serialization.XmlIgnoreAttribute xmlIgnoreAttribute in property.GetCustomAttributes(typeof(System.Xml.Serialization.XmlIgnoreAttribute), false))
|
||||
{
|
||||
ignoreThisProperty = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ignoreThisProperty)
|
||||
{
|
||||
XmlElement paramElement = CreateParameterElement(property, paramObject, doc);
|
||||
paramListElement.AppendChild(paramElement);
|
||||
}
|
||||
}
|
||||
|
||||
return paramListElement;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the param element for the <paramref name="property"/>.
|
||||
/// </summary>
|
||||
/// <param name="property"></param>
|
||||
/// <param name="paramObject"></param>
|
||||
/// <param name="doc"></param>
|
||||
/// <returns></returns>
|
||||
private static XmlElement CreateParameterElement(PropertyInfo property, object paramObject, XmlDocument doc)
|
||||
{
|
||||
XmlElement paramElement = doc.CreateElement(ParamElementname);
|
||||
|
||||
XmlAttribute nameAttribute = doc.CreateAttribute(NameAttributename);
|
||||
nameAttribute.InnerText = property.Name;
|
||||
paramElement.Attributes.Append(nameAttribute);
|
||||
|
||||
XmlAttribute paramTypeAttribute = doc.CreateAttribute(TypeAttributename);
|
||||
paramTypeAttribute.InnerText = MapType(property.GetGetMethod().ReturnType);
|
||||
paramElement.Attributes.Append(paramTypeAttribute);
|
||||
|
||||
object val = property.GetValue(paramObject, null);
|
||||
if (val != null)
|
||||
{
|
||||
if (paramTypeAttribute.InnerText == "record")
|
||||
{
|
||||
XmlElement recordElement = CreateRecordElement(val, doc);
|
||||
paramElement.AppendChild(recordElement);
|
||||
}
|
||||
else if (paramTypeAttribute.InnerText == "sequence")
|
||||
{
|
||||
XmlAttribute seqTypeAttribute = doc.CreateAttribute(SequenceTypeAttributename);
|
||||
bool isComplexTypeSequence;
|
||||
if (property.PropertyType == typeof(string[]))
|
||||
{
|
||||
seqTypeAttribute.InnerText = MapType(typeof(string));
|
||||
isComplexTypeSequence = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
seqTypeAttribute.InnerText = RecordElementname;
|
||||
isComplexTypeSequence = true;
|
||||
}
|
||||
paramElement.Attributes.Append(seqTypeAttribute);
|
||||
|
||||
Array ar = (Array)val;
|
||||
for (int i = 0; i < ar.Length; ++i)
|
||||
{
|
||||
XmlElement itemElement = doc.CreateElement(ItemElementname);
|
||||
if (isComplexTypeSequence)
|
||||
{
|
||||
XmlElement recordElement = CreateRecordElement(ar.GetValue(i), doc);
|
||||
itemElement.AppendChild(recordElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemElement.InnerText = ar.GetValue(i).ToString();
|
||||
}
|
||||
paramElement.AppendChild(itemElement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
paramElement.InnerText = SerializeValue(val);
|
||||
}
|
||||
}
|
||||
|
||||
return paramElement;
|
||||
}
|
||||
}
|
||||
}
|
91
SEClient/NotificationBroker/LocalSubscription.cs
Normal file
91
SEClient/NotificationBroker/LocalSubscription.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Application specific Notification Broker message handler delegate.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="notification"></param>
|
||||
public delegate void NotificationHandler(object sender, Notification notification);
|
||||
|
||||
/// <summary>
|
||||
/// Subscriber using in-AppDomain communication via delegates.
|
||||
/// </summary>
|
||||
public class LocalSubscription : Subscription
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="type">type of notification this subscriber is interested to receive</param>
|
||||
/// <param name="filters">notification message filter defining rules for filter in or out of messages</param>
|
||||
/// <param name="handler">(Multicast-)Delegate to invoke for notification delivery</param>
|
||||
public LocalSubscription(Type type, NotificationHandler handler, IList<ISubscriptionFilter> filters)
|
||||
: base(type, filters)
|
||||
{
|
||||
lock (LockObject)
|
||||
{
|
||||
this.handler = handler;
|
||||
}
|
||||
}
|
||||
|
||||
private NotificationHandler handler;
|
||||
/// <summary>
|
||||
/// Delegate to invoke when a notification of a desired type arrives.
|
||||
/// </summary>
|
||||
public NotificationHandler Handler
|
||||
{
|
||||
get { lock (LockObject) { return handler; } }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Safely invoke delegates to fire notification. Done on a separate thread pool thread.
|
||||
/// </summary>
|
||||
/// <param name="notification"></param>
|
||||
public override void Send(Notification notification)
|
||||
{
|
||||
// Broadcast messages individually
|
||||
Delegate[] invocationList = null;
|
||||
lock (LockObject)
|
||||
{
|
||||
if (this.Handler == null) return;
|
||||
invocationList = (Delegate[])this.Handler.GetInvocationList().Clone();
|
||||
}
|
||||
|
||||
// If not a multicast delegate, then invoke in this thread, as Subscriptions.Fire already
|
||||
// scheduled invocation onto a separate thread from the one calling ServiceAccessor.GetService<INotificationBroker>().Fire()
|
||||
if (invocationList.Length == 1)
|
||||
{
|
||||
// singlecast delegate (only 1 handler). Call directly from this thread pool thread.
|
||||
// For performance reasons do not switch to yet another thread.
|
||||
invocationList[0].DynamicInvoke(this, notification);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Invoke every delegate separately to allow for exception handling.
|
||||
// Otherwise following handlers are not invoked.
|
||||
foreach (NotificationHandler oneNotiticationHandler in invocationList)
|
||||
{
|
||||
try
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(delegate(object state)
|
||||
{
|
||||
NotificationHandler handler = state as NotificationHandler;
|
||||
|
||||
// invoke one separate invocation handler on pool thread to decouple.
|
||||
handler(this, notification);
|
||||
}, oneNotiticationHandler);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new NotImplementedException("One of the multicast delegate invocations on "
|
||||
+ "subscription handlers failed. Decide on actions in this catch block!", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
223
SEClient/NotificationBroker/NotificationBroker.cs
Normal file
223
SEClient/NotificationBroker/NotificationBroker.cs
Normal file
@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using log4net;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Notification Broker to broadcast local and/or remote notifications.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")]
|
||||
public static class NotificationBroker
|
||||
{
|
||||
#region [auto] Fields
|
||||
|
||||
/// <summary>
|
||||
/// Writes to logging infrastructure.
|
||||
/// </summary>
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(NotificationBroker));
|
||||
|
||||
/// <summary>
|
||||
/// An identifier to distinguish instances of NB (client, server),
|
||||
/// so not to sound notifications in circles. To check if process name is sufficient.
|
||||
/// </summary>
|
||||
private static string id = System.Diagnostics.Process.GetCurrentProcess().ProcessName.Replace(".vshost", "");
|
||||
|
||||
/// <summary>
|
||||
/// List of subscriptions
|
||||
/// </summary>
|
||||
private static Subscriptions subscriptions = new Subscriptions();
|
||||
|
||||
#endregion [auto] Fields
|
||||
|
||||
#region [auto] Properties
|
||||
|
||||
/// <summary>
|
||||
/// NotificationBroker identification used as sender. Do not dispatch notification sent yourself.
|
||||
/// </summary>
|
||||
public static string Id { get { return id; } }
|
||||
|
||||
#endregion [auto] Properties
|
||||
|
||||
#region [auto] Methods
|
||||
|
||||
/// <summary>
|
||||
/// Remove and disposes all subscriptions.
|
||||
/// </summary>
|
||||
public static void Clear()
|
||||
{
|
||||
// remove all local ones
|
||||
subscriptions.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers a notification subscription (including type, handlers and filters).
|
||||
/// </summary>
|
||||
/// <param name="subscription">The subscription (local, web service, db, etc.) to register.</param>
|
||||
public static void Register(Subscription subscription)
|
||||
{
|
||||
lock (subscriptions)
|
||||
{
|
||||
subscriptions.Add(subscription);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers a notification subscription (including type, handlers and filters).
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the message to register for.</param>
|
||||
/// <param name="handler">The handler to invoke when a message of the given type arrives.</param>
|
||||
/// <param name="filters">The filters that apply for this subscription so not to get certain messages.</param>
|
||||
public static void Register(Type type, NotificationHandler handler, IList<ISubscriptionFilter> filters)
|
||||
{
|
||||
LocalSubscription subscription = new LocalSubscription(type, handler, filters);
|
||||
lock (subscriptions)
|
||||
{
|
||||
subscriptions.Add(subscription);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes a notification message.
|
||||
/// </summary>
|
||||
/// <param name="notification">The notification message.</param>
|
||||
/// <param name="scope">The scope of the notification (Local or Remote/Local).</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes"), SuppressMessage("Microsoft.Design", "CA1030", Justification = "there are no events in a WCF contract")]
|
||||
public static void Send(Notification notification, NotificationScope scope)
|
||||
{
|
||||
// test inputs
|
||||
//Validate.IsNotNull<ArgumentNullException>(notification, "Must pass a valid notification");
|
||||
|
||||
// adds the sender (current named instance of NB) to the notification
|
||||
// to find out that a certain notification was sent by yourself!
|
||||
if (string.IsNullOrEmpty(notification.Sender))
|
||||
{
|
||||
// only the initial sender is important. Do not overwrite by intermediary service callback
|
||||
// implementations calling this Send() too.
|
||||
notification.Sender = Id;
|
||||
}
|
||||
|
||||
// fire locally. Get a copied list of subscription references.
|
||||
lock (subscriptions)
|
||||
{
|
||||
IList<Subscription> copiedSubscriptions = subscriptions.Get(notification.GetType());
|
||||
foreach (Subscription subscription in copiedSubscriptions)
|
||||
{
|
||||
try
|
||||
{
|
||||
// fire when no filter specified
|
||||
if (subscription.Filters == null)
|
||||
{
|
||||
SendAsync(subscription, notification, scope);
|
||||
continue;
|
||||
}
|
||||
if (subscription.Filters.Count == 0)
|
||||
{
|
||||
SendAsync(subscription, notification, scope);
|
||||
continue;
|
||||
}
|
||||
|
||||
// fire when one of the filters evaluates to true
|
||||
bool filterIncluded = true;
|
||||
bool filterExcluded = false;
|
||||
foreach (ISubscriptionFilter subscriptionFilter in subscription.Filters)
|
||||
{
|
||||
// fire when one (and only when; not and/or logic) filter include evaluates true
|
||||
if (subscriptionFilter.FilterOperation == SubscriptionFilterOperation.Include
|
||||
&& !subscriptionFilter.IsMatch(notification))
|
||||
{
|
||||
filterIncluded = false; // filter out
|
||||
}
|
||||
// however, does not fire when one (and only when; not and/or logic) filter exclude evaluates true
|
||||
if (subscriptionFilter.FilterOperation == SubscriptionFilterOperation.Exclude
|
||||
&& subscriptionFilter.IsMatch(notification))
|
||||
{
|
||||
filterExcluded = true; // filter out
|
||||
}
|
||||
|
||||
if (filterIncluded && !filterExcluded)
|
||||
{
|
||||
SendAsync(subscription, notification, scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Warn("One of the subscription handler invocations failed.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters a notification subscription.
|
||||
/// </summary>
|
||||
/// <param name="subscription">The subscription to remove (local, web service, db, etc.).</param>
|
||||
public static void Unregister(Subscription subscription)
|
||||
{
|
||||
lock (subscriptions)
|
||||
{
|
||||
subscriptions.Remove(subscription);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters a notification subscription.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the subscription to remove.</param>
|
||||
/// <param name="handler">The handler that was registered to receive notifications.</param>
|
||||
public static void Unregister(Type type, NotificationHandler handler)
|
||||
{
|
||||
lock (subscriptions)
|
||||
{
|
||||
subscriptions.Remove(type, handler);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters the specified type.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of message to unregister.</param>
|
||||
public static void Unregister(Type type)
|
||||
{
|
||||
lock (subscriptions)
|
||||
{
|
||||
subscriptions.Remove(type);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously send notification using a thread pool thread.
|
||||
/// </summary>
|
||||
/// <param name="subscription">The subscription.</param>
|
||||
/// <param name="notification">The notification.</param>
|
||||
/// <param name="scope">The scope of the notification.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
|
||||
private static void SendAsync(Subscription subscription, Notification notification, NotificationScope scope)
|
||||
{
|
||||
if (subscription.Scope == scope || scope == NotificationScope.Remote)
|
||||
{
|
||||
// go to another thread to execute delegate!
|
||||
ThreadPool.QueueUserWorkItem(
|
||||
delegate(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
// invoke one separate invocation handler on pool thread to decouple.
|
||||
subscription.Send(notification);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Warn(string.Format(CultureInfo.InvariantCulture, "{0} subscription handler {1} invocations failed.", subscription.Scope, subscription.NotificationType.FullName), ex);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion [auto] Methods
|
||||
}
|
||||
}
|
53
SEClient/NotificationBroker/NotificationHelper.cs
Normal file
53
SEClient/NotificationBroker/NotificationHelper.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using System.IO;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Supporting functionality around notifications
|
||||
/// </summary>
|
||||
public static class NotificationHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize notification object into a string.
|
||||
/// </summary>
|
||||
/// <param name="notification"></param>
|
||||
/// <returns></returns>
|
||||
public static string Serialize(Notification notification)
|
||||
{
|
||||
Validate.IsNotNull<ArgumentNullException>(notification, "must pass a notification");
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(Notification));
|
||||
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
serializer.Serialize(ms, notification);
|
||||
|
||||
// convert to string
|
||||
return Encoding.UTF8.GetString(ms.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize string into a notification object.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static Notification Deserialize(string data)
|
||||
{
|
||||
Validate.IsTrue<ArgumentNullException>(!string.IsNullOrEmpty(data), "must pass a notification data");
|
||||
|
||||
// use .NET 3.0 (WCF) serializer
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(Notification));
|
||||
using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(data)))
|
||||
{
|
||||
Notification notification = (Notification)serializer.Deserialize(ms);
|
||||
return notification;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MT.Platform.Common;
|
||||
|
||||
namespace Services.NotificationBroker.Notifications
|
||||
{
|
||||
/// <summary>
|
||||
/// Notification to be used to send written log texts to interested parties.
|
||||
/// </summary>
|
||||
public class LogWrittenNotification : Notification
|
||||
{
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
53
SEClient/NotificationBroker/Notifications/Notification.cs
Normal file
53
SEClient/NotificationBroker/Notifications/Notification.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for all NotificationBroker messages.
|
||||
/// </summary>
|
||||
public class Notification
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor to initialize content values.
|
||||
/// </summary>
|
||||
public Notification()
|
||||
{
|
||||
this.Stamp = DateTime.Now;
|
||||
this.Id = Guid.NewGuid();
|
||||
}
|
||||
|
||||
private Guid id;
|
||||
/// <summary>
|
||||
/// Notification identier.
|
||||
/// </summary>
|
||||
public Guid Id
|
||||
{
|
||||
get { return id; }
|
||||
set { id = value; }
|
||||
}
|
||||
|
||||
private DateTime stamp;
|
||||
/// <summary>
|
||||
/// Notification creator's time stamp.
|
||||
/// </summary>
|
||||
public DateTime Stamp
|
||||
{
|
||||
get { return stamp; }
|
||||
set { stamp = value; }
|
||||
}
|
||||
|
||||
private string sender;
|
||||
/// <summary>
|
||||
/// Sender identification of notification. Used so not to send back to publisher?
|
||||
/// </summary>
|
||||
public string Sender
|
||||
{
|
||||
get { return sender; }
|
||||
set { sender = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Notifications are sent in-process, cross-process, etc.
|
||||
/// </summary>
|
||||
public enum NotificationScope
|
||||
{
|
||||
/// <summary>
|
||||
/// Subscribers are in the same process and AppDomain
|
||||
/// </summary>
|
||||
Local,
|
||||
/// <summary>
|
||||
/// Subscribers can also be in other processes. Needs remote notification strategy attached.
|
||||
/// </summary>
|
||||
Remote
|
||||
}
|
||||
}
|
65
SEClient/NotificationBroker/Subscription.cs
Normal file
65
SEClient/NotificationBroker/Subscription.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Subscription base class. Contains notification "type" and notification message filters.
|
||||
/// </summary>
|
||||
public abstract class Subscription
|
||||
{
|
||||
private object lockObject = new object();
|
||||
/// <summary>
|
||||
/// Lock for ensuring thread safety of subscriptions.
|
||||
/// </summary>
|
||||
protected object LockObject { get { return lockObject; } }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="notificationType">type of notification this subscriber is interested to receive</param>
|
||||
/// <param name="filters">notification message filter defining rules for filter in or out of messages</param>
|
||||
protected Subscription(Type notificationType, IList<ISubscriptionFilter> filters)
|
||||
{
|
||||
lock (lockObject)
|
||||
{
|
||||
this.notificationType = notificationType;
|
||||
this.filters = filters;
|
||||
}
|
||||
}
|
||||
|
||||
private Type notificationType = null;
|
||||
/// <summary>
|
||||
/// Notification type. Type.Missing means to subscribe for any type of notification.
|
||||
/// </summary>
|
||||
public Type NotificationType
|
||||
{
|
||||
get { return notificationType; }
|
||||
}
|
||||
|
||||
private IList<ISubscriptionFilter> filters;
|
||||
/// <summary>
|
||||
/// List of notification message filters. Depending on the notification's content it is sent or not.
|
||||
/// Allows for more fine-grained control over notification subscriptions and who gets which notifications.
|
||||
/// </summary>
|
||||
public IList<ISubscriptionFilter> Filters
|
||||
{
|
||||
get { return filters; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether subscription is local or remote.
|
||||
/// </summary>
|
||||
public virtual NotificationScope Scope { get { return NotificationScope.Local; } }
|
||||
|
||||
/// <summary>
|
||||
/// Send notification using this subscriber type.
|
||||
/// </summary>
|
||||
/// <param name="notification"></param>
|
||||
[SuppressMessage("Microsoft.Design", "CA1030", Justification="there are no events in a WCF contract")]
|
||||
public abstract void Send(Notification notification);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// NotificationBroker subscription filter interface for custom filter implementations
|
||||
/// </summary>
|
||||
public interface ISubscriptionFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Return true when filter evaluates true.
|
||||
/// </summary>
|
||||
/// <param name="notification"></param>
|
||||
/// <returns></returns>
|
||||
bool IsMatch(object notification);
|
||||
|
||||
/// <summary>
|
||||
/// Indicates, when this filter evaluating to true, that the message is explicitely included or excluded.
|
||||
/// </summary>
|
||||
SubscriptionFilterOperation FilterOperation { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Subscription filter operation type
|
||||
/// </summary>
|
||||
public enum SubscriptionFilterOperation
|
||||
{
|
||||
/// <summary>
|
||||
/// Include in filter when rule matches true
|
||||
/// </summary>
|
||||
Include,
|
||||
|
||||
/// <summary>
|
||||
/// Exclude in filter when rule matches true
|
||||
/// </summary>
|
||||
Exclude
|
||||
}
|
||||
}
|
176
SEClient/NotificationBroker/Subscriptions.cs
Normal file
176
SEClient/NotificationBroker/Subscriptions.cs
Normal file
@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages list of notification subscriptions. Can be of local or remote kind.
|
||||
/// </summary>
|
||||
public sealed class Subscriptions
|
||||
{
|
||||
/// <summary>
|
||||
/// List of subscriptions
|
||||
/// </summary>
|
||||
private IList<Subscription> subscribers;
|
||||
|
||||
/// <summary>
|
||||
/// Default Constructor
|
||||
/// </summary>
|
||||
public Subscriptions()
|
||||
{
|
||||
subscribers = new List<Subscription>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add subscription to list
|
||||
/// </summary>
|
||||
/// <param name="subscriber"></param>
|
||||
public void Add(Subscription subscriber)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
subscribers.Add(subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of subscriptions of the specified type. Filters are not taken into account yet.
|
||||
/// Also return subscriptions for all type of notifications (type = null).
|
||||
/// </summary>
|
||||
/// <param name="type">Notification type or "null" type for all messages.</param>
|
||||
/// <returns>List of subscriptions</returns>
|
||||
public IList<Subscription> Get(Type type)
|
||||
{
|
||||
IList<Subscription> getSubscribers = new List<Subscription>();
|
||||
lock (this)
|
||||
{
|
||||
foreach (Subscription subscriber in this.subscribers)
|
||||
{
|
||||
// send to registered subscriptions
|
||||
// with all types
|
||||
if (type == null
|
||||
|| (subscriber.NotificationType != null && subscriber.NotificationType.Equals(type))
|
||||
|| (type != null && subscriber.NotificationType == null))
|
||||
{
|
||||
getSubscribers.Add(subscriber);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getSubscribers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a subscription from the list
|
||||
/// </summary>
|
||||
/// <param name="subscriber"></param>
|
||||
public void Remove(Subscription subscriber)
|
||||
{
|
||||
Remove(subscriber.NotificationType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a delegate from local subscriptions in the list.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the notification.</param>
|
||||
/// <param name="handler">The handler for the notification.</param>
|
||||
public void Remove(Type type, NotificationHandler handler)
|
||||
{
|
||||
IList<Subscription> removeList = new List<Subscription>();
|
||||
|
||||
lock (this)
|
||||
{
|
||||
// first the ones to remove
|
||||
foreach (Subscription subscription in subscribers)
|
||||
{
|
||||
LocalSubscription localSubscription = subscription as LocalSubscription;
|
||||
if (localSubscription != null)
|
||||
{
|
||||
if (localSubscription.NotificationType != null
|
||||
&& localSubscription.NotificationType.Equals(type)
|
||||
&& localSubscription.Handler.Equals(handler))
|
||||
{
|
||||
removeList.Add(localSubscription);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// then remove separately
|
||||
foreach (Subscription subscription in removeList)
|
||||
{
|
||||
RemoveOne(subscription);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes and disposes one subscription.
|
||||
/// </summary>
|
||||
/// <param name="subscription"></param>
|
||||
private void RemoveOne(Subscription subscription)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
// remove from list
|
||||
subscribers.Remove(subscription);
|
||||
|
||||
// and dispose
|
||||
IDisposable disposableSubscription = subscription as IDisposable;
|
||||
if (disposableSubscription != null)
|
||||
{
|
||||
disposableSubscription.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all subscription for the given type from the list
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the notification to remove.</param>
|
||||
public void Remove(Type type)
|
||||
{
|
||||
IList<Subscription> removeList = new List<Subscription>();
|
||||
|
||||
lock (this)
|
||||
{
|
||||
// first the ones to remove
|
||||
foreach (Subscription subscription in subscribers)
|
||||
{
|
||||
if (subscription.NotificationType != null && subscription.NotificationType.Equals(type))
|
||||
{
|
||||
removeList.Add(subscription);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// then remove separately
|
||||
foreach (Subscription subscription in removeList)
|
||||
{
|
||||
RemoveOne(subscription);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove and disposes all subscriptions.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
IList<Subscription> removeList = new List<Subscription>();
|
||||
|
||||
// get the ones to remove in separate list. Cannot loop over a list and remove items ...!
|
||||
foreach (Subscription subscription in subscribers)
|
||||
{
|
||||
removeList.Add(subscription);
|
||||
}
|
||||
|
||||
// then remove separately
|
||||
foreach (Subscription subscription in removeList)
|
||||
{
|
||||
RemoveOne(subscription);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
95
SEClient/NotificationBroker/Validation/Validate.cs
Normal file
95
SEClient/NotificationBroker/Validation/Validate.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace MT.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a helper class for validation.
|
||||
/// </summary>
|
||||
public sealed class Validate
|
||||
{
|
||||
private Validate() { }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <paramref name="o"/> is null.
|
||||
/// In case of null the specified exception will be thrown.
|
||||
/// </summary>
|
||||
/// <param name="o">The o.</param>
|
||||
/// <param name="formatedMessage">The formated message.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "o"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "formated"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter"), SuppressMessage("Microsoft.DesignRules", "CA1004", Justification = "For a better readability.")]
|
||||
public static void IsNotNull<TExceptionType>(object o, string formatedMessage, params object[] args) where TExceptionType : System.Exception, new()
|
||||
{
|
||||
IsFalse<TExceptionType>(o == null, formatedMessage, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <paramref name="condition"/> is true.
|
||||
/// In case of the condition is false the specified condition is thrown.
|
||||
/// </summary>
|
||||
/// <param name="condition">if set to <c>true</c> [condition].</param>
|
||||
/// <param name="formatedMessage">The formated message.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "formated"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter"), SuppressMessage("Microsoft.DesignRules", "CA1004", Justification = "For a better readability.")]
|
||||
public static void IsTrue<TExceptionType>(bool condition, string formatedMessage, params object[] args) where TExceptionType : System.Exception, new()
|
||||
{
|
||||
IsFalse < TExceptionType >(!condition, formatedMessage, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <paramref name="condition"/> is false.
|
||||
/// In case of the condition is true the specified exception is thrown.
|
||||
/// </summary>
|
||||
/// <param name="condition">if set to <c>true</c> [condition].</param>
|
||||
/// <param name="formatedMessage">The formated message.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter"), SuppressMessage("Microsoft.DesignRules", "CA1004", Justification = "For a better readability.")]
|
||||
public static void IsFalse<TExceptionType>(bool condition, string formatedMessage, params object[] args) where TExceptionType : System.Exception, new()
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
TExceptionType exception = new TExceptionType();
|
||||
SetProperty(exception, "_message", string.Format(CultureInfo.CurrentCulture, formatedMessage, args), false);
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a field / property of an object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object of which the field / property should be set</param>
|
||||
/// <param name="propertyName">The name of the field / property</param>
|
||||
/// <param name="propertyValue">The value of the property</param>
|
||||
/// <param name="ignoreCase">True if it shall operate case insensitive</param>
|
||||
static private void SetProperty(object obj, string propertyName, string propertyValue, bool ignoreCase)
|
||||
{
|
||||
BindingFlags bindings = BindingFlags.Public | BindingFlags.Instance;
|
||||
if (ignoreCase)
|
||||
{
|
||||
bindings |= BindingFlags.IgnoreCase;
|
||||
}
|
||||
Type type = obj.GetType();
|
||||
|
||||
// look for a setable property
|
||||
PropertyInfo property = type.GetProperty(propertyName, bindings);
|
||||
if (property != null && property.CanWrite)
|
||||
{
|
||||
property.SetValue(obj, propertyValue, null);
|
||||
return;
|
||||
}
|
||||
// look for a public field
|
||||
FieldInfo field = type.GetField(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (field != null)
|
||||
{
|
||||
field.SetValue(obj, propertyValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
SEClient/Properties/AssemblyInfo.cs
Normal file
36
SEClient/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ClassLibrary1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ClassLibrary1")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e097fca6-5287-4f3b-b841-544ed9e75ffc")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
307
SEClient/ResultMessageSerializer.cs
Normal file
307
SEClient/ResultMessageSerializer.cs
Normal file
@ -0,0 +1,307 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using MT.pHLab.SE.V1;
|
||||
using XMLSerializationCustomization;
|
||||
|
||||
namespace SERemoteLib
|
||||
{
|
||||
public class SEResultMessageSerializer
|
||||
{
|
||||
|
||||
public static string Serialize(ResultMessage objResultMessage)
|
||||
{
|
||||
XmlSerializer xmlSerializer = new XmlSerializer(objResultMessage.GetType());
|
||||
StringWriter xmlStream = new StringWriter();
|
||||
xmlSerializer.Serialize(xmlStream, objResultMessage);
|
||||
return xmlStream.ToString();
|
||||
}
|
||||
|
||||
public static ResultMessage Deserialize(string xmlResultMessage)
|
||||
{
|
||||
StringReader stringReader = new StringReader(xmlResultMessage);
|
||||
XmlTextReader reader = new XMLSerializationCustomization.PdkXmlTextReader(stringReader);
|
||||
|
||||
ResultMessage objResultMessage = new ResultMessage();
|
||||
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
xmlRoot.Namespace = "tf";
|
||||
//xmlRoot.ElementName = "";
|
||||
xmlRoot.IsNullable = true;
|
||||
XmlSerializer xmlser = new XmlSerializer(objResultMessage.GetType(), xmlRoot);
|
||||
|
||||
return (ResultMessage)xmlser.Deserialize(reader);
|
||||
}
|
||||
|
||||
public static string SerializeString(ResultMessage rm)
|
||||
{
|
||||
string sResultMessage = "";
|
||||
string sResult = "";
|
||||
string sResultType = "";
|
||||
string sResultUnit = "";
|
||||
|
||||
try
|
||||
{
|
||||
Object Result = rm.result.Item;
|
||||
Type ResultType = Result.GetType();
|
||||
string[] a = ResultType.ToString().Split('.');
|
||||
sResultType = a[a.Length - 1];
|
||||
|
||||
if (ResultType == typeof(DecimalResult))
|
||||
{
|
||||
sResult = SerializeDecimalResult((DecimalResult)Result);
|
||||
}
|
||||
else if (ResultType == typeof(IntegerResult))
|
||||
{
|
||||
sResult = ((IntegerResult)Result).value.ToString();
|
||||
}
|
||||
else if (ResultType == typeof(StringResult))
|
||||
{
|
||||
sResult = ((StringResult)Result).value;
|
||||
}
|
||||
else if (ResultType == typeof(ResultPh))
|
||||
{
|
||||
|
||||
return GetText((ResultPh)Result);
|
||||
}
|
||||
else if (ResultType == typeof(ResultCnd))
|
||||
{
|
||||
return GetText((ResultCnd)Result);
|
||||
}
|
||||
//else if (ResultType == typeof(ErrorResult))
|
||||
//{
|
||||
// sResult = SerializeErrorResult((ErrorResult)Result);
|
||||
//}
|
||||
else
|
||||
{
|
||||
sResult = string.Format("??? type: {0}", sResultType);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
sResult = "ERROR";
|
||||
}
|
||||
|
||||
//get result unit
|
||||
sResultUnit = rm.unitstring;
|
||||
if (String.IsNullOrEmpty(sResultUnit))
|
||||
{
|
||||
sResultUnit = ((ECommonUnit)rm.unit).ToString();
|
||||
}
|
||||
|
||||
sResultMessage = string.Format("{0}.{1}.{2} ({3}) -> {4} [{5}] (Prec: {6})"
|
||||
, rm.rackid
|
||||
, rm.slotid
|
||||
, rm.groupid
|
||||
, sResultType
|
||||
, sResult
|
||||
, sResultUnit
|
||||
, rm.precision
|
||||
);
|
||||
|
||||
return sResultMessage;
|
||||
}
|
||||
|
||||
private static string SerializeDecimalResult(DecimalResult r)
|
||||
{
|
||||
switch (r.state)
|
||||
{
|
||||
case EDecimalResultState.eDecimalResultState_Valid:
|
||||
return r.value.ToString();
|
||||
case EDecimalResultState.eDecimalResultState_NaN:
|
||||
return "NaN";
|
||||
case EDecimalResultState.eDecimalResultState_INF:
|
||||
return "INF";
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("r.state");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static public string GetText(EAnalysisStatus enumAnalysisStatus)
|
||||
{
|
||||
switch (enumAnalysisStatus)
|
||||
{
|
||||
case EAnalysisStatus.eAnalysisStatusid_AnalysisStatus_OK:
|
||||
return "OK";
|
||||
case EAnalysisStatus.eAnalysisStatusid_AnalysisStatus_OKStar:
|
||||
return "OK*";
|
||||
case EAnalysisStatus.eAnalysisStatusid_AnalysisStatus_Failed:
|
||||
return "Failed";
|
||||
case EAnalysisStatus.eAnalysisStatusid_AnalysisStatus_Error:
|
||||
return "Error";
|
||||
case EAnalysisStatus.eAnalysisStatusid_AnalysisStatus_CriticalError:
|
||||
return "Critical Error";
|
||||
case EAnalysisStatus.eAnalysisStatusid_AnalysisStatus_Terminate:
|
||||
return "Terminate";
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
static public string GetText(EResultLimitState enumResultLimitState)
|
||||
{
|
||||
switch (enumResultLimitState)
|
||||
{
|
||||
case EResultLimitState.eResultLimit_NotChecked:
|
||||
return "Not Checked";
|
||||
case EResultLimitState.eResultLimit_InRange:
|
||||
return "In Range";
|
||||
case EResultLimitState.eResultLimit_OutUpper:
|
||||
return "Error (above high limit)";
|
||||
case EResultLimitState.eResultLimit_OutLower:
|
||||
return "Error (below low limit)";
|
||||
case EResultLimitState.eResultLimit_min:
|
||||
return "Minimum";
|
||||
case EResultLimitState.eResultLimit_max:
|
||||
return "Maximum";
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
static public string GetText(ECommonUnit eCommonUnit)
|
||||
{
|
||||
switch (eCommonUnit)
|
||||
{
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_None:
|
||||
return string.Empty;
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_PSU:
|
||||
return "psu";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_PPT:
|
||||
return "ppt";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MMOLL:
|
||||
return "mmol/L";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MOLL:
|
||||
return "mol/L";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_TDSPPT:
|
||||
return "ppt(‰)";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MgL:
|
||||
return "mg/L";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_PPM:
|
||||
return "ppm";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_Percent:
|
||||
return "%";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_PX:
|
||||
return "pX";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_PH:
|
||||
return "pH";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MV:
|
||||
return "mV";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_RelMV:
|
||||
return "Rel.mV";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_USCM:
|
||||
return "µS/cm";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MSCM:
|
||||
return "mS/cm";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_SPerM:
|
||||
return "S/m";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_USPerM:
|
||||
return "µS/m";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MSPerM:
|
||||
return "mS/m";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_GPerL:
|
||||
return "g/L";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_mBar:
|
||||
return "mbar";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_hPa:
|
||||
return "hPa";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_mmHg:
|
||||
return "mmHg";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_Atm:
|
||||
return "Atm";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_KOCM:
|
||||
return "KΩ.cm";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MOCM:
|
||||
return "MΩ.cm";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_OCM:
|
||||
return "Ω.cm";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_GPerMOL:
|
||||
return "g/Mol";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_CellConstant:
|
||||
return "CC";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MVPerPH:
|
||||
return "mV/pH";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MVPerPX:
|
||||
return "mV/pX";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_ML:
|
||||
return "mL";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_Celsius:
|
||||
return "°C";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_Fahrenheit:
|
||||
return "°F";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_Ohm:
|
||||
return "Ω";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_Seconds:
|
||||
return "s";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_V:
|
||||
return "V";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_PercentPerCenti:
|
||||
return "%";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_KOhm:
|
||||
return "K.Ω";
|
||||
case ECommonUnit.eCommonUnitid_CommonUnit_MOhm:
|
||||
return "M.Ω";
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
static public string GetText(EResultQuality enumResultQuality)
|
||||
{
|
||||
switch (enumResultQuality)
|
||||
{
|
||||
case EResultQuality.eDraftValue:
|
||||
return "Draft";
|
||||
case EResultQuality.eDraftValue_Stable:
|
||||
return "Draft/Stable";
|
||||
case EResultQuality.eManualEndpoint:
|
||||
return "Manualendpoint";
|
||||
case EResultQuality.eAutoEndpoint_Strict:
|
||||
return "Automatic/Strict";
|
||||
case EResultQuality.eAutoEndpoint_Normal:
|
||||
return "Automatic/Normal";
|
||||
case EResultQuality.eAutoEndpoint_Fast:
|
||||
return "Automatic/Standard";
|
||||
case EResultQuality.eAutoEndpoint_UserDef:
|
||||
return "Automatic/User defined";
|
||||
case EResultQuality.eTimedEndpoint:
|
||||
return "Timed";
|
||||
default:
|
||||
return "Unspecified";
|
||||
}
|
||||
}
|
||||
|
||||
static public string GetText(ResultCnd result)
|
||||
{
|
||||
string output = string.Format("Cnd: {0}{1}, {2}{3} ({4} {5})",
|
||||
result.resultValue.Value,
|
||||
GetText(result.resultUnit),
|
||||
result.rawTemperature.Value,
|
||||
GetText(result.temperatureUnit),
|
||||
GetText(result.resultQuality),
|
||||
GetText(result.resultLimitState));
|
||||
|
||||
return output;
|
||||
}
|
||||
static public string GetText(ResultPh result)
|
||||
{
|
||||
string output = string.Format("Ph: {0}{1}, {2}{3} ({4} {5})",
|
||||
result.resultValue.Value,
|
||||
GetText(result.resultUnit),
|
||||
result.rawTemperature.Value,
|
||||
GetText(result.temperatureUnit),
|
||||
GetText(result.resultQuality),
|
||||
GetText(result.resultLimitState));
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
319
SEClient/SEClient.cs
Normal file
319
SEClient/SEClient.cs
Normal file
@ -0,0 +1,319 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using MT.Platform.Common;
|
||||
using Services.NotificationBroker.Notifications;
|
||||
|
||||
namespace SERemoteConnection
|
||||
{
|
||||
|
||||
public class SEResult: ResultMessageSubscriber
|
||||
{
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(SEClient));
|
||||
|
||||
public SEResult() :base("SEResult")
|
||||
{
|
||||
}
|
||||
|
||||
public override void Update(uint jobId, string xmlResultMessage)
|
||||
{
|
||||
string text= string.Format("[R] jobId({0}) result({1}):", jobId, xmlResultMessage );
|
||||
NotificationBroker.Send(new LogWrittenNotification { Text = text, Sender = this.GetType().FullName, Stamp = DateTime.Now }, NotificationScope.Local);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SEClient
|
||||
{
|
||||
private short m_jobId;
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(SEClient));
|
||||
|
||||
bool LoggingIsPending { set; get; }
|
||||
|
||||
//private SEConnection m_connection;
|
||||
private CommandDispatcher m_commandDispatcher;
|
||||
|
||||
private SEResult m_seResult;
|
||||
|
||||
enum Status
|
||||
{
|
||||
Attached,
|
||||
Detached
|
||||
};
|
||||
|
||||
private static IDictionary<String, Status> statsuMappings = new Dictionary<String, Status>()
|
||||
{
|
||||
{ "Attached", Status.Attached },
|
||||
{ "Detached", Status.Detached }
|
||||
};
|
||||
|
||||
public SEClient(SEConnection connection)
|
||||
{
|
||||
m_commandDispatcher = new CommandDispatcher(connection);
|
||||
m_seResult = new SEResult();
|
||||
m_commandDispatcher.Subscribe(m_seResult);
|
||||
m_jobId = -1;
|
||||
}
|
||||
|
||||
public void Open(string host, int port)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool Attach()
|
||||
{
|
||||
CommandSimpleRequest command = new CommandSimpleRequest("connect");
|
||||
|
||||
bool success = false;
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
success = command.m_record.m_bSuccess;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public bool Detach()
|
||||
{
|
||||
CommandSimpleRequest command = new CommandSimpleRequest("disconnect");
|
||||
|
||||
bool success = false;
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
success = command.m_record.m_bSuccess;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetStatus()
|
||||
{
|
||||
string stringStatus = "not connected";
|
||||
|
||||
CommandGetState command = new CommandGetState();
|
||||
|
||||
MessageBox.Show("GetStatus 1");
|
||||
m_commandDispatcher.Submit(command);
|
||||
MessageBox.Show("GetStatus 2");
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
MessageBox.Show("GetStatus 3");
|
||||
stringStatus = command.m_record.m_status;
|
||||
}
|
||||
|
||||
return stringStatus;
|
||||
}
|
||||
|
||||
public string[] getListOfMethods()
|
||||
{
|
||||
string[] list = new string[0];
|
||||
|
||||
CommandGetListOfMethods command = new CommandGetListOfMethods();
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
list = command.m_list;
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
public string[] getListOfSensors()
|
||||
{
|
||||
string[] list = new string[0];
|
||||
|
||||
CommandGetListOfSensors command = new CommandGetListOfSensors();
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
list = command.m_list;
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
public MT.pHLab.SE.V1.moduleConfigParamRecord[] getListOfModules()
|
||||
{
|
||||
MT.pHLab.SE.V1.moduleConfigParamRecord[] list = null;
|
||||
|
||||
CommandGetListOfModules command = new CommandGetListOfModules();
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
list = command.m_list;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool setModule(string moduleId, string sensorId)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
CommandSetModule command = new CommandSetModule();
|
||||
command.m_request.m_moduleId = moduleId;
|
||||
command.m_request.m_sensorId = sensorId;
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
success = command.m_response.m_bSuccess;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
public bool startMethod(string methodId, string sampleId, string comment)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
CommandStartMethod command = new CommandStartMethod();
|
||||
command.MethodId = methodId;
|
||||
command.SampleId = sampleId;
|
||||
command.Comment = comment;
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
success = command.success;
|
||||
m_jobId = command.m_JobId;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public bool terminateMethod()
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
CommandTerminateMethod command = new CommandTerminateMethod();
|
||||
command.JobId = m_jobId;
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
success = command.m_response.m_bSuccess;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
public byte[] exportTable( EItemType eItemType )
|
||||
{
|
||||
CommandExportTable command = new CommandExportTable(eItemType);
|
||||
m_commandDispatcher.Submit(command);
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
return command.Table;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool importTable( byte[] table )
|
||||
{
|
||||
CommandImportTable command = new CommandImportTable();
|
||||
command.Table= table;
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public string getSettings( string setting )
|
||||
{
|
||||
CommandSettingGet command = new CommandSettingGet();
|
||||
command.Setting = setting;
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
|
||||
}
|
||||
return command.Value;
|
||||
}
|
||||
|
||||
public bool setSettings(string setting, string value )
|
||||
{
|
||||
CommandSettingSet command = new CommandSettingSet();
|
||||
command.Setting = setting;
|
||||
command.Value = value;
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool showScreenLogin( string[] userlist, ref string username, ref string password )
|
||||
{
|
||||
|
||||
CommandScreenLogin command = new CommandScreenLogin();
|
||||
command.Usererlist = userlist;
|
||||
|
||||
LoggingIsPending = true;
|
||||
|
||||
m_commandDispatcher.Submit(command);
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
username= command.Username;
|
||||
password= command.Password;
|
||||
}
|
||||
|
||||
LoggingIsPending = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool showScreenLoginCancel()
|
||||
{
|
||||
CommandSimpleRequest command = new CommandSimpleRequest("login.loginCancel");
|
||||
|
||||
bool success = false;
|
||||
m_commandDispatcher.Submit(command);
|
||||
|
||||
if (command.WaitForResponse())
|
||||
{
|
||||
success = command.m_record.m_bSuccess;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
104
SEClient/SEClient.csproj
Normal file
104
SEClient/SEClient.csproj
Normal file
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5222F720-4E4F-4932-B01D-E4B8DBD8CC5F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SERemoteLib</RootNamespace>
|
||||
<AssemblyName>SERemoteLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.3.0.3-preview.1\lib\net462\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Commands.cs" />
|
||||
<Compile Include="Contract\results_labxdirect.cs">
|
||||
<DependentUpon>results_labxdirect.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="decfloat.cs" />
|
||||
<Compile Include="LancePdkXML.cs" />
|
||||
<Compile Include="NotificationBroker\LocalSubscription.cs" />
|
||||
<Compile Include="NotificationBroker\NotificationBroker.cs" />
|
||||
<Compile Include="NotificationBroker\NotificationHelper.cs" />
|
||||
<Compile Include="NotificationBroker\Notifications\LogWrittenNotification.cs" />
|
||||
<Compile Include="NotificationBroker\Notifications\Notification.cs" />
|
||||
<Compile Include="NotificationBroker\Notifications\NotificationScope.cs" />
|
||||
<Compile Include="NotificationBroker\Subscription.cs" />
|
||||
<Compile Include="NotificationBroker\SubscriptionFilters\ISubscriptionFilter.cs" />
|
||||
<Compile Include="NotificationBroker\SubscriptionFilters\SubscriptionFilterOperation.cs" />
|
||||
<Compile Include="NotificationBroker\Subscriptions.cs" />
|
||||
<Compile Include="NotificationBroker\Validation\Validate.cs" />
|
||||
<Compile Include="ResultMessageSerializer.cs" />
|
||||
<Compile Include="SEClient.cs" />
|
||||
<Compile Include="SECommandDispatcher.cs" />
|
||||
<Compile Include="SERecord.cs" />
|
||||
<Compile Include="SETelegram.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SEConnection.cs" />
|
||||
<Compile Include="SEText.cs" />
|
||||
<Compile Include="XmlUtilities.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Contract\importer.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Contract\results_labxdirect.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Contract\result_types_platform.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Contract\service.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Target Name="AfterBuild" DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource" Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)" Outputs="$(OutputPath)$(_SGenDllName)">
|
||||
<!-- Delete the file because I can't figure out how to force the SGen task. -->
|
||||
<Delete Files="$(TargetDir)$(TargetName).XmlSerializers.dll" ContinueOnError="true" />
|
||||
</Target>
|
||||
</Project>
|
222
SEClient/SECommandDispatcher.cs
Normal file
222
SEClient/SECommandDispatcher.cs
Normal file
@ -0,0 +1,222 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using MT.pHLab.SE.V1;
|
||||
using MT.Platform.Common;
|
||||
using SERemoteLib;
|
||||
using Services.NotificationBroker.Notifications;
|
||||
|
||||
namespace SERemoteConnection
|
||||
{
|
||||
public abstract class AbstractCommand
|
||||
{
|
||||
private ManualResetEvent m_eventResponse;
|
||||
private int m_requestId;
|
||||
|
||||
static int mg_requestId = 300000000;
|
||||
|
||||
public AbstractCommand()
|
||||
{
|
||||
m_eventResponse = new ManualResetEvent(false);
|
||||
m_requestId = mg_requestId++;
|
||||
}
|
||||
|
||||
public int GetRequestId()
|
||||
{
|
||||
return m_requestId;
|
||||
}
|
||||
|
||||
public abstract bool OnResponse(XmlReader reader);
|
||||
public abstract bool Submit(SEConnection connection);
|
||||
|
||||
public void setResponse()
|
||||
{
|
||||
m_eventResponse.Set();
|
||||
}
|
||||
|
||||
public bool WaitForResponse()
|
||||
{
|
||||
return m_eventResponse.WaitOne();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class ResultMessageSubscriber : ISubscriber
|
||||
{
|
||||
public string ObserverName { get; private set; }
|
||||
public ResultMessageSubscriber(string name)
|
||||
{
|
||||
this.ObserverName = name;
|
||||
}
|
||||
public abstract void Update( uint jobId, string xmlResultMessage );
|
||||
}
|
||||
|
||||
interface ISubscriber
|
||||
{
|
||||
void Update( uint jobId, string xmlResultMessage );
|
||||
}
|
||||
|
||||
public class CommandDispatcher
|
||||
{
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(CommandDispatcher));
|
||||
|
||||
private List<AbstractCommand> m_commandList;
|
||||
|
||||
private SEConnection m_connection;
|
||||
|
||||
private List<ResultMessageSubscriber> m_observers = new List<ResultMessageSubscriber>();
|
||||
|
||||
public CommandDispatcher(SEConnection connection)
|
||||
{
|
||||
m_connection = connection;
|
||||
m_connection.OnTelegram = new OnTelegramDelegate(this.OnTelegram);
|
||||
m_commandList = new List<AbstractCommand>();
|
||||
}
|
||||
|
||||
~CommandDispatcher()
|
||||
{
|
||||
}
|
||||
|
||||
public void Subscribe(ResultMessageSubscriber observer)
|
||||
{
|
||||
m_observers.Add(observer);
|
||||
}
|
||||
|
||||
public void Unsubscribe(ResultMessageSubscriber observer)
|
||||
{
|
||||
m_observers.Remove(observer);
|
||||
}
|
||||
|
||||
|
||||
public bool Submit(AbstractCommand command)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
m_commandList.Add(command);
|
||||
|
||||
if (command.Submit(m_connection))
|
||||
{
|
||||
success = command.WaitForResponse();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public bool OnResponse(XmlReader reader)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
int requestId = Int32.Parse(reader.GetAttribute("requestId"));
|
||||
if (requestId >= 0)
|
||||
{
|
||||
foreach (var iCommand in m_commandList)
|
||||
{
|
||||
if (iCommand.GetRequestId() == requestId)
|
||||
{
|
||||
success= iCommand.OnResponse(reader);
|
||||
|
||||
m_commandList.Remove(iCommand);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
private void OnResultMessage(uint jobId, XmlReader reader)
|
||||
{
|
||||
string xmlResultMessage = reader.ReadOuterXml();
|
||||
|
||||
m_observers.ForEach(x => x.Update(jobId, xmlResultMessage));
|
||||
|
||||
try
|
||||
{
|
||||
ResultMessage rm = SEResultMessageSerializer.Deserialize(xmlResultMessage);
|
||||
Log(string.Format(CultureInfo.InvariantCulture, "notifyAnalysisResult: #{0} {1}"
|
||||
, jobId
|
||||
, SEResultMessageSerializer.SerializeString(rm)
|
||||
));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log(string.Format(CultureInfo.InvariantCulture, "notifyAnalysisResult: #{0} ERROR DESERIALIZING \n{1}\n{2}"
|
||||
, jobId, ex.ToString(), xmlResultMessage));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
//<Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
// <Notification jobId="1">
|
||||
// <method>
|
||||
// <mf type="MFTitleRecord">
|
||||
// <param-list>
|
||||
// ...
|
||||
|
||||
private void OnNotification(XmlReader reader)
|
||||
{
|
||||
string jobId = reader.GetAttribute("jopId");
|
||||
if (reader.Read())
|
||||
{
|
||||
if (reader.Name.Equals("ResultMessage") && (reader.NodeType == XmlNodeType.Element))
|
||||
{
|
||||
uint id = Convert.ToUInt32(jobId, 16);
|
||||
OnResultMessage(id, reader);
|
||||
}
|
||||
else
|
||||
if (reader.Name.Equals("EndOfMethod") && (reader.NodeType == XmlNodeType.Element))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTelegram(byte[] telegram)
|
||||
{
|
||||
UTF8Encoding utf8 = new UTF8Encoding();
|
||||
string dump = utf8.GetString(telegram);
|
||||
logger.DebugFormat("OnTelegram: {0}", dump);
|
||||
|
||||
using (XmlReader reader = XmlReader.Create(new StringReader(dump)))
|
||||
{
|
||||
if (reader.ReadToFollowing("Telegram"))
|
||||
{
|
||||
if (reader.Read())
|
||||
if (reader.Name.Equals("Response") && (reader.NodeType == XmlNodeType.Element))
|
||||
{
|
||||
OnResponse(reader);
|
||||
}
|
||||
else
|
||||
if (reader.Name.Equals("Notification") && (reader.NodeType == XmlNodeType.Element))
|
||||
{
|
||||
OnNotification(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the specified text by raising the LogWritten event.
|
||||
/// </summary>
|
||||
/// <param name="text">The text.</param>
|
||||
private void Log(string text)
|
||||
{
|
||||
text = "[C] " + text;
|
||||
NotificationBroker.Send(new LogWrittenNotification { Text = text, Sender = this.GetType().FullName, Stamp = DateTime.Now }, NotificationScope.Local);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
154
SEClient/SEConnection.cs
Normal file
154
SEClient/SEConnection.cs
Normal file
@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
|
||||
namespace SERemoteConnection
|
||||
{
|
||||
//public abstract class ISEConnection
|
||||
//{
|
||||
// public abstract void OnTelegram(byte[] telegram);
|
||||
//}
|
||||
public delegate void OnTelegramDelegate(byte[] telegram);
|
||||
|
||||
|
||||
public class SEConnection : IDisposable
|
||||
{
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(SEConnection));
|
||||
|
||||
private Socket m_socket;
|
||||
private System.Threading.Thread m_thread;
|
||||
private bool m_isActive;
|
||||
private System.IO.MemoryStream m_stream;
|
||||
|
||||
public OnTelegramDelegate OnTelegram { set; get; }
|
||||
|
||||
|
||||
public SEConnection()
|
||||
{
|
||||
}
|
||||
|
||||
~SEConnection()
|
||||
{
|
||||
if (m_socket.Connected)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// What the f**, call dispose on the context and any of its members here
|
||||
this.m_socket.Dispose();
|
||||
this.m_stream.Dispose();
|
||||
}
|
||||
|
||||
public bool Open(string host, int port)
|
||||
{
|
||||
IPAddress[] IPs = Dns.GetHostAddresses(host);
|
||||
|
||||
m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
try
|
||||
{
|
||||
m_socket.Connect(IPs[0], port);
|
||||
|
||||
m_isActive = m_socket.Connected;
|
||||
|
||||
if (m_isActive)
|
||||
{
|
||||
m_stream = new System.IO.MemoryStream();
|
||||
|
||||
m_thread = new System.Threading.Thread(Run);
|
||||
m_thread.Start();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_isActive = false;
|
||||
}
|
||||
return m_isActive;
|
||||
}
|
||||
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_isActive = false;
|
||||
m_socket.Close();
|
||||
m_thread.Join();
|
||||
}
|
||||
|
||||
private void Run()
|
||||
{
|
||||
// Buffer to read data
|
||||
var buffer = new byte[m_socket.ReceiveBufferSize];
|
||||
|
||||
while (m_socket.Connected && m_socket.Poll(-1, SelectMode.SelectRead))
|
||||
{
|
||||
if (m_socket.Connected)
|
||||
{
|
||||
// There is data waiting to be read"
|
||||
int readCount = m_socket.Receive(buffer);
|
||||
|
||||
if (readCount > 0)
|
||||
{
|
||||
Process(buffer, readCount);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something bad has happened, shut down
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Write(Byte[] buffer)
|
||||
{
|
||||
UTF8Encoding utf8 = new UTF8Encoding();
|
||||
string dump = utf8.GetString(buffer);
|
||||
logger.DebugFormat("Write: {0}", dump);
|
||||
|
||||
byte[] sendTerminater = Encoding.ASCII.GetBytes("\r\n");
|
||||
|
||||
m_socket.Send(buffer);
|
||||
m_socket.Send(sendTerminater);
|
||||
}
|
||||
|
||||
private bool Process(byte[] buffer, int length)
|
||||
{
|
||||
for (var i = 0; i < length; ++i)
|
||||
{
|
||||
if (buffer[i] == '\r')
|
||||
{
|
||||
++i;
|
||||
if (i < length)
|
||||
{
|
||||
if (buffer[i] == '\n')
|
||||
{
|
||||
if (OnTelegram != null && m_stream.Capacity>0)
|
||||
{
|
||||
OnTelegram(m_stream.ToArray());
|
||||
}
|
||||
m_stream = new System.IO.MemoryStream();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stream.WriteByte(buffer[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stream.WriteByte(buffer[i]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
745
SEClient/SERecord.cs
Normal file
745
SEClient/SERecord.cs
Normal file
@ -0,0 +1,745 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using XMLSerializationCustomization;
|
||||
using log4net;
|
||||
using System.Collections;
|
||||
|
||||
namespace MT.pHLab.SE.V1
|
||||
{
|
||||
/// <summary>
|
||||
/// The serializer to generate an XML document. This class offers some functions to create general xml-elements
|
||||
/// for the transfer of data over SOAP to a PDK instrument.
|
||||
/// </summary>
|
||||
public sealed class PdkXmlSerializer
|
||||
{
|
||||
private static IDictionary<Type, String> typeMappings;
|
||||
|
||||
/// <summary>
|
||||
/// The XmlElement name of a parameterlist-element.
|
||||
/// </summary>
|
||||
public static readonly String ParamlistElementname = "param-list";
|
||||
/// <summary>
|
||||
/// The XmlElement name of a parameter-element.
|
||||
/// </summary>
|
||||
public static readonly String ParamElementname = "param";
|
||||
/// <summary>
|
||||
/// The XmlElement name of a parameter-element.
|
||||
/// </summary>
|
||||
public static readonly String ItemElementname = "item";
|
||||
/// <summary>
|
||||
/// The XmlAttribute name of a type-attribute.
|
||||
/// </summary>
|
||||
public static readonly String TypeAttributename = "type";
|
||||
/// <summary>
|
||||
/// The XmlAttribute name of a sequence type-attribute.
|
||||
/// </summary>
|
||||
public static readonly String SequenceTypeAttributename = "sequenceType";
|
||||
/// <summary>
|
||||
/// The XmlAttribute name of a name-attribute.
|
||||
/// </summary>
|
||||
public static readonly String NameAttributename = "name";
|
||||
|
||||
/// <summary>
|
||||
/// The XmlElement name of a method-element.
|
||||
/// </summary>
|
||||
public static readonly String MethodElementname = "method";
|
||||
/// <summary>
|
||||
/// The XmlElement name of a methodfunction-element.
|
||||
/// </summary>
|
||||
public static readonly String MethodfunctionElementname = "mf";
|
||||
/// <summary>
|
||||
/// The XmlElement name of a record-element.
|
||||
/// </summary>
|
||||
public static readonly String RecordElementname = "record";
|
||||
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(PdkXmlSerializer));
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PdkXmlSerializer"/> class.
|
||||
/// </summary>
|
||||
private PdkXmlSerializer()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the record <paramref name="record"/> into the PDK specific XML.
|
||||
/// </summary>
|
||||
/// <param name="record">The browsable screen record.</param>
|
||||
/// <returns></returns>
|
||||
public static string SerializeRecord(object record)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
XmlElement recordElement = CreateRecordElement(record, doc);
|
||||
doc.AppendChild(recordElement);
|
||||
|
||||
if (logger.IsDebugEnabled)
|
||||
{
|
||||
logger.Debug("Serialized " + record.GetType().ToString() + " into " + doc.InnerXml);
|
||||
}
|
||||
|
||||
return doc.InnerXml.Replace("\r\n", "
").Replace("\n", "
").Replace("\t", "	");
|
||||
}
|
||||
|
||||
private static XmlElement CreateRecordElement(object recordObject, XmlDocument doc)
|
||||
{
|
||||
XmlElement recordElement = doc.CreateElement(RecordElementname);
|
||||
|
||||
XmlAttribute recordTypeAttribute = doc.CreateAttribute(TypeAttributename);
|
||||
recordTypeAttribute.InnerText = recordObject.GetType().Name;
|
||||
recordElement.Attributes.Append(recordTypeAttribute);
|
||||
|
||||
XmlElement paramListElement = CreateParameterListElement(recordObject, doc);
|
||||
recordElement.AppendChild(paramListElement);
|
||||
|
||||
return recordElement;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the type-mapping dictonary.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "add collection members")]
|
||||
static PdkXmlSerializer()
|
||||
{
|
||||
typeMappings = new Dictionary<Type, String>();
|
||||
|
||||
typeMappings.Add(typeof(string), "wstring");
|
||||
typeMappings.Add(typeof(bool), "boolean");
|
||||
typeMappings.Add(typeof(short), "short");
|
||||
typeMappings.Add(typeof(DateTime), "datetime");
|
||||
typeMappings.Add(typeof(decimal), "decfloat");
|
||||
typeMappings.Add(typeof(int), "long");
|
||||
typeMappings.Add(typeof(byte), "octet");
|
||||
typeMappings.Add(typeof(decfloat), "decfloat");
|
||||
typeMappings.Add(typeof(double), "double");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps a <paramref name="type"/> to the according PDK type.
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static String MapType(Type type)
|
||||
{
|
||||
if (typeMappings.ContainsKey(type))
|
||||
{
|
||||
return typeMappings[type];
|
||||
}
|
||||
else if (type.IsEnum)
|
||||
{
|
||||
return "short";
|
||||
}
|
||||
else if (type.IsArray)
|
||||
{
|
||||
return "sequence";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "record";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the <paramref name="val"/> value into the according XML representation.
|
||||
/// </summary>
|
||||
/// <param name="val">The value to serialize. MUST NOT be null</param>
|
||||
/// <returns>XML string representing the value.</returns>
|
||||
public static String SerializeValue(object val)
|
||||
{
|
||||
String returnValue = null;
|
||||
|
||||
if (val == null)
|
||||
{
|
||||
throw new ArgumentException("The argument val MUST NOT be null.");
|
||||
}
|
||||
|
||||
if (typeMappings.ContainsKey(val.GetType()))
|
||||
{
|
||||
if (val.GetType() == typeof(string))
|
||||
{
|
||||
returnValue = (string)val;
|
||||
}
|
||||
else if (val.GetType() == typeof(bool))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((bool)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(short))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((short)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(DateTime))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((DateTime)val, "yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
else if (val.GetType() == typeof(decimal))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((decimal)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(int))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((int)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(byte))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((byte)val);
|
||||
}
|
||||
else if (val.GetType() == typeof(decfloat))
|
||||
{
|
||||
returnValue = ((decfloat)val).Value;
|
||||
}
|
||||
else if (val.GetType() == typeof(double))
|
||||
{
|
||||
returnValue = XmlConvert.ToString((double)val);
|
||||
}
|
||||
}
|
||||
else if (val.GetType().IsEnum)
|
||||
{
|
||||
returnValue = XmlConvert.ToString((int)val);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the element param-list element with all its param subelements. Each property of the <paramref name="paramObject"/>
|
||||
/// is added as a param elemment.
|
||||
/// </summary>
|
||||
/// <param name="paramObject"></param>
|
||||
/// <param name="doc"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes", MessageId = "System.Xml.XmlNode"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "object")]
|
||||
private static XmlElement CreateParameterListElement(object paramObject, XmlDocument doc)
|
||||
{
|
||||
XmlElement paramListElement = doc.CreateElement(ParamlistElementname);
|
||||
|
||||
//add parameters
|
||||
PropertyInfo[] properties = paramObject.GetType().GetProperties();
|
||||
foreach (PropertyInfo property in properties)
|
||||
{
|
||||
bool ignoreThisProperty = false;
|
||||
foreach (System.Xml.Serialization.XmlIgnoreAttribute xmlIgnoreAttribute in property.GetCustomAttributes(typeof(System.Xml.Serialization.XmlIgnoreAttribute), false))
|
||||
{
|
||||
ignoreThisProperty = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ignoreThisProperty)
|
||||
{
|
||||
XmlElement paramElement = CreateParameterElement(property, paramObject, doc);
|
||||
paramListElement.AppendChild(paramElement);
|
||||
}
|
||||
}
|
||||
|
||||
return paramListElement;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the param element for the <paramref name="property"/>.
|
||||
/// </summary>
|
||||
/// <param name="property"></param>
|
||||
/// <param name="paramObject"></param>
|
||||
/// <param name="doc"></param>
|
||||
/// <returns></returns>
|
||||
private static XmlElement CreateParameterElement(PropertyInfo property, object paramObject, XmlDocument doc)
|
||||
{
|
||||
XmlElement paramElement = doc.CreateElement(ParamElementname);
|
||||
|
||||
XmlAttribute nameAttribute = doc.CreateAttribute(NameAttributename);
|
||||
nameAttribute.InnerText = property.Name;
|
||||
paramElement.Attributes.Append(nameAttribute);
|
||||
|
||||
XmlAttribute paramTypeAttribute = doc.CreateAttribute(TypeAttributename);
|
||||
paramTypeAttribute.InnerText = MapType(property.GetGetMethod().ReturnType);
|
||||
paramElement.Attributes.Append(paramTypeAttribute);
|
||||
|
||||
object val = property.GetValue(paramObject, null);
|
||||
if (val != null)
|
||||
{
|
||||
if (paramTypeAttribute.InnerText == "record")
|
||||
{
|
||||
XmlElement recordElement = CreateRecordElement(val, doc);
|
||||
paramElement.AppendChild(recordElement);
|
||||
}
|
||||
else if (paramTypeAttribute.InnerText == "sequence")
|
||||
{
|
||||
XmlAttribute seqTypeAttribute = doc.CreateAttribute(SequenceTypeAttributename);
|
||||
bool isComplexTypeSequence;
|
||||
if (property.PropertyType == typeof(string[]))
|
||||
{
|
||||
seqTypeAttribute.InnerText = MapType(typeof(string));
|
||||
isComplexTypeSequence = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
seqTypeAttribute.InnerText = RecordElementname;
|
||||
isComplexTypeSequence = true;
|
||||
}
|
||||
paramElement.Attributes.Append(seqTypeAttribute);
|
||||
|
||||
Array ar = (Array)val;
|
||||
for (int i = 0; i < ar.Length; ++i)
|
||||
{
|
||||
XmlElement itemElement = doc.CreateElement(ItemElementname);
|
||||
if (isComplexTypeSequence)
|
||||
{
|
||||
XmlElement recordElement = CreateRecordElement(ar.GetValue(i), doc);
|
||||
itemElement.AppendChild(recordElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemElement.InnerText = ar.GetValue(i).ToString();
|
||||
}
|
||||
paramElement.AppendChild(itemElement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
paramElement.InnerText = SerializeValue(val);
|
||||
}
|
||||
}
|
||||
|
||||
return paramElement;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class PdkXmlDeserializer
|
||||
{
|
||||
private static IDictionary<String, Type> typeMappings = new Dictionary<String, Type>()
|
||||
{
|
||||
{ "wstring", typeof(string) },
|
||||
{ "boolean", typeof(bool) },
|
||||
{ "short", typeof(short) },
|
||||
{ "datetime", typeof(DateTime) },
|
||||
{ "decfloat", typeof(decimal) },
|
||||
{ "long", typeof(int) },
|
||||
{ "octet", typeof(byte) },
|
||||
{ "decfloat", typeof(decfloat) },
|
||||
{ "double", typeof(double) }
|
||||
};
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "add collection members")]
|
||||
static PdkXmlDeserializer()
|
||||
{
|
||||
}
|
||||
|
||||
public static Type ResolveType(string stringType)
|
||||
{
|
||||
if (typeMappings.ContainsKey(stringType))
|
||||
{
|
||||
return typeMappings[stringType];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class PDKXmlWriter
|
||||
{
|
||||
static private void WriteProperty(object record, PropertyInfo property, System.Xml.XmlWriter write)
|
||||
{
|
||||
write.WriteStartElement("param");
|
||||
write.WriteAttributeString("name", property.Name);
|
||||
string parameterType = PdkXmlSerializer.MapType(property.GetGetMethod().ReturnType);
|
||||
write.WriteAttributeString("type", parameterType);
|
||||
|
||||
object val = property.GetValue(record, null);
|
||||
if (val != null)
|
||||
{
|
||||
if (parameterType == "record")
|
||||
{
|
||||
WriteRecord(val, write);
|
||||
}
|
||||
else if (parameterType == "sequence")
|
||||
{
|
||||
if (property.PropertyType == typeof(string[]))
|
||||
{
|
||||
write.WriteAttributeString(PdkXmlSerializer.SequenceTypeAttributename, PdkXmlSerializer.MapType(typeof(string)));
|
||||
Array ar = (Array)val;
|
||||
for (int i = 0; i < ar.Length; ++i)
|
||||
{
|
||||
write.WriteStartElement(PdkXmlSerializer.ItemElementname);
|
||||
write.WriteString(ar.GetValue(i).ToString());
|
||||
write.WriteEndElement();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write.WriteAttributeString(PdkXmlSerializer.SequenceTypeAttributename, PdkXmlSerializer.RecordElementname);
|
||||
Array ar = (Array)val;
|
||||
for (int i = 0; i < ar.Length; ++i)
|
||||
{
|
||||
write.WriteStartElement(PdkXmlSerializer.ItemElementname);
|
||||
WriteRecord(ar.GetValue(i), write);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write.WriteString(PdkXmlSerializer.SerializeValue(val));
|
||||
}
|
||||
}
|
||||
write.WriteEndElement();
|
||||
}
|
||||
|
||||
|
||||
static private void WriteParameterList(object record, PropertyInfo[] properties, System.Xml.XmlWriter writer)
|
||||
{
|
||||
foreach (PropertyInfo property in properties)
|
||||
{
|
||||
bool ignoreThisProperty = false;
|
||||
foreach (System.Xml.Serialization.XmlIgnoreAttribute xmlIgnoreAttribute in property.GetCustomAttributes(typeof(System.Xml.Serialization.XmlIgnoreAttribute), false))
|
||||
{
|
||||
ignoreThisProperty = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ignoreThisProperty)
|
||||
{
|
||||
WriteProperty(record, property, writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static public void WriteRecord(object record, System.Xml.XmlWriter writer)
|
||||
{
|
||||
writer.WriteStartElement("record");
|
||||
writer.WriteAttributeString("type", record.GetType().Name);
|
||||
writer.WriteStartElement("param-list");
|
||||
PropertyInfo[] properties = record.GetType().GetProperties();
|
||||
WriteParameterList(record, properties, writer);
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class IGenericRecord : IXmlSerializable
|
||||
{
|
||||
/*
|
||||
* <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
* <Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
* <Response requestId="102478">
|
||||
*
|
||||
* <record type="Response_StatusRecord">
|
||||
* <param-list>
|
||||
* <param name="m_status" type="wstring">Attached</param>
|
||||
* </param-list>
|
||||
* </record>
|
||||
*
|
||||
* </Response>
|
||||
* </Telegram>
|
||||
*/
|
||||
Dictionary<string, Type> _propertyTypeDic = new Dictionary<string, Type>();
|
||||
Dictionary<string, PropertyInfo> _propertyInfoDic = new Dictionary<string, PropertyInfo>();
|
||||
|
||||
public System.Xml.Schema.XmlSchema GetSchema()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void WriteXml(System.Xml.XmlWriter writer)
|
||||
{
|
||||
PDKXmlWriter.WriteRecord(this, writer);
|
||||
}
|
||||
|
||||
|
||||
//<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
//<Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
// <Response requestId="0">
|
||||
// <record type="Response_setupGetItemListRecord">
|
||||
// <param-list>
|
||||
// <param name="m_itemList" type="sequence" sequenceType="wstring">
|
||||
// <item>M001</item>
|
||||
// <item>M002</item>
|
||||
// <item>M021</item>
|
||||
// <item>A8000</item>
|
||||
// </param>
|
||||
// </param-list>
|
||||
// </record>
|
||||
// </Response>
|
||||
//</Telegram>;
|
||||
|
||||
//
|
||||
//<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
//<Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
// <Response requestId="0">
|
||||
// <record type="Response_StatusRecord">
|
||||
// <param-list>
|
||||
// <param name="m_status" type="wstring">Connected</param>
|
||||
// </param-list>
|
||||
// </record>
|
||||
// </Response>
|
||||
//</Telegram>;
|
||||
|
||||
protected object CreateFormString(Type type, string value)
|
||||
{
|
||||
if (type == typeof(string))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
else if (type == typeof(bool))
|
||||
{
|
||||
return Convert.ToBoolean(value);
|
||||
}
|
||||
else if (type == typeof(short))
|
||||
{
|
||||
return Convert.ToInt16(value);
|
||||
}
|
||||
else if (type == typeof(DateTime))
|
||||
{
|
||||
return Convert.ToDateTime(value);
|
||||
}
|
||||
else if (type == typeof(decimal))
|
||||
{
|
||||
return Convert.ToDecimal(value);
|
||||
}
|
||||
else if (type == typeof(int))
|
||||
{
|
||||
return Convert.ToInt32(value);
|
||||
}
|
||||
else if (type == typeof(byte))
|
||||
{
|
||||
return Convert.ToByte(value);
|
||||
}
|
||||
else if (type == typeof(decfloat))
|
||||
{
|
||||
return Convert.ToDecimal(value);
|
||||
}
|
||||
else if (type == typeof(double))
|
||||
{
|
||||
return Convert.ToDouble(value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected T[] CreatFromXml<T>(System.Xml.XmlReader reader) where T: IGenericRecord
|
||||
{
|
||||
List<T> list = new List<T>();
|
||||
reader.ReadToFollowing("item");
|
||||
while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
|
||||
{
|
||||
reader.ReadToFollowing("record");
|
||||
// reader stays on "record"
|
||||
T tempValue = default(T);
|
||||
//IGenericRecord tempValue = null;
|
||||
tempValue = CreateFromXml<T>(reader);
|
||||
if (tempValue != null)
|
||||
{
|
||||
list.Add(tempValue);
|
||||
reader.ReadEndElement();
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
//<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
//<Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
// <Response requestId="0">
|
||||
// <record type="Response_moduleGetRecord">
|
||||
// <param-list>
|
||||
// <param name="m_moduleConfigs" type="sequence" sequenceType="record">
|
||||
// <item>
|
||||
// <record type="moduleConfigParamRecord">
|
||||
// <param-list>
|
||||
// <param name="m_moduleId" type="wstring">A</param>
|
||||
// <param name="m_sensorId" type="wstring" />
|
||||
// <param name="m_tempSensorId" type="wstring" />
|
||||
// </param-list>
|
||||
// </record>
|
||||
// </item>
|
||||
// </param>
|
||||
// </param-list>
|
||||
// </record>
|
||||
// </Response>
|
||||
//</Telegram>;
|
||||
|
||||
protected void ReadProperty(System.Xml.XmlReader reader)
|
||||
{
|
||||
string nodeName = reader.Name;
|
||||
if (nodeName.Equals("param") && (reader.NodeType == XmlNodeType.Element))
|
||||
{
|
||||
string valueType = reader.GetAttribute("type");
|
||||
string valueName = reader.GetAttribute("name");
|
||||
|
||||
if (_propertyTypeDic != null && _propertyTypeDic.ContainsKey(valueName))
|
||||
{
|
||||
if (valueType == "sequence")
|
||||
{
|
||||
string sequenceType = reader.GetAttribute("sequenceType");
|
||||
if (sequenceType == PdkXmlSerializer.RecordElementname)
|
||||
{
|
||||
Type arrayType = _propertyTypeDic[valueName];
|
||||
Type elementType = arrayType.GetElementType();
|
||||
if (elementType == typeof(moduleConfigParamRecord))
|
||||
{
|
||||
moduleConfigParamRecord[] array = CreatFromXml<moduleConfigParamRecord>(reader);
|
||||
_propertyInfoDic[valueName].SetValue(this, array);
|
||||
}
|
||||
}
|
||||
if (sequenceType == PdkXmlSerializer.SequenceTypeAttributename)
|
||||
{
|
||||
; // fill it
|
||||
}
|
||||
else
|
||||
if (sequenceType == "wstring")
|
||||
{
|
||||
XmlSerializer stringSerializer = new XmlSerializer(typeof(string));
|
||||
|
||||
List<string> list = new List<string>();
|
||||
reader.Read();
|
||||
while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
|
||||
{
|
||||
reader.ReadStartElement(PdkXmlSerializer.ItemElementname);
|
||||
string content = reader.ReadString();
|
||||
list.Add(content);
|
||||
reader.ReadEndElement();
|
||||
reader.MoveToContent();
|
||||
}
|
||||
_propertyInfoDic[valueName].SetValue(this, list.ToArray(), null);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (valueType == "record")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.ReadStartElement(nodeName);
|
||||
object tempValue = null;
|
||||
tempValue = CreateFormString(_propertyTypeDic[valueName], reader.ReadString());
|
||||
reader.Read();
|
||||
if (tempValue != null && _propertyInfoDic != null && _propertyInfoDic.ContainsKey(valueName))
|
||||
{
|
||||
_propertyInfoDic[valueName].SetValue(this, tempValue, null);
|
||||
}
|
||||
}
|
||||
} //if "param"
|
||||
} // if
|
||||
|
||||
}
|
||||
|
||||
public void ReadXml(System.Xml.XmlReader reader)
|
||||
{
|
||||
XmlUtilities.GetTypePropertyDic(GetType(), ref _propertyTypeDic, ref _propertyInfoDic);
|
||||
// reader stays on record
|
||||
reader.ReadToFollowing("param-list");
|
||||
try
|
||||
{
|
||||
reader.Read();
|
||||
while ( reader.IsStartElement() )
|
||||
{
|
||||
ReadProperty(reader);
|
||||
} // while
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
static public IGenericRecord CreateFromXml(System.Xml.XmlReader reader)
|
||||
{
|
||||
// reader stays on "record"
|
||||
string recordType = reader.GetAttribute("type");
|
||||
|
||||
IGenericRecord record = null;
|
||||
|
||||
if (recordType == "moduleConfigParamRecord")
|
||||
{
|
||||
record = new MT.pHLab.SE.V1.moduleConfigParamRecord();
|
||||
record.ReadXml(reader);
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
private static T CreateFromXml<T>(System.Xml.XmlReader reader) where T : IGenericRecord
|
||||
{
|
||||
// reader stays on "record"
|
||||
string recordType = reader.GetAttribute("type");
|
||||
|
||||
IGenericRecord record = null;
|
||||
|
||||
if (recordType == "moduleConfigParamRecord")
|
||||
{
|
||||
record = new MT.pHLab.SE.V1.moduleConfigParamRecord();
|
||||
record.ReadXml(reader);
|
||||
}
|
||||
|
||||
if (record is T)
|
||||
{
|
||||
return (T)record;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
return (T)Convert.ChangeType(record, typeof(T));
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region Physical properties
|
||||
public partial class Response_StatusRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
public partial class Request_methodParamsRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
|
||||
public partial class Request_setupGetItemListRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Response_setupGetItemListRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Response_SimpleResultRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Response_moduleGetRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class moduleConfigParamRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Request_moduleSetRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Request_terminateMethodRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Response_startMethodRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Request_setupExportRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Request_getSettingRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Response_getSettingRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Request_setSettingRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Request_loginRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
public partial class Response_loginRecord : IGenericRecord
|
||||
{
|
||||
}
|
||||
|
||||
}
|
228
SEClient/SETelegram.cs
Normal file
228
SEClient/SETelegram.cs
Normal file
@ -0,0 +1,228 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using XMLSerializationCustomization;
|
||||
using log4net;
|
||||
using System.Collections;
|
||||
|
||||
namespace MT.pHLab.SE.V1
|
||||
{
|
||||
|
||||
public abstract class SERequest
|
||||
{
|
||||
public static IDictionary<Type, String> typeMapping = new Dictionary<Type, String>()
|
||||
{
|
||||
{ typeof(Response_SimpleResultRecord), "Response_SimpleResultRecord" },
|
||||
{ typeof(Response_moduleGetRecord), "Response_moduleGetRecord" },
|
||||
{ typeof(Request_methodParamsRecord), "Request_methodParamsRecord" },
|
||||
{ typeof(Request_setupGetItemListRecord), "Request_setupGetItemListRecord" },
|
||||
{ typeof(Request_setupExportRecord), "Request_setupExportRecord" },
|
||||
};
|
||||
|
||||
public static IDictionary<Type, String> requestMapping = new Dictionary<Type, String>()
|
||||
{
|
||||
{ typeof(Response_SimpleResultRecord), "Response_SimpleResultRecord" },
|
||||
{ typeof(Response_StatusRecord), "Response_StatusRecord" },
|
||||
{ typeof(Response_moduleGetRecord), "Response_moduleGetRecord" },
|
||||
{ typeof(Request_methodParamsRecord), "method.start" },
|
||||
{ typeof(Request_setupGetItemListRecord), "setup.getItemList" },
|
||||
{ typeof(Request_moduleSetRecord), "module.set" },
|
||||
{ typeof(Request_terminateMethodRecord), "method.terminate" },
|
||||
{ typeof(Request_setupExportRecord), "setup.export" },
|
||||
{ typeof(Request_setSettingRecord ), "setting.setItem" },
|
||||
{ typeof(Request_getSettingRecord ), "setting.getItem" },
|
||||
{ typeof(Request_loginRecord), "login" }
|
||||
};
|
||||
|
||||
public int RequestId { get; private set; }
|
||||
|
||||
public SERequest(int requestId)
|
||||
{
|
||||
RequestId = requestId;
|
||||
}
|
||||
|
||||
public static String MapRequest(Type type)
|
||||
{
|
||||
if (requestMapping.ContainsKey(type))
|
||||
{
|
||||
return requestMapping[type];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void WriteXml( IGenericRecord record, XmlWriter writer )
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("Telegram");
|
||||
writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema");
|
||||
writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
|
||||
writer.WriteStartElement("Request");
|
||||
writer.WriteAttributeString("requestType", MapRequest(record.GetType()));
|
||||
writer.WriteAttributeString("requestId", RequestId.ToString() );
|
||||
PDKXmlWriter.WriteRecord(record, writer );
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndDocument();
|
||||
}
|
||||
}
|
||||
|
||||
public class SESimpleRequest : SERequest
|
||||
{
|
||||
string m_stringSimpleRequest;
|
||||
|
||||
public SESimpleRequest( int requestId, string request)
|
||||
: base(requestId)
|
||||
{
|
||||
m_stringSimpleRequest= request;
|
||||
}
|
||||
|
||||
public void WriteXml( XmlWriter writer )
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("Telegram");
|
||||
writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema");
|
||||
writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
|
||||
//writer.WriteAttributeString("xmlns", "tm");
|
||||
writer.WriteStartElement("Request");
|
||||
writer.WriteAttributeString("requestType", m_stringSimpleRequest);
|
||||
writer.WriteAttributeString("requestId", this.RequestId.ToString());
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndDocument();
|
||||
}
|
||||
|
||||
public byte[] CreateTelegram()
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Indent = false;
|
||||
settings.Encoding = new UTF8Encoding(false);
|
||||
using (MemoryStream output = new MemoryStream())
|
||||
{
|
||||
//using (var xw = XmlTextWriter.Create(output, new UTF8Encoding(false)))
|
||||
using (var xw = XmlWriter.Create(output, settings ))
|
||||
{
|
||||
// Build Xml with xw.
|
||||
WriteXml(xw);
|
||||
}
|
||||
return output.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SEParamRequest : SERequest
|
||||
{
|
||||
public SEParamRequest(int requestId)
|
||||
: base(requestId)
|
||||
{
|
||||
}
|
||||
|
||||
public byte[] CreateTelegram(IGenericRecord record )
|
||||
{
|
||||
//Encoding utf8noBOM = new UTF8Encoding(false);
|
||||
//using (MemoryStream output = new MemoryStream())
|
||||
//{
|
||||
// using (XmlWriter writer = XmlWriter.Create(output, settings))
|
||||
// {
|
||||
// writer.WriteStartDocument();
|
||||
// writer.WriteStartElement("Colors");
|
||||
// writer.WriteElementString("Color", "RED");
|
||||
// writer.WriteEndDocument();
|
||||
// }
|
||||
// result = Encoding.Default.GetString(output.ToArray());
|
||||
//}
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Indent = false;
|
||||
settings.Encoding = new UTF8Encoding(false);
|
||||
using (MemoryStream output = new MemoryStream())
|
||||
{
|
||||
//using (var xw = XmlTextWriter.Create(output, new UTF8Encoding(false)))
|
||||
using (var xw = XmlWriter.Create(output, settings ))
|
||||
{
|
||||
// Build Xml with xw.
|
||||
WriteXml(record, xw);
|
||||
}
|
||||
return output.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SEResponse
|
||||
{
|
||||
/*
|
||||
* <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
* <Telegram xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform">
|
||||
* <Response requestId="102478">
|
||||
* <record type="Response_StatusRecord">
|
||||
* <param-list>
|
||||
* <param name="m_status" type="wstring">Attached</param>
|
||||
* </param-list>
|
||||
* </record>
|
||||
* </Response>
|
||||
* </Telegram>
|
||||
*/
|
||||
private static IDictionary<String, Type> typeMappings = new Dictionary<String, Type>()
|
||||
{
|
||||
{ "Response_SimpleResultRecord", typeof(Response_SimpleResultRecord) },
|
||||
{ "Response_StatusRecord", typeof(Response_StatusRecord) },
|
||||
{ "Response_moduleGetRecord", typeof(Response_moduleGetRecord) },
|
||||
{ "Response_setupGetItemListRecord", typeof(Response_setupGetItemListRecord) },
|
||||
{ "Response_startMethodRecord", typeof(Response_startMethodRecord) },
|
||||
{ "Response_getSettingRecord", typeof(Response_getSettingRecord) },
|
||||
{ "Response_loginRecord", typeof(Response_loginRecord) },
|
||||
};
|
||||
|
||||
XmlReader m_reader;
|
||||
|
||||
string m_recordType;
|
||||
|
||||
static public SEResponse CreateFromXml(XmlReader reader)
|
||||
{
|
||||
SEResponse response = null;
|
||||
|
||||
// Build Xml with xw.
|
||||
response = new SEResponse(reader);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public SEResponse( XmlReader reader )
|
||||
{
|
||||
m_reader = reader;
|
||||
m_reader.ReadToFollowing("record");
|
||||
m_recordType = m_reader.GetAttribute("type");
|
||||
}
|
||||
|
||||
|
||||
public Type GetRecordType()
|
||||
{
|
||||
return typeMappings[m_recordType];
|
||||
}
|
||||
|
||||
public object CreateInstance()
|
||||
{
|
||||
if (typeMappings[m_recordType] == typeof(MT.pHLab.SE.V1.Response_StatusRecord) )
|
||||
{
|
||||
MT.pHLab.SE.V1.Response_StatusRecord record = new MT.pHLab.SE.V1.Response_StatusRecord();
|
||||
|
||||
record.ReadXml(m_reader);
|
||||
return record;
|
||||
} else
|
||||
if (typeMappings[m_recordType] == typeof(MT.pHLab.SE.V1.Response_setupGetItemListRecord))
|
||||
{
|
||||
MT.pHLab.SE.V1.Response_setupGetItemListRecord record = new MT.pHLab.SE.V1.Response_setupGetItemListRecord();
|
||||
|
||||
record.ReadXml(m_reader);
|
||||
return record;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
15
SEClient/SEText.cs
Normal file
15
SEClient/SEText.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using MT.pHLab.SE.V1;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SERemoteLib
|
||||
{
|
||||
class SEText
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
95
SEClient/Validation/Validate.cs
Normal file
95
SEClient/Validation/Validate.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace MT.Sequoia.Platform.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a helper class for validation.
|
||||
/// </summary>
|
||||
public sealed class Validate
|
||||
{
|
||||
private Validate() { }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <paramref name="o"/> is null.
|
||||
/// In case of null the specified exception will be thrown.
|
||||
/// </summary>
|
||||
/// <param name="o">The o.</param>
|
||||
/// <param name="formatedMessage">The formated message.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "o"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "formated"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter"), SuppressMessage("Microsoft.DesignRules", "CA1004", Justification = "For a better readability.")]
|
||||
public static void IsNotNull<TExceptionType>(object o, string formatedMessage, params object[] args) where TExceptionType : System.Exception, new()
|
||||
{
|
||||
IsFalse<TExceptionType>(o == null, formatedMessage, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <paramref name="condition"/> is true.
|
||||
/// In case of the condition is false the specified condition is thrown.
|
||||
/// </summary>
|
||||
/// <param name="condition">if set to <c>true</c> [condition].</param>
|
||||
/// <param name="formatedMessage">The formated message.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "formated"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter"), SuppressMessage("Microsoft.DesignRules", "CA1004", Justification = "For a better readability.")]
|
||||
public static void IsTrue<TExceptionType>(bool condition, string formatedMessage, params object[] args) where TExceptionType : System.Exception, new()
|
||||
{
|
||||
IsFalse < TExceptionType >(!condition, formatedMessage, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <paramref name="condition"/> is false.
|
||||
/// In case of the condition is true the specified exception is thrown.
|
||||
/// </summary>
|
||||
/// <param name="condition">if set to <c>true</c> [condition].</param>
|
||||
/// <param name="formatedMessage">The formated message.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter"), SuppressMessage("Microsoft.DesignRules", "CA1004", Justification = "For a better readability.")]
|
||||
public static void IsFalse<TExceptionType>(bool condition, string formatedMessage, params object[] args) where TExceptionType : System.Exception, new()
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
TExceptionType exception = new TExceptionType();
|
||||
SetProperty(exception, "_message", string.Format(CultureInfo.CurrentCulture, formatedMessage, args), false);
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a field / property of an object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object of which the field / property should be set</param>
|
||||
/// <param name="propertyName">The name of the field / property</param>
|
||||
/// <param name="propertyValue">The value of the property</param>
|
||||
/// <param name="ignoreCase">True if it shall operate case insensitive</param>
|
||||
static private void SetProperty(object obj, string propertyName, string propertyValue, bool ignoreCase)
|
||||
{
|
||||
BindingFlags bindings = BindingFlags.Public | BindingFlags.Instance;
|
||||
if (ignoreCase)
|
||||
{
|
||||
bindings |= BindingFlags.IgnoreCase;
|
||||
}
|
||||
Type type = obj.GetType();
|
||||
|
||||
// look for a setable property
|
||||
PropertyInfo property = type.GetProperty(propertyName, bindings);
|
||||
if (property != null && property.CanWrite)
|
||||
{
|
||||
property.SetValue(obj, propertyValue, null);
|
||||
return;
|
||||
}
|
||||
// look for a public field
|
||||
FieldInfo field = type.GetField(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (field != null)
|
||||
{
|
||||
field.SetValue(obj, propertyValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
99
SEClient/XmlUtilities.cs
Normal file
99
SEClient/XmlUtilities.cs
Normal file
@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace XMLSerializationCustomization
|
||||
{
|
||||
public class XmlUtilities
|
||||
{
|
||||
//public static string SerializeToString(object obj)
|
||||
//{
|
||||
// if (obj != null)
|
||||
// {
|
||||
// XmlSerializer serializer = new XmlSerializer(obj.GetType());
|
||||
|
||||
// using (StringWriter writer = new StringWriter())
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// serializer.Serialize(writer, obj);
|
||||
|
||||
// return writer.ToString();
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// return string.Empty;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return string.Empty;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public static T SerializeFromString<T>(string xml)
|
||||
//{
|
||||
// if (!string.IsNullOrEmpty(xml))
|
||||
// {
|
||||
// XmlSerializer serializer = new XmlSerializer(typeof(T));
|
||||
|
||||
// using (StringReader reader = new StringReader(xml))
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// return (T)serializer.Deserialize(reader);
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// throw new Exception("XML document is wrong.");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return default(T);
|
||||
// }
|
||||
//}
|
||||
|
||||
public static void GetTypePropertyDic(Type type, ref Dictionary<string, Type> propertyTypeDic, ref Dictionary<string, PropertyInfo> propertyInfoDic)
|
||||
{
|
||||
PropertyInfo[] propertyArray = type.GetProperties(BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.SetProperty);
|
||||
if (propertyArray != null)
|
||||
{
|
||||
foreach (PropertyInfo property in propertyArray)
|
||||
{
|
||||
propertyTypeDic[property.Name] = property.PropertyType;
|
||||
propertyInfoDic[property.Name] = property;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class PdkXmlTextReader : XmlTextReader
|
||||
{
|
||||
public PdkXmlTextReader(System.IO.TextReader reader) : base(reader) { }
|
||||
|
||||
public override string NamespaceURI
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.NamespaceURI == "LancePlatform")
|
||||
{
|
||||
return "tf";
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.NamespaceURI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
28271
SEClient/bin/Debug/log4net.xml
Normal file
28271
SEClient/bin/Debug/log4net.xml
Normal file
File diff suppressed because it is too large
Load Diff
69
SEClient/decfloat.cs
Normal file
69
SEClient/decfloat.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MT.pHLab.SE.V1
|
||||
{
|
||||
public partial class decfloat
|
||||
{
|
||||
public decfloat()
|
||||
{
|
||||
DecimalValue = null;
|
||||
}
|
||||
|
||||
public decfloat(decimal value)
|
||||
{
|
||||
DecimalValue = value;
|
||||
}
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute()]
|
||||
public decimal? DecimalValue
|
||||
{
|
||||
get
|
||||
{
|
||||
decimal value;
|
||||
|
||||
if (decimal.TryParse(this.valueField, NumberStyles.Float, CultureInfo.InvariantCulture, out value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value.HasValue)
|
||||
{
|
||||
this.valueField = string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.valueField = "NaN";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static implicit operator decfloat(decimal value)
|
||||
{
|
||||
return new decfloat(value);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
decimal? value = DecimalValue;
|
||||
if (value.HasValue)
|
||||
{
|
||||
return value.Value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "not defined";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
0
SEClient/obj/Debug/SEClient.csproj.CopyComplete
Normal file
0
SEClient/obj/Debug/SEClient.csproj.CopyComplete
Normal file
19
SEClient/obj/Debug/SEClient.csproj.FileListAbsolute.txt
Normal file
19
SEClient/obj/Debug/SEClient.csproj.FileListAbsolute.txt
Normal file
@ -0,0 +1,19 @@
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\bin\Debug\SERemoteLib.dll
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\bin\Debug\SERemoteLib.pdb
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\bin\Debug\log4net.dll
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\bin\Debug\log4net.xml
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\obj\Debug\SEClient.csproj.AssemblyReference.cache
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\obj\Debug\SEClient.csproj.CoreCompileInputs.cache
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\obj\Debug\SEClient.csproj.CopyComplete
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\obj\Debug\SERemoteLib.dll
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SEClient\obj\Debug\SERemoteLib.pdb
|
||||
D:\GitCode\Remote-control\SEClient\obj\Debug\SEClient.csproj.AssemblyReference.cache
|
||||
D:\GitCode\Remote-control\SEClient\obj\Debug\SEClient.csproj.CoreCompileInputs.cache
|
||||
D:\GitCode\Remote-control\SEClient\bin\Debug\SERemoteLib.dll
|
||||
D:\GitCode\Remote-control\SEClient\bin\Debug\SERemoteLib.pdb
|
||||
D:\GitCode\Remote-control\SEClient\bin\Debug\log4net.dll
|
||||
D:\GitCode\Remote-control\SEClient\bin\Debug\log4net.pdb
|
||||
D:\GitCode\Remote-control\SEClient\bin\Debug\log4net.xml
|
||||
D:\GitCode\Remote-control\SEClient\obj\Debug\SEClient.csproj.CopyComplete
|
||||
D:\GitCode\Remote-control\SEClient\obj\Debug\SERemoteLib.dll
|
||||
D:\GitCode\Remote-control\SEClient\obj\Debug\SERemoteLib.pdb
|
1
SEClient/obj/Debug/_IsIncrementalBuild
Normal file
1
SEClient/obj/Debug/_IsIncrementalBuild
Normal file
@ -0,0 +1 @@
|
||||
obj\Debug\\_IsIncrementalBuild
|
4
SEClient/packages.config
Normal file
4
SEClient/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="3.0.3-preview.1" targetFramework="net48" />
|
||||
</packages>
|
32
SECockpit.sln
Normal file
32
SECockpit.sln
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SEClient", "SEClient\SEClient.csproj", "{5222F720-4E4F-4932-B01D-E4B8DBD8CC5F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{80352D19-F394-4627-BACE-6AC5FC8BF7F8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SERemoteControl", "SERemoteControl\SERemoteControl.csproj", "{038E7505-59C6-4800-B91B-97A432233BF1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5222F720-4E4F-4932-B01D-E4B8DBD8CC5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5222F720-4E4F-4932-B01D-E4B8DBD8CC5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5222F720-4E4F-4932-B01D-E4B8DBD8CC5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5222F720-4E4F-4932-B01D-E4B8DBD8CC5F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{80352D19-F394-4627-BACE-6AC5FC8BF7F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{80352D19-F394-4627-BACE-6AC5FC8BF7F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{80352D19-F394-4627-BACE-6AC5FC8BF7F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{80352D19-F394-4627-BACE-6AC5FC8BF7F8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{038E7505-59C6-4800-B91B-97A432233BF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{038E7505-59C6-4800-B91B-97A432233BF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{038E7505-59C6-4800-B91B-97A432233BF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{038E7505-59C6-4800-B91B-97A432233BF1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
185
SERemoteControl/AboutBox.Designer.cs
generated
Normal file
185
SERemoteControl/AboutBox.Designer.cs
generated
Normal file
@ -0,0 +1,185 @@
|
||||
namespace SERemoteControl
|
||||
{
|
||||
partial class AboutBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.logoPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.labelProductName = new System.Windows.Forms.Label();
|
||||
this.labelVersion = new System.Windows.Forms.Label();
|
||||
this.labelCopyright = new System.Windows.Forms.Label();
|
||||
this.labelCompanyName = new System.Windows.Forms.Label();
|
||||
this.textBoxDescription = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.tableLayoutPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel
|
||||
//
|
||||
this.tableLayoutPanel.ColumnCount = 2;
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F));
|
||||
this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3);
|
||||
this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4);
|
||||
this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5);
|
||||
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel.Location = new System.Drawing.Point(9, 8);
|
||||
this.tableLayoutPanel.Name = "tableLayoutPanel";
|
||||
this.tableLayoutPanel.RowCount = 6;
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.Size = new System.Drawing.Size(417, 245);
|
||||
this.tableLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
// logoPictureBox
|
||||
//
|
||||
this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.logoPictureBox.Image = global::SERemoteControl.Properties.Resources.SevenExcellence;
|
||||
this.logoPictureBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.logoPictureBox.Name = "logoPictureBox";
|
||||
this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6);
|
||||
this.logoPictureBox.Size = new System.Drawing.Size(131, 239);
|
||||
this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.logoPictureBox.TabIndex = 12;
|
||||
this.logoPictureBox.TabStop = false;
|
||||
//
|
||||
// labelProductName
|
||||
//
|
||||
this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelProductName.Location = new System.Drawing.Point(143, 0);
|
||||
this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelProductName.MaximumSize = new System.Drawing.Size(0, 16);
|
||||
this.labelProductName.Name = "labelProductName";
|
||||
this.labelProductName.Size = new System.Drawing.Size(271, 16);
|
||||
this.labelProductName.TabIndex = 19;
|
||||
this.labelProductName.Text = "Product Name";
|
||||
this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelVersion
|
||||
//
|
||||
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelVersion.Location = new System.Drawing.Point(143, 24);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 16);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
this.labelVersion.Size = new System.Drawing.Size(271, 16);
|
||||
this.labelVersion.TabIndex = 0;
|
||||
this.labelVersion.Text = "Version";
|
||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCopyright
|
||||
//
|
||||
this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCopyright.Location = new System.Drawing.Point(143, 48);
|
||||
this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 16);
|
||||
this.labelCopyright.Name = "labelCopyright";
|
||||
this.labelCopyright.Size = new System.Drawing.Size(271, 16);
|
||||
this.labelCopyright.TabIndex = 21;
|
||||
this.labelCopyright.Text = "Copyright";
|
||||
this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCompanyName
|
||||
//
|
||||
this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCompanyName.Location = new System.Drawing.Point(143, 72);
|
||||
this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 16);
|
||||
this.labelCompanyName.Name = "labelCompanyName";
|
||||
this.labelCompanyName.Size = new System.Drawing.Size(271, 16);
|
||||
this.labelCompanyName.TabIndex = 22;
|
||||
this.labelCompanyName.Text = "Company Name";
|
||||
this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// textBoxDescription
|
||||
//
|
||||
this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBoxDescription.Location = new System.Drawing.Point(143, 99);
|
||||
this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||
this.textBoxDescription.Multiline = true;
|
||||
this.textBoxDescription.Name = "textBoxDescription";
|
||||
this.textBoxDescription.ReadOnly = true;
|
||||
this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBoxDescription.Size = new System.Drawing.Size(271, 116);
|
||||
this.textBoxDescription.TabIndex = 23;
|
||||
this.textBoxDescription.TabStop = false;
|
||||
this.textBoxDescription.Text = "Description";
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.okButton.Location = new System.Drawing.Point(339, 221);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 21);
|
||||
this.okButton.TabIndex = 24;
|
||||
this.okButton.Text = "&OK";
|
||||
//
|
||||
// AboutBox
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(435, 261);
|
||||
this.Controls.Add(this.tableLayoutPanel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AboutBox";
|
||||
this.Padding = new System.Windows.Forms.Padding(9, 8, 9, 8);
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "About";
|
||||
this.tableLayoutPanel.ResumeLayout(false);
|
||||
this.tableLayoutPanel.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
|
||||
private System.Windows.Forms.PictureBox logoPictureBox;
|
||||
private System.Windows.Forms.Label labelProductName;
|
||||
private System.Windows.Forms.Label labelVersion;
|
||||
private System.Windows.Forms.Label labelCopyright;
|
||||
private System.Windows.Forms.Label labelCompanyName;
|
||||
private System.Windows.Forms.TextBox textBoxDescription;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
}
|
||||
}
|
105
SERemoteControl/AboutBox.cs
Normal file
105
SERemoteControl/AboutBox.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SERemoteControl
|
||||
{
|
||||
partial class AboutBox : Form
|
||||
{
|
||||
public AboutBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = String.Format("About {0}", AssemblyTitle);
|
||||
this.labelProductName.Text = AssemblyProduct;
|
||||
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
|
||||
this.labelCopyright.Text = AssemblyCopyright;
|
||||
this.labelCompanyName.Text = AssemblyCompany;
|
||||
this.textBoxDescription.Text = AssemblyDescription;
|
||||
}
|
||||
|
||||
#region Assembly Attribute Accessors
|
||||
|
||||
public string AssemblyTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
|
||||
if (attributes.Length > 0)
|
||||
{
|
||||
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
|
||||
if (titleAttribute.Title != "")
|
||||
{
|
||||
return titleAttribute.Title;
|
||||
}
|
||||
}
|
||||
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyProduct
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyProductAttribute)attributes[0]).Product;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyCopyright
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyCompany
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyCompanyAttribute)attributes[0]).Company;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
120
SERemoteControl/AboutBox.resx
Normal file
120
SERemoteControl/AboutBox.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
21
SERemoteControl/App.config
Normal file
21
SERemoteControl/App.config
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="SERemoteControl.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<SERemoteControl.Properties.Settings>
|
||||
<setting name="AddressHistory" serializeAs="String">
|
||||
<value>http://192.168.1.101:8088;</value>
|
||||
</setting>
|
||||
<setting name="CurrentAddress" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</SERemoteControl.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
776
SERemoteControl/FormMain.Designer.cs
generated
Normal file
776
SERemoteControl/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,776 @@
|
||||
namespace SERemoteControl
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.tabCockpit = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.comboBoxSevenExcellence = new System.Windows.Forms.ComboBox();
|
||||
this.buttonClearLog = new System.Windows.Forms.Button();
|
||||
this.textBoxState = new System.Windows.Forms.TextBox();
|
||||
this.buttonGetState = new System.Windows.Forms.Button();
|
||||
this.buttonDetach = new System.Windows.Forms.Button();
|
||||
this.buttonAttach = new System.Windows.Forms.Button();
|
||||
this.buttonDisconnect = new System.Windows.Forms.Button();
|
||||
this.buttonConnect = new System.Windows.Forms.Button();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.comboBoxSensor = new System.Windows.Forms.ComboBox();
|
||||
this.comboBoxModule = new System.Windows.Forms.ComboBox();
|
||||
this.buttonConnectSensorToModule = new System.Windows.Forms.Button();
|
||||
this.listView2 = new System.Windows.Forms.ListView();
|
||||
this.columnSensor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.buttonSensors = new System.Windows.Forms.Button();
|
||||
this.listView1 = new System.Windows.Forms.ListView();
|
||||
this.columnHeaderModule = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderSensor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.buttonModules = new System.Windows.Forms.Button();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.buttonTermiate = new System.Windows.Forms.Button();
|
||||
this.textBoxMethodSampleId = new System.Windows.Forms.TextBox();
|
||||
this.textBoxMethodInstruction = new System.Windows.Forms.TextBox();
|
||||
this.buttonStartMethod = new System.Windows.Forms.Button();
|
||||
this.listboxListOfMethods = new System.Windows.Forms.ListBox();
|
||||
this.buttonMethods = new System.Windows.Forms.Button();
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
this.textBoxSettingValue = new System.Windows.Forms.TextBox();
|
||||
this.comboBoxSettingTag = new System.Windows.Forms.ComboBox();
|
||||
this.buttonSetupSetting = new System.Windows.Forms.Button();
|
||||
this.listViewSettings = new System.Windows.Forms.ListView();
|
||||
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.buttonRequestSetupItemList = new System.Windows.Forms.Button();
|
||||
this.tabPage5 = new System.Windows.Forms.TabPage();
|
||||
this.buttonImport = new System.Windows.Forms.Button();
|
||||
this.buttonExport = new System.Windows.Forms.Button();
|
||||
this.comboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.tabPage6 = new System.Windows.Forms.TabPage();
|
||||
this.buttonLoginCancel = new System.Windows.Forms.Button();
|
||||
this.checkBoxProposedUsers = new System.Windows.Forms.CheckBox();
|
||||
this.textBoxUsernameList = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
||||
this.textBoxUsername = new System.Windows.Forms.TextBox();
|
||||
this.buttonLogin = new System.Windows.Forms.Button();
|
||||
this.listviewLog = new System.Windows.Forms.ListView();
|
||||
this.columnHeaderTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderLog = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
this.splitContainer.Panel2.SuspendLayout();
|
||||
this.splitContainer.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.tabCockpit.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.tabPage4.SuspendLayout();
|
||||
this.tabPage5.SuspendLayout();
|
||||
this.tabPage6.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer
|
||||
//
|
||||
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer.Location = new System.Drawing.Point(0, 24);
|
||||
this.splitContainer.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.splitContainer.Name = "splitContainer";
|
||||
this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer.Panel1
|
||||
//
|
||||
this.splitContainer.Panel1.Controls.Add(this.panel1);
|
||||
//
|
||||
// splitContainer.Panel2
|
||||
//
|
||||
this.splitContainer.Panel2.Controls.Add(this.listviewLog);
|
||||
this.splitContainer.Size = new System.Drawing.Size(611, 471);
|
||||
this.splitContainer.SplitterDistance = 305;
|
||||
this.splitContainer.SplitterWidth = 5;
|
||||
this.splitContainer.TabIndex = 4;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.AutoSize = true;
|
||||
this.panel1.Controls.Add(this.tabCockpit);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(611, 305);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// tabCockpit
|
||||
//
|
||||
this.tabCockpit.Controls.Add(this.tabPage1);
|
||||
this.tabCockpit.Controls.Add(this.tabPage2);
|
||||
this.tabCockpit.Controls.Add(this.tabPage3);
|
||||
this.tabCockpit.Controls.Add(this.tabPage4);
|
||||
this.tabCockpit.Controls.Add(this.tabPage5);
|
||||
this.tabCockpit.Controls.Add(this.tabPage6);
|
||||
this.tabCockpit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabCockpit.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabCockpit.Name = "tabCockpit";
|
||||
this.tabCockpit.SelectedIndex = 0;
|
||||
this.tabCockpit.Size = new System.Drawing.Size(611, 305);
|
||||
this.tabCockpit.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.comboBoxSevenExcellence);
|
||||
this.tabPage1.Controls.Add(this.buttonClearLog);
|
||||
this.tabPage1.Controls.Add(this.textBoxState);
|
||||
this.tabPage1.Controls.Add(this.buttonGetState);
|
||||
this.tabPage1.Controls.Add(this.buttonDetach);
|
||||
this.tabPage1.Controls.Add(this.buttonAttach);
|
||||
this.tabPage1.Controls.Add(this.buttonDisconnect);
|
||||
this.tabPage1.Controls.Add(this.buttonConnect);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(603, 279);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Connection";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// comboBoxSevenExcellence
|
||||
//
|
||||
this.comboBoxSevenExcellence.FormattingEnabled = true;
|
||||
this.comboBoxSevenExcellence.Location = new System.Drawing.Point(128, 29);
|
||||
this.comboBoxSevenExcellence.Name = "comboBoxSevenExcellence";
|
||||
this.comboBoxSevenExcellence.Size = new System.Drawing.Size(213, 21);
|
||||
this.comboBoxSevenExcellence.TabIndex = 7;
|
||||
//
|
||||
// buttonClearLog
|
||||
//
|
||||
this.buttonClearLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonClearLog.Location = new System.Drawing.Point(522, 247);
|
||||
this.buttonClearLog.Name = "buttonClearLog";
|
||||
this.buttonClearLog.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonClearLog.TabIndex = 6;
|
||||
this.buttonClearLog.Text = "Clear Log";
|
||||
this.buttonClearLog.UseVisualStyleBackColor = true;
|
||||
this.buttonClearLog.Click += new System.EventHandler(this.buttonClearLog_Click);
|
||||
//
|
||||
// textBoxState
|
||||
//
|
||||
this.textBoxState.Location = new System.Drawing.Point(128, 117);
|
||||
this.textBoxState.Name = "textBoxState";
|
||||
this.textBoxState.Size = new System.Drawing.Size(181, 20);
|
||||
this.textBoxState.TabIndex = 0;
|
||||
//
|
||||
// buttonGetState
|
||||
//
|
||||
this.buttonGetState.Location = new System.Drawing.Point(28, 114);
|
||||
this.buttonGetState.Name = "buttonGetState";
|
||||
this.buttonGetState.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonGetState.TabIndex = 5;
|
||||
this.buttonGetState.Text = "State";
|
||||
this.buttonGetState.UseVisualStyleBackColor = true;
|
||||
this.buttonGetState.Click += new System.EventHandler(this.buttonGetState_Click);
|
||||
//
|
||||
// buttonDetach
|
||||
//
|
||||
this.buttonDetach.Location = new System.Drawing.Point(28, 161);
|
||||
this.buttonDetach.Name = "buttonDetach";
|
||||
this.buttonDetach.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonDetach.TabIndex = 3;
|
||||
this.buttonDetach.Text = "Detach";
|
||||
this.buttonDetach.UseVisualStyleBackColor = true;
|
||||
this.buttonDetach.Click += new System.EventHandler(this.buttonDetach_Click);
|
||||
//
|
||||
// buttonAttach
|
||||
//
|
||||
this.buttonAttach.Location = new System.Drawing.Point(28, 70);
|
||||
this.buttonAttach.Name = "buttonAttach";
|
||||
this.buttonAttach.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAttach.TabIndex = 2;
|
||||
this.buttonAttach.Text = "Attach";
|
||||
this.buttonAttach.UseVisualStyleBackColor = true;
|
||||
this.buttonAttach.Click += new System.EventHandler(this.buttonAttach_Click);
|
||||
//
|
||||
// buttonDisconnect
|
||||
//
|
||||
this.buttonDisconnect.Location = new System.Drawing.Point(28, 203);
|
||||
this.buttonDisconnect.Name = "buttonDisconnect";
|
||||
this.buttonDisconnect.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonDisconnect.TabIndex = 1;
|
||||
this.buttonDisconnect.Text = "Disconnect";
|
||||
this.buttonDisconnect.UseVisualStyleBackColor = true;
|
||||
this.buttonDisconnect.Click += new System.EventHandler(this.buttonDisconnect_Click);
|
||||
//
|
||||
// buttonConnect
|
||||
//
|
||||
this.buttonConnect.Location = new System.Drawing.Point(28, 28);
|
||||
this.buttonConnect.Name = "buttonConnect";
|
||||
this.buttonConnect.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonConnect.TabIndex = 0;
|
||||
this.buttonConnect.Text = "Connect";
|
||||
this.buttonConnect.UseVisualStyleBackColor = true;
|
||||
this.buttonConnect.Click += new System.EventHandler(this.buttonConnect_Click);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.comboBoxSensor);
|
||||
this.tabPage2.Controls.Add(this.comboBoxModule);
|
||||
this.tabPage2.Controls.Add(this.buttonConnectSensorToModule);
|
||||
this.tabPage2.Controls.Add(this.listView2);
|
||||
this.tabPage2.Controls.Add(this.buttonSensors);
|
||||
this.tabPage2.Controls.Add(this.listView1);
|
||||
this.tabPage2.Controls.Add(this.buttonModules);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(603, 279);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Modules";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// comboBoxSensor
|
||||
//
|
||||
this.comboBoxSensor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSensor.FormattingEnabled = true;
|
||||
this.comboBoxSensor.Location = new System.Drawing.Point(246, 218);
|
||||
this.comboBoxSensor.Name = "comboBoxSensor";
|
||||
this.comboBoxSensor.Size = new System.Drawing.Size(307, 21);
|
||||
this.comboBoxSensor.TabIndex = 7;
|
||||
//
|
||||
// comboBoxModule
|
||||
//
|
||||
this.comboBoxModule.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxModule.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.comboBoxModule.FormattingEnabled = true;
|
||||
this.comboBoxModule.Location = new System.Drawing.Point(91, 218);
|
||||
this.comboBoxModule.Name = "comboBoxModule";
|
||||
this.comboBoxModule.Size = new System.Drawing.Size(149, 21);
|
||||
this.comboBoxModule.TabIndex = 6;
|
||||
//
|
||||
// buttonConnectSensorToModule
|
||||
//
|
||||
this.buttonConnectSensorToModule.Location = new System.Drawing.Point(10, 218);
|
||||
this.buttonConnectSensorToModule.Name = "buttonConnectSensorToModule";
|
||||
this.buttonConnectSensorToModule.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonConnectSensorToModule.TabIndex = 5;
|
||||
this.buttonConnectSensorToModule.Text = "Connect";
|
||||
this.buttonConnectSensorToModule.UseVisualStyleBackColor = true;
|
||||
this.buttonConnectSensorToModule.Click += new System.EventHandler(this.buttonConnectSensorToModule_Click);
|
||||
//
|
||||
// listView2
|
||||
//
|
||||
this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnSensor,
|
||||
this.columnHeader2});
|
||||
this.listView2.FullRowSelect = true;
|
||||
this.listView2.HideSelection = false;
|
||||
this.listView2.Location = new System.Drawing.Point(91, 100);
|
||||
this.listView2.Name = "listView2";
|
||||
this.listView2.Size = new System.Drawing.Size(462, 104);
|
||||
this.listView2.TabIndex = 4;
|
||||
this.listView2.UseCompatibleStateImageBehavior = false;
|
||||
this.listView2.View = System.Windows.Forms.View.Details;
|
||||
this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
|
||||
//
|
||||
// columnSensor
|
||||
//
|
||||
this.columnSensor.Text = "Sensor";
|
||||
this.columnSensor.Width = 190;
|
||||
//
|
||||
// columnHeader2
|
||||
//
|
||||
this.columnHeader2.Text = "Sensor";
|
||||
this.columnHeader2.Width = 200;
|
||||
//
|
||||
// buttonSensors
|
||||
//
|
||||
this.buttonSensors.Location = new System.Drawing.Point(10, 100);
|
||||
this.buttonSensors.Name = "buttonSensors";
|
||||
this.buttonSensors.Size = new System.Drawing.Size(75, 22);
|
||||
this.buttonSensors.TabIndex = 3;
|
||||
this.buttonSensors.Text = "Sensor";
|
||||
this.buttonSensors.UseVisualStyleBackColor = true;
|
||||
this.buttonSensors.Click += new System.EventHandler(this.buttonConnectSensor_Click);
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeaderModule,
|
||||
this.columnHeaderSensor});
|
||||
this.listView1.FullRowSelect = true;
|
||||
this.listView1.HideSelection = false;
|
||||
this.listView1.Location = new System.Drawing.Point(91, 19);
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(462, 75);
|
||||
this.listView1.TabIndex = 2;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
|
||||
//
|
||||
// columnHeaderModule
|
||||
//
|
||||
this.columnHeaderModule.Text = "Module";
|
||||
this.columnHeaderModule.Width = 190;
|
||||
//
|
||||
// columnHeaderSensor
|
||||
//
|
||||
this.columnHeaderSensor.Text = "Sensor";
|
||||
this.columnHeaderSensor.Width = 200;
|
||||
//
|
||||
// buttonModules
|
||||
//
|
||||
this.buttonModules.Location = new System.Drawing.Point(10, 19);
|
||||
this.buttonModules.Name = "buttonModules";
|
||||
this.buttonModules.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonModules.TabIndex = 0;
|
||||
this.buttonModules.Text = "Modules";
|
||||
this.buttonModules.UseVisualStyleBackColor = true;
|
||||
this.buttonModules.Click += new System.EventHandler(this.buttonModules_Click);
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.buttonTermiate);
|
||||
this.tabPage3.Controls.Add(this.textBoxMethodSampleId);
|
||||
this.tabPage3.Controls.Add(this.textBoxMethodInstruction);
|
||||
this.tabPage3.Controls.Add(this.buttonStartMethod);
|
||||
this.tabPage3.Controls.Add(this.listboxListOfMethods);
|
||||
this.tabPage3.Controls.Add(this.buttonMethods);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage3.Size = new System.Drawing.Size(603, 279);
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "Methods";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonTermiate
|
||||
//
|
||||
this.buttonTermiate.Location = new System.Drawing.Point(11, 197);
|
||||
this.buttonTermiate.Name = "buttonTermiate";
|
||||
this.buttonTermiate.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonTermiate.TabIndex = 5;
|
||||
this.buttonTermiate.Text = "Terminate";
|
||||
this.buttonTermiate.UseVisualStyleBackColor = true;
|
||||
this.buttonTermiate.Click += new System.EventHandler(this.buttonTermiate_Click);
|
||||
//
|
||||
// textBoxMethodSampleId
|
||||
//
|
||||
this.textBoxMethodSampleId.Location = new System.Drawing.Point(181, 131);
|
||||
this.textBoxMethodSampleId.Name = "textBoxMethodSampleId";
|
||||
this.textBoxMethodSampleId.Size = new System.Drawing.Size(405, 20);
|
||||
this.textBoxMethodSampleId.TabIndex = 4;
|
||||
//
|
||||
// textBoxMethodInstruction
|
||||
//
|
||||
this.textBoxMethodInstruction.Location = new System.Drawing.Point(181, 157);
|
||||
this.textBoxMethodInstruction.Name = "textBoxMethodInstruction";
|
||||
this.textBoxMethodInstruction.Size = new System.Drawing.Size(405, 20);
|
||||
this.textBoxMethodInstruction.TabIndex = 3;
|
||||
//
|
||||
// buttonStartMethod
|
||||
//
|
||||
this.buttonStartMethod.Location = new System.Drawing.Point(10, 129);
|
||||
this.buttonStartMethod.Name = "buttonStartMethod";
|
||||
this.buttonStartMethod.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonStartMethod.TabIndex = 2;
|
||||
this.buttonStartMethod.Text = "Start Method";
|
||||
this.buttonStartMethod.UseVisualStyleBackColor = true;
|
||||
this.buttonStartMethod.Click += new System.EventHandler(this.buttonStartMethod_Click);
|
||||
//
|
||||
// listboxListOfMethods
|
||||
//
|
||||
this.listboxListOfMethods.FormattingEnabled = true;
|
||||
this.listboxListOfMethods.Location = new System.Drawing.Point(91, 17);
|
||||
this.listboxListOfMethods.Name = "listboxListOfMethods";
|
||||
this.listboxListOfMethods.Size = new System.Drawing.Size(495, 95);
|
||||
this.listboxListOfMethods.TabIndex = 1;
|
||||
//
|
||||
// buttonMethods
|
||||
//
|
||||
this.buttonMethods.Location = new System.Drawing.Point(10, 18);
|
||||
this.buttonMethods.Name = "buttonMethods";
|
||||
this.buttonMethods.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonMethods.TabIndex = 0;
|
||||
this.buttonMethods.Text = "Methods";
|
||||
this.buttonMethods.UseVisualStyleBackColor = true;
|
||||
this.buttonMethods.Click += new System.EventHandler(this.buttonMethods_Click);
|
||||
//
|
||||
// tabPage4
|
||||
//
|
||||
this.tabPage4.Controls.Add(this.textBoxSettingValue);
|
||||
this.tabPage4.Controls.Add(this.comboBoxSettingTag);
|
||||
this.tabPage4.Controls.Add(this.buttonSetupSetting);
|
||||
this.tabPage4.Controls.Add(this.listViewSettings);
|
||||
this.tabPage4.Controls.Add(this.buttonRequestSetupItemList);
|
||||
this.tabPage4.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage4.Name = "tabPage4";
|
||||
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage4.Size = new System.Drawing.Size(603, 279);
|
||||
this.tabPage4.TabIndex = 3;
|
||||
this.tabPage4.Text = "Settings";
|
||||
this.tabPage4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBoxSettingValue
|
||||
//
|
||||
this.textBoxSettingValue.Location = new System.Drawing.Point(340, 222);
|
||||
this.textBoxSettingValue.Name = "textBoxSettingValue";
|
||||
this.textBoxSettingValue.Size = new System.Drawing.Size(226, 20);
|
||||
this.textBoxSettingValue.TabIndex = 4;
|
||||
//
|
||||
// comboBoxSettingTag
|
||||
//
|
||||
this.comboBoxSettingTag.FormattingEnabled = true;
|
||||
this.comboBoxSettingTag.Location = new System.Drawing.Point(118, 222);
|
||||
this.comboBoxSettingTag.Name = "comboBoxSettingTag";
|
||||
this.comboBoxSettingTag.Size = new System.Drawing.Size(216, 21);
|
||||
this.comboBoxSettingTag.TabIndex = 3;
|
||||
//
|
||||
// buttonSetupSetting
|
||||
//
|
||||
this.buttonSetupSetting.Location = new System.Drawing.Point(20, 222);
|
||||
this.buttonSetupSetting.Name = "buttonSetupSetting";
|
||||
this.buttonSetupSetting.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonSetupSetting.TabIndex = 2;
|
||||
this.buttonSetupSetting.Text = "Setup";
|
||||
this.buttonSetupSetting.UseVisualStyleBackColor = true;
|
||||
this.buttonSetupSetting.Click += new System.EventHandler(this.buttonSetupSetting_Click);
|
||||
//
|
||||
// listViewSettings
|
||||
//
|
||||
this.listViewSettings.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader3,
|
||||
this.columnHeader4});
|
||||
this.listViewSettings.Location = new System.Drawing.Point(118, 23);
|
||||
this.listViewSettings.Name = "listViewSettings";
|
||||
this.listViewSettings.Size = new System.Drawing.Size(448, 176);
|
||||
this.listViewSettings.TabIndex = 1;
|
||||
this.listViewSettings.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewSettings.View = System.Windows.Forms.View.Details;
|
||||
this.listViewSettings.SelectedIndexChanged += new System.EventHandler(this.listViewSettings_SelectedIndexChanged);
|
||||
//
|
||||
// columnHeader3
|
||||
//
|
||||
this.columnHeader3.Text = "Setting";
|
||||
this.columnHeader3.Width = 304;
|
||||
//
|
||||
// columnHeader4
|
||||
//
|
||||
this.columnHeader4.Text = "Value";
|
||||
this.columnHeader4.Width = 125;
|
||||
//
|
||||
// buttonRequestSetupItemList
|
||||
//
|
||||
this.buttonRequestSetupItemList.Location = new System.Drawing.Point(20, 23);
|
||||
this.buttonRequestSetupItemList.Name = "buttonRequestSetupItemList";
|
||||
this.buttonRequestSetupItemList.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonRequestSetupItemList.TabIndex = 0;
|
||||
this.buttonRequestSetupItemList.Text = "List";
|
||||
this.buttonRequestSetupItemList.UseVisualStyleBackColor = true;
|
||||
this.buttonRequestSetupItemList.Click += new System.EventHandler(this.buttonRequestSetupItemListt_Click);
|
||||
//
|
||||
// tabPage5
|
||||
//
|
||||
this.tabPage5.Controls.Add(this.buttonImport);
|
||||
this.tabPage5.Controls.Add(this.buttonExport);
|
||||
this.tabPage5.Controls.Add(this.comboBox2);
|
||||
this.tabPage5.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage5.Name = "tabPage5";
|
||||
this.tabPage5.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage5.Size = new System.Drawing.Size(603, 279);
|
||||
this.tabPage5.TabIndex = 4;
|
||||
this.tabPage5.Text = "Import/Export";
|
||||
this.tabPage5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonImport
|
||||
//
|
||||
this.buttonImport.Location = new System.Drawing.Point(206, 91);
|
||||
this.buttonImport.Name = "buttonImport";
|
||||
this.buttonImport.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonImport.TabIndex = 3;
|
||||
this.buttonImport.Text = "Import...";
|
||||
this.buttonImport.UseVisualStyleBackColor = true;
|
||||
this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click);
|
||||
//
|
||||
// buttonExport
|
||||
//
|
||||
this.buttonExport.Location = new System.Drawing.Point(206, 45);
|
||||
this.buttonExport.Name = "buttonExport";
|
||||
this.buttonExport.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonExport.TabIndex = 2;
|
||||
this.buttonExport.Text = "Export...";
|
||||
this.buttonExport.UseVisualStyleBackColor = true;
|
||||
this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click);
|
||||
//
|
||||
// comboBox2
|
||||
//
|
||||
this.comboBox2.FormattingEnabled = true;
|
||||
this.comboBox2.Location = new System.Drawing.Point(61, 47);
|
||||
this.comboBox2.Name = "comboBox2";
|
||||
this.comboBox2.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBox2.TabIndex = 1;
|
||||
//
|
||||
// tabPage6
|
||||
//
|
||||
this.tabPage6.Controls.Add(this.buttonLoginCancel);
|
||||
this.tabPage6.Controls.Add(this.checkBoxProposedUsers);
|
||||
this.tabPage6.Controls.Add(this.textBoxUsernameList);
|
||||
this.tabPage6.Controls.Add(this.label2);
|
||||
this.tabPage6.Controls.Add(this.label1);
|
||||
this.tabPage6.Controls.Add(this.textBoxPassword);
|
||||
this.tabPage6.Controls.Add(this.textBoxUsername);
|
||||
this.tabPage6.Controls.Add(this.buttonLogin);
|
||||
this.tabPage6.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage6.Name = "tabPage6";
|
||||
this.tabPage6.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage6.Size = new System.Drawing.Size(603, 279);
|
||||
this.tabPage6.TabIndex = 5;
|
||||
this.tabPage6.Text = "Login";
|
||||
this.tabPage6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonLoginCancel
|
||||
//
|
||||
this.buttonLoginCancel.Location = new System.Drawing.Point(34, 209);
|
||||
this.buttonLoginCancel.Name = "buttonLoginCancel";
|
||||
this.buttonLoginCancel.Size = new System.Drawing.Size(75, 24);
|
||||
this.buttonLoginCancel.TabIndex = 7;
|
||||
this.buttonLoginCancel.Text = "Cancel";
|
||||
this.buttonLoginCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonLoginCancel.Click += new System.EventHandler(this.buttonLoginCancel_Click);
|
||||
//
|
||||
// checkBoxProposedUsers
|
||||
//
|
||||
this.checkBoxProposedUsers.AutoSize = true;
|
||||
this.checkBoxProposedUsers.Location = new System.Drawing.Point(34, 22);
|
||||
this.checkBoxProposedUsers.Name = "checkBoxProposedUsers";
|
||||
this.checkBoxProposedUsers.Size = new System.Drawing.Size(96, 17);
|
||||
this.checkBoxProposedUsers.TabIndex = 6;
|
||||
this.checkBoxProposedUsers.Text = "Proposed User";
|
||||
this.checkBoxProposedUsers.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBoxUsernameList
|
||||
//
|
||||
this.textBoxUsernameList.Location = new System.Drawing.Point(34, 45);
|
||||
this.textBoxUsernameList.Name = "textBoxUsernameList";
|
||||
this.textBoxUsernameList.Size = new System.Drawing.Size(547, 20);
|
||||
this.textBoxUsernameList.TabIndex = 5;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(31, 169);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(53, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Password";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(31, 132);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(55, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Username";
|
||||
//
|
||||
// textBoxPassword
|
||||
//
|
||||
this.textBoxPassword.Location = new System.Drawing.Point(123, 162);
|
||||
this.textBoxPassword.Name = "textBoxPassword";
|
||||
this.textBoxPassword.Size = new System.Drawing.Size(154, 20);
|
||||
this.textBoxPassword.TabIndex = 2;
|
||||
//
|
||||
// textBoxUsername
|
||||
//
|
||||
this.textBoxUsername.Location = new System.Drawing.Point(123, 125);
|
||||
this.textBoxUsername.Name = "textBoxUsername";
|
||||
this.textBoxUsername.Size = new System.Drawing.Size(154, 20);
|
||||
this.textBoxUsername.TabIndex = 1;
|
||||
//
|
||||
// buttonLogin
|
||||
//
|
||||
this.buttonLogin.Location = new System.Drawing.Point(34, 76);
|
||||
this.buttonLogin.Name = "buttonLogin";
|
||||
this.buttonLogin.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonLogin.TabIndex = 0;
|
||||
this.buttonLogin.Text = "Login";
|
||||
this.buttonLogin.UseVisualStyleBackColor = true;
|
||||
this.buttonLogin.Click += new System.EventHandler(this.buttonLogin_Click);
|
||||
//
|
||||
// listviewLog
|
||||
//
|
||||
this.listviewLog.AllowColumnReorder = true;
|
||||
this.listviewLog.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.listviewLog.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeaderTime,
|
||||
this.columnHeaderLog});
|
||||
this.listviewLog.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listviewLog.FullRowSelect = true;
|
||||
this.listviewLog.GridLines = true;
|
||||
this.listviewLog.Location = new System.Drawing.Point(0, 0);
|
||||
this.listviewLog.Name = "listviewLog";
|
||||
this.listviewLog.Size = new System.Drawing.Size(611, 161);
|
||||
this.listviewLog.TabIndex = 0;
|
||||
this.listviewLog.UseCompatibleStateImageBehavior = false;
|
||||
this.listviewLog.View = System.Windows.Forms.View.Details;
|
||||
this.listviewLog.DoubleClick += new System.EventHandler(this.listviewLog_DoubleClick);
|
||||
this.listviewLog.Resize += new System.EventHandler(this.listviewLog_Resize);
|
||||
//
|
||||
// columnHeaderTime
|
||||
//
|
||||
this.columnHeaderTime.Text = "Time";
|
||||
//
|
||||
// columnHeaderLog
|
||||
//
|
||||
this.columnHeaderLog.Text = "Log";
|
||||
this.columnHeaderLog.Width = 508;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItem1});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(611, 24);
|
||||
this.menuStrip1.TabIndex = 5;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(52, 20);
|
||||
this.toolStripMenuItem1.Text = "About";
|
||||
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(611, 495);
|
||||
this.Controls.Add(this.splitContainer);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "FormMain";
|
||||
this.Text = "SE Cockpit";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormMain_FormClose);
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
this.ResizeEnd += new System.EventHandler(this.FormMain_ResizeEnd);
|
||||
this.splitContainer.Panel1.ResumeLayout(false);
|
||||
this.splitContainer.Panel1.PerformLayout();
|
||||
this.splitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
|
||||
this.splitContainer.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.tabCockpit.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage1.PerformLayout();
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.tabPage3.PerformLayout();
|
||||
this.tabPage4.ResumeLayout(false);
|
||||
this.tabPage4.PerformLayout();
|
||||
this.tabPage5.ResumeLayout(false);
|
||||
this.tabPage6.ResumeLayout(false);
|
||||
this.tabPage6.PerformLayout();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.SplitContainer splitContainer;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.TabControl tabCockpit;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.TabPage tabPage3;
|
||||
private System.Windows.Forms.TabPage tabPage4;
|
||||
private System.Windows.Forms.ListView listviewLog;
|
||||
private System.Windows.Forms.Button buttonGetState;
|
||||
private System.Windows.Forms.Button buttonDetach;
|
||||
private System.Windows.Forms.Button buttonAttach;
|
||||
private System.Windows.Forms.Button buttonDisconnect;
|
||||
private System.Windows.Forms.Button buttonConnect;
|
||||
private System.Windows.Forms.Button buttonModules;
|
||||
private System.Windows.Forms.Button buttonStartMethod;
|
||||
private System.Windows.Forms.ListBox listboxListOfMethods;
|
||||
private System.Windows.Forms.Button buttonMethods;
|
||||
private System.Windows.Forms.TextBox textBoxState;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderTime;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderLog;
|
||||
private System.Windows.Forms.ListView listView1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderModule;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderSensor;
|
||||
private System.Windows.Forms.TextBox textBoxMethodInstruction;
|
||||
private System.Windows.Forms.TextBox textBoxMethodSampleId;
|
||||
private System.Windows.Forms.ListView listView2;
|
||||
private System.Windows.Forms.ColumnHeader columnSensor;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
private System.Windows.Forms.Button buttonSensors;
|
||||
private System.Windows.Forms.Button buttonConnectSensorToModule;
|
||||
private System.Windows.Forms.Button buttonTermiate;
|
||||
private System.Windows.Forms.TabPage tabPage5;
|
||||
private System.Windows.Forms.Button buttonExport;
|
||||
private System.Windows.Forms.ComboBox comboBox2;
|
||||
private System.Windows.Forms.Button buttonImport;
|
||||
private System.Windows.Forms.ComboBox comboBoxSensor;
|
||||
private System.Windows.Forms.ComboBox comboBoxModule;
|
||||
private System.Windows.Forms.Button buttonRequestSetupItemList;
|
||||
private System.Windows.Forms.ListView listViewSettings;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader3;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader4;
|
||||
private System.Windows.Forms.TabPage tabPage6;
|
||||
private System.Windows.Forms.Button buttonLogin;
|
||||
private System.Windows.Forms.Button buttonClearLog;
|
||||
private System.Windows.Forms.ComboBox comboBoxSevenExcellence;
|
||||
private System.Windows.Forms.Button buttonLoginCancel;
|
||||
private System.Windows.Forms.CheckBox checkBoxProposedUsers;
|
||||
private System.Windows.Forms.TextBox textBoxUsernameList;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox textBoxPassword;
|
||||
private System.Windows.Forms.TextBox textBoxUsername;
|
||||
private System.Windows.Forms.Button buttonSetupSetting;
|
||||
private System.Windows.Forms.TextBox textBoxSettingValue;
|
||||
private System.Windows.Forms.ComboBox comboBoxSettingTag;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
616
SERemoteControl/FormMain.cs
Normal file
616
SERemoteControl/FormMain.cs
Normal file
@ -0,0 +1,616 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using log4net.Appender;
|
||||
using MT.Platform.Common;
|
||||
using SERemoteLib;
|
||||
using Services.NotificationBroker.Notifications;
|
||||
|
||||
namespace SERemoteControl
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private SERemoteConnection.SEClient m_client;
|
||||
private SERemoteConnection.SEConnection m_connection;
|
||||
|
||||
/// <summary>
|
||||
/// Make use of logging infrastructure.
|
||||
/// </summary>
|
||||
private static readonly ILog _logger = LogManager.GetLogger(typeof(FormMain));
|
||||
|
||||
/// <summary>
|
||||
/// This logger property is used to log events
|
||||
/// </summary>
|
||||
public static ILog Logger
|
||||
{
|
||||
get { return _logger; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marshal calls back to the UI thread. Do not access UI controls from background threads (e.g. callback operation calls!)
|
||||
/// </summary>
|
||||
private readonly SynchronizationContext uiSynchronizationContext;
|
||||
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
uiSynchronizationContext = SynchronizationContext.Current;
|
||||
|
||||
//((log4net.Repository.Hierarchy.Hierarchy)log4net.LogManager.GetRepository()).Root.AddAppender(this);
|
||||
|
||||
// register a notification handler to log
|
||||
NotificationBroker.Register(typeof(LogWrittenNotification), (object thesender, Notification notification) =>
|
||||
{
|
||||
LogWrittenNotification logNotification = notification as LogWrittenNotification;
|
||||
|
||||
// only write on UI thread!
|
||||
uiSynchronizationContext.Send((object state) =>
|
||||
{
|
||||
Log(state as string);
|
||||
}, logNotification.Text);
|
||||
}, null);
|
||||
|
||||
|
||||
this.comboBox2.DataSource = Enum.GetValues(typeof(SERemoteConnection.EItemType));
|
||||
|
||||
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
this.Text = String.Format("Mettler Toledo - SE Cockpit V{0}", version);
|
||||
|
||||
EnableTabAndControls(false);
|
||||
}
|
||||
|
||||
public void EnableTabAndControls( bool enable )
|
||||
{
|
||||
EnableTab(tabPage2, enable);
|
||||
EnableTab(tabPage3, enable);
|
||||
EnableTab(tabPage4, enable);
|
||||
EnableTab(tabPage5, enable);
|
||||
EnableTab(tabPage6, enable);
|
||||
buttonConnect.Enabled= !enable;
|
||||
buttonDetach.Enabled= enable;
|
||||
buttonGetState.Enabled = enable;
|
||||
buttonAttach.Enabled= enable;
|
||||
buttonDisconnect.Enabled= enable;
|
||||
}
|
||||
|
||||
public static void EnableTab(TabPage page, bool enable)
|
||||
{
|
||||
foreach (Control ctl in page.Controls) ctl.Enabled = enable;
|
||||
}
|
||||
|
||||
private void buttonConnect_Click(object sender, EventArgs e)
|
||||
{
|
||||
m_connection = new SERemoteConnection.SEConnection();
|
||||
|
||||
string address = this.comboBoxSevenExcellence.Text;
|
||||
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri(address);
|
||||
|
||||
if (m_connection.Open(uri.Host, uri.Port))
|
||||
{
|
||||
m_client = new SERemoteConnection.SEClient(m_connection);
|
||||
|
||||
EnableTabAndControls(true);
|
||||
|
||||
if (this.comboBoxSevenExcellence.FindString(address) == -1)
|
||||
{
|
||||
this.comboBoxSevenExcellence.Items.Add(address);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch( UriFormatException )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonAttach_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client!=null)
|
||||
m_client.Attach();
|
||||
}
|
||||
|
||||
private void buttonDetach_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
m_client.Detach();
|
||||
}
|
||||
|
||||
private void buttonDisconnect_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
m_connection.Close();
|
||||
EnableTabAndControls(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonGetState_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
textBoxState.Text = m_client.GetStatus();
|
||||
}
|
||||
|
||||
private void buttonStartMethod_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
int index= this.listboxListOfMethods.SelectedIndex;
|
||||
if (index>=0)
|
||||
{
|
||||
string methodId= this.listboxListOfMethods.SelectedItem.ToString();
|
||||
string comment= this.textBoxMethodInstruction.Text;
|
||||
string sampleId = this.textBoxMethodSampleId.Text;
|
||||
m_client.startMethod(methodId, sampleId, comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void buttonTermiate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
m_client.terminateMethod();
|
||||
}
|
||||
}
|
||||
|
||||
private void LogUI(string text)
|
||||
{
|
||||
// make sure we are on UI thread
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
throw new InvalidOperationException("must only be called on UI thread!");
|
||||
}
|
||||
|
||||
// log to list view
|
||||
ListViewItem item = listviewLog.Items.Add(new ListViewItem(new string[] { DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss.fff", CultureInfo.InvariantCulture), text }));
|
||||
item.EnsureVisible();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write to list view log and scroll automatically.
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void Log(string text)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
// switch to UI thread, because call came from bg thread
|
||||
this.uiSynchronizationContext.Send((state) => { LogUI(text); }, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogUI(text);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonMethods_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
this.listboxListOfMethods.Items.Clear();
|
||||
string[] methods = m_client.getListOfMethods();
|
||||
if (methods!=null)
|
||||
this.listboxListOfMethods.Items.AddRange(methods);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonModules_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
this.listView1.Items.Clear();
|
||||
this.comboBoxModule.Items.Clear();
|
||||
|
||||
MT.pHLab.SE.V1.moduleConfigParamRecord[] modules = m_client.getListOfModules();
|
||||
|
||||
if (modules!=null)
|
||||
{
|
||||
foreach (MT.pHLab.SE.V1.moduleConfigParamRecord module in modules)
|
||||
{
|
||||
ListViewItem item = new ListViewItem(module.m_moduleId);
|
||||
item.SubItems.Add(module.m_sensorId);
|
||||
item.SubItems.Add(module.m_tempSensorId);
|
||||
this.listView1.Items.Add(item);
|
||||
this.comboBoxModule.Items.Add(module.m_moduleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonConnectSensor_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
this.listView2.Items.Clear();
|
||||
this.comboBoxSensor.Items.Clear();
|
||||
|
||||
this.listboxListOfMethods.Items.Clear();
|
||||
string[] sensors = m_client.getListOfSensors();
|
||||
|
||||
foreach (string sensor in sensors)
|
||||
{
|
||||
ListViewItem item = new ListViewItem(sensor);
|
||||
// item.SubItems.Add(sensor);
|
||||
this.listView2.Items.Add(item);
|
||||
this.comboBoxSensor.Items.Add(sensor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonConnectSensorToModule_Click(object sender, EventArgs e)
|
||||
{
|
||||
string sensorId = this.comboBoxSensor.Text;
|
||||
string moduleId = this.comboBoxModule.Text;
|
||||
|
||||
if (m_client != null && moduleId != null && sensorId != null)
|
||||
{
|
||||
m_client.setModule(moduleId, sensorId);
|
||||
buttonModules_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
SERemoteConnection.EItemType eItemType = (SERemoteConnection.EItemType)Enum.Parse(typeof(SERemoteConnection.EItemType), this.comboBox2.SelectedValue.ToString());
|
||||
|
||||
Byte[] table= null;
|
||||
table= m_client.exportTable(eItemType);
|
||||
|
||||
if (table != null)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
|
||||
saveFileDialog.FileName = "Export-" + eItemType.ToString() + "-" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
||||
// the filter box and no extension is specified by the user.
|
||||
saveFileDialog.DefaultExt = "xml";
|
||||
saveFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
|
||||
saveFileDialog.FilterIndex = 1;
|
||||
saveFileDialog.RestoreDirectory = true;
|
||||
saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Stream myStream;
|
||||
if ((myStream = saveFileDialog.OpenFile()) != null)
|
||||
{
|
||||
using (BinaryWriter writer = new BinaryWriter(myStream, Encoding.UTF8))
|
||||
{
|
||||
writer.Write(table);
|
||||
}
|
||||
myStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
Stream myStream = null;
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
|
||||
openFileDialog.InitialDirectory = "c:\\";
|
||||
openFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
|
||||
openFileDialog.FilterIndex = 1;
|
||||
openFileDialog.RestoreDirectory = true;
|
||||
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((myStream = openFileDialog.OpenFile()) != null)
|
||||
{
|
||||
using (myStream)
|
||||
{
|
||||
// Insert code to read the stream here.
|
||||
byte[] table= ReadToEnd(myStream);
|
||||
if (table != null)
|
||||
{
|
||||
m_client.importTable(table);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] ReadToEnd(System.IO.Stream stream)
|
||||
{
|
||||
long originalPosition = 0;
|
||||
|
||||
if (stream.CanSeek)
|
||||
{
|
||||
originalPosition = stream.Position;
|
||||
stream.Position = 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
byte[] readBuffer = new byte[4096];
|
||||
|
||||
int totalBytesRead = 0;
|
||||
int bytesRead;
|
||||
|
||||
while ((bytesRead = stream.Read(readBuffer, totalBytesRead, readBuffer.Length - totalBytesRead)) > 0)
|
||||
{
|
||||
totalBytesRead += bytesRead;
|
||||
|
||||
if (totalBytesRead == readBuffer.Length)
|
||||
{
|
||||
int nextByte = stream.ReadByte();
|
||||
if (nextByte != -1)
|
||||
{
|
||||
byte[] temp = new byte[readBuffer.Length * 2];
|
||||
Buffer.BlockCopy(readBuffer, 0, temp, 0, readBuffer.Length);
|
||||
Buffer.SetByte(temp, totalBytesRead, (byte)nextByte);
|
||||
readBuffer = temp;
|
||||
totalBytesRead++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
byte[] buffer = readBuffer;
|
||||
if (readBuffer.Length != totalBytesRead)
|
||||
{
|
||||
buffer = new byte[totalBytesRead];
|
||||
Buffer.BlockCopy(readBuffer, 0, buffer, 0, totalBytesRead);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (stream.CanSeek)
|
||||
{
|
||||
stream.Position = originalPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string moduleId = this.listView1.SelectedItems[0].Text;
|
||||
|
||||
if (moduleId != null)
|
||||
{
|
||||
this.comboBoxModule.SelectedIndex = this.comboBoxModule.FindStringExact(moduleId);
|
||||
}
|
||||
}
|
||||
|
||||
private void listView2_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string sensorId = this.listView2.SelectedItems[0].Text;
|
||||
|
||||
if (sensorId != null)
|
||||
{
|
||||
this.comboBoxSensor.SelectedIndex = this.comboBoxSensor.FindStringExact(sensorId);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRequestSetupItemListt_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client != null)
|
||||
{
|
||||
string[] settingNames = {
|
||||
"UserSetting.guiLanguage",
|
||||
"UserSetting.protocolLanguage",
|
||||
"UserSetting.settingsBrightness",
|
||||
"UserSetting.Beep.buttonBeep",
|
||||
"UserSetting.Beep.userBeep",
|
||||
"UserSetting.Beep.newsBeep",
|
||||
"UserSetting.Beep.errorBeep",
|
||||
"UserSetting.Beep.stabilityBeep",
|
||||
"UserSetting.alphanumericKeyboard",
|
||||
"GlobalSetting.confirmEndOfAnalysis",
|
||||
"GlobalSetting.showRequiredResourcesAtStart",
|
||||
"GlobalSetting.showCalulatedResultsAfterAnalysis",
|
||||
"GlobalSetting.bSuppresPopups",
|
||||
"GlobalSetting.globalTemperatureUnit",
|
||||
"GlobalSetting.globalBarometricPressureUnit",
|
||||
"GlobalSetting.lifeSpanExpireAction",
|
||||
"GlobalSetting.usableLifeExpireAction",
|
||||
"GlobalSetting.DataTime",
|
||||
"GlobalSetting.Identification_ID",
|
||||
//"NetworkSetting.keepAlive"
|
||||
};
|
||||
|
||||
this.comboBoxSettingTag.Items.Clear();
|
||||
|
||||
this.listViewSettings.Items.Clear();
|
||||
|
||||
foreach (string settingName in settingNames)
|
||||
{
|
||||
string value = m_client.getSettings(settingName);
|
||||
|
||||
ListViewItem item = new ListViewItem(settingName);
|
||||
item.SubItems.Add(value);
|
||||
this.listViewSettings.Items.Add(item);
|
||||
|
||||
this.comboBoxSettingTag.Items.Add(settingName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void listViewSettings_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string settingTag = this.listViewSettings.SelectedItems[0].Text;
|
||||
|
||||
if (settingTag != null)
|
||||
{
|
||||
this.comboBoxSettingTag.SelectedIndex = this.comboBoxSettingTag.FindStringExact(settingTag);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSetupSetting_Click(object sender, EventArgs e)
|
||||
{
|
||||
string settingTag = this.comboBoxSettingTag.Text;
|
||||
string settingValue = this.textBoxSettingValue.Text;
|
||||
|
||||
if (m_client != null && settingTag != null && settingValue != null)
|
||||
{
|
||||
m_client.setSettings(settingTag, settingValue);
|
||||
buttonRequestSetupItemListt_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void FormMain_ResizeEnd(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void listviewLog_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
SizeLastColumn((ListView)sender);
|
||||
}
|
||||
|
||||
private void SizeLastColumn(ListView lv)
|
||||
{
|
||||
this.listviewLog.Columns[this.listviewLog.Columns.Count - 1].Width = -2;
|
||||
}
|
||||
|
||||
|
||||
private void listviewLog_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
foreach (ListViewItem item in this.listviewLog.SelectedItems)
|
||||
{
|
||||
MessageBox.Show(item.SubItems[1].Text, item.SubItems[0].Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonClearLog_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void FormMain_FormClose(object sender, EventArgs e)
|
||||
{
|
||||
if (m_connection != null)
|
||||
m_connection.Close();
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (SERemoteControl.Properties.Settings.Default.AddressHistory != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
StringReader sr = new StringReader(SERemoteControl.Properties.Settings.Default.AddressHistory);
|
||||
var adresses = sr.ReadLine().Split(';');
|
||||
this.comboBoxSevenExcellence.Items.AddRange(adresses.ToArray());
|
||||
}
|
||||
catch (System.NullReferenceException)
|
||||
{
|
||||
this.comboBoxSevenExcellence.Items.Add("http://localhost:8016");
|
||||
this.comboBoxSevenExcellence.Items.Add("http://localhost:8014");
|
||||
}
|
||||
|
||||
string address= SERemoteControl.Properties.Settings.Default.CurrentAddress;
|
||||
int index= this.comboBoxSevenExcellence.FindString(address);
|
||||
if ( index!= -1)
|
||||
{
|
||||
this.comboBoxSevenExcellence.SelectedIndex= index;
|
||||
}
|
||||
}
|
||||
|
||||
this.textBoxUsernameList.Text= "Thomas;Xufeng;Toni;Max";
|
||||
}
|
||||
|
||||
private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (SERemoteControl.Properties.Settings.Default.AddressHistory != null)
|
||||
{
|
||||
|
||||
var list= new List<string>();
|
||||
{
|
||||
foreach (var item in this.comboBoxSevenExcellence.Items)
|
||||
{
|
||||
list.Add(item.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
SERemoteControl.Properties.Settings.Default.CurrentAddress = this.comboBoxSevenExcellence.Text;
|
||||
SERemoteControl.Properties.Settings.Default.AddressHistory = string.Join(";", list.ToArray());
|
||||
|
||||
SERemoteControl.Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct LoginRequestResult
|
||||
{
|
||||
public string username;
|
||||
public string password;
|
||||
}
|
||||
|
||||
LoginRequestResult LoginRequest()
|
||||
{
|
||||
string[] usernamelist = null;
|
||||
if (this.checkBoxProposedUsers.Checked)
|
||||
{
|
||||
StringReader sr = new StringReader(this.textBoxUsernameList.Text);
|
||||
usernamelist = sr.ReadLine().Split(';');
|
||||
}
|
||||
|
||||
LoginRequestResult result;
|
||||
result.username= "";
|
||||
result.password= "";
|
||||
|
||||
if (m_client.showScreenLogin(usernamelist, ref result.username, ref result.password))
|
||||
{
|
||||
//
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private async void buttonLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
Task<LoginRequestResult> returnedTask = Task.Run(() => LoginRequest());
|
||||
|
||||
LoginRequestResult result= await returnedTask;
|
||||
|
||||
this.textBoxUsername.Text = result.username;
|
||||
this.textBoxPassword.Text = result.password;
|
||||
}
|
||||
|
||||
|
||||
private void buttonLoginCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (m_client.showScreenLoginCancel() )
|
||||
{
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
AboutBox about= new AboutBox();
|
||||
about.ShowDialog();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
1648
SERemoteControl/FormMain.resx
Normal file
1648
SERemoteControl/FormMain.resx
Normal file
File diff suppressed because it is too large
Load Diff
16
SERemoteControl/LogWrittenEventArgs.cs
Normal file
16
SERemoteControl/LogWrittenEventArgs.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Event argument passing logging text.
|
||||
/// </summary>
|
||||
public class LogWrittenEventArgs : EventArgs
|
||||
{
|
||||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
}
|
22
SERemoteControl/Program.cs
Normal file
22
SERemoteControl/Program.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SERemoteControl
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormMain());
|
||||
}
|
||||
}
|
||||
}
|
37
SERemoteControl/Properties/AssemblyInfo.cs
Normal file
37
SERemoteControl/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SERemoteControl")]
|
||||
[assembly: AssemblyDescription("SevenExcellence Remote Control\r\nSevenExcellence™ is the modular benchtop meter for precise analysis of pH, conductivity, dissolved oxygen and ions, and stands for unmatched compliance and efficiency. Automate your pH analysis with innovative remote control functionalities.\r\nSevenExcellence was built on Lance Platform")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Mettler Toledo Gmbh")]
|
||||
[assembly: AssemblyProduct("SERemoteControl")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("cc4759d9-332e-4d51-a4ec-bd004486aaf9")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.9.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.9.0.0")]
|
||||
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
|
BIN
SERemoteControl/Properties/Icon1.ico
Normal file
BIN
SERemoteControl/Properties/Icon1.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 89 KiB |
83
SERemoteControl/Properties/Resources.Designer.cs
generated
Normal file
83
SERemoteControl/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,83 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SERemoteControl.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SERemoteControl.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon Icon1 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Icon1", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap SevenExcellence {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("SevenExcellence", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
127
SERemoteControl/Properties/Resources.resx
Normal file
127
SERemoteControl/Properties/Resources.resx
Normal file
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Icon1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>icon1.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SevenExcellence" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\SevenExcellence.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
50
SERemoteControl/Properties/Settings.Designer.cs
generated
Normal file
50
SERemoteControl/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,50 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SERemoteControl.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://192.168.1.101:8088;")]
|
||||
public string AddressHistory {
|
||||
get {
|
||||
return ((string)(this["AddressHistory"]));
|
||||
}
|
||||
set {
|
||||
this["AddressHistory"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string CurrentAddress {
|
||||
get {
|
||||
return ((string)(this["CurrentAddress"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentAddress"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
SERemoteControl/Properties/Settings.settings
Normal file
12
SERemoteControl/Properties/Settings.settings
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="SERemoteControl.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="AddressHistory" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">http://192.168.1.101:8088;</Value>
|
||||
</Setting>
|
||||
<Setting Name="CurrentAddress" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
73
SERemoteControl/Properties/app.manifest
Normal file
73
SERemoteControl/Properties/app.manifest
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC 清单选项
|
||||
如果想要更改 Windows 用户帐户控制级别,请使用
|
||||
以下节点之一替换 requestedExecutionLevel 节点。
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
|
||||
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
|
||||
元素。
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
|
||||
Windows 版本的列表。取消评论适当的元素,
|
||||
Windows 将自动选择最兼容的环境。 -->
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
|
||||
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
|
||||
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
|
||||
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
|
||||
|
||||
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
177
SERemoteControl/SERemoteControl.csproj
Normal file
177
SERemoteControl/SERemoteControl.csproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{038E7505-59C6-4800-B91B-97A432233BF1}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SERemoteControl</RootNamespace>
|
||||
<AssemblyName>SERemoteControl</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>\\Ch03sf003\mtpdk%24\publish\SERemoteControl\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Unc</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.htm</WebPage>
|
||||
<ApplicationRevision>2</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>0267358EC216934A81E085AF36477DC499C5AE1B</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>SERemoteControl_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.3.0.3-preview.1\lib\net462\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AboutBox.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AboutBox.Designer.cs">
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FormMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormMain.Designer.cs">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LogWrittenEventArgs.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<EmbeddedResource Include="AboutBox.resx">
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FormMain.resx">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SEClient\SEClient.csproj">
|
||||
<Project>{5222f720-4e4f-4932-b01d-e4b8dbd8cc5f}</Project>
|
||||
<Name>SEClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SERemoteControl_TemporaryKey.pfx" />
|
||||
<None Include="SevenExcellence.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\Icon1.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
BIN
SERemoteControl/SERemoteControl_TemporaryKey.pfx
Normal file
BIN
SERemoteControl/SERemoteControl_TemporaryKey.pfx
Normal file
Binary file not shown.
28
SERemoteControl/Settings.cs
Normal file
28
SERemoteControl/Settings.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace SERemoteControl.Properties {
|
||||
|
||||
|
||||
// This class allows you to handle specific events on the settings class:
|
||||
// The SettingChanging event is raised before a setting's value is changed.
|
||||
// The PropertyChanged event is raised after a setting's value is changed.
|
||||
// The SettingsLoaded event is raised after the setting values are loaded.
|
||||
// The SettingsSaving event is raised before the setting values are saved.
|
||||
internal sealed partial class Settings {
|
||||
|
||||
public Settings() {
|
||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
||||
//
|
||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
||||
//
|
||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
||||
//
|
||||
}
|
||||
|
||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
||||
// Add code to handle the SettingChangingEvent event here.
|
||||
}
|
||||
|
||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
// Add code to handle the SettingsSaving event here.
|
||||
}
|
||||
}
|
||||
}
|
BIN
SERemoteControl/SevenExcellence.png
Normal file
BIN
SERemoteControl/SevenExcellence.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
21
SERemoteControl/bin/Debug/SERemoteControl.exe.config
Normal file
21
SERemoteControl/bin/Debug/SERemoteControl.exe.config
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="SERemoteControl.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<SERemoteControl.Properties.Settings>
|
||||
<setting name="AddressHistory" serializeAs="String">
|
||||
<value>http://192.168.1.101:8088;</value>
|
||||
</setting>
|
||||
<setting name="CurrentAddress" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</SERemoteControl.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
28271
SERemoteControl/bin/Debug/log4net.xml
Normal file
28271
SERemoteControl/bin/Debug/log4net.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
BIN
SERemoteControl/obj/Debug/SERemoteControl.AboutBox.resources
Normal file
BIN
SERemoteControl/obj/Debug/SERemoteControl.AboutBox.resources
Normal file
Binary file not shown.
BIN
SERemoteControl/obj/Debug/SERemoteControl.FormMain.resources
Normal file
BIN
SERemoteControl/obj/Debug/SERemoteControl.FormMain.resources
Normal file
Binary file not shown.
Binary file not shown.
@ -0,0 +1,35 @@
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.csproj.AssemblyReference.cache
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.csproj.SuggestedBindingRedirects.cache
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.AboutBox.resources
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.FormMain.resources
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.Properties.Resources.resources
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.csproj.GenerateResource.cache
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.csproj.CoreCompileInputs.cache
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\bin\Debug\SERemoteControl.exe.config
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\bin\Debug\SERemoteControl.exe
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\bin\Debug\SERemoteControl.pdb
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\bin\Debug\log4net.dll
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\bin\Debug\SERemoteLib.dll
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\bin\Debug\SERemoteLib.pdb
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\bin\Debug\log4net.xml
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.csproj.CopyComplete
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.exe
|
||||
D:\Code\SERemoteControl-master\SERemoteControl-master\SERemoteControl\obj\Debug\SERemoteControl.pdb
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.csproj.AssemblyReference.cache
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.csproj.SuggestedBindingRedirects.cache
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.AboutBox.resources
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.FormMain.resources
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.Properties.Resources.resources
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.csproj.GenerateResource.cache
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.csproj.CoreCompileInputs.cache
|
||||
D:\GitCode\Remote-control\SERemoteControl\bin\Debug\SERemoteControl.exe.config
|
||||
D:\GitCode\Remote-control\SERemoteControl\bin\Debug\SERemoteControl.exe
|
||||
D:\GitCode\Remote-control\SERemoteControl\bin\Debug\SERemoteControl.pdb
|
||||
D:\GitCode\Remote-control\SERemoteControl\bin\Debug\log4net.dll
|
||||
D:\GitCode\Remote-control\SERemoteControl\bin\Debug\SERemoteLib.dll
|
||||
D:\GitCode\Remote-control\SERemoteControl\bin\Debug\SERemoteLib.pdb
|
||||
D:\GitCode\Remote-control\SERemoteControl\bin\Debug\log4net.pdb
|
||||
D:\GitCode\Remote-control\SERemoteControl\bin\Debug\log4net.xml
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.csproj.CopyComplete
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.exe
|
||||
D:\GitCode\Remote-control\SERemoteControl\obj\Debug\SERemoteControl.pdb
|
1
SERemoteControl/obj/Debug/_IsIncrementalBuild
Normal file
1
SERemoteControl/obj/Debug/_IsIncrementalBuild
Normal file
@ -0,0 +1 @@
|
||||
obj\Debug\\_IsIncrementalBuild
|
4
SERemoteControl/packages.config
Normal file
4
SERemoteControl/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="3.0.3-preview.1" targetFramework="net48" />
|
||||
</packages>
|
36
UnitTestProject/Properties/AssemblyInfo.cs
Normal file
36
UnitTestProject/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("UnitTestProject")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UnitTestProject")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("ceaebdda-2557-4402-834f-75815e6ae7a3")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
235
UnitTestProject/UnitTest1.cs
Normal file
235
UnitTestProject/UnitTest1.cs
Normal file
@ -0,0 +1,235 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using MT.pHLab.SE.V1;
|
||||
using SERemoteLib;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace UnitTestProject
|
||||
{
|
||||
internal static class PhInstrumentSerializationHelper
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Tries do deserialize the given xml data to the given type.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// An object of the given type if the data could be deserialized, <c>null</c>
|
||||
/// otherwise.
|
||||
/// </returns>
|
||||
public static T DeserializeDeviceData<T>(this string xml)
|
||||
{
|
||||
object deviceData = null;
|
||||
try
|
||||
{
|
||||
using (TextReader reader = new StringReader(xml))
|
||||
{
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
xmlRoot.Namespace = "tf";
|
||||
xmlRoot.IsNullable = true;
|
||||
|
||||
var serializer = new XmlSerializer(typeof(T), xmlRoot);
|
||||
deviceData = serializer.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
catch (XmlException )
|
||||
{
|
||||
}
|
||||
catch (InvalidOperationException )
|
||||
{
|
||||
}
|
||||
return (T)deviceData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestClass]
|
||||
public class UnitTestResultMessage
|
||||
{
|
||||
[TestMethod]
|
||||
public void Test01()
|
||||
{
|
||||
string telegram = "<IntegerResult xmlns='LancePlatform'><timestamp>2016-02-03T12:29:08.4670</timestamp><value>1</value></IntegerResult>";
|
||||
|
||||
StringReader stringReader = new StringReader(telegram);
|
||||
XmlTextReader reader = new XMLSerializationCustomization.PdkXmlTextReader(stringReader);
|
||||
|
||||
{
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
xmlRoot.Namespace = "tf";
|
||||
xmlRoot.IsNullable = true;
|
||||
|
||||
IntegerResult objResultMessage = new IntegerResult();
|
||||
XmlSerializer xmlser = new XmlSerializer(objResultMessage.GetType(), xmlRoot);
|
||||
objResultMessage = (IntegerResult)xmlser.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test01StringResult()
|
||||
{
|
||||
string telegram = "<StringResult xmlns='LancePlatform'><timestamp>2016-02-04T09:27:32.7300</timestamp><value>Hello world, here I am</value></StringResult>";
|
||||
|
||||
StringReader stringReader = new StringReader(telegram);
|
||||
XmlTextReader reader = new XMLSerializationCustomization.PdkXmlTextReader(stringReader);
|
||||
|
||||
{
|
||||
StringResult objResultMessage = new StringResult();
|
||||
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
xmlRoot.Namespace = "tf";
|
||||
xmlRoot.IsNullable = true;
|
||||
|
||||
XmlSerializer xmlser = new XmlSerializer(objResultMessage.GetType(), xmlRoot);
|
||||
objResultMessage = (StringResult)xmlser.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test01Decfloat()
|
||||
{
|
||||
//string telegram = "<DecimalResult xmlns='LancePlatform'><timestamp>2016-02-04T09:27:32.7300</timestamp><state>eDecimalResultState_Valid</state><value>1.034</value></DecimalResult>";
|
||||
string telegram = "<DecimalResult xmlns='tf'><timestamp>2016-02-04T09:27:32.7300</timestamp><state>0</state><value>1.034</value></DecimalResult>";
|
||||
|
||||
StringReader stringReader = new StringReader(telegram);
|
||||
XmlTextReader reader = new XMLSerializationCustomization.PdkXmlTextReader(stringReader);
|
||||
|
||||
{
|
||||
DecimalResult objResultMessage = new DecimalResult();
|
||||
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
xmlRoot.Namespace = "tf";
|
||||
xmlRoot.IsNullable = true;
|
||||
|
||||
XmlSerializer xmlser = new XmlSerializer(objResultMessage.GetType(), xmlRoot);
|
||||
objResultMessage = (DecimalResult)xmlser.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void Test02_ResultMessage()
|
||||
{
|
||||
//string BAD telegram = "<ResultMessage xmlns='LancePlatform'><rackid></rackid><slotid></slotid><groupid>MeasType1:Measure1</groupid><unit>0</unit><unitstring></unitstring><precision>0</precision><result><ResultPh><rawValue>-235.0</rawValue><rawTemperature>23.4</rawTemperature><temperatureUnit>31</temperatureUnit><resultValue>10.99</resultValue><resultUnit>10</resultUnit><resultQuality>2</resultQuality><resultLimitState>0</resultLimitState><timeStamp>2016-02-04 14:56:54</timeStamp></ResultPh></result></ResultMessage>";
|
||||
//string telegram = "<ResultMessage xmlns='LancePlatform'><rackid></rackid><slotid></slotid><groupid>MeasType1:Measure1</groupid><unit>0</unit><unitstring></unitstring><precision>0</precision><result><DecimalResult><timestamp>2016-02-04T09:27:32.7300</timestamp><state>eDecimalResultState_Valid</state><value>1.034</value></DecimalResult></result></ResultMessage>";
|
||||
// OK string telegram = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?><Telegram xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='LancePlatform'><Notification jobId='2'><ResultMessage><rackid></rackid><slotid></slotid><groupid>TIMESTAMPS</groupid><unit>0</unit><unitstring></unitstring><precision>0</precision><result><IntegerResult><timestamp>2016-02-04T09:27:32.7300</timestamp><value>1</value></IntegerResult></result></ResultMessage></Notification></Telegram>";
|
||||
// OK string telegram = "<ResultMessage xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns='tf'><rackid>A</rackid><slotid>B</slotid><groupid>TIMESTAMPS</groupid><unit>0</unit><unitstring></unitstring><precision>0</precision><result><IntegerResult><timestamp>2016-02-03T12:29:08.4670</timestamp><value>1</value></IntegerResult></result></ResultMessage>";
|
||||
// OK string telegram = "<ResultMessage xmlns='tf'><rackid>A</rackid><slotid>B</slotid><groupid>TIMESTAMPS</groupid><unit>0</unit><unitstring></unitstring><precision>0</precision><result><IntegerResult><timestamp>2016-02-03T12:29:08.4670</timestamp><value>1</value></IntegerResult></result></ResultMessage>";
|
||||
//string telegram = "<ResultMessage><rackid>A</rackid><slotid>B</slotid><groupid>TIMESTAMPS</groupid><unit>0</unit><unitstring></unitstring><precision>0</precision><result><IntegerResult><timestamp>2016-02-03T12:29:08.4670</timestamp><value>1</value></IntegerResult></result></ResultMessage>";
|
||||
string telegram = "<ResultMessage xmlns='tf'><rackid>Hallo</rackid><slotid>Echo</slotid><groupid>MeasType1:Measure1</groupid><unit>0</unit><unitstring></unitstring><precision>0</precision><result><ResultPh><rawValue>174.5</rawValue><rawTemperature>24.5</rawTemperature><temperatureUnit>31</temperatureUnit><resultValue>4.04</resultValue><resultUnit>10</resultUnit><resultQuality>2</resultQuality><resultLimitState>0</resultLimitState><timeStamp>2016-02-05 17:54:07</timeStamp></ResultPh></result></ResultMessage>";
|
||||
|
||||
StringReader stringReader= new StringReader(telegram);
|
||||
XmlTextReader reader = new XMLSerializationCustomization.PdkXmlTextReader(stringReader);
|
||||
|
||||
reader.ReadToFollowing("ResultMessage");
|
||||
|
||||
{
|
||||
ResultMessage objResultMessage = new ResultMessage();
|
||||
|
||||
//var resultMessage = PhInstrumentSerializationHelper.DeserializeDeviceData<ResultMessage>(telegram);
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
xmlRoot.Namespace = "tf";
|
||||
xmlRoot.IsNullable = true;
|
||||
|
||||
XmlSerializer xmlser = new XmlSerializer(typeof(ResultMessage), xmlRoot);
|
||||
objResultMessage = (ResultMessage)xmlser.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test03()
|
||||
{
|
||||
string xmlstring;
|
||||
|
||||
{
|
||||
StringWriter stream = new StringWriter();
|
||||
|
||||
ResultMessage message = new ResultMessage();
|
||||
message.groupid = "GroupId";
|
||||
message.rackid = "RackId";
|
||||
message.slotid = "SlotId";
|
||||
message.result = new TreasureFleetAnyResult();
|
||||
message.result.Item = new DecimalResult();
|
||||
((DecimalResult)message.result.Item).value = 4712.4m;
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(message.GetType());
|
||||
serializer.Serialize(stream, message);
|
||||
|
||||
xmlstring = stream.ToString();
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
StringReader xmlStream = new StringReader(xmlstring);
|
||||
ResultMessage message = new ResultMessage();
|
||||
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
//xmlRoot.Namespace = "tf";
|
||||
xmlRoot.ElementName = "Telegram";
|
||||
xmlRoot.IsNullable = true;
|
||||
|
||||
XmlSerializer xmlser = new XmlSerializer(message.GetType());
|
||||
message = (ResultMessage)xmlser.Deserialize(xmlStream);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test04()
|
||||
{
|
||||
string xmlstring;
|
||||
{
|
||||
StringWriter stream = new StringWriter();
|
||||
|
||||
ResultMessage message = new ResultMessage();
|
||||
message.groupid = "GroupId";
|
||||
message.rackid = "RackId";
|
||||
message.slotid = "SlotId";
|
||||
message.result = new TreasureFleetAnyResult();
|
||||
message.result.Item = new DecimalResult();
|
||||
((DecimalResult)message.result.Item).value = 4712.4m;
|
||||
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
xmlRoot.Namespace = "tf";
|
||||
xmlRoot.IsNullable = true;
|
||||
XmlSerializer serializer = new XmlSerializer(message.GetType(), xmlRoot);
|
||||
serializer.Serialize(stream, message);
|
||||
|
||||
xmlstring = stream.ToString();
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
StringReader xmlStream = new StringReader(xmlstring);
|
||||
ResultMessage message = new ResultMessage();
|
||||
|
||||
XmlRootAttribute xmlRoot = new XmlRootAttribute();
|
||||
xmlRoot.Namespace = "tf";
|
||||
xmlRoot.IsNullable = true;
|
||||
|
||||
XmlSerializer xmlser = new XmlSerializer(message.GetType(), xmlRoot);
|
||||
message = (ResultMessage)xmlser.Deserialize(xmlStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void Test05_Response()
|
||||
{
|
||||
string telegram= "<?xml version='1.0' encoding='utf-8' standalone='yes' ?><Telegram xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='LancePlatform'><Response requestId='0'><record type='Response_setupGetItemListRecord'><param-list><param name='m_itemList' type='sequence' sequenceType='wstring'><item>M001</item><item>M002</item><item>M003</item><item>M004</item><item>M005</item><item>M006</item><item>M007</item><item>M008</item><item>M009</item><item>M010</item><item>M011</item><item>M012</item><item>M013</item><item>M014</item><item>M015</item><item>M016</item><item>M017</item><item>M018</item><item>M019</item><item>M020</item><item>M021</item></param></param-list></record></Response></Telegram>";
|
||||
{
|
||||
XmlReader reader = XmlReader.Create(new StringReader(telegram));
|
||||
MT.pHLab.SE.V1.SEResponse response = MT.pHLab.SE.V1.SEResponse.CreateFromXml(reader);
|
||||
|
||||
if (response.GetRecordType() == typeof(MT.pHLab.SE.V1.Response_setupGetItemListRecord))
|
||||
{
|
||||
var record = new MT.pHLab.SE.V1.Response_setupGetItemListRecord();
|
||||
record.ReadXml(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
95
UnitTestProject/UnitTestProject.csproj
Normal file
95
UnitTestProject/UnitTestProject.csproj
Normal file
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{80352D19-F394-4627-BACE-6AC5FC8BF7F8}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UnitTestProject</RootNamespace>
|
||||
<AssemblyName>UnitTestProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="System.Xml.Serialization" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="UnitTest1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SEClient\SEClient.csproj">
|
||||
<Project>{5222f720-4e4f-4932-b01d-e4b8dbd8cc5f}</Project>
|
||||
<Name>SEClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
BIN
packages/log4net.3.0.3-preview.1/.signature.p7s
vendored
Normal file
BIN
packages/log4net.3.0.3-preview.1/.signature.p7s
vendored
Normal file
Binary file not shown.
31
packages/log4net.3.0.3-preview.1/README.md
vendored
Normal file
31
packages/log4net.3.0.3-preview.1/README.md
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
# log4net
|
||||
[](https://www.nuget.org/packages/log4net)
|
||||
[](https://www.nuget.org/packages/log4net)
|
||||
|
||||
# Introduction
|
||||
|
||||
Apache log4net is a sub project of the Apache Logging Services project.
|
||||
Apache log4net graduated from the Apache Incubator in February 2007.
|
||||
Web site: http://logging.apache.org/log4net
|
||||
|
||||
# Documentation
|
||||
|
||||
For the latest documentation see the log4net web site at:
|
||||
http://logging.apache.org/log4net
|
||||
|
||||
# Contributing
|
||||
|
||||
log4net development happens on [Github](https://github.com/apache/logging-log4net)
|
||||
and on our [mailing list](https://logging.apache.org/support.html).
|
||||
Please join the mailing list and discuss bigger changes before working on them.
|
||||
|
||||
For bigger changes we must ask you to sign a [Contributor License Agreement](http://www.apache.org/licenses/#clas).
|
||||
|
||||
# Developing
|
||||
|
||||
log4net targets net462 and netstandard2.0.
|
||||
|
||||
Please see
|
||||
- [CONTRIBUTING.md](doc/CONTRIBUTING.md)
|
||||
- [BUILDING.md](doc/BUILDING.md)
|
||||
- [RELEASING.md](doc/RELEASING.md)
|
28271
packages/log4net.3.0.3-preview.1/lib/net462/log4net.xml
vendored
Normal file
28271
packages/log4net.3.0.3-preview.1/lib/net462/log4net.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
27591
packages/log4net.3.0.3-preview.1/lib/netstandard2.0/log4net.xml
vendored
Normal file
27591
packages/log4net.3.0.3-preview.1/lib/netstandard2.0/log4net.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/log4net.3.0.3-preview.1/log4net.3.0.3-preview.1.nupkg
vendored
Normal file
BIN
packages/log4net.3.0.3-preview.1/log4net.3.0.3-preview.1.nupkg
vendored
Normal file
Binary file not shown.
BIN
packages/log4net.3.0.3-preview.1/package-icon.png
vendored
Normal file
BIN
packages/log4net.3.0.3-preview.1/package-icon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
Loading…
x
Reference in New Issue
Block a user