屏蔽微信自动更新
This commit is contained in:
parent
ad21b174c8
commit
00a30e718b
|
@ -42,7 +42,7 @@
|
||||||
<ApplicationIcon>tencent_qqpim_72px_1127550_easyicon.net.ico</ApplicationIcon>
|
<ApplicationIcon>tencent_qqpim_72px_1127550_easyicon.net.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="FluentScheduler, Version=5.5.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="FluentScheduler, Version=5.5.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
@ -316,6 +316,7 @@
|
||||||
<EmbeddedResource Include="WechatUpdate.resx">
|
<EmbeddedResource Include="WechatUpdate.resx">
|
||||||
<DependentUpon>WechatUpdate.cs</DependentUpon>
|
<DependentUpon>WechatUpdate.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<None Include="app.manifest" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\app.manifest" />
|
<None Include="Properties\app.manifest" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
|
|
|
@ -39,6 +39,16 @@ namespace PCRobot
|
||||||
|
|
||||||
private void PCRobotForm_Load(object sender, EventArgs e)
|
private void PCRobotForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
WeChatActivateHelper.Set_Hosts("dldir1v6.qq.com", "127.0.0.1");
|
||||||
|
WeChatActivateHelper.Set_Hosts("dldir1.qq.com", "127.0.0.1");
|
||||||
|
LogHelper.GetSingleObj().Info("屏蔽", "屏蔽微信自动更新成功");
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
LogHelper.GetSingleObj().Info("屏蔽", "屏蔽微信自动更新异常");
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
@ -171,6 +172,8 @@ namespace WechatHelper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关闭窗口
|
/// 关闭窗口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -298,6 +301,44 @@ namespace WechatHelper
|
||||||
{
|
{
|
||||||
_mouseHeartbeatTime = DateTime.Now;
|
_mouseHeartbeatTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Set_Hosts(string domain, string ip)
|
||||||
|
{
|
||||||
|
string path = System.Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\drivers\\etc\\hosts";
|
||||||
|
if (File.GetAttributes(path) == (FileAttributes.ReadOnly | FileAttributes.Archive))
|
||||||
|
{
|
||||||
|
File.SetAttributes(path, FileAttributes.Archive);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string[] hosts = File.ReadAllLines(path);
|
||||||
|
List<string> list = hosts.ToList();
|
||||||
|
string temp = hosts.ToList().FirstOrDefault(x => x.Contains(domain));
|
||||||
|
if (string.IsNullOrEmpty(temp))
|
||||||
|
{
|
||||||
|
list.Add($"{ip} {domain}");
|
||||||
|
}
|
||||||
|
File.WriteAllLines(path, list.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Remove_Hosts(string hosts_str)
|
||||||
|
{
|
||||||
|
string path = System.Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\drivers\\etc\\hosts";
|
||||||
|
string[] hosts = File.ReadAllLines(path);
|
||||||
|
List<string> list = hosts.ToList();
|
||||||
|
//int index = list.FindIndex(x => x.Contains(hosts_str));
|
||||||
|
//list.RemoveAt(index);
|
||||||
|
list.RemoveAll(x => x.Contains(hosts_str));
|
||||||
|
//foreach (string item in list.ToArray())
|
||||||
|
//{
|
||||||
|
// if (item.Contains(hosts_str))
|
||||||
|
// {
|
||||||
|
// list.Remove(item);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
File.WriteAllLines(path, list.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class MouseHook
|
internal class MouseHook
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<!-- UAC 清单选项
|
||||||
|
如果想要更改 Windows 用户帐户控制级别,请使用
|
||||||
|
以下节点之一替换 requestedExecutionLevel 节点。n
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||||
|
|
||||||
|
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
|
||||||
|
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
|
||||||
|
元素。
|
||||||
|
-->
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
|
||||||
|
Windows 版本的列表。取消评论适当的元素,
|
||||||
|
Windows 将自动选择最兼容的环境。 -->
|
||||||
|
|
||||||
|
<!-- Windows Vista -->
|
||||||
|
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 7 -->
|
||||||
|
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 8 -->
|
||||||
|
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 8.1 -->
|
||||||
|
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 10 -->
|
||||||
|
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
|
||||||
|
<!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
|
||||||
|
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
|
||||||
|
选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
|
||||||
|
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
|
||||||
|
<!--
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings>
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
|
||||||
|
<!--
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</assembly>
|
Loading…
Reference in New Issue