initial commit

This commit is contained in:
chi
2025-01-07 16:08:02 +09:00
parent 9e657e2558
commit 0a93a54a6f
268 changed files with 50767 additions and 0 deletions

View File

@@ -0,0 +1,222 @@
namespace Test_NLRF100
{
partial class Form1
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.radRs232 = new System.Windows.Forms.RadioButton();
this.radTcp = new System.Windows.Forms.RadioButton();
this.tbAddr = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btOpen = new System.Windows.Forms.Button();
this.logTextBox1 = new arCtl.LogTextBox();
this.btClose = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// radRs232
//
this.radRs232.AutoSize = true;
this.radRs232.Location = new System.Drawing.Point(21, 17);
this.radRs232.Name = "radRs232";
this.radRs232.Size = new System.Drawing.Size(57, 16);
this.radRs232.TabIndex = 0;
this.radRs232.Text = "RS232";
this.radRs232.UseVisualStyleBackColor = true;
//
// radTcp
//
this.radTcp.AutoSize = true;
this.radTcp.Checked = true;
this.radTcp.Location = new System.Drawing.Point(21, 39);
this.radTcp.Name = "radTcp";
this.radTcp.Size = new System.Drawing.Size(65, 16);
this.radTcp.TabIndex = 0;
this.radTcp.TabStop = true;
this.radTcp.Text = "TCP/IP";
this.radTcp.UseVisualStyleBackColor = true;
//
// tbAddr
//
this.tbAddr.Location = new System.Drawing.Point(93, 34);
this.tbAddr.Name = "tbAddr";
this.tbAddr.Size = new System.Drawing.Size(135, 21);
this.tbAddr.TabIndex = 1;
this.tbAddr.Text = "192.168.1.10";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(91, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 12);
this.label1.TabIndex = 2;
this.label1.Text = "Port / Address";
//
// btOpen
//
this.btOpen.Location = new System.Drawing.Point(250, 14);
this.btOpen.Name = "btOpen";
this.btOpen.Size = new System.Drawing.Size(90, 40);
this.btOpen.TabIndex = 3;
this.btOpen.Text = "Open";
this.btOpen.UseVisualStyleBackColor = true;
this.btOpen.Click += new System.EventHandler(this.btOpen_Click);
//
// logTextBox1
//
this.logTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.logTextBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24)))));
this.logTextBox1.ColorList = new arCtl.sLogMessageColor[0];
this.logTextBox1.DateFormat = "yy-MM-dd HH:mm:ss";
this.logTextBox1.DefaultColor = System.Drawing.Color.LightGray;
this.logTextBox1.EnableDisplayTimer = false;
this.logTextBox1.EnableGubunColor = true;
this.logTextBox1.Font = new System.Drawing.Font("Consolas", 9F);
this.logTextBox1.ListFormat = "[{0}] {1}";
this.logTextBox1.Location = new System.Drawing.Point(17, 66);
this.logTextBox1.MaxListCount = ((ushort)(200));
this.logTextBox1.MaxTextLength = ((uint)(4000u));
this.logTextBox1.MessageInterval = 50;
this.logTextBox1.Name = "logTextBox1";
this.logTextBox1.Size = new System.Drawing.Size(419, 331);
this.logTextBox1.TabIndex = 4;
this.logTextBox1.Text = "";
//
// btClose
//
this.btClose.Location = new System.Drawing.Point(346, 14);
this.btClose.Name = "btClose";
this.btClose.Size = new System.Drawing.Size(90, 40);
this.btClose.TabIndex = 5;
this.btClose.Text = "Close";
this.btClose.UseVisualStyleBackColor = true;
this.btClose.Click += new System.EventHandler(this.btClose_Click);
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.Enabled = false;
this.button1.Location = new System.Drawing.Point(20, 403);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(90, 40);
this.button1.TabIndex = 6;
this.button1.Text = "Read";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button2.Enabled = false;
this.button2.Location = new System.Drawing.Point(116, 403);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(90, 40);
this.button2.TabIndex = 7;
this.button2.Text = "Stop";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button3.Enabled = false;
this.button3.Location = new System.Drawing.Point(212, 403);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(90, 40);
this.button3.TabIndex = 8;
this.button3.Text = "Help";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button4.Enabled = false;
this.button4.Location = new System.Drawing.Point(337, 403);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(90, 40);
this.button4.TabIndex = 9;
this.button4.Text = "Ping";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// timer1
//
this.timer1.Interval = 200;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(449, 450);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.btClose);
this.Controls.Add(this.logTextBox1);
this.Controls.Add(this.btOpen);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbAddr);
this.Controls.Add(this.radTcp);
this.Controls.Add(this.radRs232);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.RadioButton radRs232;
private System.Windows.Forms.RadioButton radTcp;
private System.Windows.Forms.TextBox tbAddr;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btOpen;
private arCtl.LogTextBox logTextBox1;
private System.Windows.Forms.Button btClose;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Timer timer1;
}
}

View File

@@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Test_NLRF100
{
public partial class Form1 : Form
{
arDev.NLRF100.Device dev;
public Form1()
{
InitializeComponent();
dev = new arDev.NLRF100.Device();
dev.Message += Dev_Message;
dev.ReceiveData += Dev_ReceiveData;
}
private void Dev_ReceiveData(object sender, arDev.NLRF100.Device.ReceviceDataEventArgs e)
{
//데이터를 읽었을때
logTextBox1.AddMsg("수신", string.Format("\n안테나={0},값={1}",e.Antena,e.DataString));
}
private void Dev_Message(object sender, arDev.NLRF100.Device.MessageEventArgs e)
{
if (e.isError) logTextBox1.AddMsg("ERROR", "\n"+e.Message);
else logTextBox1.AddMsg("\n"+e.Message);
}
private void btOpen_Click(object sender, EventArgs e)
{
if (dev != null && dev.bInit && dev.IsOpen)
{
dev.Close();
}
if (tbAddr.Text == "")
{
Util.MsgE("포트/HostIP 를 입력하세요");
return;
}
if (radRs232.Checked) dev.init(arDev.NLRF100.eConnType.RS232, tbAddr.Text);
else dev.init(arDev.NLRF100.eConnType.SOCKET, tbAddr.Text);
if (dev.IsOpen == false)
{
logTextBox1.AddMsg("ERROR", "접속실패");
}
else
{
logTextBox1.AddMsg("접속성공");
}
timer1.Start();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btClose_Click(object sender, EventArgs e)
{
if (dev != null && dev.IsOpen)
{
dev.Close();
this.logTextBox1.AddMsg("접속 종료");
timer1.Stop();
}
}
private void button1_Click(object sender, EventArgs e)
{
//read
dev.Start();
}
private void button2_Click(object sender, EventArgs e)
{
//stop
dev.Stop();
}
private void button3_Click(object sender, EventArgs e)
{
//help
dev.Help();
}
private void button4_Click(object sender, EventArgs e)
{
//ping
dev.Ping();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Text = "접속상태:" + dev.IsOpen.ToString();
if(dev.IsOpen)
{
button1.Enabled = true;
button2.Enabled = true;
button3.Enabled = true;
button4.Enabled = true;
} else
{
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
}
}
}
}

View File

@@ -0,0 +1,123 @@
<?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>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Test_NLRF100
{
static class Program
{
/// <summary>
/// 해당 응용 프로그램의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("Test_NLRF100")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test_NLRF100")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("2cdad6d3-2d25-4604-a46c-edec0eb308d8")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test_NLRF100.Properties
{
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
// ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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 ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test_NLRF100.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;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test_NLRF100.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Test_NLRF100</RootNamespace>
<AssemblyName>Test_NLRF100</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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>
<ItemGroup>
<Reference Include="arControl.Net4">
<HintPath>..\Sub\arCtl\obj\Debug\arControl.Net4.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<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="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Util.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.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>
</Compile>
<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>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,407 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Management;
using System.Net;
using System.Text;
using System.Windows.Forms;
namespace Test_NLRF100
{
public static class Util
{
#region "MessageBox"
public static void MsgI(string m, Boolean legacy = true)
{
//if(legacy)
{
MessageBox.Show(m, "확인", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
public static void MsgE(string m, Boolean legacy = false)
{
//if(legacy)
{
MessageBox.Show(m, "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public static DialogResult MsgQ(string m, Boolean legacy = false, string btOK = "확인",string btCancel = "아니오")
{
//if(legacy)
{
DialogResult dlg = MessageBox.Show(m, "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
return dlg;
}
}
#endregion
public static string SelectSerialPort()
{
var f = new System.Windows.Forms.Form();
f.WindowState = System.Windows.Forms.FormWindowState.Normal;
f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
f.Size = new System.Drawing.Size(800, 400);
f.MaximizeBox = false;
f.MinimizeBox = false;
f.Text = "Select Port";
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
var lst = new System.Windows.Forms.ListBox();
lst.Font = new System.Drawing.Font("Consolas", 15, System.Drawing.FontStyle.Bold);
lst.Dock = System.Windows.Forms.DockStyle.Fill;
lst.DoubleClick += (s1, e1) =>
{
if (lst.SelectedItem != null) f.DialogResult = System.Windows.Forms.DialogResult.OK;
};
using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort"))
{
var portnames = System.IO.Ports.SerialPort.GetPortNames().OrderBy(t => t);
var ports = searcher.Get().Cast<ManagementBaseObject>().ToList();
foreach (var port in portnames)
{
var desc = "";
var portInfo = ports.Where(t => t["DeviceId"].ToString() == port).FirstOrDefault();
if (portInfo != null) desc = portInfo["Caption"].ToString();
lst.Items.Add(string.Format("{0} - {1}", port, desc));
}
}
f.Controls.Add(lst);
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
var name = lst.SelectedItem.ToString().Split('-');
return name[0].Trim();
}
else return string.Empty;
}
public static void ScreenCaptrue(int _BitmapWidth, int _BitmapHeight, Point ptSouce)
{
try
{
Bitmap bitmap = new Bitmap(_BitmapWidth, _BitmapHeight);
Graphics _graphic = Graphics.FromImage(bitmap);
_graphic.CopyFromScreen(ptSouce, new Point(0, 0), new Size(_BitmapWidth, _BitmapHeight));
string savefile = System.IO.Path.Combine(Util.CurrentPath, "ScreenShot", DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
System.IO.FileInfo grpath = new FileInfo(savefile);
if (!grpath.Directory.Exists) grpath.Directory.Create();
bitmap.Save(grpath.FullName, System.Drawing.Imaging.ImageFormat.Png);
Util.MsgI("화면 캡쳐 성공\n" +
"위치:" + grpath.Directory.FullName +"\n" +
"파일명: " + grpath.Name);
}
catch (Exception ex)
{
Util.MsgE("화면 캡쳐 실패\n" + ex.Message);
}
}
public static void SaveBugReport(string content, string subdirName = "BugReport")
{
try
{
var path = CurrentPath + subdirName;
if (!System.IO.Directory.Exists(path)) System.IO.Directory.CreateDirectory(path);
var file = path + "\\" + DateTime.Now.ToString("yyyyMMdd_HHmmss_fff") + ".txt";
System.IO.File.WriteAllText(file, content, System.Text.Encoding.UTF8);
}
catch
{
//nothing
}
}
public static void CopyData(System.Data.DataRow drSrc, System.Data.DataRow drDes)
{
if (drDes == null || drSrc == null) return;
foreach (System.Data.DataColumn col in drSrc.Table.Columns)
{
if (col.ColumnName.ToUpper() == "IDX") continue;
drDes[col.ColumnName] = drSrc[col.ColumnName];
}
}
/// <summary>
/// 현재실행중인폴더를 반환합니다.
/// </summary>
public static string CurrentPath
{
get
{
return AppDomain.CurrentDomain.BaseDirectory;
}
}
/// <summary>
/// 콤마와 줄바꿈등을 제거합니다.
/// </summary>
/// <returns></returns>
public static string ToCSVString(string src)
{
string retval = src.Replace("\r", "").Replace("\n", "").Replace(",", "");
return retval;
}
public static Boolean RunProcess(string file, string arg = "")
{
var fi = new System.IO.FileInfo(file);
if (!fi.Exists)
{
// Pub.log.AddE("Run Error : " + file);
return false;
}
System.Diagnostics.Process prc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(file);
si.Arguments = arg;
prc.StartInfo = si;
prc.Start();
return true;
}
#region "convert"
public static string RectToStr(Rectangle rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string RectToStr(RectangleF rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string PointToStr(Point pt)
{
return string.Format("{0};{1}", pt.X, pt.Y);
}
public static string PointToStr(PointF pt)
{
return string.Format("{0};{1}", pt.X, pt.Y);
}
#endregion
#region "NIC"
/// <summary>
/// 지정된 nic카드가 현재 목록에 존재하는지 확인한다.
/// </summary>
/// <returns></returns>
public static Boolean ExistNIC(string NICName)
{
if (string.IsNullOrEmpty(NICName)) return false;
foreach (string NetName in NICCardList())
{
if (NetName.ToLower() == NICName.ToLower())
{
return true;
}
}
return false;
}
/// <summary>
/// Ehternet Card 를 사용안함으로 설정합니다.(관리자권한필요)
/// </summary>
/// <param name="NicName"></param>
public static Boolean NICDisable(string NICName)
{
//해당 nic 가 현재 목록에 존재하는지 확인한다.
string cmd = "interface set interface " + NICName + " disable";
Process prc = new Process();
ProcessStartInfo si = new ProcessStartInfo("netsh", cmd);
si.WindowStyle = ProcessWindowStyle.Hidden;
prc.StartInfo = si;
prc.Start();
////목록에서 사라질때까지 기다린다.
DateTime SD = DateTime.Now;
Boolean timeout = false;
while ((true))
{
bool FindNetwork = false;
foreach (string NetName in NICCardList())
{
if (NetName == NICName.ToLower())
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
if (!FindNetwork)
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
timeout = true;
break; // TODO: might not be correct. Was : Exit While
}
}
return !timeout;
}
public static List<String> NICCardList()
{
List<String> Retval = new List<string>();
foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (Net.NetworkInterfaceType == System.Net.NetworkInformation.NetworkInterfaceType.Ethernet)
{
Retval.Add(Net.Name.ToUpper());
}
}
return Retval;
}
/// <summary>
/// 이더넷카드를 사용함으로 설정합니다.
/// </summary>
/// <param name="NicName"></param>
public static Boolean NICEnable(string NICName)
{
string cmd = "interface set interface " + NICName + " enable";
System.Diagnostics.Process prc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo("netsh", cmd);
si.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
prc.StartInfo = si;
prc.Start();
////목록에생길떄까지 대기
DateTime SD = DateTime.Now;
while ((true))
{
bool FindNetwork = false;
foreach (string NetName in NICCardList())
{
if (NetName.ToLower() == NICName.ToLower())
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
if (FindNetwork)
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
return false;
}
}
////결이 완료될떄까지 기다린다.
SD = DateTime.Now;
while ((true))
{
bool FindNetwork = false;
foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet &&
Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet) continue;
if (Net.Name.ToLower() == NICName.ToLower())
{
//string data = Net.GetIPProperties().GatewayAddresses[0].ToString();
if (Net.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
}
if (FindNetwork)
return true;
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
return false;
}
}
}
#endregion
public static void RunExplorer(string arg)
{
System.Diagnostics.ProcessStartInfo si = new ProcessStartInfo("explorer");
si.Arguments = arg;
System.Diagnostics.Process.Start(si);
}
#region "watchdog"
public static void WatchDog_Run()
{
System.IO.FileInfo fi = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "WatchCat.exe");
if (!fi.Exists) return;
var Exist = CheckExistProcess("watchcat");
if (Exist) return;
RunProcess(fi.FullName);
}
public static Boolean CheckExistProcess(string ProcessName)
{
foreach (var prc in System.Diagnostics.Process.GetProcesses())
{
if (prc.ProcessName.StartsWith("svchost")) continue;
if (prc.ProcessName.ToUpper() == ProcessName.ToUpper()) return true;
}
return false;
}
#endregion
#region "web function"
/// <summary>
/// URL로부터 문자열을 수신합니다.
/// </summary>
/// <param name="url"></param>
/// <param name="isError"></param>
/// <returns></returns>
public static string GetStrfromurl(string url, out Boolean isError)
{
isError = false;
string result = "";
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url));
request.Timeout = 60000;
request.ReadWriteTimeout = 60000;
request.MaximumAutomaticRedirections = 4;
request.MaximumResponseHeadersLength = 4;
request.Credentials = CredentialCache.DefaultCredentials;
var response = request.GetResponse() as HttpWebResponse;
var txtReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
result = txtReader.ReadToEnd();
}
catch (Exception ex)
{
isError = true;
result = ex.Message.ToString();
}
return result;
}
#endregion
}
}