From de13c87afecf24008608348d47beae51eaf95147 Mon Sep 17 00:00:00 2001 From: dathlin Date: Tue, 19 Sep 2017 10:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86=E9=87=8D?= =?UTF-8?q?=E6=9E=84=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8B=E8=BD=BD=E5=A4=B1=E8=B4=A5=E7=9A=84BUG?= =?UTF-8?q?=EF=BC=8C=E5=8F=91=E5=B8=83=E7=89=88=E6=9C=AC1.4.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AccountSupport/FormAccountDetails.cs | 19 ++-- ClientsLibrary/AccountSupport/UserPortrait.cs | 74 +++++++++------ ClientsLibrary/UserClient.cs | 18 ++-- CommonLibrary/AccountSupport/ServerAccount.cs | 2 +- CommonLibrary/BasicSupport/SoftSettings.cs | 4 +- CommonLibrary/CommonLibrary.csproj | 4 +- CommonLibrary/{ => ProtocolSupport}/Common.cs | 93 ++++++------------- .../{ => ProtocolSupport}/HeadCode.cs | 0 软件系统客户端Wpf/MainWindow.xaml.cs | 9 +- .../Views/UserFileRender.xaml.cs | 4 +- .../Views/UserFileRenderItem.xaml.cs | 4 +- 软件系统客户端模版/FormMainWindow.cs | 5 +- .../UIControls/ShareFilesRender.cs | 8 +- 软件系统服务端模版/FormServerWindow.cs | 24 ++--- 14 files changed, 129 insertions(+), 139 deletions(-) rename CommonLibrary/{ => ProtocolSupport}/Common.cs (68%) rename CommonLibrary/{ => ProtocolSupport}/HeadCode.cs (100%) diff --git a/ClientsLibrary/AccountSupport/FormAccountDetails.cs b/ClientsLibrary/AccountSupport/FormAccountDetails.cs index 353ce62..47e8ce7 100644 --- a/ClientsLibrary/AccountSupport/FormAccountDetails.cs +++ b/ClientsLibrary/AccountSupport/FormAccountDetails.cs @@ -45,7 +45,7 @@ namespace ClientsLibrary textBox_UserName.Text = UserClient.UserAccount.UserName; // 加载头像 - ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadPoolLoadPortrait), null); + ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadPoolLoadLargePortrait), null); // 加载文件列表 DownloadUserFileNames(); @@ -93,17 +93,16 @@ namespace ClientsLibrary } } } - - - - private void ThreadPoolLoadPortrait(object obj) - { - UserPortrait.LoadUserLargePortraint(LoadPortraitByFileName); - } + private void pictureBox_UserPortrait_Click(object sender, EventArgs e) { UserPortrait.ChangePortrait(); + ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadPoolLoadLargePortrait), null); + } + + private void ThreadPoolLoadLargePortrait(object obj) + { UserPortrait.LoadUserLargePortraint(LoadPortraitByFileName); } @@ -185,7 +184,7 @@ namespace ClientsLibrary "Files", "Personal", UserClient.UserAccount.UserName, - folderBrowserDialog.SelectedPath + "\\" + treeNode.Text + folderBrowserDialog.SelectedPath ); download.ShowDialog(); } @@ -197,7 +196,7 @@ namespace ClientsLibrary { // 删除选中文件 TreeNode treeNode = treeView1.SelectedNode; - if (treeNode.Name != "file_root") + if (treeNode.Name != "files_root") { using (FormPasswordCheck passwordCheck = new FormPasswordCheck(UserClient.UserAccount.Password)) { diff --git a/ClientsLibrary/AccountSupport/UserPortrait.cs b/ClientsLibrary/AccountSupport/UserPortrait.cs index 908314d..e628c7a 100644 --- a/ClientsLibrary/AccountSupport/UserPortrait.cs +++ b/ClientsLibrary/AccountSupport/UserPortrait.cs @@ -75,7 +75,7 @@ namespace ClientsLibrary bitmap32.Dispose(); using (FormFileOperate ffo = new FormFileOperate( - UserClient.Net_File_Client, + UserClient.Net_File_Client, new string[] { path300, @@ -85,41 +85,59 @@ namespace ClientsLibrary ffo.ShowDialog(); } - // 上传文件MD5码 - string SmallPortraitMD5 = SoftBasic.CalculateFileMD5(path32); - string LargePortraitMD5 = SoftBasic.CalculateFileMD5(path300); - - JObject json = new JObject + ThreadPool.QueueUserWorkItem(new WaitCallback(obj => { - { UserAccount.UserNameText, new JValue(UserClient.UserAccount.UserName) }, - { UserAccount.SmallPortraitText, new JValue(SmallPortraitMD5) }, - { UserAccount.LargePortraitText, new JValue(LargePortraitMD5) } - }; + // 上传文件MD5码 + string SmallPortraitMD5 = ""; SoftBasic.CalculateFileMD5(path32); + string LargePortraitMD5 = ""; SoftBasic.CalculateFileMD5(path300); - OperateResultString result = UserClient.Net_simplify_client.ReadFromServer( - CommonHeadCode.SimplifyHeadCode.上传头像MD5, - json.ToString()); - - if(result.IsSuccess) - { - if (result.Content.Substring(0, 2) == "成功") + try { - UserClient.UserAccount.SmallPortraitMD5 = SmallPortraitMD5; - UserClient.UserAccount.LargePortraitMD5 = LargePortraitMD5; - // 成功上传MD5码 - LoadUserSmallPortraint(); + SmallPortraitMD5 = SoftBasic.CalculateFileMD5(path32); + LargePortraitMD5 = SoftBasic.CalculateFileMD5(path300); + } + catch(Exception ex) + { + UserClient.LogNet.WriteException("获取文件MD5码失败:", ex); + MessageBox.Show("文件信息确认失败,请重新上传!"); + return; + } + + JObject json = new JObject + { + { UserAccount.UserNameText, new JValue(UserClient.UserAccount.UserName) }, + { UserAccount.SmallPortraitText, new JValue(SmallPortraitMD5) }, + { UserAccount.LargePortraitText, new JValue(LargePortraitMD5) } + }; + + + OperateResultString result = UserClient.Net_simplify_client.ReadFromServer( + CommonHeadCode.SimplifyHeadCode.上传头像MD5, + json.ToString()); + + if (result.IsSuccess) + { + if (result.Content.Substring(0, 2) == "成功") + { + UserClient.UserAccount.SmallPortraitMD5 = SmallPortraitMD5; + UserClient.UserAccount.LargePortraitMD5 = LargePortraitMD5; + // 成功上传MD5码 + LoadUserSmallPortraint(); + } + else + { + MessageBox.Show("上传头像失败!原因:" + result.Content); + } } else { - MessageBox.Show("上传头像失败!原因:" + result.Content); + MessageBox.Show("上传头像失败!原因:" + result.Message); } - } - else - { - MessageBox.Show("上传头像失败!原因:" + result.Message); - } - + + }), null); + } + } } diff --git a/ClientsLibrary/UserClient.cs b/ClientsLibrary/UserClient.cs index d0065c0..200bc8e 100644 --- a/ClientsLibrary/UserClient.cs +++ b/ClientsLibrary/UserClient.cs @@ -6,6 +6,7 @@ using HslCommunication.Enthernet; using HslCommunication.BasicFramework; using CommonLibrary; using System.Net; +using CommonLibrary; namespace ClientsLibrary { @@ -37,9 +38,10 @@ namespace ClientsLibrary /// - /// 服务器的IP地址,默认为127.0.0.1,可用于单机调试,云服务器端:117.48.203.204 + /// 服务器的IP地址,默认为127.0.0.1,可用于单机调试, + /// 云服务器端:117.48.203.204,注意,云端为最新版,客户端版本比较旧会调试失败 /// - public static string ServerIp { get; } = "117.48.203.204";//用于测试的云服务器地址 + public static string ServerIp { get; } = "127.0.0.1";//用于测试的云服务器地址 /// @@ -88,9 +90,9 @@ namespace ClientsLibrary /// public static NetSimplifyClient Net_simplify_client { get; set; } = new NetSimplifyClient( new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp), - CommonLibrary.CommonLibrary.Port_Second_Net)) + CommonLibrary.CommonProtocol.Port_Second_Net)) { - KeyToken = CommonHeadCode.KeyToken, + KeyToken = CommonLibrary.CommonProtocol.KeyToken, ConnectTimeout = 5000, }; @@ -99,9 +101,9 @@ namespace ClientsLibrary /// public static NetUdpClient Net_Udp_Client { get; set; } = new NetUdpClient( new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp), - CommonLibrary.CommonLibrary.Port_Udp_Server)) + CommonLibrary.CommonProtocol.Port_Udp_Server)) { - KeyToken = CommonHeadCode.KeyToken, + KeyToken = CommonLibrary.CommonProtocol.KeyToken, }; @@ -110,9 +112,9 @@ namespace ClientsLibrary /// public static AdvancedFileClient Net_File_Client { get; set; } = new AdvancedFileClient() { - KeyToken = CommonHeadCode.KeyToken, + KeyToken = CommonLibrary.CommonProtocol.KeyToken, LogNet = LogNet, - ServerIpEndPoint = new IPEndPoint(IPAddress.Parse(ServerIp), CommonLibrary.CommonLibrary.Port_Advanced_File_Server) + ServerIpEndPoint = new IPEndPoint(IPAddress.Parse(ServerIp), CommonLibrary.CommonProtocol.Port_Advanced_File_Server) }; /// diff --git a/CommonLibrary/AccountSupport/ServerAccount.cs b/CommonLibrary/AccountSupport/ServerAccount.cs index 3f23034..547f3a5 100644 --- a/CommonLibrary/AccountSupport/ServerAccount.cs +++ b/CommonLibrary/AccountSupport/ServerAccount.cs @@ -72,7 +72,7 @@ namespace CommonLibrary { all_list_accounts[i].SmallPortraitMD5 = smallPortraitMD5; all_list_accounts[i].LargePortraitMD5 = largePortraitMD5; - ILogNet?.WriteInfo(Resource.StringResouce.AccountModifyPassword + name); + ILogNet?.WriteInfo(Resource.StringResouce.AccountUploadPortrait + name); break; } } diff --git a/CommonLibrary/BasicSupport/SoftSettings.cs b/CommonLibrary/BasicSupport/SoftSettings.cs index 59f2afb..e2ab999 100644 --- a/CommonLibrary/BasicSupport/SoftSettings.cs +++ b/CommonLibrary/BasicSupport/SoftSettings.cs @@ -274,14 +274,14 @@ namespace CommonLibrary /// public override void LoadByFile() { - LoadByFile(m => SoftSecurity.MD5Decrypt(m, CommonLibrary.Security)); + LoadByFile(m => SoftSecurity.MD5Decrypt(m, CommonProtocol.Security)); } /// /// 使用指定的加密实现数据加密 /// public override void SaveToFile() { - SaveToFile(m => SoftSecurity.MD5Encrypt(m, CommonLibrary.Security)); + SaveToFile(m => SoftSecurity.MD5Encrypt(m, CommonProtocol.Security)); } diff --git a/CommonLibrary/CommonLibrary.csproj b/CommonLibrary/CommonLibrary.csproj index 6cdf5f2..ea6777c 100644 --- a/CommonLibrary/CommonLibrary.csproj +++ b/CommonLibrary/CommonLibrary.csproj @@ -86,8 +86,8 @@ FormVersionControl.cs - - + + diff --git a/CommonLibrary/Common.cs b/CommonLibrary/ProtocolSupport/Common.cs similarity index 68% rename from CommonLibrary/Common.cs rename to CommonLibrary/ProtocolSupport/Common.cs index c5a8b32..25630ac 100644 --- a/CommonLibrary/Common.cs +++ b/CommonLibrary/ProtocolSupport/Common.cs @@ -6,9 +6,21 @@ using HslCommunication.BasicFramework; namespace CommonLibrary { - public class CommonLibrary + + + /***************************************************************************************** + * + * 说明:本界面规定了客户端服务器双方共同遵守的一些协议基础,主要包含了端口号,令牌,密钥 + * + * 注意:在进行二次开发的时候,必须修改下面的所有参数 + * + *****************************************************************************************/ + + + + public class CommonProtocol { - static CommonLibrary() + static CommonProtocol() { /************************************************************************** * @@ -39,7 +51,7 @@ namespace CommonLibrary /************************************************************************** * - * 时间:2017年9月14日 22:06:27 版本号:1.4.0 + * 时间:2017年9月19日 22:06:27 版本号:1.4.0 * **************************************************************************/ @@ -48,7 +60,20 @@ namespace CommonLibrary } - #region 公用端口设计块 + + /************************************************************************************************ + * + * 注意:您在准备二次开发时,应该重新生成一个自己的GUID码 + * + **************************************************************************************************/ + + + /// + /// 用于整个网络服务交互的身份令牌,可有效的防止来自网络的攻击,重新生成令牌后就无法更改,否则不支持自动升级 + /// + public static Guid KeyToken { get; set; } = new Guid("1275BB9A-14B2-4A96-9673-B0AF0463D474"); + + //====================================================================================== // 此处的所有的网络端口应该重新指定,防止其他人的项目连接到你的程序上 @@ -82,71 +107,13 @@ namespace CommonLibrary /// 文件管理的服务器端口 /// public static int Port_Advanced_File_Server { get; } = 24672; - #endregion - /// /// 整个系统的加密解密密码 /// - public const string Security = "qwertyui"; + public static string Security { get; } = "qwertyui"; } - - /// - /// 选项类,包含了所有的标识和文本的对应关系 - /// - public class BasicOptions - { - /// - /// 测试,用于生成数据状态的信息存储 - /// - public static readonly List test = new List() - { - new BasicOptions(0,"测试一"), - new BasicOptions(1,"测试二"), - new BasicOptions(2,"测试三"), - }; - - - - - - - /// - /// 实例化一个对象 - /// - public BasicOptions() - { - - } - /// - /// 根据信息实例化一个选项对象 - /// - /// - /// - public BasicOptions(int code, string des) - { - IntegerCode = code; - Description = des; - } - /// - /// 整数的代号 - /// - public int IntegerCode { get; set; } = 0; - /// - /// 代号描述的文本 - /// - public string Description { get; set; } = string.Empty; - /// - /// 过去描述 - /// - /// - public override string ToString() - { - return Description; - } - } - } diff --git a/CommonLibrary/HeadCode.cs b/CommonLibrary/ProtocolSupport/HeadCode.cs similarity index 100% rename from CommonLibrary/HeadCode.cs rename to CommonLibrary/ProtocolSupport/HeadCode.cs diff --git a/软件系统客户端Wpf/MainWindow.xaml.cs b/软件系统客户端Wpf/MainWindow.xaml.cs index 6055453..fa23775 100644 --- a/软件系统客户端Wpf/MainWindow.xaml.cs +++ b/软件系统客户端Wpf/MainWindow.xaml.cs @@ -398,10 +398,10 @@ namespace 软件系统客户端Wpf { try { - net_socket_client.KeyToken = CommonHeadCode.KeyToken;//新增的身份令牌 + net_socket_client.KeyToken = CommonLibrary.CommonProtocol.KeyToken;//新增的身份令牌 net_socket_client.EndPointServer = new System.Net.IPEndPoint( System.Net.IPAddress.Parse(UserClient.ServerIp), - CommonLibrary.CommonLibrary.Port_Main_Net); + CommonLibrary.CommonProtocol.Port_Main_Net); net_socket_client.ClientAlias = $"{UserClient.UserAccount.UserName} ({UserClient.UserAccount.Factory})";//标记客户端在线的名称 net_socket_client.ClientStart(); } @@ -608,8 +608,9 @@ namespace 软件系统客户端Wpf #endregion #region Udp发送示例 + /// - /// 调用该方法并指定参数即可,最长字符串不得 + /// 调用该方法并指定参数即可,最长字符串不得超过服务器定义的数据 /// /// private void SendServerUdpData(int customer, string data) @@ -760,6 +761,8 @@ namespace 软件系统客户端Wpf #endregion + + private void Button_BackMain_Click(object sender, RoutedEventArgs e) { //点击了主页 diff --git a/软件系统客户端Wpf/Views/UserFileRender.xaml.cs b/软件系统客户端Wpf/Views/UserFileRender.xaml.cs index 27c61e2..0307e00 100644 --- a/软件系统客户端Wpf/Views/UserFileRender.xaml.cs +++ b/软件系统客户端Wpf/Views/UserFileRender.xaml.cs @@ -57,10 +57,10 @@ namespace 软件系统客户端Wpf.Views } using (FormSimplyFileUpload upload = new FormSimplyFileUpload( - CommonHeadCode.KeyToken, + CommonLibrary.CommonProtocol.KeyToken, UserClient.LogNet, UserClient.ServerIp, - CommonLibrary.CommonLibrary.Port_Share_File, + CommonLibrary.CommonProtocol.Port_Share_File, UserClient.UserAccount.UserName)) { upload.ShowDialog(); diff --git a/软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs b/软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs index 4543ba3..07eeece 100644 --- a/软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs +++ b/软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs @@ -32,9 +32,9 @@ namespace 软件系统客户端Wpf.Views fileClient = new SimpleFileClient() { - KeyToken = CommonLibrary.CommonHeadCode.KeyToken, + KeyToken = CommonLibrary.CommonProtocol.KeyToken, LogNet = UserClient.LogNet, - ServerIpEndPoint =new IPEndPoint(IPAddress.Parse(UserClient.ServerIp),CommonLibrary.CommonLibrary.Port_Advanced_File_Server) + ServerIpEndPoint =new IPEndPoint(IPAddress.Parse(UserClient.ServerIp),CommonLibrary.CommonProtocol.Port_Advanced_File_Server) }; } diff --git a/软件系统客户端模版/FormMainWindow.cs b/软件系统客户端模版/FormMainWindow.cs index e5706e4..dfee05d 100644 --- a/软件系统客户端模版/FormMainWindow.cs +++ b/软件系统客户端模版/FormMainWindow.cs @@ -337,10 +337,11 @@ namespace 软件系统客户端模版 { try { - net_socket_client.KeyToken = CommonHeadCode.KeyToken;//新增的身份令牌 + net_socket_client.KeyToken = CommonLibrary.CommonProtocol.KeyToken;// 新增的身份令牌 + net_socket_client.LogNet = UserClient.LogNet; net_socket_client.EndPointServer = new System.Net.IPEndPoint( System.Net.IPAddress.Parse(UserClient.ServerIp), - CommonLibrary.CommonLibrary.Port_Main_Net); + CommonLibrary.CommonProtocol.Port_Main_Net); net_socket_client.ClientAlias = $"{UserClient.UserAccount.UserName} ({UserClient.UserAccount.Factory})";//标记客户端在线的名称 net_socket_client.ClientStart(); } diff --git a/软件系统客户端模版/UIControls/ShareFilesRender.cs b/软件系统客户端模版/UIControls/ShareFilesRender.cs index a1dff58..7d4fb04 100644 --- a/软件系统客户端模版/UIControls/ShareFilesRender.cs +++ b/软件系统客户端模版/UIControls/ShareFilesRender.cs @@ -34,10 +34,10 @@ namespace 软件系统客户端模版.UIControls // 上传文件 using (FormSimplyFileUpload upload = new FormSimplyFileUpload( - CommonHeadCode.KeyToken, + CommonLibrary.CommonProtocol.KeyToken, UserClient.LogNet, UserClient.ServerIp, - CommonLibrary.CommonLibrary.Port_Share_File, + CommonLibrary.CommonProtocol.Port_Share_File, UserClient.UserAccount.UserName)) { upload.ShowDialog(); @@ -71,9 +71,9 @@ namespace 软件系统客户端模版.UIControls foreach(var m in files) { FileItemShow item = new FileItemShow( - CommonHeadCode.KeyToken, + CommonLibrary.CommonProtocol.KeyToken, UserClient.LogNet, UserClient.ServerIp, - CommonLibrary.CommonLibrary.Port_Share_File, + CommonLibrary.CommonProtocol.Port_Share_File, () => { if (m.UploadName != UserClient.UserAccount.UserName) diff --git a/软件系统服务端模版/FormServerWindow.cs b/软件系统服务端模版/FormServerWindow.cs index a937d32..62b47ae 100644 --- a/软件系统服务端模版/FormServerWindow.cs +++ b/软件系统服务端模版/FormServerWindow.cs @@ -344,9 +344,9 @@ namespace 软件系统服务端模版 net_soft_update_Server.LogNet = new LogNetSingle(LogSavePath + @"\update_log.txt"); //在服务器的这个路径下,放置客户端运行的所有文件,不要包含settings文件,不要从此处运行 //只放置exe和dll组件,必须放置:软件自动更新.exe - net_soft_update_Server.KeyToken = CommonHeadCode.KeyToken; + net_soft_update_Server.KeyToken = CommonLibrary.CommonProtocol.KeyToken; net_soft_update_Server.FileUpdatePath = Application.StartupPath + @"\ClientFiles";//客户端文件路径 - net_soft_update_Server.ServerStart(CommonLibrary.CommonLibrary.Port_Update_Net); + net_soft_update_Server.ServerStart(CommonLibrary.CommonProtocol.Port_Update_Net); } catch (Exception ex) { @@ -384,8 +384,8 @@ namespace 软件系统服务端模版 net_file_Advanced.FilesDirectoryPath = Application.StartupPath; net_file_Advanced.FilesDirectoryPathTemp = Application.StartupPath + @"\Temp"; net_file_Advanced.LogNet = new LogNetSingle(LogSavePath + @"\Advanced_file_log.txt"); - net_file_Advanced.KeyToken = CommonHeadCode.KeyToken; - net_file_Advanced.ServerStart(CommonLibrary.CommonLibrary.Port_Advanced_File_Server); + net_file_Advanced.KeyToken = CommonLibrary.CommonProtocol.KeyToken; + net_file_Advanced.ServerStart(CommonLibrary.CommonProtocol.Port_Advanced_File_Server); } catch (Exception ex) { @@ -408,12 +408,12 @@ namespace 软件系统服务端模版 { try { - net_simplify_server.KeyToken = CommonHeadCode.KeyToken;//设置身份令牌 + net_simplify_server.KeyToken = CommonLibrary.CommonProtocol.KeyToken;//设置身份令牌 net_simplify_server.LogNet = new LogNetSingle(LogSavePath + @"\simplify_log.txt");//日志路径 net_simplify_server.LogNet.SetMessageDegree(HslMessageDegree.DEBUG);//默认debug及以上级别日志均进行存储,根据需要自行选择 net_simplify_server.ReceiveStringEvent += Net_simplify_server_ReceiveStringEvent;//接收到字符串触发 net_simplify_server.ReceivedBytesEvent += Net_simplify_server_ReceivedBytesEvent;//接收到字节触发 - net_simplify_server.ServerStart(CommonLibrary.CommonLibrary.Port_Second_Net); + net_simplify_server.ServerStart(CommonLibrary.CommonProtocol.Port_Second_Net); net_simplify_server.ConnectTimeout = 5200; } catch (Exception ex) @@ -815,7 +815,7 @@ namespace 软件系统服务端模版 { try { - net_socket_server.KeyToken = CommonHeadCode.KeyToken;//设置身份令牌 + net_socket_server.KeyToken = CommonLibrary.CommonProtocol.KeyToken;//设置身份令牌 net_socket_server.LogNet =new LogNetSingle(LogSavePath + @"\net_log.txt"); net_socket_server.LogNet.SetMessageDegree(HslMessageDegree.DEBUG);//默认debug及以上级别日志均进行存储,根据需要自行选择 net_socket_server.FormatClientOnline = "#IP:{0} Name:{1}";//必须为#开头,具体格式可由自身需求确定 @@ -826,7 +826,7 @@ namespace 软件系统服务端模版 net_socket_server.MessageAlerts += new HslCommunication.NetBase.IEDelegate(Net_socket_server_MessageAlerts);//服务器产生提示消息触发 net_socket_server.AcceptByte += new HslCommunication.NetBase.IEDelegate(Net_socket_server_AcceptByte);//服务器接收到字节数据触发 net_socket_server.AcceptString += new HslCommunication.NetBase.IEDelegate(Net_socket_server_AcceptString);//服务器接收到字符串数据触发 - net_socket_server.ServerStart(CommonLibrary.CommonLibrary.Port_Main_Net); + net_socket_server.ServerStart(CommonLibrary.CommonProtocol.Port_Main_Net); } catch (Exception ex) { @@ -1075,7 +1075,7 @@ namespace 软件系统服务端模版 //文件信息存储路径 FileListName = Application.StartupPath + @"\files.txt" }; - net_simple_file_server.KeyToken = CommonHeadCode.KeyToken; + net_simple_file_server.KeyToken = CommonLibrary.CommonProtocol.KeyToken; net_simple_file_server.ReadFromFile(); net_simple_file_server.LogNet =new LogNetSingle(LogSavePath + @"\share_file_log.txt"); net_simple_file_server.LogNet.SetMessageDegree(HslMessageDegree.DEBUG);//默认debug及以上级别日志均进行存储,根据需要自行选择 @@ -1083,7 +1083,7 @@ namespace 软件系统服务端模版 net_simple_file_server.FilesDirectoryPath = Application.StartupPath + @"\Files"; net_simple_file_server.FilesDirectoryPathTemp = Application.StartupPath + @"\Temp"; net_simple_file_server.FileChange += Net_simple_file_server_FileChange; - net_simple_file_server.ServerStart(CommonLibrary.CommonLibrary.Port_Share_File); + net_simple_file_server.ServerStart(CommonLibrary.CommonProtocol.Port_Share_File); } catch (Exception ex) { @@ -1144,11 +1144,11 @@ namespace 软件系统服务端模版 net_udp_server = new NetUdpServer(); net_udp_server.LogNet =new LogNetSingle(LogSavePath + @"\udp_log.txt");//日志路径 net_udp_server.LogNet.SetMessageDegree(HslMessageDegree.DEBUG);//默认debug及以上级别日志均进行存储,根据需要自行选择 - net_udp_server.KeyToken = CommonHeadCode.KeyToken; + net_udp_server.KeyToken = CommonLibrary.CommonProtocol.KeyToken; net_udp_server.ReceiveCacheLength = 1024;//单次接收数据的缓冲长度 net_udp_server.AcceptByte += Net_udp_server_AcceptByte;//接收到字节数据的时候触发事件 net_udp_server.AcceptString += Net_udp_server_AcceptString;//接收到字符串数据的时候触发事件 - net_udp_server.ServerStart(CommonLibrary.CommonLibrary.Port_Udp_Server); + net_udp_server.ServerStart(CommonLibrary.CommonProtocol.Port_Udp_Server); } catch (Exception ex) {