网络组件进行了重构整理,相关的名称也重新命名了。

This commit is contained in:
hsl
2017-04-23 18:05:12 +08:00
parent d8ce00a5c1
commit 2923246925
14 changed files with 1324 additions and 1308 deletions

BIN
Public/HslCommunication.dll Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -6,7 +6,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using IndustryEthernet; using HslCommunication;
namespace namespace
{ {

View File

@@ -6,17 +6,20 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using IndustryEthernet;
using CommonLibrary; using CommonLibrary;
using HslCommunication;
using HslCommunication.Enthernet;
namespace namespace
{ {
public partial class FormLog : Form public partial class FormLog : Form
{ {
public FormLog(Net_Simplify_Client client) public FormLog()
{ {
InitializeComponent(); InitializeComponent();
net_simplify_client = client; net_simplify_client = UserClient.Net_simplify_client;
} }
private Net_Simplify_Client net_simplify_client = null; private Net_Simplify_Client net_simplify_client = null;

View File

@@ -7,8 +7,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Threading; using System.Threading;
using IndustryEthernet;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using HslCommunication;
using HslCommunication.Enthernet;
namespace namespace
{ {
@@ -180,7 +181,7 @@ namespace 软件系统客户端模版
else else
{ {
//访问失败 //访问失败
if (IsHandleCreated) Invoke(message_show, result.Message); if (IsHandleCreated) Invoke(message_show, result.Error.Message);
if (IsHandleCreated) Invoke(thread_finish); if (IsHandleCreated) Invoke(thread_finish);
return; return;
} }
@@ -220,7 +221,7 @@ namespace 软件系统客户端模版
else else
{ {
//访问失败 //访问失败
if (IsHandleCreated) Invoke(message_show, result.Message); if (IsHandleCreated) Invoke(message_show, result.Error.Message);
if (IsHandleCreated) Invoke(thread_finish); if (IsHandleCreated) Invoke(thread_finish);
return; return;
} }
@@ -272,7 +273,7 @@ namespace 软件系统客户端模版
else else
{ {
//访问失败 //访问失败
if (IsHandleCreated) Invoke(message_show, result.Message); if (IsHandleCreated) Invoke(message_show, result.Error.Message);
if (IsHandleCreated) Invoke(thread_finish); if (IsHandleCreated) Invoke(thread_finish);
return; return;
} }
@@ -301,7 +302,7 @@ namespace 软件系统客户端模版
else else
{ {
//访问失败 //访问失败
if (IsHandleCreated) Invoke(message_show, result.Message); if (IsHandleCreated) Invoke(message_show, result.Error.Message);
if (IsHandleCreated) Invoke(thread_finish); if (IsHandleCreated) Invoke(thread_finish);
return; return;
} }

View File

@@ -7,10 +7,11 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BasicFramework; using BasicFramework;
using IndustryEthernet;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using CommonLibrary; using CommonLibrary;
using System.Threading; using System.Threading;
using HslCommunication;
using HslCommunication.Enthernet;
//============================================================================ //============================================================================
@@ -172,14 +173,14 @@ namespace 软件系统客户端模版
private void ToolStripMenuItem_Click(object sender, EventArgs e) private void ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
FormLog flg = new FormLog(UserClient.Net_simplify_client); FormLog flg = new FormLog();
flg.ShowDialog(); flg.ShowDialog();
flg.Dispose(); flg.Dispose();
} }
private void ToolStripMenuItem_Click(object sender, EventArgs e) private void ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
using (FormRegisterAccount fra = new FormRegisterAccount(UserClient.Net_simplify_client)) using (FormRegisterAccount fra = new FormRegisterAccount())
{ {
fra.ShowDialog(); fra.ShowDialog();
} }

View File

@@ -6,17 +6,18 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using IndustryEthernet; using HslCommunication.Enthernet;
using HslCommunication;
namespace namespace
{ {
public partial class FormRegisterAccount : Form public partial class FormRegisterAccount : Form
{ {
public FormRegisterAccount(Net_Simplify_Client client) public FormRegisterAccount()
{ {
InitializeComponent(); InitializeComponent();
net_client = client; net_client = UserClient.Net_simplify_client;
} }
private void FormRegisterAccount_Load(object sender, EventArgs e) private void FormRegisterAccount_Load(object sender, EventArgs e)

View File

@@ -6,7 +6,8 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using IndustryEthernet; using HslCommunication;
using HslCommunication.Enthernet;
using CommonLibrary; using CommonLibrary;
namespace namespace

View File

@@ -6,8 +6,9 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using IndustryEthernet;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using HslCommunication.Enthernet;
using HslCommunication;
namespace .UIControls namespace .UIControls

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using IndustryEthernet; using HslCommunication.Enthernet;
namespace namespace

View File

@@ -39,9 +39,8 @@
<Reference Include="CommonLibrary"> <Reference Include="CommonLibrary">
<HintPath>..\CommonLibrary\bin\Debug\CommonLibrary.dll</HintPath> <HintPath>..\CommonLibrary\bin\Debug\CommonLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="IndustryEthernet, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="HslCommunication">
<SpecificVersion>False</SpecificVersion> <HintPath>..\Public\HslCommunication.dll</HintPath>
<HintPath>..\Public\IndustryEthernet.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>

View File

@@ -6,7 +6,8 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using IndustryEthernet; using HslCommunication;
using HslCommunication.Enthernet;
using System.Threading; using System.Threading;
using CommonLibrary; using CommonLibrary;
using BasicFramework; using BasicFramework;
@@ -206,12 +207,12 @@ namespace 软件系统服务端模版
{ {
try try
{ {
net_soft_update_Server.log_record.log_save_path = Application.StartupPath + @"\update_log.txt"; net_soft_update_Server.LogHelper.LogSaveFileName = Application.StartupPath + @"\update_log.txt";
//在服务器的这个路径下放置客户端运行的所有文件不要包含settings文件不要从此处运行 //在服务器的这个路径下放置客户端运行的所有文件不要包含settings文件不要从此处运行
//只放置exe和dll组件必须放置软件自动更新.exe //只放置exe和dll组件必须放置软件自动更新.exe
net_soft_update_Server.KeyToken = CommonHeadCode.KeyToken; net_soft_update_Server.KeyToken = CommonHeadCode.KeyToken;
net_soft_update_Server.FileUpdatePath = @"C:\ClientFiles"; net_soft_update_Server.FileUpdatePath = @"C:\ClientFiles";
net_soft_update_Server.AutoUpdateEngineStart(CommonLibrary.CommonLibrary.Port_Update_Net); net_soft_update_Server.ServerStart(CommonLibrary.CommonLibrary.Port_Update_Net);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -233,10 +234,10 @@ namespace 软件系统服务端模版
{ {
try try
{ {
net_file_update.FilesPath = @"C:\ClientFiles";//服务器客户端需要更新的路径,与上述一致 net_file_update.FilesPath = Application.StartupPath + @"\ClientFiles";//服务器客户端需要更新的路径,与上述一致
net_file_update.log_record.log_save_path = Application.StartupPath + @"\update_file_log.txt"; net_file_update.LogHelper.LogSaveFileName = Application.StartupPath + @"\update_file_log.txt";
net_file_update.KeyToken = CommonHeadCode.KeyToken; net_file_update.KeyToken = CommonHeadCode.KeyToken;
net_file_update.Server_Start(CommonLibrary.CommonLibrary.Port_Update_Remote); net_file_update.ServerStart(CommonLibrary.CommonLibrary.Port_Update_Remote);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -258,10 +259,10 @@ namespace 软件系统服务端模版
try try
{ {
net_simplify_server.KeyToken = CommonHeadCode.KeyToken;//设置身份令牌 net_simplify_server.KeyToken = CommonHeadCode.KeyToken;//设置身份令牌
net_simplify_server.log_record.log_save_path = Application.StartupPath + @"\simplify_log.txt"; net_simplify_server.LogHelper.LogSaveFileName = Application.StartupPath + @"\simplify_log.txt";
net_simplify_server.ReceiveStringEvent += Net_simplify_server_ReceiveStringEvent; net_simplify_server.ReceiveStringEvent += Net_simplify_server_ReceiveStringEvent;
net_simplify_server.ReceivedBytesEvent += Net_simplify_server_ReceivedBytesEvent; net_simplify_server.ReceivedBytesEvent += Net_simplify_server_ReceivedBytesEvent;
net_simplify_server.Server_Start(CommonLibrary.CommonLibrary.Port_Second_Net); net_simplify_server.ServerStart(CommonLibrary.CommonLibrary.Port_Second_Net);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -310,7 +311,7 @@ namespace 软件系统服务端模版
string name = SoftBasic.GetValueFromJsonObject(json, UserAccount.UserNameText, ""); string name = SoftBasic.GetValueFromJsonObject(json, UserAccount.UserNameText, "");
string password = SoftBasic.GetValueFromJsonObject(json, UserAccount.PasswordText, ""); string password = SoftBasic.GetValueFromJsonObject(json, UserAccount.PasswordText, "");
net_simplify_server.SendMessage(object1, UserServer.ServerAccounts.CheckAccountJson( net_simplify_server.SendMessage(object1, UserServer.ServerAccounts.CheckAccountJson(
name, password, ((System.Net.IPEndPoint)(object1._WorkSocket.RemoteEndPoint)).Address.ToString())); name, password, ((System.Net.IPEndPoint)(object1.WorkSocket.RemoteEndPoint)).Address.ToString()));
} }
else if (head_code == CommonHeadCode.SimplifyHeadCode.) else if (head_code == CommonHeadCode.SimplifyHeadCode.)
{ {
@@ -357,29 +358,29 @@ namespace 软件系统服务端模版
} }
else if (head_code == CommonHeadCode.SimplifyHeadCode.) else if (head_code == CommonHeadCode.SimplifyHeadCode.)
{ {
net_simplify_server.SendMessage(object1, net_socket_server.LogReacord.GetLogText()); net_simplify_server.SendMessage(object1, net_socket_server.LogHelper.GetLogText());
} }
else if (head_code == CommonHeadCode.SimplifyHeadCode.) else if (head_code == CommonHeadCode.SimplifyHeadCode.)
{ {
net_socket_server.LogReacord.ClearLogText(); net_socket_server.LogHelper.ClearLogText();
net_simplify_server.SendMessage(object1, "成功"); net_simplify_server.SendMessage(object1, "成功");
} }
else if (head_code == CommonHeadCode.SimplifyHeadCode.) else if (head_code == CommonHeadCode.SimplifyHeadCode.)
{ {
net_simplify_server.SendMessage(object1, net_simplify_server.log_record.GetLogText()); net_simplify_server.SendMessage(object1, net_simplify_server.LogHelper.GetLogText());
} }
else if (head_code == CommonHeadCode.SimplifyHeadCode.) else if (head_code == CommonHeadCode.SimplifyHeadCode.)
{ {
net_simplify_server.log_record.ClearLogText(); net_simplify_server.LogHelper.ClearLogText();
net_simplify_server.SendMessage(object1, "成功"); net_simplify_server.SendMessage(object1, "成功");
} }
else if (head_code == CommonHeadCode.SimplifyHeadCode.) else if (head_code == CommonHeadCode.SimplifyHeadCode.)
{ {
net_simplify_server.SendMessage(object1, net_soft_update_Server.log_record.GetLogText()); net_simplify_server.SendMessage(object1, net_soft_update_Server.LogHelper.GetLogText());
} }
else if (head_code == CommonHeadCode.SimplifyHeadCode.) else if (head_code == CommonHeadCode.SimplifyHeadCode.)
{ {
net_soft_update_Server.log_record.ClearLogText(); net_soft_update_Server.LogHelper.ClearLogText();
net_simplify_server.SendMessage(object1, "成功"); net_simplify_server.SendMessage(object1, "成功");
} }
else if (head_code == CommonHeadCode.SimplifyHeadCode.) else if (head_code == CommonHeadCode.SimplifyHeadCode.)
@@ -409,7 +410,7 @@ namespace 软件系统服务端模版
try try
{ {
net_socket_server.KeyToken = CommonHeadCode.KeyToken;//设置身份令牌 net_socket_server.KeyToken = CommonHeadCode.KeyToken;//设置身份令牌
net_socket_server.LogReacord.log_save_path = Application.StartupPath + @"\net_log.txt"; net_socket_server.LogHelper.LogSaveFileName = Application.StartupPath + @"\net_log.txt";
net_socket_server.FormatClientOnline = "#IP:{0} Name:{1}";//必须为#开头,具体格式可由自身需求确定 net_socket_server.FormatClientOnline = "#IP:{0} Name:{1}";//必须为#开头,具体格式可由自身需求确定
net_socket_server.IsSaveLogClientLineChange = true; net_socket_server.IsSaveLogClientLineChange = true;
net_socket_server.ClientOnline += Net_socket_server_ClientOnline; net_socket_server.ClientOnline += Net_socket_server_ClientOnline;
@@ -417,7 +418,7 @@ namespace 软件系统服务端模版
net_socket_server.MessageAlerts += Net_socket_server_MessageAlerts; net_socket_server.MessageAlerts += Net_socket_server_MessageAlerts;
net_socket_server.AcceptByte += Net_socket_server_AcceptByte; net_socket_server.AcceptByte += Net_socket_server_AcceptByte;
net_socket_server.AcceptString += Net_socket_server_AcceptString; net_socket_server.AcceptString += Net_socket_server_AcceptString;
net_socket_server.SocketStart(CommonLibrary.CommonLibrary.Port_Main_Net); net_socket_server.ServerStart(CommonLibrary.CommonLibrary.Port_Main_Net);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -549,7 +550,7 @@ namespace 软件系统服务端模版
//文件存储路径 //文件存储路径
net_simple_file_server.File_save_path = Application.StartupPath + @"\Files"; net_simple_file_server.File_save_path = Application.StartupPath + @"\Files";
net_simple_file_server.FileChange += Net_simple_file_server_FileChange; net_simple_file_server.FileChange += Net_simple_file_server_FileChange;
net_simple_file_server.FileEngineStart(CommonLibrary.CommonLibrary.Port_Share_File); net_simple_file_server.ServerStart(CommonLibrary.CommonLibrary.Port_Share_File);
} }
catch(Exception ex) catch(Exception ex)
{ {
@@ -570,6 +571,6 @@ namespace 软件系统服务端模版
/// <summary> /// <summary>
/// 还未有其他什么用途 /// 还未有其他什么用途
/// </summary> /// </summary>
private Log_Record log = new Log_Record(); private HslLogHelper LogHelper = new HslLogHelper();
} }
} }

View File

@@ -39,9 +39,8 @@
<Reference Include="CommonLibrary"> <Reference Include="CommonLibrary">
<HintPath>..\CommonLibrary\bin\Debug\CommonLibrary.dll</HintPath> <HintPath>..\CommonLibrary\bin\Debug\CommonLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="IndustryEthernet, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="HslCommunication">
<SpecificVersion>False</SpecificVersion> <HintPath>..\Public\HslCommunication.dll</HintPath>
<HintPath>..\Public\IndustryEthernet.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>