2020-12-19 V2.1.2012.1901
*.[新增]Hosts类AddHosts函数新增支持判断是否需要更新hosts文件(不写入)。
This commit is contained in:
parent
dccac0cf64
commit
6e8d41e3d4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1421,6 +1421,14 @@
|
|||
<param name="list">要追加的内容列表,每一行为ip 域名的格式</param>
|
||||
<returns>0表示无需新增,-1表示添加失败,1表示追加成功</returns>
|
||||
</member>
|
||||
<member name="M:ryCommon.Hosts.AddHosts(System.String,System.Boolean)">
|
||||
<summary>
|
||||
write为true,追加内容到hosts里;为false,判断是否需要追加
|
||||
</summary>
|
||||
<param name="list">要追加的内容列表,每一行为ip 域名的格式</param>
|
||||
<param name="write">是否要写入,如果为false,则只判断是否需要追加,而不写入Hosts文件</param>
|
||||
<returns>0表示无需新增,-1表示添加失败,1表示追加成功</returns>
|
||||
</member>
|
||||
<member name="M:ryCommon.Hosts.AddHosts(ryCommon.HostInfo)">
|
||||
<summary>
|
||||
追加内容到hosts里
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1421,6 +1421,14 @@
|
|||
<param name="list">要追加的内容列表,每一行为ip 域名的格式</param>
|
||||
<returns>0表示无需新增,-1表示添加失败,1表示追加成功</returns>
|
||||
</member>
|
||||
<member name="M:ryCommon.Hosts.AddHosts(System.String,System.Boolean)">
|
||||
<summary>
|
||||
write为true,追加内容到hosts里;为false,判断是否需要追加
|
||||
</summary>
|
||||
<param name="list">要追加的内容列表,每一行为ip 域名的格式</param>
|
||||
<param name="write">是否要写入,如果为false,则只判断是否需要追加,而不写入Hosts文件</param>
|
||||
<returns>0表示无需新增,-1表示添加失败,1表示追加成功</returns>
|
||||
</member>
|
||||
<member name="M:ryCommon.Hosts.AddHosts(ryCommon.HostInfo)">
|
||||
<summary>
|
||||
追加内容到hosts里
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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 更新
|
||||
------
|
||||
|
||||
|
||||
|
|
Binary file not shown.
|
@ -60,6 +60,16 @@ namespace ryCommon
|
|||
/// <param name="list">要追加的内容列表,每一行为ip 域名的格式</param>
|
||||
/// <returns>0表示无需新增,-1表示添加失败,1表示追加成功</returns>
|
||||
public static int AddHosts(string list)
|
||||
{
|
||||
return AddHosts(list,true);
|
||||
}
|
||||
/// <summary>
|
||||
/// write为true,追加内容到hosts里;为false,判断是否需要追加
|
||||
/// </summary>
|
||||
/// <param name="list">要追加的内容列表,每一行为ip 域名的格式</param>
|
||||
/// <param name="write">是否要写入,如果为false,则只判断是否需要追加,而不写入Hosts文件</param>
|
||||
/// <returns>0表示无需新增,-1表示添加失败,1表示追加成功</returns>
|
||||
public static int AddHosts(string list,bool write)
|
||||
{
|
||||
var hosts_path= ryCommon.RyFiles.GetRealPath("<sys>\\drivers\\etc\\hosts");
|
||||
var content = ryCommon.RyFiles.ReadAllText(hosts_path).Trim();
|
||||
|
@ -104,6 +114,8 @@ namespace ryCommon
|
|||
}
|
||||
}
|
||||
if (isAdd)
|
||||
{
|
||||
if (write)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -127,6 +139,7 @@ namespace ryCommon
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ return 0; }
|
||||
return 1;
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”: :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.1.2012.1001")]
|
||||
[assembly: AssemblyFileVersion("2.1.2012.1001")]
|
||||
[assembly: AssemblyVersion("2.1.2012.1901")]
|
||||
[assembly: AssemblyFileVersion("2.1.2012.1901")]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user