diff --git a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe index 9a81bdc..42e4a34 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe and b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll b/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll index 32bcf66..36afc00 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll and b/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll index 423fd38..ee53c04 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll and b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll b/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll index ff68b7c..d87a1e1 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll and b/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/RyWeb.dll b/Bin/Debug/CommonControls/.NET4 示例/RyWeb.dll index 77ac91e..c52853d 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/RyWeb.dll and b/Bin/Debug/CommonControls/.NET4 示例/RyWeb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll b/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll index b6d8a1f..6f04428 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll and b/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll b/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll index ba3dbfd..730d957 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll and b/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb.dll b/Bin/Debug/CommonControls/.NET4/MyDb.dll index 32bcf66..36afc00 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb.dll and b/Bin/Debug/CommonControls/.NET4/MyDb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_MSSQL.dll b/Bin/Debug/CommonControls/.NET4/MyDb_MSSQL.dll index e4296eb..0caf7bc 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_MSSQL.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_MSSQL.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll index f81a391..1c3c923 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll index 423fd38..ee53c04 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/RyPrint.dll b/Bin/Debug/CommonControls/.NET4/RyPrint.dll index ff68b7c..d87a1e1 100644 Binary files a/Bin/Debug/CommonControls/.NET4/RyPrint.dll and b/Bin/Debug/CommonControls/.NET4/RyPrint.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/RyWeb.dll b/Bin/Debug/CommonControls/.NET4/RyWeb.dll index c52853d..0dce034 100644 Binary files a/Bin/Debug/CommonControls/.NET4/RyWeb.dll and b/Bin/Debug/CommonControls/.NET4/RyWeb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/ryControls.dll b/Bin/Debug/CommonControls/.NET4/ryControls.dll index b6d8a1f..6f04428 100644 Binary files a/Bin/Debug/CommonControls/.NET4/ryControls.dll and b/Bin/Debug/CommonControls/.NET4/ryControls.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/ryUpdate.dll b/Bin/Debug/CommonControls/.NET4/ryUpdate.dll index ba3dbfd..730d957 100644 Binary files a/Bin/Debug/CommonControls/.NET4/ryUpdate.dll and b/Bin/Debug/CommonControls/.NET4/ryUpdate.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe b/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe index c009282..76d7d91 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe and b/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe differ diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb.dll b/Bin/Release/CommonControls/.NET4 示例/MyDb.dll index f82a8dd..4d124eb 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/MyDb.dll and b/Bin/Release/CommonControls/.NET4 示例/MyDb.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb.xml b/Bin/Release/CommonControls/.NET4 示例/MyDb.xml index ef49181..1efd837 100644 --- a/Bin/Release/CommonControls/.NET4 示例/MyDb.xml +++ b/Bin/Release/CommonControls/.NET4 示例/MyDb.xml @@ -1421,6 +1421,14 @@ 要追加的内容列表,每一行为ip 域名的格式 0表示无需新增,-1表示添加失败,1表示追加成功 + + + write为true,追加内容到hosts里;为false,判断是否需要追加 + + 要追加的内容列表,每一行为ip 域名的格式 + 是否要写入,如果为false,则只判断是否需要追加,而不写入Hosts文件 + 0表示无需新增,-1表示添加失败,1表示追加成功 + 追加内容到hosts里 diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll index a3bbea4..b496768 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll and b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll b/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll index 3af7986..2ac72d5 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll and b/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/RyWeb.dll b/Bin/Release/CommonControls/.NET4 示例/RyWeb.dll index 77ac91e..c52853d 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/RyWeb.dll and b/Bin/Release/CommonControls/.NET4 示例/RyWeb.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/ryControls.dll b/Bin/Release/CommonControls/.NET4 示例/ryControls.dll index afc1a82..4dc7baf 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/ryControls.dll and b/Bin/Release/CommonControls/.NET4 示例/ryControls.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll b/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll index 5b80ddf..f3bf136 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll and b/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb.dll b/Bin/Release/CommonControls/.NET4/MyDb.dll index f82a8dd..4d124eb 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb.dll and b/Bin/Release/CommonControls/.NET4/MyDb.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb.xml b/Bin/Release/CommonControls/.NET4/MyDb.xml index ef49181..1efd837 100644 --- a/Bin/Release/CommonControls/.NET4/MyDb.xml +++ b/Bin/Release/CommonControls/.NET4/MyDb.xml @@ -1421,6 +1421,14 @@ 要追加的内容列表,每一行为ip 域名的格式 0表示无需新增,-1表示添加失败,1表示追加成功 + + + write为true,追加内容到hosts里;为false,判断是否需要追加 + + 要追加的内容列表,每一行为ip 域名的格式 + 是否要写入,如果为false,则只判断是否需要追加,而不写入Hosts文件 + 0表示无需新增,-1表示添加失败,1表示追加成功 + 追加内容到hosts里 diff --git a/Bin/Release/CommonControls/.NET4/MyDb_MSSQL.dll b/Bin/Release/CommonControls/.NET4/MyDb_MSSQL.dll index af0a5c5..a713f9c 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb_MSSQL.dll and b/Bin/Release/CommonControls/.NET4/MyDb_MSSQL.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll index 222da3b..fa7ae82 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll and b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll index a3bbea4..b496768 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll and b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll differ diff --git a/Bin/Release/CommonControls/.NET4/RyPrint.dll b/Bin/Release/CommonControls/.NET4/RyPrint.dll index 3af7986..2ac72d5 100644 Binary files a/Bin/Release/CommonControls/.NET4/RyPrint.dll and b/Bin/Release/CommonControls/.NET4/RyPrint.dll differ diff --git a/Bin/Release/CommonControls/.NET4/RyWeb.dll b/Bin/Release/CommonControls/.NET4/RyWeb.dll index 1afbd4e..4dc42b0 100644 Binary files a/Bin/Release/CommonControls/.NET4/RyWeb.dll and b/Bin/Release/CommonControls/.NET4/RyWeb.dll differ diff --git a/Bin/Release/CommonControls/.NET4/ryControls.dll b/Bin/Release/CommonControls/.NET4/ryControls.dll index afc1a82..4dc7baf 100644 Binary files a/Bin/Release/CommonControls/.NET4/ryControls.dll and b/Bin/Release/CommonControls/.NET4/ryControls.dll differ diff --git a/Bin/Release/CommonControls/.NET4/ryUpdate.dll b/Bin/Release/CommonControls/.NET4/ryUpdate.dll index 5b80ddf..f3bf136 100644 Binary files a/Bin/Release/CommonControls/.NET4/ryUpdate.dll and b/Bin/Release/CommonControls/.NET4/ryUpdate.dll differ diff --git a/CHANGELOG.md b/CHANGELOG.md index 77c5cb9..0703c47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,14 @@ -### 2020-12-18更新 +### 2020-12-19 dev 更新 +------ +#### MyDb V2.1.2012.1901 +- *.[新增]Hosts类AddHosts函数新增支持判断是否需要更新hosts文件(不写入)。 + +### 2020-12-18 dev 更新 ------ #### ryControls V2.1.2012.1801 - *.[修复]修复RichTextBox2控件拖动滚动条,会导致界面变花的BUG。 -### 2020-12-10更新 +### 2020-12-10 dev 更新 ------ diff --git a/Source/.vs/公用控件组V4/v16/.suo b/Source/.vs/公用控件组V4/v16/.suo index 48a5fdf..f3a732e 100644 Binary files a/Source/.vs/公用控件组V4/v16/.suo and b/Source/.vs/公用控件组V4/v16/.suo differ diff --git a/Source/MyDb/FileFuns/Hosts.cs b/Source/MyDb/FileFuns/Hosts.cs index bde7d30..673196b 100644 --- a/Source/MyDb/FileFuns/Hosts.cs +++ b/Source/MyDb/FileFuns/Hosts.cs @@ -53,13 +53,23 @@ namespace ryCommon var hosts_path = ryCommon.RyFiles.GetRealPath("\\drivers\\etc\\hosts"); var content = ryCommon.RyFiles.ReadAllText(hosts_path).Trim(); return GetHosts(content); - } + } /// /// 追加内容到hosts里 /// /// 要追加的内容列表,每一行为ip 域名的格式 + /// 0表示无需新增,-1表示添加失败,1表示追加成功 + public static int AddHosts(string list) + { + return AddHosts(list,true); + } + /// + /// write为true,追加内容到hosts里;为false,判断是否需要追加 + /// + /// 要追加的内容列表,每一行为ip 域名的格式 + /// 是否要写入,如果为false,则只判断是否需要追加,而不写入Hosts文件 /// 0表示无需新增,-1表示添加失败,1表示追加成功 - public static int AddHosts(string list) + public static int AddHosts(string list,bool write) { var hosts_path= ryCommon.RyFiles.GetRealPath("\\drivers\\etc\\hosts"); var content = ryCommon.RyFiles.ReadAllText(hosts_path).Trim(); @@ -105,26 +115,29 @@ namespace ryCommon } if (isAdd) { - try - { - content = ""; - for (int i = 0; i < from_list.Count; i++) - { - if (content.Length > 0) { content += "\r\n"; } - if (from_list[i].Comment.Length > 0) - { - content += from_list[i].Comment; - } - else - { - content += from_list[i].IP + "\t" + from_list[i].Domain; - } - } - ryCommon.RyFiles.WriteAllText(hosts_path, content, Encoding.UTF8); - } - catch - { - return -1; + if (write) + { + try + { + content = ""; + for (int i = 0; i < from_list.Count; i++) + { + if (content.Length > 0) { content += "\r\n"; } + if (from_list[i].Comment.Length > 0) + { + content += from_list[i].Comment; + } + else + { + content += from_list[i].IP + "\t" + from_list[i].Domain; + } + } + ryCommon.RyFiles.WriteAllText(hosts_path, content, Encoding.UTF8); + } + catch + { + return -1; + } } } else diff --git a/Source/MyDb/Properties/AssemblyInfo.cs b/Source/MyDb/Properties/AssemblyInfo.cs index 7d43107..b7f986d 100644 --- a/Source/MyDb/Properties/AssemblyInfo.cs +++ b/Source/MyDb/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.2012.1001")] -[assembly: AssemblyFileVersion("2.1.2012.1001")] \ No newline at end of file +[assembly: AssemblyVersion("2.1.2012.1901")] +[assembly: AssemblyFileVersion("2.1.2012.1901")] \ No newline at end of file diff --git a/Source/MyDb/bin/x86/Debug/MyDb.dll b/Source/MyDb/bin/x86/Debug/MyDb.dll index f733d64..fa36da6 100644 Binary files a/Source/MyDb/bin/x86/Debug/MyDb.dll and b/Source/MyDb/bin/x86/Debug/MyDb.dll differ diff --git a/Source/MyDb/bin/x86/Release/MyDb.dll b/Source/MyDb/bin/x86/Release/MyDb.dll index 48494f7..c4280b9 100644 Binary files a/Source/MyDb/bin/x86/Release/MyDb.dll and b/Source/MyDb/bin/x86/Release/MyDb.dll differ diff --git a/Source/ryControls/bin/x86/Debug/MyDb.dll b/Source/ryControls/bin/x86/Debug/MyDb.dll index f733d64..fa36da6 100644 Binary files a/Source/ryControls/bin/x86/Debug/MyDb.dll and b/Source/ryControls/bin/x86/Debug/MyDb.dll differ diff --git a/Source/ryControls/bin/x86/Debug/ryControls.dll b/Source/ryControls/bin/x86/Debug/ryControls.dll index a9f9189..9efa252 100644 Binary files a/Source/ryControls/bin/x86/Debug/ryControls.dll and b/Source/ryControls/bin/x86/Debug/ryControls.dll differ diff --git a/Source/ryControls/bin/x86/Release/MyDb.dll b/Source/ryControls/bin/x86/Release/MyDb.dll index 48494f7..c4280b9 100644 Binary files a/Source/ryControls/bin/x86/Release/MyDb.dll and b/Source/ryControls/bin/x86/Release/MyDb.dll differ diff --git a/Source/ryControls/bin/x86/Release/ryControls.dll b/Source/ryControls/bin/x86/Release/ryControls.dll index 2ecdcff..0d4d85e 100644 Binary files a/Source/ryControls/bin/x86/Release/ryControls.dll and b/Source/ryControls/bin/x86/Release/ryControls.dll differ