├── Bindding ├── Bindding.csproj ├── Bindding.csproj.user ├── ExcuteClasses │ ├── AboutParameter │ │ ├── CommonParameter.cs │ │ ├── ConfigParam.cs │ │ ├── ConstParameter_JS.cs │ │ ├── ConstParameters.cs │ │ ├── ContentLog.cs │ │ ├── ListContent.cs │ │ └── RunParameters.cs │ ├── BaseUserControl.cs │ ├── ChangeIp │ │ ├── IIPElfControl.cs │ │ ├── IPDevices.cs │ │ ├── IPElfControlDll.cs │ │ ├── IPElfControlExe.cs │ │ └── OperateADSL.cs │ ├── CommonFunction.cs │ ├── LicenseHelper.cs │ ├── Set-ScreenResolutionEx.cs │ └── SqliteHelper.cs ├── JavaScript1.js ├── MainForms │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── TestUCForm.Designer.cs │ ├── TestUCForm.cs │ ├── TestUCForm.resx │ └── UserControls │ │ ├── LifeSpanHandler.cs │ │ ├── RequestHandler.cs │ │ ├── UC_Browser.Designer.cs │ │ ├── UC_Browser.cs │ │ ├── UC_Browser.resx │ │ ├── UC_BrowserTabs.Designer.cs │ │ ├── UC_BrowserTabs.cs │ │ ├── UC_BrowserTabs.resx │ │ ├── UC_KeyList.Designer.cs │ │ ├── UC_KeyList.cs │ │ ├── UC_KeyList.resx │ │ ├── UC_LogsControl.Designer.cs │ │ ├── UC_LogsControl.cs │ │ ├── UC_LogsControl.resx │ │ ├── UC_MenuTitle.Designer.cs │ │ ├── UC_MenuTitle.cs │ │ ├── UC_MenuTitle.resx │ │ ├── UC_MyDataGridView_Style.Designer.cs │ │ ├── UC_MyDataGridView_Style.cs │ │ ├── UC_MyDataGridView_Style.resx │ │ ├── UC_SimpleBrower.Designer.cs │ │ ├── UC_SimpleBrower.cs │ │ ├── UC_SimpleBrower.resx │ │ ├── UC_TopControl.Designer.cs │ │ ├── UC_TopControl.cs │ │ └── UC_TopControl.resx ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Read me.txt ├── Resources │ ├── Icon.ico │ ├── nav_left_green.png │ ├── nav_plain_green.png │ ├── nav_plain_red.png │ └── nav_right_green.png ├── SQLite.Interop.dll ├── SubForms │ ├── SF_AccountInfo.Designer.cs │ ├── SF_AccountInfo.cs │ ├── SF_AccountInfo.resx │ ├── SF_ConfigForm.Designer.cs │ ├── SF_ConfigForm.cs │ ├── SF_ConfigForm.resx │ ├── SF_RegisterForm.Designer.cs │ ├── SF_RegisterForm.cs │ ├── SF_RegisterForm.resx │ ├── SF_StartupConfig.Designer.cs │ ├── SF_StartupConfig.cs │ ├── SF_StartupConfig.resx │ └── UserControls │ │ ├── BaseConfigUserControl.cs │ │ ├── UC_AdslAccount.Designer.cs │ │ ├── UC_AdslAccount.cs │ │ ├── UC_AdslAccount.resx │ │ ├── UC_ChangeIP.Designer.cs │ │ ├── UC_ChangeIP.cs │ │ ├── UC_ChangeIP.resx │ │ ├── UC_IpelfAccount.Designer.cs │ │ ├── UC_IpelfAccount.cs │ │ ├── UC_IpelfAccount.resx │ │ ├── UC_Keywords.Designer.cs │ │ ├── UC_Keywords.cs │ │ ├── UC_Keywords.resx │ │ ├── UC_SecondsMinMax.Designer.cs │ │ ├── UC_SecondsMinMax.cs │ │ ├── UC_SecondsMinMax.resx │ │ ├── UC_SimulateSpeed.Designer.cs │ │ ├── UC_SimulateSpeed.cs │ │ ├── UC_SimulateSpeed.resx │ │ ├── UC_SleepSeconds.Designer.cs │ │ ├── UC_SleepSeconds.cs │ │ └── UC_SleepSeconds.resx ├── app.config ├── config.json └── packages.config ├── BinddingV1.0.sln ├── CallProcess ├── CallProcess.csproj ├── CallProcess.csproj.user ├── CommonFunction.cs ├── ControlProcess.cs ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── HotKey.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ ├── Settings.settings │ └── app.manifest ├── SendMsg.cs └── app.config ├── LICENSE.md ├── README.md ├── ReferenceDll ├── DotRas.dll ├── EasyLicense.Lib.dll ├── SQLite.Interop.dll ├── System.Data.SQLite.dll ├── WindowsInput.dll └── log4net.dll └── RegisterMachine ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── RegisterForm.Designer.cs ├── RegisterForm.cs ├── RegisterForm.resx ├── RegisterHelper.cs ├── RegisterMachine.csproj └── packages.config /Bindding/Bindding.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ShowAllFiles 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/AboutParameter/ConfigParam.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Text; 6 | 7 | namespace Bindding.ExcuteClasses 8 | { 9 | /// 10 | /// 配置信息的类 11 | /// 12 | public class ConfigParam 13 | { 14 | /// 15 | /// 切换IP方式 16 | /// 17 | public ChangeIPType change_ip { get; set; } 18 | 19 | /// 20 | /// 循环次数 21 | /// 22 | public int loop_count { get; set; } 23 | 24 | /// 25 | /// 查询关键词(key,match) 26 | /// 27 | public List> key_match_list { get; set; } 28 | 29 | /// 30 | /// IP精灵信息 31 | /// 32 | public IpelfInfo ipelf_info { get; set; } 33 | 34 | public AdslInfo adsl_info { get; set; } 35 | 36 | /// 37 | /// 所有睡眠时间 38 | /// 39 | public SleepSeconds sleep_seconds { get; set; } 40 | 41 | /// 42 | /// 模拟操作的速度 43 | /// 44 | public SimulateSpeed simulate_speed { get; set; } 45 | } 46 | 47 | public class IpelfInfo 48 | { 49 | public string soft_path { get; set; } 50 | public string username { get; set; } 51 | public string password { get; set; } 52 | public string provice { get; set; } 53 | public string city { get; set; } 54 | } 55 | 56 | public class AdslInfo 57 | { 58 | public string username { get; set; } 59 | public string password { get; set; } 60 | } 61 | 62 | public class SleepSeconds 63 | { 64 | /// 65 | /// 多少庙后等待查询 66 | /// 67 | public RandomMinMax after_search { get; set; } 68 | 69 | public RandomMinMax baidu_search { get; set; } 70 | 71 | /// 72 | /// 弹出的页面展示时间 73 | /// 74 | public RandomMinMax pop_up { get; set; } 75 | 76 | /// 77 | /// 重连时间 78 | /// 79 | public RandomMinMax recon_time { get; set; } 80 | } 81 | 82 | public enum ChangeIPType 83 | { 84 | /// 85 | /// ADSL 拨号 86 | /// 87 | ADSL = 1, 88 | 89 | /// 90 | /// 按键精灵 91 | /// 92 | IPElf = 2, 93 | 94 | /// 95 | /// 未知 96 | /// 97 | NONE = -1 98 | } 99 | 100 | /// 101 | /// 模拟操作速度(随机时间范围) 102 | /// 103 | public class SimulateSpeed 104 | { 105 | /// 106 | /// 鼠标滚动滑轮 107 | /// 108 | public RandomMinMax mouse_scroll { get; set; } 109 | 110 | /// 111 | /// 鼠标移动到搜索框 112 | /// 113 | public RandomMinMax mouse_move_search_input { get; set; } 114 | 115 | /// 116 | /// 鼠标移动到搜索框 后,点击等待时间 117 | /// 118 | public RandomMinMax mouse_click_search_input { get; set; } 119 | 120 | /// 121 | /// 输入关键字的时间 122 | /// 123 | public RandomMinMax keyboard_keywords_speed { get; set; } 124 | } 125 | 126 | /// 127 | /// 点击数据最小,最大的范围 128 | /// 129 | public class RandomMinMax 130 | { 131 | /// 132 | /// 最小毫秒 133 | /// 134 | public int min_ms { get; set; } 135 | 136 | /// 137 | /// 最大毫秒数 138 | /// 139 | public int max_ms { get; set; } 140 | 141 | public int ToRandom() 142 | { 143 | return ConstParameter.RandomSeed.Next(min_ms, max_ms); 144 | } 145 | } 146 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/AboutParameter/ConstParameter_JS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Bindding.ExcuteClasses 4 | { 5 | /// 6 | /// js 的常量 7 | /// 8 | internal static partial class ConstParameter 9 | { 10 | #region 百度 11 | 12 | /// 13 | /// 百度 模拟点击的js 14 | /// 15 | internal static string GET_BAIDU_LIST_JS = 16 | @"'; function getBaiduContentList() { 17 | if ($('div.nums').text()) { 18 | var _retlist = []; 19 | var _title = ''; 20 | $('#head').hide(); 21 | $('#content_left div h3 a').each(function (index, el) { 22 | var singleModel = { 'title': '', 'target': '', 'link': '', 'is_ad': false, 'top': 0, 'left': 0 }; 23 | var _element = $(el); 24 | singleModel.title = _element.text(); 25 | singleModel.link = _element.attr('href'); 26 | singleModel.top = parseInt(_element.position().top); 27 | singleModel.left = parseInt(_element.position().left); 28 | if (_element.attr('data-landurl')) { 29 | if (_element.attr('data-landurl').indexOf(_matchKey) > -1) { 30 | singleModel.is_ad = true; 31 | singleModel.target = _element.attr('data-landurl'); 32 | _retlist.push(singleModel); 33 | } 34 | } else { 35 | var _tmptitle = $('a[href=\'' + _element.attr('href') + '\'][class=\'c-showurl\']').text(); 36 | if (_tmptitle.indexOf(_matchKey) > -1) { 37 | singleModel.is_ad = false; 38 | singleModel.target = _tmptitle; 39 | _retlist.push(singleModel); 40 | } 41 | } 42 | }); 43 | 44 | return JSON.stringify(_retlist); 45 | } 46 | 47 | return []; 48 | } 49 | 50 | getBaiduContentList();".Replace(Environment.NewLine, string.Empty); 51 | 52 | #endregion 百度 53 | 54 | #region 随机浏览的js 55 | 56 | /// 57 | /// 获取弹出页面的随机一个a标签 58 | /// 59 | internal static string GET_POPUP_RANDOM_A = @" 60 | function get_postition() { 61 | var _rd_n = Math.floor(Math.random() * $('a[href!=#][target=_blank]').length); 62 | var _random_a = $($('a[href!=#][target=_blank]')[_rd_n]); 63 | 64 | var singleModel = { 'title': '', 'target': '', 'link': '', 'is_ad': false, 'top': 0, 'left': 0 }; 65 | singleModel.title = _rd_n; 66 | singleModel.link = _random_a.attr('href'); 67 | singleModel.top = parseInt(_random_a.position().top); 68 | singleModel.left = parseInt(_random_a.position().left); 69 | return JSON.stringify(singleModel); 70 | } 71 | 72 | get_postition();".Replace(Environment.NewLine, string.Empty); 73 | 74 | internal static string GET_POPUP_CLICK_A = @";$('a[href!=#][target=_blank]')[_n].click();"; 75 | 76 | #endregion 随机浏览的js 77 | } 78 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/AboutParameter/ConstParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Bindding.ExcuteClasses 8 | { 9 | internal static partial class ConstParameter 10 | { 11 | #region Brower 相关参数 12 | 13 | /// 14 | /// 随机种子 15 | /// 16 | internal static Random RandomSeed = new Random(); 17 | 18 | /// 19 | /// 我创建的拨号名 20 | /// 21 | internal static string EntryName = "my_entry_name"; 22 | 23 | /// 24 | /// 浏览器距离窗体的高度 25 | /// 26 | internal const int BrowerY = 230; 27 | 28 | /// 29 | /// 搜索框距离窗体的x 30 | /// 31 | internal const int SearchX = 250; 32 | 33 | /// 34 | /// 搜索框距离窗体的y 35 | /// 36 | internal const int SearchY = 192; 37 | 38 | /// 39 | /// 默认的搜索引擎 40 | /// 41 | internal const string SEARCH_ENGINES = "https://www.baidu.com/"; 42 | 43 | /// 44 | /// 空白页面 45 | /// 46 | internal const string BLANK_PAGE = "about:blank"; 47 | 48 | /// 49 | /// 点击广告 50 | /// 51 | internal const bool CLICK_AD = true; 52 | 53 | internal const string Sqlite_DB_NAME = "bindding.db"; 54 | 55 | internal static string CookiePath = Path.Combine(Environment.CurrentDirectory, Path.Combine("MyApplication", "cookies")); 56 | internal static string CachePath = Path.Combine(Environment.CurrentDirectory, Path.Combine("MyApplication", "cache")); 57 | 58 | #endregion Brower 相关参数 59 | 60 | #region 文件路径参数 61 | 62 | /// 63 | /// 配置文件路径 64 | /// 65 | internal static string ConfigPath = Environment.CurrentDirectory + "\\config.json"; 66 | 67 | /// 68 | /// 日志类型的路径 69 | /// 70 | internal static class LogTypePath 71 | { 72 | internal static string LogDir = Path.Combine(Environment.CurrentDirectory, Path.Combine("MyApplication", "logs")); 73 | 74 | internal static string RunPath = Path.Combine(LogDir, "my_run.log"); 75 | } 76 | 77 | #endregion 文件路径参数 78 | } 79 | 80 | /// 81 | /// 允许类型 82 | /// 83 | internal enum LogType 84 | { 85 | /// 86 | /// 运行日志 87 | /// 88 | RunLog = 1 89 | } 90 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/AboutParameter/ContentLog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Bindding.ExcuteClasses.AboutParameter 4 | { 5 | internal class ContentLog 6 | { 7 | public string ch_No { get; set; } 8 | public DateTime ch_Time { get; set; } 9 | public string ch_Key { get; set; } 10 | public string ch_Title { get; set; } 11 | public string ch_Website { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/AboutParameter/ListContent.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.ExcuteClasses 2 | { 3 | public class ListContent 4 | { 5 | public string title { get; set; } 6 | 7 | public string link { get; set; } 8 | 9 | public string target { get; set; } 10 | 11 | public bool is_ad { get; set; } 12 | 13 | public int top { get; set; } 14 | 15 | public int left { get; set; } 16 | 17 | /// 18 | /// 用于列表展示 19 | /// 20 | public string ad_show 21 | { 22 | get 23 | { 24 | if (is_ad) 25 | { 26 | return "√"; 27 | } 28 | 29 | return string.Empty; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/AboutParameter/RunParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Bindding.ExcuteClasses 7 | { 8 | /// 9 | /// 运行时的参数,需要保存到硬盘中 10 | /// 11 | public class RunParameters 12 | { 13 | public int CurUserAgentIndex 14 | { 15 | get 16 | { 17 | return CommonParameter.CurrentUserAgentIndex; 18 | } 19 | set 20 | { 21 | CommonParameter.CurrentUserAgentIndex = value; 22 | } 23 | } 24 | 25 | public int CurScrRslIndex 26 | { 27 | get 28 | { 29 | return CommonParameter.CurrentScreenResolutionIndex; 30 | } 31 | set 32 | { 33 | CommonParameter.CurrentScreenResolutionIndex = value; 34 | } 35 | } 36 | 37 | public int CurLoopNo 38 | { 39 | get 40 | { 41 | return CommonParameter.CurrentLoopNum; 42 | } 43 | set 44 | { 45 | CommonParameter.CurrentLoopNum = value; 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/BaseUserControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace Bindding.ExcuteClasses 8 | { 9 | public class BaseUserControl : UserControl 10 | { 11 | protected new bool DesignMode 12 | { 13 | get 14 | { 15 | bool returnFlag = false; 16 | #if DEBUG 17 | if (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime) 18 | { 19 | returnFlag = true; 20 | } 21 | else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToUpper().Equals("DEVENV")) 22 | { 23 | returnFlag = true; 24 | } 25 | #endif 26 | return returnFlag; 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/ChangeIp/IIPElfControl.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Bindding.ExcuteClasses 4 | { 5 | public interface IIpelfControl 6 | { 7 | string InitLogin(); 8 | 9 | string IPGetUserInfo(); 10 | 11 | List IPGetProvices(); 12 | 13 | List IPGetCitys(string _provice); 14 | 15 | bool IPConnect(); 16 | 17 | bool IPDisConnect(); 18 | 19 | void IPUnInit(); 20 | 21 | string IPStatus(); 22 | } 23 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/ChangeIp/IPDevices.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Bindding.ExcuteClasses 4 | { 5 | internal delegate int InitCallBack(int _result); 6 | 7 | internal static class IPDevices 8 | { 9 | /// 10 | /// 初始化 11 | /// 12 | /// 用户名 13 | /// 密码 14 | /// 注册的回调函数 15 | /// 返回 0成功,返回其它失败,1初始化失败,2用户名密码验证失败 16 | [DllImport("ipDevices.dll", EntryPoint = "IPInit", CallingConvention = CallingConvention.StdCall)] 17 | internal static extern int IPInit(string _name, string _pwd, InitCallBack _callback); 18 | 19 | /// 20 | /// 获取用户信息 21 | /// 22 | /// 返回用户基本信息以\r\n 分割 23 | [DllImport("ipDevices.dll", EntryPoint = "IPGetUserInfo", CallingConvention = CallingConvention.StdCall)] 24 | internal static extern string IPGetUserInfo(); 25 | 26 | /// 27 | /// 获取普通线路列表 28 | /// 29 | /// 返回线路列表,每条线路以\r\n区分开,返回数据空为失败 30 | [DllImport("ipDevices.dll", EntryPoint = "IPGetLines", CallingConvention = CallingConvention.StdCall)] 31 | internal static extern string IPGetLines(); 32 | 33 | /// 34 | /// 获取混拨省份列表 35 | /// 36 | /// 返回混拨省份列表,每个省份以\r\n区分开,返回数据空为失败 37 | [DllImport("ipDevices.dll", EntryPoint = "IPGetProvices", CallingConvention = CallingConvention.StdCall)] 38 | internal static extern string IPGetProvices(); 39 | 40 | /// 41 | /// 根据省份名获取混拨城市列表 42 | /// 43 | /// 传入省份名称 44 | /// 返回混拨城市列表,每条线路以\r\n区分开,返回数据空为失败 45 | [DllImport("ipDevices.dll", EntryPoint = "IPGetCitys", CallingConvention = CallingConvention.StdCall)] 46 | internal static extern string IPGetCitys(string _provice); 47 | 48 | /// 49 | /// 普通线路的连接 50 | /// 注意:只有在回调函数中状态值为0,或者22,23时才能连接 51 | /// 52 | /// 服务器名称 53 | /// 连接方式,见上面的枚举 54 | /// 返回 0为调用成功,其它为调用失败,调用成功后可以在回调函数中看到具体的连接返回 55 | [DllImport("ipDevices.dll", EntryPoint = "IPConnect", CallingConvention = CallingConvention.StdCall)] 56 | internal static extern int IPConnect(string _serverName, VPN_LINKPATTERN _linkType); 57 | 58 | /// 59 | /// 混拨线路的连接 60 | /// 注意:只有在回调函数中状态值为0,或者22,23时才能连接 61 | /// 62 | /// 混拨省份名称 为空为所有线路 63 | /// 混拨城市名称 64 | /// 几天内不重复IP 65 | /// 连接方式,见上面的枚举 66 | /// 返回 0为调用成功,其它为调用失败,调用成功后可以在回调函数中看到具体的连接返回 67 | [DllImport("ipDevices.dll", EntryPoint = "IPHbConnect", CallingConvention = CallingConvention.StdCall)] 68 | internal static extern int IPHbConnect(string _provice, string _city, int _date, VPN_LINKPATTERN _linkType); 69 | 70 | /// 71 | /// 断开连接 72 | /// 73 | /// linkType:连接方式,见上面的枚举 74 | /// 正常返回0 注意:状态为11的时候为连接成功,可以使用该函数 75 | [DllImport("ipDevices.dll", EntryPoint = "IPDisConnect", CallingConvention = CallingConvention.StdCall)] 76 | internal static extern int IPDisConnect(VPN_LINKPATTERN _linkType); 77 | 78 | /// 79 | /// 正常退出,退出登录 80 | /// 81 | /// 正常返回0 82 | [DllImport("ipDevices.dll", EntryPoint = "IPUnInit", CallingConvention = CallingConvention.StdCall)] 83 | internal static extern int IPUnInit(); 84 | } 85 | 86 | internal enum CONNSTATE 87 | { 88 | SE_INIT = 1, // 1:初始化 89 | SE_GETDEIVCES = 2, // 2:获取驱动 90 | SE_INSTALLDEVICES = 3, // 3:安装驱动. 91 | SE_INSTALLERR = 4, // 4:安装驱动失败 92 | SE_CERTAUTH = 5, // 5: 服务器证书验证 93 | SE_USERAUTH = 6, // 6:用户身份验证 94 | SE_SESSCONNECTION = 7, // 7:建立会话 95 | SE_REDIRECT = 8, // 8:重定向连接 96 | SE_SESSCONNECTING = 9, // 9: 会话建立 97 | SE_SESSCONNECTED = 10, // 10:会话建立成功 98 | SE_CONNECTEDSUSS = 11, // 11:sevpn连接已经建立 99 | SE_STARTDISCONNECT = 20, // 20: 断开中 100 | SE_DISCONNECTED = 21, // 21: 已断开 101 | SE_CONNECTERROR = 22, // 22: 连接失败 102 | SE_UNKNOWNERROR = 23, // 23: 已断开 103 | 104 | // 以下是L2TP的连接断开状态 105 | OPENPORT = 100, // 打开端口 106 | 107 | PORTOPENED = 101, // 端口打开 108 | CONNECTDEVICE = 102, // 连接设备 109 | DEVICECONNECTED = 103, // 连接设备中 110 | ALLDEVICESCONNECTED = 104, // 设备已连接 111 | AUTHENTICATE = 105, // 开始认证 112 | AUTHNOTIFY = 106, // 认证中 113 | AUTHPROJECT = 107, // 认证项目 114 | PROJECTED = 108, // 已认证项目 115 | AUTHENTICATED = 109, // 认证通过 116 | UNKNOWN = 110, 117 | CONNECTED = 111, // 连接成功 118 | DISCONNECTING = 112, // 断开连接中 119 | DISCONNECTED = 113, // 已断开 120 | CONNECTING = 114, // 连接中 121 | CONNECTFAILED = 115, // 连接失败 122 | 123 | UNKNOWN_MSG = 120, 124 | }; 125 | 126 | internal enum ERROR_TYPE 127 | { 128 | SUSS = 0, 129 | INIT_ERROR = 1, // 未初始化,或者初始化失败 130 | AUTH_ERROR = 2, // 用户验证失败或者失效 131 | DEVICE_ERROR = 3, // 所给的服务ID不正确,可能是未找到该服务器 132 | LINE_ERROR = 4, // 获取线路失败 133 | LINEING = 5, // 已经在连接中 134 | LINE_DIAL = 6, // 线路在拨号中 135 | 136 | //LINE_DIAL = 6, // 没有符合条件的线路连接 137 | PARAM_ERROR = 100, //参数错误 138 | }; 139 | 140 | internal enum VPN_LINKPATTERN 141 | { 142 | SEVPN, 143 | L2TP, 144 | PPTP, 145 | OPENVPN 146 | }; 147 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/ChangeIp/IPElfControlDll.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Bindding.ExcuteClasses 5 | { 6 | /// 7 | /// IP精灵 控制 dll 方式 8 | /// 9 | internal class IpelfControlDll : IIpelfControl 10 | { 11 | /// 12 | /// 登录 13 | /// 14 | /// 15 | public string InitLogin() 16 | { 17 | if (CommonParameter.IPElfIsInit) 18 | { 19 | return string.Empty; 20 | } 21 | 22 | string _name = CommonParameter.ConfigParam.ipelf_info.username; 23 | string _pwd = CommonParameter.ConfigParam.ipelf_info.password; 24 | int retCode = IPDevices.IPInit(_name, _pwd, (_param) => 25 | { 26 | CommonFunction.WriteLogInFile(_param.ToString() + " " + Enum.GetName(typeof(CONNSTATE), _param), LogType.RunLog); 27 | return 0; 28 | }); 29 | 30 | switch (retCode) 31 | { 32 | case 0: // 成功 33 | CommonParameter.IPElfIsInit = true; 34 | break; 35 | 36 | case 1: 37 | CommonFunction.WriteLogInFile("IP精灵 初始化失败", LogType.RunLog); 38 | return "IP精灵 初始化失败"; 39 | 40 | case 2: 41 | CommonFunction.WriteLogInFile("IP精灵 初始化失败", LogType.RunLog); 42 | return "IP精灵 用户名或密码验证失败"; 43 | } 44 | 45 | return string.Empty; 46 | } 47 | 48 | public string IPGetUserInfo() 49 | { 50 | return IPDevices.IPGetUserInfo(); 51 | } 52 | 53 | public List IPGetProvices() 54 | { 55 | string _provices = IPDevices.IPGetProvices(); 56 | List _provicesList = new List(_provices.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)); 57 | return _provicesList; 58 | } 59 | 60 | public List IPGetCitys(string _provice) 61 | { 62 | string _cities = IPDevices.IPGetCitys(_provice); 63 | List __citiesList = new List(_cities.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)); 64 | return __citiesList; 65 | } 66 | 67 | /// 68 | /// 混播链接 默认一天,使用openvpn 69 | /// 70 | /// 71 | public bool IPConnect() 72 | { 73 | string _provice = CommonParameter.ConfigParam.ipelf_info.provice; 74 | string _city = CommonParameter.ConfigParam.ipelf_info.city; 75 | int _code = IPDevices.IPHbConnect( 76 | _provice == "所有" ? string.Empty : _provice, 77 | _city == "所有" ? string.Empty : _city, 1, VPN_LINKPATTERN.SEVPN); 78 | if (_code == 0) 79 | { 80 | return true; 81 | } 82 | else 83 | { 84 | CommonFunction.WriteLogInFile(string.Format("混播连接失败,{0}。参数 {1},{2}", Enum.GetName(typeof(ERROR_TYPE), _code), _provice, _city), LogType.RunLog); 85 | return false; 86 | } 87 | } 88 | 89 | public bool IPDisConnect() 90 | { 91 | int _code = IPDevices.IPDisConnect(VPN_LINKPATTERN.SEVPN); 92 | if (_code == 0) 93 | { 94 | return true; 95 | } 96 | else 97 | { 98 | CommonFunction.WriteLogInFile("混播断开连接失败:" + Enum.GetName(typeof(ERROR_TYPE), _code), LogType.RunLog); 99 | return false; 100 | } 101 | } 102 | 103 | public string IPStatus() 104 | { 105 | return "暂无设计"; 106 | } 107 | 108 | /// 109 | /// 软件退出 110 | /// 111 | public void IPUnInit() 112 | { 113 | if (!CommonParameter.IPElfIsInit) 114 | { 115 | return; 116 | } 117 | 118 | if (IPDevices.IPUnInit() == 0) 119 | { 120 | CommonFunction.WriteLogInFile("IP精灵,正常退出!", LogType.RunLog); 121 | } 122 | else 123 | { 124 | CommonFunction.WriteLogInFile("IP精灵,退出失败!", LogType.RunLog); 125 | } 126 | } 127 | } 128 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/ChangeIp/OperateADSL.cs: -------------------------------------------------------------------------------- 1 | using DotRas; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.Net; 7 | using System.Text; 8 | using System.Threading; 9 | 10 | namespace Bindding.ExcuteClasses 11 | { 12 | public class OperateADSL 13 | { 14 | /// 15 | /// 创建或更新一个PPPOE连接(指定PPPOE名称) 16 | /// 17 | public void CreateOrUpdatePPPOE(string updatePPPOEname) 18 | { 19 | RasDialer dialer = new RasDialer(); 20 | RasPhoneBook allUsersPhoneBook = new RasPhoneBook(); 21 | string path = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers); 22 | allUsersPhoneBook.Open(path); 23 | 24 | if (allUsersPhoneBook.Entries.Contains(updatePPPOEname)) 25 | { 26 | allUsersPhoneBook.Entries[updatePPPOEname].PhoneNumber = " "; 27 | // 不管当前PPPOE是否连接,服务器地址的更新总能成功,如果正在连接,则需要PPPOE重启后才能起作用 28 | allUsersPhoneBook.Entries[updatePPPOEname].Update(); 29 | } 30 | else 31 | { 32 | string adds = string.Empty; 33 | ReadOnlyCollection readOnlyCollection = RasDevice.GetDevices(); 34 | // Find the device that will be used to dial the connection. 35 | RasDevice device = RasDevice.GetDevices().Where(o => o.DeviceType == RasDeviceType.PPPoE).First(); 36 | RasEntry entry = RasEntry.CreateBroadbandEntry(updatePPPOEname, device); //建立宽带连接Entry 37 | entry.PhoneNumber = " "; 38 | allUsersPhoneBook.Entries.Add(entry); 39 | } 40 | } 41 | 42 | /// 43 | /// ADSL链接 44 | /// 45 | /// 连接名称 46 | public bool Connect() 47 | { 48 | try 49 | { 50 | // CreateOrUpdatePPPOE(strConnName); 51 | RasDialer dialer = new RasDialer(); 52 | dialer.EntryName = ConstParameter.EntryName; 53 | dialer.PhoneNumber = " "; 54 | dialer.AllowUseStoredCredentials = true; 55 | dialer.PhoneBookPath = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers); 56 | dialer.Credentials = new NetworkCredential( 57 | CommonParameter.ConfigParam.adsl_info.username, 58 | CommonParameter.ConfigParam.adsl_info.password); 59 | dialer.Timeout = 1000; 60 | RasHandle myras = dialer.Dial(); 61 | if (!myras.IsInvalid) 62 | { 63 | CommonFunction.WriteLogInFile("RasDialer Success! ", LogType.RunLog); 64 | return true; 65 | } 66 | } 67 | catch (Exception ex) 68 | { 69 | CommonFunction.WriteLogInFile("RasDialer error! error is :" + ex.ToString(), LogType.RunLog); 70 | } 71 | 72 | return false; 73 | } 74 | 75 | public bool DisConnenct() 76 | { 77 | try 78 | { 79 | ReadOnlyCollection conList = RasConnection.GetActiveConnections(); 80 | foreach (RasConnection con in conList) 81 | { 82 | if (con.EntryName == ConstParameter.EntryName 83 | && con.GetConnectionStatus().ConnectionState == RasConnectionState.Connected) 84 | { 85 | string ipAddresses = this.GetIPAddress(); 86 | con.HangUp(); 87 | CommonFunction.WriteLogInFile("RasDialer HangUp!IP:" + ipAddresses, LogType.RunLog); 88 | return true; 89 | } 90 | } 91 | } 92 | catch (Exception ex) 93 | { 94 | CommonFunction.WriteLogInFile("RasDialer HangUp error! error is :" + ex.ToString(), LogType.RunLog); 95 | } 96 | 97 | return false; 98 | } 99 | 100 | public void ReConnect() 101 | { 102 | DisConnenct(); 103 | Thread.Sleep(CommonParameter.ConfigParam.sleep_seconds.recon_time.ToRandom()); 104 | Connect(); 105 | } 106 | 107 | /// 108 | /// 获取当前的ADSL ip 109 | /// 110 | /// 111 | /// 112 | private string GetIPAddress() 113 | { 114 | string ipAddress = string.Empty; 115 | var conns = RasConnection.GetActiveConnections(); 116 | foreach (var conn in conns) 117 | { 118 | if (conn.Device.DeviceType == RasDeviceType.PPPoE) 119 | { 120 | RasIPInfo ipAddresses = (RasIPInfo)conn.GetProjectionInfo(RasProjectionType.IP); 121 | ipAddress = ipAddresses.IPAddress.ToString(); 122 | return ipAddress; 123 | } 124 | } 125 | 126 | return string.Empty; 127 | } 128 | } 129 | } -------------------------------------------------------------------------------- /Bindding/ExcuteClasses/Set-ScreenResolutionEx.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/Bindding/ExcuteClasses/Set-ScreenResolutionEx.cs -------------------------------------------------------------------------------- /Bindding/JavaScript1.js: -------------------------------------------------------------------------------- 1 | function get_postition() { 2 | var _rd_n = Math.floor(Math.random() * $('a').length); 3 | var _random_a = $($('a')[_rd_n]); 4 | _random_a.attr('target', '_blank'); 5 | 6 | var singleModel = { 'title': '', 'target': '', 'link': '', 'is_ad': false, 'top': 0, 'left': 0 }; 7 | singleModel.title = _rd_n; 8 | singleModel.link = _random_a.attr('href'); 9 | singleModel.top = parseInt(_random_a.position().top); 10 | singleModel.left = parseInt(_random_a.position().left); 11 | return singleModel; 12 | } 13 | get_postition(); 14 | _random_a[0].click(); -------------------------------------------------------------------------------- /Bindding/MainForms/TestUCForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.MainForms 2 | { 3 | partial class TestUCForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.uC_LogsControl1 = new Bindding.MainForms.UserControls.UC_LogsControl(); 32 | this.SuspendLayout(); 33 | // 34 | // uC_LogsControl1 35 | // 36 | this.uC_LogsControl1.Location = new System.Drawing.Point(139, 39); 37 | this.uC_LogsControl1.Name = "uC_LogsControl1"; 38 | this.uC_LogsControl1.Size = new System.Drawing.Size(577, 236); 39 | this.uC_LogsControl1.TabIndex = 0; 40 | // 41 | // TestUCForm 42 | // 43 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 44 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 45 | this.ClientSize = new System.Drawing.Size(854, 399); 46 | this.Controls.Add(this.uC_LogsControl1); 47 | this.Name = "TestUCForm"; 48 | this.Text = "TestUCForm"; 49 | this.ResumeLayout(false); 50 | 51 | } 52 | 53 | #endregion 54 | 55 | private UserControls.UC_LogsControl uC_LogsControl1; 56 | 57 | 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /Bindding/MainForms/TestUCForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace Bindding.MainForms 11 | { 12 | public partial class TestUCForm : Form 13 | { 14 | public TestUCForm() 15 | { 16 | InitializeComponent(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Bindding/MainForms/TestUCForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/LifeSpanHandler.cs: -------------------------------------------------------------------------------- 1 | using CefSharp; 2 | using System; 3 | 4 | namespace Bindding.MainForms.UserControls 5 | { 6 | internal class LifeSpanHandler : ILifeSpanHandler 7 | { 8 | /// 9 | /// 弹出的事件 10 | /// 11 | internal event EventHandler MyBeforPopup; 12 | 13 | public bool DoClose(IWebBrowser browserControl, IBrowser browser) 14 | { 15 | return false; 16 | } 17 | 18 | public void OnAfterCreated(IWebBrowser browserControl, IBrowser browser) 19 | { 20 | } 21 | 22 | public void OnBeforeClose(IWebBrowser browserControl, IBrowser browser) 23 | { 24 | } 25 | 26 | public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) 27 | { 28 | if (MyBeforPopup != null) 29 | { 30 | MyBeforPopup(targetUrl, null); 31 | } 32 | 33 | newBrowser = null; 34 | return true; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/RequestHandler.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using CefSharp; 3 | 4 | namespace Bindding.MainForms.UserControls 5 | { 6 | public class RequestHandler : IRequestHandler 7 | { 8 | public bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) 9 | { 10 | return false; 11 | } 12 | 13 | public IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response) 14 | { 15 | return null; 16 | } 17 | 18 | public bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect) 19 | { 20 | return false; 21 | } 22 | 23 | public CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback) 24 | { 25 | var headers = request.Headers; 26 | headers["User-Agent"] = CommonParameter.CurrentUserAgentValue; 27 | request.Headers = headers; 28 | return CefReturnValue.Continue; 29 | } 30 | 31 | public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback) 32 | { 33 | return false; 34 | } 35 | 36 | public bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture) 37 | { 38 | return false; 39 | } 40 | 41 | public void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath) 42 | { 43 | } 44 | 45 | public bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url) 46 | { 47 | return false; 48 | } 49 | 50 | public bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, IRequestCallback callback) 51 | { 52 | return false; 53 | } 54 | 55 | public void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status) 56 | { 57 | } 58 | 59 | public void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser) 60 | { 61 | } 62 | 63 | public void OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, UrlRequestStatus status, long receivedContentLength) 64 | { 65 | } 66 | 67 | public void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, ref string newUrl) 68 | { 69 | } 70 | 71 | public bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response) 72 | { 73 | return false; 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_BrowserTabs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using CefSharp.WinForms.Internals; 10 | using Bindding.ExcuteClasses; 11 | 12 | namespace Bindding.MainForms.UserControls 13 | { 14 | public partial class UC_BrowserTabs : BaseUserControl 15 | { 16 | public UC_BrowserTabs() 17 | { 18 | InitializeComponent(); 19 | this.uc_search_page.MyNextSearch += (o1, e1) => 20 | { 21 | this.InvokeOnUiThreadIfRequired(() => 22 | { 23 | this.uc_tab_browsers.SelectTab(0); 24 | }); 25 | }; 26 | 27 | this.uc_search_page.MyBeforPopup += (o1, e1) => 28 | { 29 | this.InvokeOnUiThreadIfRequired(() => 30 | { 31 | this.uc_pop_page.UrlText = o1.ToString(); 32 | this.uc_tab_browsers.SelectTab(1); 33 | }); 34 | }; 35 | 36 | this.uc_pop_page.MyBeforPopup += (o1, e1) => 37 | { 38 | this.InvokeOnUiThreadIfRequired(() => 39 | { 40 | this.uc_second_page.UrlText = o1.ToString(); 41 | this.uc_tab_browsers.SelectTab(2); 42 | }); 43 | }; 44 | 45 | if (!DesignMode) 46 | { 47 | this.uc_search_page.InitialBrower(); 48 | this.uc_pop_page.InitialBrower(); 49 | this.uc_second_page.InitialBrower(); 50 | } 51 | } 52 | 53 | internal UC_Browser main_browser 54 | { 55 | get 56 | { 57 | return this.uc_search_page; 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_KeyList.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.MainForms.UserControls 2 | { 3 | partial class UC_KeyList 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.lbTotalNum = new System.Windows.Forms.Label(); 32 | this.label4 = new System.Windows.Forms.Label(); 33 | this.lbCurrentNum = new System.Windows.Forms.Label(); 34 | this.label3 = new System.Windows.Forms.Label(); 35 | this.uC_MyDataGridView_Style1 = new Bindding.MainForms.UserControls.UC_MyDataGridView_Style(); 36 | this.SuspendLayout(); 37 | // 38 | // lbTotalNum 39 | // 40 | this.lbTotalNum.AutoSize = true; 41 | this.lbTotalNum.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 42 | this.lbTotalNum.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); 43 | this.lbTotalNum.Location = new System.Drawing.Point(112, 11); 44 | this.lbTotalNum.Name = "lbTotalNum"; 45 | this.lbTotalNum.Size = new System.Drawing.Size(26, 16); 46 | this.lbTotalNum.TabIndex = 21; 47 | this.lbTotalNum.Text = "10"; 48 | // 49 | // label4 50 | // 51 | this.label4.AutoSize = true; 52 | this.label4.Location = new System.Drawing.Point(71, 15); 53 | this.label4.Name = "label4"; 54 | this.label4.Size = new System.Drawing.Size(35, 12); 55 | this.label4.TabIndex = 20; 56 | this.label4.Text = "次 共"; 57 | // 58 | // lbCurrentNum 59 | // 60 | this.lbCurrentNum.AutoSize = true; 61 | this.lbCurrentNum.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 62 | this.lbCurrentNum.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); 63 | this.lbCurrentNum.Location = new System.Drawing.Point(48, 11); 64 | this.lbCurrentNum.Name = "lbCurrentNum"; 65 | this.lbCurrentNum.Size = new System.Drawing.Size(17, 16); 66 | this.lbCurrentNum.TabIndex = 19; 67 | this.lbCurrentNum.Text = "1"; 68 | // 69 | // label3 70 | // 71 | this.label3.AutoSize = true; 72 | this.label3.Location = new System.Drawing.Point(26, 15); 73 | this.label3.Name = "label3"; 74 | this.label3.Size = new System.Drawing.Size(17, 12); 75 | this.label3.TabIndex = 18; 76 | this.label3.Text = "第"; 77 | // 78 | // uC_MyDataGridView_Style1 79 | // 80 | this.uC_MyDataGridView_Style1.Dock = System.Windows.Forms.DockStyle.Bottom; 81 | this.uC_MyDataGridView_Style1.Location = new System.Drawing.Point(0, 30); 82 | this.uC_MyDataGridView_Style1.Name = "uC_MyDataGridView_Style1"; 83 | this.uC_MyDataGridView_Style1.Size = new System.Drawing.Size(180, 100); 84 | this.uC_MyDataGridView_Style1.TabIndex = 0; 85 | // 86 | // UC_KeyList 87 | // 88 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 89 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 90 | this.Controls.Add(this.lbTotalNum); 91 | this.Controls.Add(this.label4); 92 | this.Controls.Add(this.lbCurrentNum); 93 | this.Controls.Add(this.label3); 94 | this.Controls.Add(this.uC_MyDataGridView_Style1); 95 | this.Name = "UC_KeyList"; 96 | this.Size = new System.Drawing.Size(180, 130); 97 | this.ResumeLayout(false); 98 | this.PerformLayout(); 99 | 100 | } 101 | 102 | #endregion 103 | 104 | private UC_MyDataGridView_Style uC_MyDataGridView_Style1; 105 | private System.Windows.Forms.Label lbTotalNum; 106 | private System.Windows.Forms.Label label4; 107 | private System.Windows.Forms.Label lbCurrentNum; 108 | private System.Windows.Forms.Label label3; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_KeyList.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Windows.Forms; 6 | 7 | namespace Bindding.MainForms.UserControls 8 | { 9 | public partial class UC_KeyList : BaseUserControl 10 | { 11 | private DataGridView dgv_keys; 12 | 13 | public UC_KeyList() 14 | { 15 | InitializeComponent(); 16 | this.dgv_keys = this.uC_MyDataGridView_Style1.MyDataGridView; 17 | this.dgv_keys.Columns.AddRange(InitDGVHeader()); 18 | if (!DesignMode) 19 | { 20 | this.dgv_keys.DataSource = this.DGVDataSource; 21 | } 22 | } 23 | 24 | public int MyCurrentNum 25 | { 26 | set 27 | { 28 | if (this.IsHandleCreated) 29 | { 30 | this.lbCurrentNum.Invoke(new Action(() => { this.lbCurrentNum.Text = value.ToString(); })); 31 | } 32 | else 33 | { 34 | this.lbCurrentNum.Text = value.ToString(); 35 | } 36 | } 37 | } 38 | 39 | #region 设置表头 40 | 41 | private DataGridViewTextBoxColumn ch_key; 42 | private DataGridViewTextBoxColumn ch_value; 43 | 44 | private DataGridViewColumn[] InitDGVHeader() 45 | { 46 | this.ch_key = new DataGridViewTextBoxColumn(); 47 | this.ch_value = new DataGridViewTextBoxColumn(); 48 | 49 | // 50 | // key 51 | // 52 | this.ch_key.DataPropertyName = "Key"; 53 | this.ch_key.Frozen = true; 54 | this.ch_key.HeaderText = "关键字"; 55 | this.ch_key.Name = "ch_No"; 56 | this.ch_key.ReadOnly = true; 57 | this.ch_key.Width = 80; 58 | // 59 | // value 60 | // 61 | this.ch_value.DataPropertyName = "Value"; 62 | this.ch_value.Frozen = true; 63 | this.ch_value.HeaderText = "匹配域名"; 64 | this.ch_value.Name = "ch_Time"; 65 | this.ch_value.Width = 100; 66 | 67 | var _columns = new DataGridViewColumn[] { 68 | this.ch_key, 69 | this.ch_value}; 70 | 71 | return _columns; 72 | } 73 | 74 | #endregion 设置表头 75 | 76 | private BindingList> _dataSource; 77 | 78 | private BindingList> DGVDataSource 79 | { 80 | get 81 | { 82 | if (_dataSource == null) 83 | { 84 | this.RefreshData(); 85 | } 86 | 87 | return _dataSource; 88 | } 89 | } 90 | 91 | internal void RefreshData() 92 | { 93 | this.lbTotalNum.Text = CommonParameter.ConfigParam.loop_count.ToString(); 94 | _dataSource = new BindingList>(); 95 | CommonParameter.ConfigParam.key_match_list.ForEach(x => 96 | { 97 | _dataSource.Add(new KeyValuePair(x.Key, x.Value)); 98 | }); 99 | 100 | this.dgv_keys.DataSource = _dataSource; 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_LogsControl.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.MainForms.UserControls 2 | { 3 | partial class UC_LogsControl 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btn_DelLog = new System.Windows.Forms.Button(); 32 | this.btn_CleanLog = new System.Windows.Forms.Button(); 33 | this.btn_ExportLog = new System.Windows.Forms.Button(); 34 | this.uC_MyDataGridView_Style1 = new Bindding.MainForms.UserControls.UC_MyDataGridView_Style(); 35 | this.lb_ip_address = new System.Windows.Forms.Label(); 36 | this.SuspendLayout(); 37 | // 38 | // btn_DelLog 39 | // 40 | this.btn_DelLog.Location = new System.Drawing.Point(253, 3); 41 | this.btn_DelLog.Name = "btn_DelLog"; 42 | this.btn_DelLog.Size = new System.Drawing.Size(75, 23); 43 | this.btn_DelLog.TabIndex = 1; 44 | this.btn_DelLog.Text = "删除日志"; 45 | this.btn_DelLog.UseVisualStyleBackColor = true; 46 | this.btn_DelLog.Click += new System.EventHandler(this.btn_DelLog_Click); 47 | // 48 | // btn_CleanLog 49 | // 50 | this.btn_CleanLog.Location = new System.Drawing.Point(334, 3); 51 | this.btn_CleanLog.Name = "btn_CleanLog"; 52 | this.btn_CleanLog.Size = new System.Drawing.Size(75, 23); 53 | this.btn_CleanLog.TabIndex = 2; 54 | this.btn_CleanLog.Text = "清空日志"; 55 | this.btn_CleanLog.UseVisualStyleBackColor = true; 56 | this.btn_CleanLog.Click += new System.EventHandler(this.btn_CleanLog_Click); 57 | // 58 | // btn_ExportLog 59 | // 60 | this.btn_ExportLog.Location = new System.Drawing.Point(415, 3); 61 | this.btn_ExportLog.Name = "btn_ExportLog"; 62 | this.btn_ExportLog.Size = new System.Drawing.Size(75, 23); 63 | this.btn_ExportLog.TabIndex = 3; 64 | this.btn_ExportLog.Text = "导出日志"; 65 | this.btn_ExportLog.UseVisualStyleBackColor = true; 66 | this.btn_ExportLog.Click += new System.EventHandler(this.btn_ExportLog_Click); 67 | // 68 | // uC_MyDataGridView_Style1 69 | // 70 | this.uC_MyDataGridView_Style1.Dock = System.Windows.Forms.DockStyle.Bottom; 71 | this.uC_MyDataGridView_Style1.Location = new System.Drawing.Point(0, 30); 72 | this.uC_MyDataGridView_Style1.Name = "uC_MyDataGridView_Style1"; 73 | this.uC_MyDataGridView_Style1.Size = new System.Drawing.Size(520, 100); 74 | this.uC_MyDataGridView_Style1.TabIndex = 5; 75 | // 76 | // lb_ip_address 77 | // 78 | this.lb_ip_address.AutoSize = true; 79 | this.lb_ip_address.Location = new System.Drawing.Point(3, 8); 80 | this.lb_ip_address.Name = "lb_ip_address"; 81 | this.lb_ip_address.Size = new System.Drawing.Size(89, 12); 82 | this.lb_ip_address.TabIndex = 6; 83 | this.lb_ip_address.Text = "未检测到IP地址"; 84 | // 85 | // UC_LogsControl 86 | // 87 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 88 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 89 | this.Controls.Add(this.lb_ip_address); 90 | this.Controls.Add(this.uC_MyDataGridView_Style1); 91 | this.Controls.Add(this.btn_ExportLog); 92 | this.Controls.Add(this.btn_CleanLog); 93 | this.Controls.Add(this.btn_DelLog); 94 | this.Name = "UC_LogsControl"; 95 | this.Size = new System.Drawing.Size(520, 130); 96 | this.ResumeLayout(false); 97 | this.PerformLayout(); 98 | 99 | } 100 | 101 | #endregion 102 | 103 | private System.Windows.Forms.Button btn_DelLog; 104 | private System.Windows.Forms.Button btn_CleanLog; 105 | private System.Windows.Forms.Button btn_ExportLog; 106 | private UC_MyDataGridView_Style uC_MyDataGridView_Style1; 107 | private System.Windows.Forms.Label lb_ip_address; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_MenuTitle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using Bindding.ExcuteClasses; 10 | using Bindding.SubForms; 11 | 12 | namespace Bindding.MainForms.UserControls 13 | { 14 | /// 15 | /// 标题控件 16 | /// 17 | public partial class UC_MenuTitle : BaseUserControl 18 | { 19 | internal event EventHandler OnStartupClosed; 20 | 21 | public UC_MenuTitle() 22 | { 23 | InitializeComponent(); 24 | } 25 | 26 | private void tsmi_config_startup_Click(object sender, EventArgs e) 27 | { 28 | SF_StartupConfig _myform = new SF_StartupConfig(); 29 | _myform.StartPosition = FormStartPosition.CenterParent; 30 | _myform.FormClosed += (o1, e1) => OnStartupClosed(null, null); 31 | _myform.ShowDialog(); 32 | } 33 | 34 | private void tsmi_config_account_Click(object sender, EventArgs e) 35 | { 36 | SF_AccountInfo _myform = new SF_AccountInfo(); 37 | _myform.StartPosition = FormStartPosition.CenterParent; 38 | _myform.FormClosed += (o1, e1) => 39 | { 40 | if (!string.IsNullOrEmpty(CommonParameter.ConfigParam.ipelf_info.soft_path) 41 | && !CommonParameter.IPElfIsInit) 42 | { 43 | // IP精灵 已经配置路径,并且没有启动的情况下;关闭软件 44 | } 45 | }; 46 | _myform.ShowDialog(); 47 | } 48 | 49 | private void tsmi_config_timespan_Click(object sender, EventArgs e) 50 | { 51 | SF_ConfigForm _myform = new SF_ConfigForm(); 52 | _myform.StartPosition = FormStartPosition.CenterParent; 53 | _myform.ShowDialog(); 54 | } 55 | 56 | private void tsmi_registere_Click(object sender, EventArgs e) 57 | { 58 | SF_RegisterForm _myform = new SF_RegisterForm(); 59 | _myform.StartPosition = FormStartPosition.CenterParent; 60 | _myform.ShowDialog(); 61 | } 62 | 63 | private void tsmi_version_Click(object sender, EventArgs e) 64 | { 65 | MessageBox.Show( 66 | this, 67 | "版本1.0\r\n发布日期:2017/03/29\r\n联系QQ:123456!", 68 | "版本信息", 69 | MessageBoxButtons.OK, 70 | MessageBoxIcon.Information); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_MyDataGridView_Style.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.MainForms.UserControls 2 | { 3 | partial class UC_MyDataGridView_Style 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); 32 | this.dgv_style = new System.Windows.Forms.DataGridView(); 33 | ((System.ComponentModel.ISupportInitialize)(this.dgv_style)).BeginInit(); 34 | this.SuspendLayout(); 35 | // 36 | // dgv_style 37 | // 38 | this.dgv_style.AllowUserToResizeRows = false; 39 | this.dgv_style.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 40 | this.dgv_style.Cursor = System.Windows.Forms.Cursors.Default; 41 | this.dgv_style.Dock = System.Windows.Forms.DockStyle.Fill; 42 | this.dgv_style.Location = new System.Drawing.Point(0, 0); 43 | this.dgv_style.MultiSelect = false; 44 | this.dgv_style.Name = "dgv_style"; 45 | dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 46 | this.dgv_style.RowsDefaultCellStyle = dataGridViewCellStyle1; 47 | this.dgv_style.RowTemplate.Height = 23; 48 | this.dgv_style.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; 49 | this.dgv_style.Size = new System.Drawing.Size(466, 198); 50 | this.dgv_style.TabIndex = 0; 51 | this.dgv_style.TabStop = false; 52 | this.dgv_style.DataBindingComplete += new System.Windows.Forms.DataGridViewBindingCompleteEventHandler(this.dgv_style_DataBindingComplete); 53 | // 54 | // UC_MyDataGridView_Style 55 | // 56 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 57 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 58 | this.Controls.Add(this.dgv_style); 59 | this.Name = "UC_MyDataGridView_Style"; 60 | this.Size = new System.Drawing.Size(466, 198); 61 | ((System.ComponentModel.ISupportInitialize)(this.dgv_style)).EndInit(); 62 | this.ResumeLayout(false); 63 | 64 | } 65 | 66 | #endregion 67 | 68 | private System.Windows.Forms.DataGridView dgv_style; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_MyDataGridView_Style.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace Bindding.MainForms.UserControls 11 | { 12 | public partial class UC_MyDataGridView_Style : UserControl 13 | { 14 | public UC_MyDataGridView_Style() 15 | { 16 | InitializeComponent(); 17 | GDV_Style(); 18 | } 19 | 20 | public DataGridView MyDataGridView 21 | { 22 | get 23 | { 24 | return this.dgv_style; 25 | } 26 | } 27 | 28 | private void GDV_Style() 29 | { 30 | #region DataGridVeiw Style 31 | 32 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); 33 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); 34 | this.dgv_style.AllowUserToAddRows = false; 35 | this.dgv_style.AllowUserToDeleteRows = false; 36 | dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightCyan; 37 | this.dgv_style.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; 38 | this.dgv_style.BackgroundColor = System.Drawing.Color.White; 39 | this.dgv_style.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; 40 | this.dgv_style.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; 41 | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;//211, 223, 240 42 | dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(211)))), ((int)(((byte)(223)))), ((int)(((byte)(240))))); 43 | dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 44 | dataGridViewCellStyle2.ForeColor = System.Drawing.Color.Navy; 45 | dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; 46 | dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 47 | this.dgv_style.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; 48 | this.dgv_style.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 49 | this.dgv_style.EnableHeadersVisualStyles = false; 50 | this.dgv_style.GridColor = System.Drawing.SystemColors.GradientInactiveCaption; 51 | this.dgv_style.ReadOnly = true; 52 | this.dgv_style.RowHeadersVisible = false; //建议改为true;为了以后显示序号。 53 | this.dgv_style.RowTemplate.Height = 23; 54 | this.dgv_style.RowTemplate.ReadOnly = true; 55 | 56 | #endregion DataGridVeiw Style 57 | } 58 | 59 | private void dgv_style_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) 60 | { 61 | this.dgv_style.ClearSelection(); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_SimpleBrower.Designer.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | namespace Bindding.MainForms.UserControls 3 | { 4 | partial class UC_SimpleBrower 5 | { 6 | /// 7 | /// 必需的设计器变量。 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// 清理所有正在使用的资源。 13 | /// 14 | /// 如果应释放托管资源,为 true;否则为 false。 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region 组件设计器生成的代码 25 | 26 | /// 27 | /// 设计器支持所需的方法 - 不要 28 | /// 使用代码编辑器修改此方法的内容。 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); 33 | this.toolStrip1 = new System.Windows.Forms.ToolStrip(); 34 | this.urlTextBox = new System.Windows.Forms.ToolStripTextBox(); 35 | this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); 36 | this.toolStripContainer1.SuspendLayout(); 37 | this.toolStrip1.SuspendLayout(); 38 | this.SuspendLayout(); 39 | // 40 | // toolStripContainer1 41 | // 42 | this.toolStripContainer1.BottomToolStripPanelVisible = false; 43 | // 44 | // toolStripContainer1.ContentPanel 45 | // 46 | this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(856, 483); 47 | this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 48 | this.toolStripContainer1.LeftToolStripPanelVisible = false; 49 | this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); 50 | this.toolStripContainer1.Name = "toolStripContainer1"; 51 | this.toolStripContainer1.RightToolStripPanelVisible = false; 52 | this.toolStripContainer1.Size = new System.Drawing.Size(856, 508); 53 | this.toolStripContainer1.TabIndex = 3; 54 | this.toolStripContainer1.Text = "toolStripContainer1"; 55 | // 56 | // toolStripContainer1.TopToolStripPanel 57 | // 58 | this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1); 59 | // 60 | // toolStrip1 61 | // 62 | this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None; 63 | this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; 64 | this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 65 | this.urlTextBox}); 66 | this.toolStrip1.Location = new System.Drawing.Point(0, 0); 67 | this.toolStrip1.Name = "toolStrip1"; 68 | this.toolStrip1.Padding = new System.Windows.Forms.Padding(0); 69 | this.toolStrip1.Size = new System.Drawing.Size(856, 25); 70 | this.toolStrip1.Stretch = true; 71 | this.toolStrip1.TabIndex = 1; 72 | // 73 | // urlTextBox 74 | // 75 | this.urlTextBox.AutoSize = false; 76 | this.urlTextBox.Name = "urlTextBox"; 77 | this.urlTextBox.ReadOnly = true; 78 | this.urlTextBox.Size = new System.Drawing.Size(500, 25); 79 | this.urlTextBox.Text = ConstParameter.BLANK_PAGE; 80 | // 81 | // UC_SimpleBrower 82 | // 83 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 84 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 85 | this.Controls.Add(this.toolStripContainer1); 86 | this.Name = "UC_SimpleBrower"; 87 | this.Size = new System.Drawing.Size(856, 508); 88 | this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false); 89 | this.toolStripContainer1.TopToolStripPanel.PerformLayout(); 90 | this.toolStripContainer1.ResumeLayout(false); 91 | this.toolStripContainer1.PerformLayout(); 92 | this.toolStrip1.ResumeLayout(false); 93 | this.toolStrip1.PerformLayout(); 94 | this.ResumeLayout(false); 95 | 96 | } 97 | 98 | #endregion 99 | 100 | private System.Windows.Forms.ToolStripContainer toolStripContainer1; 101 | private System.Windows.Forms.ToolStrip toolStrip1; 102 | private System.Windows.Forms.ToolStripTextBox urlTextBox; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_SimpleBrower.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using CefSharp; 3 | using CefSharp.WinForms; 4 | using CefSharp.WinForms.Internals; 5 | using Newtonsoft.Json; 6 | using System; 7 | using System.ComponentModel; 8 | using System.Threading; 9 | using System.Windows.Forms; 10 | 11 | namespace Bindding.MainForms.UserControls 12 | { 13 | /// 14 | /// 简单的浏览器控件只是 随机点击 15 | /// 16 | public partial class UC_SimpleBrower : BaseUserControl 17 | { 18 | public UC_SimpleBrower() 19 | { 20 | InitializeComponent(); 21 | urlTextBox.Width = Math.Max(0, toolStrip1.Width - urlTextBox.Margin.Horizontal - 18); 22 | } 23 | 24 | #region 属性 25 | 26 | /// 27 | /// 设置Url地址 28 | /// 29 | internal string UrlText 30 | { 31 | set 32 | { 33 | browser.Load(value); 34 | } 35 | } 36 | 37 | /// 38 | /// 是否为主页面,如果false 则为二次点击界面 39 | /// 40 | [Browsable(true)] 41 | [Description("是否为二次点击的页面"), DefaultValue(true)] 42 | public bool SecondPage { get; set; } 43 | 44 | #endregion 属性 45 | 46 | private ChromiumWebBrowser browser; 47 | 48 | internal void InitialBrower() 49 | { 50 | browser = new ChromiumWebBrowser(ConstParameter.BLANK_PAGE) 51 | { 52 | Dock = DockStyle.Fill 53 | }; 54 | 55 | toolStripContainer1.ContentPanel.Controls.Add(browser); 56 | var _lfsh = new LifeSpanHandler(); // 弹出框 57 | _lfsh.MyBeforPopup += MyBeforPopup; 58 | browser.RequestHandler = new RequestHandler(); // 重写request 59 | browser.LifeSpanHandler = _lfsh; 60 | browser.AddressChanged += OnBrowserAddressChanged; 61 | if (SecondPage) 62 | { 63 | browser.FrameLoadEnd += RandomMove; 64 | } 65 | else 66 | { 67 | browser.FrameLoadEnd += RandomClick; 68 | } 69 | } 70 | 71 | internal event EventHandler MyBeforPopup; 72 | 73 | private void OnBrowserAddressChanged(object sender, AddressChangedEventArgs args) 74 | { 75 | this.InvokeOnUiThreadIfRequired(() => { urlTextBox.Text = args.Address; }); 76 | } 77 | 78 | /// 79 | /// 随机点击 80 | /// 81 | private void RandomClick(object sender, FrameLoadEndEventArgs args) 82 | { 83 | if (args.Url == ConstParameter.BLANK_PAGE) 84 | { 85 | return; 86 | } 87 | 88 | string returnValue = string.Empty; 89 | browser.EvaluateScriptAsync(ConstParameter.GET_POPUP_RANDOM_A).ContinueWith(t => 90 | { 91 | if (!t.IsFaulted) 92 | { 93 | var response = t.Result; 94 | if (response.Success && response.Result != null) 95 | { 96 | returnValue = response.Result.ToString(); 97 | } 98 | 99 | this.SimMoveAndClick(returnValue); 100 | } 101 | }); 102 | } 103 | 104 | /// 105 | /// 模拟移动 或者 点击 网址 106 | /// 107 | private void SimMoveAndClick(string _retStr) 108 | { 109 | ListContent _retData; 110 | if (string.IsNullOrEmpty(_retStr)) 111 | { 112 | // 没有返回则不移动,因为重定向 113 | return; 114 | 115 | // 如果没有返回,只随机移动 116 | _retData = new ListContent(); 117 | _retData.top = ConstParameter.RandomSeed.Next(300, 600); 118 | _retData.left = ConstParameter.RandomSeed.Next(200, 800); 119 | } 120 | else 121 | { 122 | _retData = JsonConvert.DeserializeObject(_retStr); 123 | } 124 | 125 | CommonFunction.SimMoveAndLefClick(_retData.left, _retData.top, true); 126 | 127 | // 执行点击事件 128 | if (!string.IsNullOrEmpty(_retStr)) 129 | { 130 | browser.ExecuteScriptAsync("var _n=" + _retData.title + ConstParameter.GET_POPUP_CLICK_A); 131 | } 132 | } 133 | 134 | /// 135 | /// 随机移动,滚动滑轮 136 | /// 137 | private void RandomMove(object sender, FrameLoadEndEventArgs args) 138 | { 139 | if (args.Url == ConstParameter.BLANK_PAGE) 140 | { 141 | return; 142 | } 143 | 144 | this.InvokeOnUiThreadIfRequired(() => 145 | { 146 | Monitor.Enter(CommonParameter.LokerObj); 147 | int _x = ConstParameter.RandomSeed.Next(300, 600); 148 | int _y = ConstParameter.RandomSeed.Next(200, 800); 149 | CommonFunction.SimMoveAndLefClick(_x, _y, false); 150 | Monitor.Pulse(CommonParameter.LokerObj); 151 | Monitor.Exit(CommonParameter.LokerObj); 152 | }); 153 | } 154 | } 155 | } -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_TopControl.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.MainForms.UserControls 2 | { 3 | partial class UC_TopControl 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要修改 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // UC_TopControl 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.Name = "UC_TopControl"; 38 | this.Size = new System.Drawing.Size(694, 508); 39 | this.ResumeLayout(false); 40 | 41 | } 42 | 43 | #endregion 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Bindding/MainForms/UserControls/UC_TopControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using Bindding.ExcuteClasses; 10 | 11 | namespace Bindding.MainForms.UserControls 12 | { 13 | public partial class UC_TopControl : BaseUserControl 14 | { 15 | public UC_TopControl() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Bindding/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | using Bindding.MainForms; 6 | using Bindding.ExcuteClasses; 7 | 8 | namespace Bindding 9 | { 10 | internal static class Program 11 | { 12 | /// 13 | /// 应用程序的主入口点。 14 | /// 15 | [STAThread] 16 | private static void Main(string[] args) 17 | { 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | CommonFunction.ReadRunParam(); 21 | #if !DEBUG 22 | if (args.Length == 0) 23 | { 24 | MessageBox.Show("请从主程序[CallProcess.exe]启动!"); 25 | return; 26 | } 27 | var instance = CommonFunction.RunningInstance(); 28 | if (instance == null) 29 | { 30 | var isrunning = Convert.ToBoolean(args[0]); 31 | CheckedSystem(isrunning); 32 | 33 | CommonFunction.ReadConfig(); 34 | CommonFunction.ReadRunParam(); 35 | Application.Run(new MainForm(isrunning)); 36 | } 37 | else 38 | { 39 | CommonFunction.HandleRunningInstance(instance); // 已经有一个实例在运行,激活它 40 | } 41 | #else 42 | Application.Run(new MainForm(false)); 43 | #endif 44 | } 45 | 46 | /// 47 | /// 检查系统 方面 48 | /// 49 | /// 50 | private static bool CheckedSystem(bool _isrunning) 51 | { 52 | try 53 | { 54 | var sim = new WindowsInput.InputSimulator(); 55 | sim.Mouse.LeftButtonClick(); 56 | } 57 | catch (Exception ex) 58 | { 59 | CommonFunction.WriteLogInFile(ex.ToString(), LogType.RunLog); 60 | MessageBox.Show("关闭杀毒软件,或者目录添加为白名单!", "配置异常", MessageBoxButtons.OK, MessageBoxIcon.Information); 61 | return false; 62 | } 63 | 64 | // 如果处在运行中,不需要再次启动 IP精灵 65 | CommonParameter.IPElfIsInit = _isrunning; 66 | if (!_isrunning) 67 | { 68 | var _retStr = CommonParameter.IpelfCurrentInstance.InitLogin(); 69 | if (!string.IsNullOrEmpty(_retStr)) 70 | { 71 | MessageBox.Show(_retStr, "配置异常", MessageBoxButtons.OK, MessageBoxIcon.Information); 72 | return false; 73 | } 74 | } 75 | 76 | if (DateTime.Now.Date != LicenseHelper.getWebsiteDatetime().Date) 77 | { 78 | MessageBox.Show("系统时间不正确!请同步互联网时间!", "系统异常", MessageBoxButtons.OK, MessageBoxIcon.Information); 79 | return false; 80 | } 81 | 82 | return true; 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Bindding/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Bindding")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Bindding")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("9decffc7-6626-4e99-b2cf-e9a435051c24")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Bindding/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bindding.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bindding.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 使用此强类型资源类,为所有资源查找 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// 查找类似于 (Icon) 的 System.Drawing.Icon 类型的本地化资源。 65 | /// 66 | internal static System.Drawing.Icon Icon { 67 | get { 68 | object obj = ResourceManager.GetObject("Icon", resourceCulture); 69 | return ((System.Drawing.Icon)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 75 | /// 76 | internal static System.Drawing.Bitmap nav_left_green { 77 | get { 78 | object obj = ResourceManager.GetObject("nav_left_green", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 85 | /// 86 | internal static System.Drawing.Bitmap nav_plain_green { 87 | get { 88 | object obj = ResourceManager.GetObject("nav_plain_green", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 95 | /// 96 | internal static System.Drawing.Bitmap nav_plain_red { 97 | get { 98 | object obj = ResourceManager.GetObject("nav_plain_red", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | 103 | /// 104 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 105 | /// 106 | internal static System.Drawing.Bitmap nav_right_green { 107 | get { 108 | object obj = ResourceManager.GetObject("nav_right_green", resourceCulture); 109 | return ((System.Drawing.Bitmap)(obj)); 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Bindding/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bindding.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Bindding/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Bindding/Read me.txt: -------------------------------------------------------------------------------- 1 | 1、将该软件添加到360或其他防护软件的白名单; 2 | 2、保持较快的网速,避免出现其他不可预料的异常; 3 | 3、只支持在主显示器上; 4 | 4、分辨率的高度最低为 768px; -------------------------------------------------------------------------------- /Bindding/Resources/Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/Bindding/Resources/Icon.ico -------------------------------------------------------------------------------- /Bindding/Resources/nav_left_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/Bindding/Resources/nav_left_green.png -------------------------------------------------------------------------------- /Bindding/Resources/nav_plain_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/Bindding/Resources/nav_plain_green.png -------------------------------------------------------------------------------- /Bindding/Resources/nav_plain_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/Bindding/Resources/nav_plain_red.png -------------------------------------------------------------------------------- /Bindding/Resources/nav_right_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/Bindding/Resources/nav_right_green.png -------------------------------------------------------------------------------- /Bindding/SQLite.Interop.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/Bindding/SQLite.Interop.dll -------------------------------------------------------------------------------- /Bindding/SubForms/SF_AccountInfo.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.SubForms 2 | { 3 | partial class SF_AccountInfo 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.uC_AdslAccount1 = new Bindding.SubForms.UserControls.UC_AdslAccount(); 32 | this.uC_IpelfAccount1 = new Bindding.SubForms.UserControls.UC_IpelfAccount(); 33 | this.btnSave = new System.Windows.Forms.Button(); 34 | this.btnCancel = new System.Windows.Forms.Button(); 35 | this.SuspendLayout(); 36 | // 37 | // uC_AdslAccount1 38 | // 39 | this.uC_AdslAccount1.Dock = System.Windows.Forms.DockStyle.Top; 40 | this.uC_AdslAccount1.Location = new System.Drawing.Point(0, 0); 41 | this.uC_AdslAccount1.Name = "uC_AdslAccount1"; 42 | this.uC_AdslAccount1.Size = new System.Drawing.Size(321, 80); 43 | this.uC_AdslAccount1.TabIndex = 0; 44 | // 45 | // uC_IpelfAccount1 46 | // 47 | this.uC_IpelfAccount1.Dock = System.Windows.Forms.DockStyle.Top; 48 | this.uC_IpelfAccount1.Location = new System.Drawing.Point(0, 80); 49 | this.uC_IpelfAccount1.Name = "uC_IpelfAccount1"; 50 | this.uC_IpelfAccount1.Size = new System.Drawing.Size(321, 165); 51 | this.uC_IpelfAccount1.TabIndex = 1; 52 | // 53 | // btnSave 54 | // 55 | this.btnSave.Location = new System.Drawing.Point(34, 266); 56 | this.btnSave.Name = "btnSave"; 57 | this.btnSave.Size = new System.Drawing.Size(75, 23); 58 | this.btnSave.TabIndex = 2; 59 | this.btnSave.Text = "确 定"; 60 | this.btnSave.UseVisualStyleBackColor = true; 61 | this.btnSave.Click += new System.EventHandler(this.btnSave_Click); 62 | // 63 | // btnCancel 64 | // 65 | this.btnCancel.Location = new System.Drawing.Point(183, 266); 66 | this.btnCancel.Name = "btnCancel"; 67 | this.btnCancel.Size = new System.Drawing.Size(75, 23); 68 | this.btnCancel.TabIndex = 3; 69 | this.btnCancel.Text = "取 消"; 70 | this.btnCancel.UseVisualStyleBackColor = true; 71 | this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); 72 | // 73 | // SF_AccountInfo 74 | // 75 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 76 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 77 | this.ClientSize = new System.Drawing.Size(321, 310); 78 | this.Controls.Add(this.btnCancel); 79 | this.Controls.Add(this.btnSave); 80 | this.Controls.Add(this.uC_IpelfAccount1); 81 | this.Controls.Add(this.uC_AdslAccount1); 82 | this.Name = "SF_AccountInfo"; 83 | this.Text = "账户配置信息"; 84 | this.ResumeLayout(false); 85 | 86 | } 87 | 88 | #endregion 89 | 90 | private UserControls.UC_AdslAccount uC_AdslAccount1; 91 | private UserControls.UC_IpelfAccount uC_IpelfAccount1; 92 | private System.Windows.Forms.Button btnSave; 93 | private System.Windows.Forms.Button btnCancel; 94 | } 95 | } -------------------------------------------------------------------------------- /Bindding/SubForms/SF_AccountInfo.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Windows.Forms; 10 | 11 | namespace Bindding.SubForms 12 | { 13 | public partial class SF_AccountInfo : Form 14 | { 15 | public SF_AccountInfo() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | /// 21 | /// 更新配置信息 22 | /// 23 | /// 24 | /// 25 | private void btnSave_Click(object sender, EventArgs e) 26 | { 27 | if (!this.uC_AdslAccount1.VerifyAndSaveData()) 28 | { 29 | return; 30 | } 31 | 32 | if (!this.uC_IpelfAccount1.VerifyAndSaveData()) 33 | { 34 | return; 35 | } 36 | 37 | CommonFunction.WriteConfig(); 38 | CommonFunction.WriteLogInFile("更新 连接账户信息!", LogType.RunLog); 39 | if (CommonParameter.IPElfIsInit) 40 | { 41 | MessageBox.Show("连接 账户更新成功!"); 42 | } 43 | else 44 | { 45 | MessageBox.Show("连接 账户更新成功!需要重启软件!"); 46 | } 47 | 48 | this.Close(); 49 | } 50 | 51 | private void btnCancel_Click(object sender, EventArgs e) 52 | { 53 | this.Close(); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Bindding/SubForms/SF_AccountInfo.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Bindding/SubForms/SF_ConfigForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.SubForms 2 | { 3 | partial class SF_ConfigForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.uC_SleepSeconds1 = new Bindding.SubForms.UserControls.UC_SleepSeconds(); 32 | this.uC_SimulateSpeed1 = new Bindding.SubForms.UserControls.UC_SimulateSpeed(); 33 | this.btnCancel = new System.Windows.Forms.Button(); 34 | this.btnSave = new System.Windows.Forms.Button(); 35 | this.SuspendLayout(); 36 | // 37 | // uC_SleepSeconds1 38 | // 39 | this.uC_SleepSeconds1.Location = new System.Drawing.Point(0, 12); 40 | this.uC_SleepSeconds1.Name = "uC_SleepSeconds1"; 41 | this.uC_SleepSeconds1.Size = new System.Drawing.Size(277, 165); 42 | this.uC_SleepSeconds1.TabIndex = 0; 43 | // 44 | // uC_SimulateSpeed1 45 | // 46 | this.uC_SimulateSpeed1.Location = new System.Drawing.Point(283, 12); 47 | this.uC_SimulateSpeed1.Name = "uC_SimulateSpeed1"; 48 | this.uC_SimulateSpeed1.Size = new System.Drawing.Size(283, 165); 49 | this.uC_SimulateSpeed1.TabIndex = 1; 50 | // 51 | // btnCancel 52 | // 53 | this.btnCancel.Location = new System.Drawing.Point(312, 199); 54 | this.btnCancel.Name = "btnCancel"; 55 | this.btnCancel.Size = new System.Drawing.Size(75, 23); 56 | this.btnCancel.TabIndex = 5; 57 | this.btnCancel.Text = "取 消"; 58 | this.btnCancel.UseVisualStyleBackColor = true; 59 | this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); 60 | // 61 | // btnSave 62 | // 63 | this.btnSave.Location = new System.Drawing.Point(163, 199); 64 | this.btnSave.Name = "btnSave"; 65 | this.btnSave.Size = new System.Drawing.Size(75, 23); 66 | this.btnSave.TabIndex = 4; 67 | this.btnSave.Text = "确 定"; 68 | this.btnSave.UseVisualStyleBackColor = true; 69 | this.btnSave.Click += new System.EventHandler(this.btnSave_Click); 70 | // 71 | // SF_ConfigForm 72 | // 73 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 74 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 75 | this.ClientSize = new System.Drawing.Size(574, 234); 76 | this.Controls.Add(this.btnCancel); 77 | this.Controls.Add(this.btnSave); 78 | this.Controls.Add(this.uC_SimulateSpeed1); 79 | this.Controls.Add(this.uC_SleepSeconds1); 80 | this.Name = "SF_ConfigForm"; 81 | this.Text = "时间间隔配置界面"; 82 | this.ResumeLayout(false); 83 | 84 | } 85 | 86 | #endregion 87 | 88 | private UserControls.UC_SleepSeconds uC_SleepSeconds1; 89 | private UserControls.UC_SimulateSpeed uC_SimulateSpeed1; 90 | private System.Windows.Forms.Button btnCancel; 91 | private System.Windows.Forms.Button btnSave; 92 | } 93 | } -------------------------------------------------------------------------------- /Bindding/SubForms/SF_ConfigForm.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using System; 3 | using System.Windows.Forms; 4 | 5 | namespace Bindding.SubForms 6 | { 7 | public partial class SF_ConfigForm : Form 8 | { 9 | public SF_ConfigForm() 10 | { 11 | InitializeComponent(); 12 | } 13 | 14 | private void btnCancel_Click(object sender, EventArgs e) 15 | { 16 | this.Close(); 17 | } 18 | 19 | private void btnSave_Click(object sender, EventArgs e) 20 | { 21 | if (!this.uC_SimulateSpeed1.VerifyAndSaveData()) 22 | { 23 | return; 24 | } 25 | 26 | if (!this.uC_SleepSeconds1.VerifyAndSaveData()) 27 | { 28 | return; 29 | } 30 | 31 | CommonFunction.WriteConfig(); 32 | CommonFunction.WriteLogInFile("更新 时间间隔配置信息!", LogType.RunLog); 33 | MessageBox.Show("时间间隔配置,更新成功!"); 34 | this.Close(); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Bindding/SubForms/SF_ConfigForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Bindding/SubForms/SF_RegisterForm.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using System; 3 | using System.IO; 4 | using System.Windows.Forms; 5 | 6 | namespace Bindding.SubForms 7 | { 8 | public partial class SF_RegisterForm : Form 9 | { 10 | public SF_RegisterForm() 11 | { 12 | InitializeComponent(); 13 | 14 | var _v_info = LicenseHelper.ValidationGetInfo(); 15 | if (_v_info != null) 16 | { 17 | var _days = _v_info.ExpirationDate - DateTime.Now; 18 | lbTitle.Text = string.Format("还有 {0} 天使用期!", _days.Days.ToString()); 19 | btnReg.Text = "重 新 注 册"; 20 | } 21 | else 22 | { 23 | txtMachineNum.Text = LicenseHelper.GetOnwerPrivateKey(); 24 | } 25 | } 26 | 27 | private void btnCopy_Click(object sender, EventArgs e) 28 | { 29 | if (string.IsNullOrEmpty(txtMachineNum.Text)) 30 | { 31 | MessageBox.Show("机器码为空!"); 32 | return; 33 | } 34 | 35 | Clipboard.SetDataObject(txtMachineNum.Text); 36 | MessageBox.Show("复制成功"); 37 | } 38 | 39 | private void btnReg_Click(object sender, EventArgs e) 40 | { 41 | if (string.IsNullOrEmpty(txtRegisterNum.Text)) 42 | { 43 | MessageBox.Show("注册码为空!"); 44 | return; 45 | } 46 | 47 | File.WriteAllText("license.lic", txtRegisterNum.Text); 48 | var _v_info = LicenseHelper.ValidationGetInfo(); 49 | if (_v_info != null) 50 | { 51 | LicenseHelper.RegsterIsSuccess(true); 52 | MessageBox.Show("注册成功!"); 53 | this.Close(); 54 | } 55 | else 56 | { 57 | LicenseHelper.RegsterIsSuccess(false); 58 | MessageBox.Show("注册失败!", "提示", MessageBoxButtons.OK); 59 | } 60 | } 61 | 62 | private void txtRegisterNum_Click(object sender, EventArgs e) 63 | { 64 | txtRegisterNum.SelectAll(); 65 | } 66 | 67 | private void txtMachineNum_Click(object sender, EventArgs e) 68 | { 69 | txtMachineNum.SelectAll(); 70 | } 71 | 72 | private void btnReReg_Click(object sender, EventArgs e) 73 | { 74 | var result = MessageBox.Show("如果重新注册,将会重新计算日期!\r\n确定[重新注册]?", "警 告", MessageBoxButtons.YesNo); 75 | if (result == DialogResult.Yes) 76 | { 77 | result = MessageBox.Show("确定[重新注册]?", "警 告", MessageBoxButtons.YesNo); 78 | if (result == DialogResult.No) 79 | { 80 | return; 81 | } 82 | } 83 | else 84 | { 85 | return; 86 | } 87 | 88 | txtMachineNum.Text = LicenseHelper.GetOnwerPrivateKey(); 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /Bindding/SubForms/SF_StartupConfig.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.SubForms 2 | { 3 | partial class SF_StartupConfig 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.uC_Keywords1 = new Bindding.SubForms.UserControls.UC_Keywords(); 32 | this.uC_ChangeIP1 = new Bindding.SubForms.UserControls.UC_ChangeIP(); 33 | this.btnCancel = new System.Windows.Forms.Button(); 34 | this.btnSave = new System.Windows.Forms.Button(); 35 | this.SuspendLayout(); 36 | // 37 | // uC_Keywords1 38 | // 39 | this.uC_Keywords1.Dock = System.Windows.Forms.DockStyle.Top; 40 | this.uC_Keywords1.Location = new System.Drawing.Point(0, 60); 41 | this.uC_Keywords1.Name = "uC_Keywords1"; 42 | this.uC_Keywords1.Size = new System.Drawing.Size(411, 228); 43 | this.uC_Keywords1.TabIndex = 1; 44 | // 45 | // uC_ChangeIP1 46 | // 47 | this.uC_ChangeIP1.Dock = System.Windows.Forms.DockStyle.Top; 48 | this.uC_ChangeIP1.Location = new System.Drawing.Point(0, 0); 49 | this.uC_ChangeIP1.Name = "uC_ChangeIP1"; 50 | this.uC_ChangeIP1.Size = new System.Drawing.Size(411, 60); 51 | this.uC_ChangeIP1.TabIndex = 0; 52 | // 53 | // btnCancel 54 | // 55 | this.btnCancel.Location = new System.Drawing.Point(210, 304); 56 | this.btnCancel.Name = "btnCancel"; 57 | this.btnCancel.Size = new System.Drawing.Size(75, 23); 58 | this.btnCancel.TabIndex = 5; 59 | this.btnCancel.Text = "取 消"; 60 | this.btnCancel.UseVisualStyleBackColor = true; 61 | this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); 62 | // 63 | // btnSave 64 | // 65 | this.btnSave.Location = new System.Drawing.Point(56, 304); 66 | this.btnSave.Name = "btnSave"; 67 | this.btnSave.Size = new System.Drawing.Size(75, 23); 68 | this.btnSave.TabIndex = 4; 69 | this.btnSave.Text = "确 定"; 70 | this.btnSave.UseVisualStyleBackColor = true; 71 | this.btnSave.Click += new System.EventHandler(this.btnSave_Click); 72 | // 73 | // SF_StartupConfig 74 | // 75 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 76 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 77 | this.ClientSize = new System.Drawing.Size(411, 339); 78 | this.Controls.Add(this.btnCancel); 79 | this.Controls.Add(this.btnSave); 80 | this.Controls.Add(this.uC_Keywords1); 81 | this.Controls.Add(this.uC_ChangeIP1); 82 | this.Name = "SF_StartupConfig"; 83 | this.Text = "启动配置界面"; 84 | this.ResumeLayout(false); 85 | 86 | } 87 | 88 | #endregion 89 | 90 | private UserControls.UC_ChangeIP uC_ChangeIP1; 91 | private UserControls.UC_Keywords uC_Keywords1; 92 | private System.Windows.Forms.Button btnCancel; 93 | private System.Windows.Forms.Button btnSave; 94 | 95 | 96 | } 97 | } -------------------------------------------------------------------------------- /Bindding/SubForms/SF_StartupConfig.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using System; 3 | using System.Windows.Forms; 4 | 5 | namespace Bindding.SubForms 6 | { 7 | public partial class SF_StartupConfig : Form 8 | { 9 | public SF_StartupConfig() 10 | { 11 | InitializeComponent(); 12 | } 13 | 14 | private void btnSave_Click(object sender, EventArgs e) 15 | { 16 | if (!this.uC_ChangeIP1.VerifyAndSaveData()) 17 | { 18 | return; 19 | } 20 | 21 | if (!this.uC_Keywords1.VerifyAndSaveData()) 22 | { 23 | return; 24 | } 25 | 26 | CommonFunction.WriteConfig(); 27 | CommonFunction.WriteLogInFile("更新 启动配置信息!", LogType.RunLog); 28 | MessageBox.Show("更新[启动配置信息]成功!"); 29 | this.Close(); 30 | } 31 | 32 | private void btnCancel_Click(object sender, EventArgs e) 33 | { 34 | this.Close(); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/BaseConfigUserControl.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | 3 | namespace Bindding.SubForms.UserControls 4 | { 5 | public abstract class BaseConfigUserControl : BaseUserControl 6 | { 7 | public BaseConfigUserControl() 8 | { 9 | InitializeComponent(); 10 | if (!DesignMode 11 | && CommonParameter.ConfigParam != null 12 | && CommonParameter.ConfigParam.change_ip != ChangeIPType.NONE) 13 | { 14 | InitData(); 15 | } 16 | } 17 | 18 | protected abstract void InitializeComponent(); 19 | 20 | protected abstract void InitData(); 21 | 22 | protected abstract bool VerifyData(); 23 | 24 | protected abstract void UpdateData(); 25 | 26 | internal virtual bool VerifyAndSaveData() 27 | { 28 | bool _isSuccess = VerifyData(); 29 | if (_isSuccess) 30 | { 31 | UpdateData(); 32 | } 33 | 34 | return _isSuccess; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_AdslAccount.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.SubForms.UserControls 2 | { 3 | partial class UC_AdslAccount 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | protected override void InitializeComponent() 30 | { 31 | this.gb_adsl = new System.Windows.Forms.GroupBox(); 32 | this.txt_AdslPwd = new System.Windows.Forms.TextBox(); 33 | this.txt_AdslUserName = new System.Windows.Forms.TextBox(); 34 | this.label1 = new System.Windows.Forms.Label(); 35 | this.label2 = new System.Windows.Forms.Label(); 36 | this.gb_adsl.SuspendLayout(); 37 | this.SuspendLayout(); 38 | // 39 | // gb_adsl 40 | // 41 | this.gb_adsl.Controls.Add(this.txt_AdslPwd); 42 | this.gb_adsl.Controls.Add(this.txt_AdslUserName); 43 | this.gb_adsl.Controls.Add(this.label1); 44 | this.gb_adsl.Controls.Add(this.label2); 45 | this.gb_adsl.Dock = System.Windows.Forms.DockStyle.Fill; 46 | this.gb_adsl.Location = new System.Drawing.Point(0, 0); 47 | this.gb_adsl.Name = "gb_adsl"; 48 | this.gb_adsl.Size = new System.Drawing.Size(320, 80); 49 | this.gb_adsl.TabIndex = 7; 50 | this.gb_adsl.TabStop = false; 51 | this.gb_adsl.Text = "ADSL(未开放)"; 52 | // 53 | // txt_AdslPwd 54 | // 55 | this.txt_AdslPwd.Location = new System.Drawing.Point(67, 47); 56 | this.txt_AdslPwd.Name = "txt_AdslPwd"; 57 | this.txt_AdslPwd.Size = new System.Drawing.Size(213, 21); 58 | this.txt_AdslPwd.TabIndex = 2; 59 | // 60 | // txt_AdslUserName 61 | // 62 | this.txt_AdslUserName.Location = new System.Drawing.Point(67, 20); 63 | this.txt_AdslUserName.Name = "txt_AdslUserName"; 64 | this.txt_AdslUserName.Size = new System.Drawing.Size(213, 21); 65 | this.txt_AdslUserName.TabIndex = 0; 66 | // 67 | // label1 68 | // 69 | this.label1.AutoSize = true; 70 | this.label1.Location = new System.Drawing.Point(32, 23); 71 | this.label1.Name = "label1"; 72 | this.label1.Size = new System.Drawing.Size(29, 12); 73 | this.label1.TabIndex = 1; 74 | this.label1.Text = "账号"; 75 | // 76 | // label2 77 | // 78 | this.label2.AutoSize = true; 79 | this.label2.Location = new System.Drawing.Point(32, 50); 80 | this.label2.Name = "label2"; 81 | this.label2.Size = new System.Drawing.Size(29, 12); 82 | this.label2.TabIndex = 3; 83 | this.label2.Text = "密码"; 84 | // 85 | // UC_AdslAccount 86 | // 87 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 88 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 89 | this.Controls.Add(this.gb_adsl); 90 | this.Name = "UC_AdslAccount"; 91 | this.Size = new System.Drawing.Size(320, 80); 92 | this.gb_adsl.ResumeLayout(false); 93 | this.gb_adsl.PerformLayout(); 94 | this.ResumeLayout(false); 95 | 96 | } 97 | 98 | #endregion 99 | 100 | private System.Windows.Forms.GroupBox gb_adsl; 101 | private System.Windows.Forms.TextBox txt_AdslPwd; 102 | private System.Windows.Forms.TextBox txt_AdslUserName; 103 | private System.Windows.Forms.Label label1; 104 | private System.Windows.Forms.Label label2; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_AdslAccount.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using System.Windows.Forms; 3 | 4 | namespace Bindding.SubForms.UserControls 5 | { 6 | public partial class UC_AdslAccount : BaseConfigUserControl 7 | { 8 | protected override void InitData() 9 | { 10 | txt_AdslUserName.Text = CommonParameter.ConfigParam.adsl_info.username; 11 | txt_AdslPwd.Text = CommonParameter.ConfigParam.adsl_info.password; 12 | } 13 | 14 | protected override bool VerifyData() 15 | { 16 | if (string.IsNullOrEmpty(txt_AdslUserName.Text.Trim())) 17 | { 18 | MessageBox.Show("Adsl账户,不能为空!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 19 | return false; 20 | } 21 | else if (string.IsNullOrEmpty(txt_AdslPwd.Text.Trim())) 22 | { 23 | MessageBox.Show("Adsl密码,不能为空!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 24 | return false; 25 | } 26 | 27 | return true; 28 | } 29 | 30 | protected override void UpdateData() 31 | { 32 | CommonParameter.ConfigParam.adsl_info.username = txt_AdslUserName.Text.Trim(); 33 | CommonParameter.ConfigParam.adsl_info.password = txt_AdslPwd.Text.Trim(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_ChangeIP.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.SubForms.UserControls 2 | { 3 | partial class UC_ChangeIP 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | protected override void InitializeComponent() 30 | { 31 | this.gb_changeIp = new System.Windows.Forms.GroupBox(); 32 | this.rbBtnNone = new System.Windows.Forms.RadioButton(); 33 | this.rdBtnIP = new System.Windows.Forms.RadioButton(); 34 | this.rdBtnAdsl = new System.Windows.Forms.RadioButton(); 35 | this.gb_changeIp.SuspendLayout(); 36 | this.SuspendLayout(); 37 | // 38 | // gb_changeIp 39 | // 40 | this.gb_changeIp.Controls.Add(this.rbBtnNone); 41 | this.gb_changeIp.Controls.Add(this.rdBtnIP); 42 | this.gb_changeIp.Controls.Add(this.rdBtnAdsl); 43 | this.gb_changeIp.Dock = System.Windows.Forms.DockStyle.Fill; 44 | this.gb_changeIp.Location = new System.Drawing.Point(0, 0); 45 | this.gb_changeIp.Name = "gb_changeIp"; 46 | this.gb_changeIp.Size = new System.Drawing.Size(285, 60); 47 | this.gb_changeIp.TabIndex = 5; 48 | this.gb_changeIp.TabStop = false; 49 | this.gb_changeIp.Text = "切换IP方式"; 50 | // 51 | // rbBtnNone 52 | // 53 | this.rbBtnNone.AutoSize = true; 54 | this.rbBtnNone.Location = new System.Drawing.Point(158, 20); 55 | this.rbBtnNone.Name = "rbBtnNone"; 56 | this.rbBtnNone.Size = new System.Drawing.Size(47, 16); 57 | this.rbBtnNone.TabIndex = 2; 58 | this.rbBtnNone.Text = "未知"; 59 | this.rbBtnNone.UseVisualStyleBackColor = true; 60 | this.rbBtnNone.Visible = false; 61 | // 62 | // rdBtnIP 63 | // 64 | this.rdBtnIP.AutoSize = true; 65 | this.rdBtnIP.Checked = true; 66 | this.rdBtnIP.Location = new System.Drawing.Point(19, 20); 67 | this.rdBtnIP.Name = "rdBtnIP"; 68 | this.rdBtnIP.Size = new System.Drawing.Size(59, 16); 69 | this.rdBtnIP.TabIndex = 1; 70 | this.rdBtnIP.TabStop = true; 71 | this.rdBtnIP.Text = "IP精灵"; 72 | this.rdBtnIP.UseVisualStyleBackColor = true; 73 | // 74 | // rdBtnAdsl 75 | // 76 | this.rdBtnAdsl.AutoSize = true; 77 | this.rdBtnAdsl.Location = new System.Drawing.Point(93, 20); 78 | this.rdBtnAdsl.Name = "rdBtnAdsl"; 79 | this.rdBtnAdsl.Size = new System.Drawing.Size(47, 16); 80 | this.rdBtnAdsl.TabIndex = 0; 81 | this.rdBtnAdsl.Text = "ADSL"; 82 | this.rdBtnAdsl.UseVisualStyleBackColor = true; 83 | this.rdBtnAdsl.Visible = false; 84 | // 85 | // UC_ChangeIP 86 | // 87 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 88 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 89 | this.Controls.Add(this.gb_changeIp); 90 | this.Name = "UC_ChangeIP"; 91 | this.Size = new System.Drawing.Size(285, 60); 92 | this.gb_changeIp.ResumeLayout(false); 93 | this.gb_changeIp.PerformLayout(); 94 | this.ResumeLayout(false); 95 | 96 | } 97 | 98 | #endregion 99 | 100 | private System.Windows.Forms.GroupBox gb_changeIp; 101 | private System.Windows.Forms.RadioButton rdBtnIP; 102 | private System.Windows.Forms.RadioButton rdBtnAdsl; 103 | private System.Windows.Forms.RadioButton rbBtnNone; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_ChangeIP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using Bindding.ExcuteClasses; 10 | 11 | namespace Bindding.SubForms.UserControls 12 | { 13 | public partial class UC_ChangeIP : BaseConfigUserControl 14 | { 15 | protected override void InitData() 16 | { 17 | switch (CommonParameter.ConfigParam.change_ip) 18 | { 19 | case ChangeIPType.ADSL: 20 | rdBtnAdsl.Checked = true; 21 | break; 22 | 23 | case ChangeIPType.IPElf: 24 | rdBtnIP.Checked = true; 25 | break; 26 | 27 | case ChangeIPType.NONE: 28 | rbBtnNone.Checked = true; 29 | break; 30 | } 31 | } 32 | 33 | protected override bool VerifyData() 34 | { 35 | if (rbBtnNone.Checked) 36 | { 37 | MessageBox.Show("切换IP方式,不能为未知!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 38 | return false; 39 | } 40 | 41 | return true; 42 | } 43 | 44 | protected override void UpdateData() 45 | { 46 | // 改变IP方式 47 | if (rdBtnAdsl.Checked) 48 | { 49 | CommonParameter.ConfigParam.change_ip = ChangeIPType.ADSL; 50 | } 51 | else if (rdBtnIP.Checked) 52 | { 53 | CommonParameter.ConfigParam.change_ip = ChangeIPType.IPElf; 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_IpelfAccount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using Bindding.ExcuteClasses; 10 | 11 | namespace Bindding.SubForms.UserControls 12 | { 13 | public partial class UC_IpelfAccount : BaseConfigUserControl 14 | { 15 | protected override void InitData() 16 | { 17 | txt_IPUser.Text = CommonParameter.ConfigParam.ipelf_info.username; 18 | txt_IpPwd.Text = CommonParameter.ConfigParam.ipelf_info.password; 19 | lbProviceCity.Text = CommonParameter.ConfigParam.ipelf_info.provice + " " + CommonParameter.ConfigParam.ipelf_info.city; 20 | 21 | // 文件存在,才能运行IP精灵 22 | string _path = CommonParameter.ConfigParam.ipelf_info.soft_path; 23 | if (System.IO.File.Exists(_path)) 24 | { 25 | txtExePath.Text = CommonParameter.ConfigParam.ipelf_info.soft_path; 26 | this.comboxIPProvice.DataSource = CommonParameter.GetIPElfProvices; 27 | this.comboxIPProvice.SelectedIndex = this.comboxIPProvice.FindStringExact(CommonParameter.ConfigParam.ipelf_info.provice); 28 | } 29 | else 30 | { 31 | this.comboxIPProvice.DataSource = new List(new string[1] { "所有" }); 32 | } 33 | } 34 | 35 | /// 36 | /// 更新 IP精灵账户信息 37 | /// 38 | protected override void UpdateData() 39 | { 40 | VerifyData(); 41 | CommonParameter.ConfigParam.ipelf_info.username = txt_IPUser.Text.Trim(); 42 | CommonParameter.ConfigParam.ipelf_info.password = txt_IpPwd.Text.Trim(); 43 | CommonParameter.ConfigParam.ipelf_info.soft_path = txtExePath.Text; 44 | CommonParameter.ConfigParam.ipelf_info.provice = this.comboxIPProvice.SelectedValue.ToString().Trim(); 45 | CommonParameter.ConfigParam.ipelf_info.city = this.comboxIPCity.SelectedValue.ToString().Trim(); 46 | } 47 | 48 | /// 49 | /// 验证保存的数据 50 | /// 51 | /// 52 | protected override bool VerifyData() 53 | { 54 | if (string.IsNullOrEmpty(txt_IPUser.Text.Trim())) 55 | { 56 | MessageBox.Show("IP精灵账户,不能为空!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 57 | return false; 58 | } 59 | else if (string.IsNullOrEmpty(txt_IpPwd.Text.Trim())) 60 | { 61 | MessageBox.Show("IP精灵密码,不能为空!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 62 | return false; 63 | } 64 | else if (string.IsNullOrEmpty(txtExePath.Text.Trim())) 65 | { 66 | MessageBox.Show("IP精灵文件路径,不能为空!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 67 | return false; 68 | } 69 | 70 | return true; 71 | } 72 | 73 | /// 74 | /// 选择文件路径 75 | /// 76 | /// 77 | /// 78 | private void btnShowExePath_Click(object sender, EventArgs e) 79 | { 80 | var _dialogResult = this.ipexeFileDialog.ShowDialog(); 81 | if (_dialogResult == DialogResult.OK) 82 | { 83 | txtExePath.Text = this.ipexeFileDialog.FileName.Replace("\\", "/"); 84 | } 85 | } 86 | 87 | private void comboxIPProvice_SelectedIndexChanged(object sender, EventArgs e) 88 | { 89 | if (this.comboxIPProvice.SelectedValue.ToString() == "所有") 90 | { 91 | this.comboxIPCity.DataSource = new List(new string[1] { "所有" }); 92 | } 93 | else 94 | { 95 | this.comboxIPCity.DataSource = CommonParameter.IpelfCurrentInstance.IPGetCitys(this.comboxIPProvice.SelectedValue.ToString()); 96 | this.comboxIPCity.SelectedIndex = this.comboxIPCity.FindStringExact(CommonParameter.ConfigParam.ipelf_info.city); 97 | } 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_Keywords.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Windows.Forms; 6 | 7 | namespace Bindding.SubForms.UserControls 8 | { 9 | public partial class UC_Keywords : BaseConfigUserControl 10 | { 11 | protected override void InitData() 12 | { 13 | // 关键字信息 14 | var _list = CommonParameter.ConfigParam.key_match_list; 15 | txtSearchKeys.Text = string.Join(Environment.NewLine, _list.Select(s => s.Key)); 16 | lb_keyNum.Text = _list.Count + "行"; 17 | // 匹配域名 18 | txtSearchMatches.Text = string.Join(Environment.NewLine, _list.Select(s => s.Value)); 19 | lb_matchNum.Text = _list.Count + "行"; 20 | 21 | this.lb_LoopCount.SelectedIndex = this.lb_LoopCount.FindStringExact(CommonParameter.ConfigParam.loop_count.ToString()); 22 | } 23 | 24 | protected override bool VerifyData() 25 | { 26 | if (string.IsNullOrEmpty(txtSearchKeys.Text.Trim())) 27 | { 28 | MessageBox.Show("关键字信息,不能为空!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 29 | return false; 30 | } 31 | 32 | if (string.IsNullOrEmpty(txtSearchMatches.Text.Trim())) 33 | { 34 | MessageBox.Show("匹配域名信息,不能为空!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 35 | return false; 36 | } 37 | 38 | if (txtSearchKeys.Lines.Length != txtSearchMatches.Lines.Length) 39 | { 40 | MessageBox.Show("关键字和域名,数量不匹配!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 41 | return false; 42 | } 43 | 44 | if (this.lb_LoopCount.SelectedIndex < 0) 45 | { 46 | MessageBox.Show("请选择循环次数!", "配置验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); 47 | return false; 48 | } 49 | 50 | return true; 51 | } 52 | 53 | protected override void UpdateData() 54 | { 55 | var _newList = new List>(); 56 | KeyValuePair _tmp; 57 | for (int i = 0; i < txtSearchKeys.Lines.Length; i++) 58 | { 59 | _tmp = new KeyValuePair(txtSearchKeys.Lines[i], txtSearchMatches.Lines[i]); 60 | _newList.Add(_tmp); 61 | } 62 | 63 | CommonParameter.ConfigParam.loop_count = Convert.ToInt32(this.lb_LoopCount.Text); 64 | CommonParameter.ConfigParam.key_match_list = _newList; 65 | } 66 | 67 | private void txtSearchKeys_KeyPress(object sender, KeyPressEventArgs e) 68 | { 69 | if (e.KeyChar == (char)Keys.Enter) 70 | { 71 | lb_keyNum.Text = (txtSearchKeys.Lines.Length + 1).ToString() + "行"; 72 | } 73 | else if (e.KeyChar == (char)Keys.Back) 74 | { 75 | lb_keyNum.Text = txtSearchKeys.Lines.Length.ToString() + "行"; 76 | } 77 | } 78 | 79 | private void txtSearchKeys_Leave(object sender, EventArgs e) 80 | { 81 | lb_keyNum.Text = txtSearchKeys.Lines.Length.ToString() + "行"; 82 | } 83 | 84 | private void txtSearchMatches_KeyPress(object sender, KeyPressEventArgs e) 85 | { 86 | if (e.KeyChar == (char)Keys.Enter) 87 | { 88 | lb_matchNum.Text = (txtSearchMatches.Lines.Length + 1).ToString() + "行"; 89 | } 90 | else if (e.KeyChar == (char)Keys.Back) 91 | { 92 | lb_matchNum.Text = txtSearchMatches.Lines.Length.ToString() + "行"; 93 | } 94 | } 95 | 96 | private void txtSearchMatches_Leave(object sender, EventArgs e) 97 | { 98 | lb_matchNum.Text = txtSearchMatches.Lines.Length.ToString() + "行"; 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_SecondsMinMax.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Bindding.SubForms.UserControls 2 | { 3 | partial class UC_SecondsMinMax 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.txtMin = new System.Windows.Forms.TextBox(); 32 | this.txtMax = new System.Windows.Forms.TextBox(); 33 | this.label2 = new System.Windows.Forms.Label(); 34 | this.label3 = new System.Windows.Forms.Label(); 35 | this.lb_MinMax_Title = new System.Windows.Forms.Label(); 36 | this.SuspendLayout(); 37 | // 38 | // txtMin 39 | // 40 | this.txtMin.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 41 | this.txtMin.Location = new System.Drawing.Point(92, 7); 42 | this.txtMin.Name = "txtMin"; 43 | this.txtMin.Size = new System.Drawing.Size(40, 21); 44 | this.txtMin.TabIndex = 0; 45 | this.txtMin.Text = "1000"; 46 | this.txtMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 47 | this.txtMin.WordWrap = false; 48 | this.txtMin.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtMin_KeyPress); 49 | this.txtMin.Leave += new System.EventHandler(this.txtMin_Leave); 50 | // 51 | // txtMax 52 | // 53 | this.txtMax.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 54 | this.txtMax.Location = new System.Drawing.Point(157, 7); 55 | this.txtMax.Name = "txtMax"; 56 | this.txtMax.Size = new System.Drawing.Size(40, 21); 57 | this.txtMax.TabIndex = 1; 58 | this.txtMax.Text = "1000"; 59 | this.txtMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 60 | this.txtMax.WordWrap = false; 61 | this.txtMax.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtMax_KeyPress); 62 | this.txtMax.Leave += new System.EventHandler(this.txtMax_Leave); 63 | // 64 | // label2 65 | // 66 | this.label2.AutoSize = true; 67 | this.label2.Location = new System.Drawing.Point(136, 11); 68 | this.label2.Name = "label2"; 69 | this.label2.Size = new System.Drawing.Size(17, 12); 70 | this.label2.TabIndex = 99; 71 | this.label2.Text = "到"; 72 | // 73 | // label3 74 | // 75 | this.label3.AutoSize = true; 76 | this.label3.Location = new System.Drawing.Point(203, 11); 77 | this.label3.Name = "label3"; 78 | this.label3.Size = new System.Drawing.Size(59, 12); 79 | this.label3.TabIndex = 99; 80 | this.label3.Text = "毫秒 随机"; 81 | // 82 | // lb_MinMax_Title 83 | // 84 | this.lb_MinMax_Title.AutoSize = true; 85 | this.lb_MinMax_Title.Location = new System.Drawing.Point(3, 11); 86 | this.lb_MinMax_Title.Name = "lb_MinMax_Title"; 87 | this.lb_MinMax_Title.Size = new System.Drawing.Size(29, 12); 88 | this.lb_MinMax_Title.TabIndex = 99; 89 | this.lb_MinMax_Title.Text = "标题"; 90 | this.lb_MinMax_Title.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 91 | // 92 | // UC_SecondsMinMax 93 | // 94 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 96 | this.Controls.Add(this.label3); 97 | this.Controls.Add(this.label2); 98 | this.Controls.Add(this.lb_MinMax_Title); 99 | this.Controls.Add(this.txtMax); 100 | this.Controls.Add(this.txtMin); 101 | this.MaximumSize = new System.Drawing.Size(268, 35); 102 | this.MinimumSize = new System.Drawing.Size(268, 35); 103 | this.Name = "UC_SecondsMinMax"; 104 | this.Size = new System.Drawing.Size(268, 35); 105 | this.ResumeLayout(false); 106 | this.PerformLayout(); 107 | 108 | } 109 | 110 | #endregion 111 | 112 | private System.Windows.Forms.TextBox txtMin; 113 | private System.Windows.Forms.TextBox txtMax; 114 | private System.Windows.Forms.Label label2; 115 | private System.Windows.Forms.Label label3; 116 | private System.Windows.Forms.Label lb_MinMax_Title; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_SecondsMinMax.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | using System; 3 | using System.ComponentModel; 4 | using System.Windows.Forms; 5 | 6 | namespace Bindding.SubForms.UserControls 7 | { 8 | /// 9 | /// 毫秒最大,最小时间 10 | /// 11 | public partial class UC_SecondsMinMax : UserControl 12 | { 13 | public UC_SecondsMinMax() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | /// 19 | /// 设置标题 20 | /// 21 | [Browsable(true)] 22 | [Description("文本框前的标题")] 23 | public string MyTitle 24 | { 25 | get { return lb_MinMax_Title.Text; } 26 | set { lb_MinMax_Title.Text = value; } 27 | } 28 | 29 | /// 30 | /// 设置最小最大的值 31 | /// 32 | public RandomMinMax MyMinMax 33 | { 34 | get 35 | { 36 | return new RandomMinMax() 37 | { 38 | min_ms = Convert.ToInt32(txtMin.Text), 39 | max_ms = Convert.ToInt32(txtMax.Text) 40 | }; 41 | } 42 | set 43 | { 44 | txtMin.Text = value.min_ms.ToString(); 45 | txtMax.Text = value.max_ms.ToString(); 46 | } 47 | } 48 | 49 | /// 50 | /// 验证最小最大值 51 | /// 52 | internal bool VerifyMinMax() 53 | { 54 | if (Convert.ToInt32(txtMin.Text) > Convert.ToInt32(txtMax.Text)) 55 | { 56 | MessageBox.Show(this.lb_MinMax_Title.Text + " 最小值不能大于最大值"); 57 | return false; 58 | } 59 | 60 | return true; 61 | } 62 | 63 | private void txtMax_KeyPress(object sender, KeyPressEventArgs e) 64 | { 65 | // 只能输入数字,回车,删除键 66 | if (!char.IsDigit(e.KeyChar) 67 | && e.KeyChar != (char)Keys.Back 68 | && e.KeyChar != (char)Keys.Enter) 69 | { 70 | e.Handled = true; 71 | } 72 | } 73 | 74 | private void txtMax_Leave(object sender, EventArgs e) 75 | { 76 | if (string.IsNullOrEmpty(txtMax.Text)) 77 | { 78 | txtMax.Text = "0"; // 如果是空的,则置为0 79 | } 80 | } 81 | 82 | private void txtMin_KeyPress(object sender, KeyPressEventArgs e) 83 | { 84 | // 只能输入数字,回车,删除键 85 | if (!char.IsDigit(e.KeyChar) 86 | && e.KeyChar != (char)Keys.Back 87 | && e.KeyChar != (char)Keys.Enter) 88 | { 89 | e.Handled = true; 90 | } 91 | } 92 | 93 | private void txtMin_Leave(object sender, EventArgs e) 94 | { 95 | if (string.IsNullOrEmpty(txtMin.Text)) 96 | { 97 | txtMin.Text = "0"; // 如果是空的,则置为0 98 | } 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_SimulateSpeed.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | 3 | namespace Bindding.SubForms.UserControls 4 | { 5 | public partial class UC_SimulateSpeed : BaseConfigUserControl 6 | { 7 | protected override void InitData() 8 | { 9 | var _tmp = CommonParameter.ConfigParam.simulate_speed; 10 | this.uc_k_keyword.MyMinMax = _tmp.keyboard_keywords_speed; 11 | this.uc_m_click_search.MyMinMax = _tmp.mouse_click_search_input; 12 | this.uc_m_move_search.MyMinMax = _tmp.mouse_move_search_input; 13 | this.uc_m_scroll.MyMinMax = _tmp.mouse_scroll; 14 | } 15 | 16 | protected override bool VerifyData() 17 | { 18 | if (!this.uc_k_keyword.VerifyMinMax()) 19 | { 20 | return false; 21 | } 22 | 23 | if (!this.uc_m_click_search.VerifyMinMax()) 24 | { 25 | return false; 26 | } 27 | 28 | if (!this.uc_m_move_search.VerifyMinMax()) 29 | { 30 | return false; 31 | } 32 | 33 | if (!this.uc_m_scroll.VerifyMinMax()) 34 | { 35 | return false; 36 | } 37 | 38 | return true; 39 | } 40 | 41 | protected override void UpdateData() 42 | { 43 | CommonParameter.ConfigParam.simulate_speed.keyboard_keywords_speed = this.uc_k_keyword.MyMinMax; 44 | CommonParameter.ConfigParam.simulate_speed.mouse_click_search_input = this.uc_m_click_search.MyMinMax; 45 | CommonParameter.ConfigParam.simulate_speed.mouse_move_search_input = this.uc_m_move_search.MyMinMax; 46 | CommonParameter.ConfigParam.simulate_speed.mouse_scroll = this.uc_m_scroll.MyMinMax; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Bindding/SubForms/UserControls/UC_SleepSeconds.cs: -------------------------------------------------------------------------------- 1 | using Bindding.ExcuteClasses; 2 | 3 | namespace Bindding.SubForms.UserControls 4 | { 5 | public partial class UC_SleepSeconds : BaseConfigUserControl 6 | { 7 | protected override void InitData() 8 | { 9 | var _tmp = CommonParameter.ConfigParam.sleep_seconds; 10 | this.uc_after_search.MyMinMax = _tmp.after_search; 11 | this.uc_baidu_search.MyMinMax = _tmp.baidu_search; 12 | this.uc_popup.MyMinMax = _tmp.pop_up; 13 | this.uc_recon.MyMinMax = _tmp.recon_time; 14 | } 15 | 16 | protected override bool VerifyData() 17 | { 18 | if (!this.uc_after_search.VerifyMinMax()) 19 | { 20 | return false; 21 | } 22 | 23 | if (!this.uc_baidu_search.VerifyMinMax()) 24 | { 25 | return false; 26 | } 27 | 28 | if (!this.uc_popup.VerifyMinMax()) 29 | { 30 | return false; 31 | } 32 | 33 | if (!this.uc_recon.VerifyMinMax()) 34 | { 35 | return false; 36 | } 37 | 38 | return true; 39 | } 40 | 41 | protected override void UpdateData() 42 | { 43 | CommonParameter.ConfigParam.sleep_seconds.after_search = this.uc_after_search.MyMinMax; 44 | CommonParameter.ConfigParam.sleep_seconds.baidu_search = this.uc_baidu_search.MyMinMax; 45 | CommonParameter.ConfigParam.sleep_seconds.pop_up = this.uc_popup.MyMinMax; 46 | CommonParameter.ConfigParam.sleep_seconds.recon_time = this.uc_recon.MyMinMax; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Bindding/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Bindding/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "change_ip": 2, 3 | "loop_count": 10, 4 | "key_match_list": [ 5 | { 6 | "Key": "百度竞价", 7 | "Value": "baidu.com" 8 | } 9 | ], 10 | "ipelf_info": { 11 | "soft_path": "E:/Work/竞价/ipjl/ipjl.exe", 12 | "username": "lzh32", 13 | "password": "5237181", 14 | "provice": "四川省", 15 | "city": "成都市" 16 | }, 17 | "adsl_info": { 18 | "username": "用户名", 19 | "password": "密码" 20 | }, 21 | "sleep_seconds": { 22 | "after_search": { 23 | "min_ms": 1000, 24 | "max_ms": 1000 25 | }, 26 | "baidu_search": { 27 | "min_ms": 1000, 28 | "max_ms": 1000 29 | }, 30 | "pop_up": { 31 | "min_ms": 8000, 32 | "max_ms": 16000 33 | }, 34 | "recon_time": { 35 | "min_ms": 60000, 36 | "max_ms": 120000 37 | } 38 | }, 39 | "simulate_speed": { 40 | "mouse_scroll": { 41 | "min_ms": 1500, 42 | "max_ms": 3000 43 | }, 44 | "mouse_move_search_input": { 45 | "min_ms": 2000, 46 | "max_ms": 3000 47 | }, 48 | "mouse_click_search_input": { 49 | "min_ms": 800, 50 | "max_ms": 1600 51 | }, 52 | "keyboard_keywords_speed": { 53 | "min_ms": 400, 54 | "max_ms": 1000 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Bindding/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /BinddingV1.0.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bindding", "Bindding\Bindding.csproj", "{9DECFFC7-6626-4E99-B2CF-E9A435051C24}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegisterMachine", "RegisterMachine\RegisterMachine.csproj", "{9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CallProcess", "CallProcess\CallProcess.csproj", "{44885820-B113-4686-B9A4-39A3985CBDD1}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Debug|Mixed Platforms = Debug|Mixed Platforms 16 | Debug|x86 = Debug|x86 17 | Release|Any CPU = Release|Any CPU 18 | Release|Mixed Platforms = Release|Mixed Platforms 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Debug|Any CPU.ActiveCfg = Debug|x86 23 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Debug|Any CPU.Build.0 = Debug|x86 24 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 25 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Debug|Mixed Platforms.Build.0 = Debug|x86 26 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Debug|x86.ActiveCfg = Debug|x86 27 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Debug|x86.Build.0 = Debug|x86 28 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Release|Mixed Platforms.ActiveCfg = Release|x86 31 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Release|Mixed Platforms.Build.0 = Release|x86 32 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Release|x86.ActiveCfg = Release|x86 33 | {9DECFFC7-6626-4E99-B2CF-E9A435051C24}.Release|x86.Build.0 = Release|x86 34 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Debug|Any CPU.ActiveCfg = Debug|x86 35 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Debug|Any CPU.Build.0 = Debug|x86 36 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 37 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Debug|Mixed Platforms.Build.0 = Debug|x86 38 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Debug|x86.ActiveCfg = Debug|x86 39 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Debug|x86.Build.0 = Debug|x86 40 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Release|Mixed Platforms.ActiveCfg = Release|x86 43 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Release|Mixed Platforms.Build.0 = Release|x86 44 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Release|x86.ActiveCfg = Release|x86 45 | {9581D6CD-F8FC-45E7-82F4-14D9DBCB84F3}.Release|x86.Build.0 = Release|x86 46 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 49 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 50 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Debug|x86.ActiveCfg = Debug|Any CPU 51 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Debug|x86.Build.0 = Debug|Any CPU 52 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 55 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Release|Mixed Platforms.Build.0 = Release|Any CPU 56 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Release|x86.ActiveCfg = Release|x86 57 | {44885820-B113-4686-B9A4-39A3985CBDD1}.Release|x86.Build.0 = Release|x86 58 | EndGlobalSection 59 | GlobalSection(SolutionProperties) = preSolution 60 | HideSolutionNode = FALSE 61 | EndGlobalSection 62 | EndGlobal 63 | -------------------------------------------------------------------------------- /CallProcess/CallProcess.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | publish\|D:\Publish\ 5 | 6 | 7 | 8 | 9 | 10 | zh-CN 11 | false 12 | 13 | -------------------------------------------------------------------------------- /CallProcess/CommonFunction.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Data.SQLite; 4 | using System.IO; 5 | using System.Text; 6 | 7 | namespace CallProcess 8 | { 9 | internal static class CommonFunction 10 | { 11 | /// 12 | /// 重置运行数 13 | /// 14 | internal static void ResetRunNo() 15 | { 16 | string _path = Environment.CurrentDirectory + "\\bindding.db"; 17 | if (File.Exists(_path)) 18 | { 19 | var m_dbConnection = new SQLiteConnection("Data Source=bindding.db;Version=3;"); 20 | m_dbConnection.Open(); 21 | string sql = string.Format("UPDATE run_parameters SET CurLoopNo=1;"); 22 | SQLiteCommand cmd = new SQLiteCommand(sql, m_dbConnection); 23 | cmd.ExecuteNonQuery(); 24 | m_dbConnection.Close(); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /CallProcess/ControlProcess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace CallProcess 11 | { 12 | internal static class ControlProcess 13 | { 14 | private static bool _is_work = false; 15 | 16 | internal static void GetProcess() 17 | { 18 | var processes = Process.GetProcessesByName("Bindding"); 19 | if (processes.Length == 1 && processes[0].Responding) 20 | { 21 | CommonFunction.ResetRunNo(); 22 | processes[0].WaitForExit(); 23 | } 24 | 25 | if (processes.Length == 0) 26 | { 27 | Process exep = new Process(); 28 | exep.StartInfo.FileName = System.Environment.CurrentDirectory + "\\Bindding.exe"; 29 | exep.StartInfo.Arguments = string.Format("{0}", _is_work.ToString()); 30 | _is_work = true; // 第二次后,一直执行中 31 | exep.StartInfo.CreateNoWindow = true; 32 | exep.StartInfo.UseShellExecute = false; 33 | exep.Start(); 34 | exep.WaitForExit(); 35 | } 36 | } 37 | 38 | internal static void CloseProcess() 39 | { 40 | var processes = Process.GetProcessesByName("Bindding"); 41 | if (processes.Length == 1) 42 | { 43 | processes[0].CloseMainWindow(); 44 | } 45 | } 46 | 47 | #region 确保程序只运行一个实例 48 | 49 | /// 50 | /// 在进程中查找是否已经有实例在运行 51 | /// 52 | /// 53 | internal static Process RunningInstance() 54 | { 55 | Process current = Process.GetCurrentProcess(); 56 | Process[] processes = Process.GetProcessesByName(current.ProcessName); 57 | //遍历与当前进程名称相同的进程列表 58 | foreach (Process process in processes) 59 | { 60 | //如果实例已经存在则忽略当前进程 61 | if (process.Id != current.Id) 62 | { 63 | //保证要打开的进程同已经存在的进程来自同一文件路径 64 | if (Assembly.GetExecutingAssembly().Location.Replace("/", "\"") == current.MainModule.FileName) 65 | { 66 | //返回已经存在的进程 67 | return process; 68 | } 69 | } 70 | } 71 | return null; 72 | } 73 | 74 | /// 75 | /// 已经有了就把它激活,并将其窗口放置最前端 76 | /// 77 | /// 78 | internal static void HandleRunningInstance(Process instance) 79 | { 80 | MessageBox.Show("已经在运行!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); 81 | ShowWindowAsync(instance.MainWindowHandle, 1); // 调用api函数,正常显示窗口 82 | SetForegroundWindow(instance.MainWindowHandle); // 将窗口放置最前端 83 | } 84 | 85 | [DllImport("User32.dll")] 86 | private static extern bool ShowWindowAsync(System.IntPtr hWnd, int cmdShow); 87 | 88 | [DllImport("User32.dll")] 89 | private static extern bool SetForegroundWindow(System.IntPtr hWnd); 90 | 91 | #endregion 确保程序只运行一个实例 92 | } 93 | } -------------------------------------------------------------------------------- /CallProcess/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using System.Windows.Forms; 4 | 5 | namespace CallProcess 6 | { 7 | internal partial class form_reboot : Form 8 | { 9 | private const int WM_HOTKEY = 0x312; // 窗口消息:热键 10 | private const int WM_CREATE = 0x1; // 窗口消息:创建 11 | private const int WM_DESTROY = 0x2; // 窗口消息:销毁 12 | internal static bool IsRunning = true; // 判断是否在允许中 13 | 14 | internal form_reboot() 15 | { 16 | InitializeComponent(); 17 | this.Location = new System.Drawing.Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height); 18 | } 19 | 20 | private void btn_exit_Click(object sender, EventArgs e) 21 | { 22 | this.Form_Exit(); 23 | } 24 | 25 | private void exitMenuItem_Click(object sender, EventArgs e) 26 | { 27 | this.Form_Exit(); 28 | } 29 | 30 | private void Form_Exit() 31 | { 32 | // 关闭浏览器窗口 33 | IsRunning = false; 34 | ControlProcess.CloseProcess(); 35 | 36 | // 关闭当前窗体 37 | nti_reboot.Visible = false; 38 | this.Close(); 39 | this.Dispose(); 40 | Application.Exit(); 41 | } 42 | 43 | private void hideMenuItem_Click(object sender, EventArgs e) 44 | { 45 | this.Hide(); 46 | } 47 | 48 | private void showMenuItem_Click(object sender, EventArgs e) 49 | { 50 | this.Show(); 51 | this.WindowState = FormWindowState.Normal; 52 | this.Activate(); 53 | } 54 | 55 | private void nti_reboot_MouseDoubleClick(object sender, MouseEventArgs e) 56 | { 57 | if (this.WindowState == FormWindowState.Normal) 58 | { 59 | this.WindowState = FormWindowState.Minimized; 60 | this.Hide(); 61 | } 62 | else if (this.WindowState == FormWindowState.Minimized) 63 | { 64 | this.Show(); 65 | this.WindowState = FormWindowState.Normal; 66 | this.Activate(); 67 | } 68 | } 69 | 70 | private void form_reboot_Load(object sender, EventArgs e) 71 | { 72 | //注册热键Shift+S,Id号为100。HotKey.KeyModifiers.Shift也可以直接使用数字4来表示。 73 | SystemHotKey.RegHotKey(Handle, 100, SystemHotKey.KeyModifiers.Ctrl, Keys.F12); 74 | SystemHotKey.RegHotKey(Handle, 101, SystemHotKey.KeyModifiers.Ctrl, Keys.F11); 75 | Task.Factory.StartNew(() => 76 | { 77 | while (IsRunning) 78 | { 79 | ControlProcess.GetProcess(); 80 | } 81 | }); 82 | } 83 | 84 | protected override void WndProc(ref Message m) 85 | { 86 | //按快捷键 87 | switch (m.Msg) 88 | { 89 | case WM_HOTKEY: 90 | switch (m.WParam.ToInt32()) 91 | { 92 | case 100: 93 | this.Form_Exit(); 94 | break; 95 | 96 | case 101: 97 | SendMsg.StopMainFormBtn(); 98 | break; 99 | } 100 | break; 101 | } 102 | base.WndProc(ref m); 103 | } 104 | 105 | private void form_reboot_FormClosed(object sender, FormClosedEventArgs e) 106 | { 107 | SystemHotKey.UnRegHotKey(Handle, 100); 108 | SystemHotKey.UnRegHotKey(Handle, 101); 109 | 110 | // 关闭浏览器窗口 111 | ControlProcess.CloseProcess(); 112 | } 113 | 114 | private void btn_stop_Click(object sender, EventArgs e) 115 | { 116 | SendMsg.StopMainFormBtn(); 117 | } 118 | } 119 | } -------------------------------------------------------------------------------- /CallProcess/HotKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Windows.Forms; 7 | 8 | namespace CallProcess 9 | { 10 | public class SystemHotKey 11 | { 12 | /// 13 | /// 如果函数执行成功,返回值不为0。 14 | /// 如果函数执行失败,返回值为0。要得到扩展错误信息,调用GetLastError。 15 | /// 16 | /// 要定义热键的窗口的句柄 17 | /// 定义热键ID(不能与其它ID重复) 18 | /// 标识热键是否在按Alt、Ctrl、Shift、Windows等键时才会生效 19 | /// 定义热键的内容 20 | /// 21 | [DllImport("user32.dll", SetLastError = true)] 22 | public static extern bool RegisterHotKey(IntPtr hWnd, int id, KeyModifiers fsModifiers, Keys vk); 23 | 24 | /// 25 | /// 注销热键 26 | /// 27 | /// 要取消热键的窗口的句柄 28 | /// 要取消热键的ID 29 | /// 30 | [DllImport("user32.dll", SetLastError = true)] 31 | public static extern bool UnregisterHotKey(IntPtr hWnd, int id); 32 | 33 | /// 34 | /// 辅助键名称。 35 | /// Alt, Ctrl, Shift, WindowsKey 36 | /// 37 | [Flags()] 38 | public enum KeyModifiers { None = 0, Alt = 1, Ctrl = 2, Shift = 4, WindowsKey = 8 } 39 | 40 | /// 41 | /// 注册热键 42 | /// 43 | /// 窗口句柄 44 | /// 热键ID 45 | /// 组合键 46 | /// 热键 47 | public static void RegHotKey(IntPtr hwnd, int hotKeyId, KeyModifiers keyModifiers, Keys key) 48 | { 49 | if (!RegisterHotKey(hwnd, hotKeyId, keyModifiers, key)) 50 | { 51 | int errorCode = Marshal.GetLastWin32Error(); 52 | if (errorCode == 1409) 53 | { 54 | MessageBox.Show("热键被占用 !"); 55 | } 56 | else 57 | { 58 | MessageBox.Show("注册热键失败!错误代码:" + errorCode); 59 | } 60 | } 61 | } 62 | 63 | /// 64 | /// 注销热键 65 | /// 66 | /// 窗口句柄 67 | /// 热键ID 68 | public static void UnRegHotKey(IntPtr hwnd, int hotKeyId) 69 | { 70 | //注销指定的热键 71 | UnregisterHotKey(hwnd, hotKeyId); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /CallProcess/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Principal; 5 | using System.Windows.Forms; 6 | 7 | namespace CallProcess 8 | { 9 | internal static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | private static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | if (!IsAdministrator()) 20 | { 21 | MessageBox.Show("请以管理员身份运行!"); 22 | return; 23 | } 24 | 25 | var instance = ControlProcess.RunningInstance(); 26 | if (instance == null) 27 | { 28 | Application.Run(new form_reboot()); 29 | } 30 | else 31 | { 32 | ControlProcess.HandleRunningInstance(instance); // 已经有一个实例在运行,激活它 33 | } 34 | } 35 | 36 | private static bool IsAdministrator() 37 | { 38 | WindowsIdentity identity = WindowsIdentity.GetCurrent(); 39 | WindowsPrincipal principal = new WindowsPrincipal(identity); 40 | return principal.IsInRole(WindowsBuiltInRole.Administrator); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /CallProcess/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("CallProcess")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CallProcess")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("68a299be-65ab-4cba-a8fc-b5f1c439dfc9")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CallProcess/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.18444 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CallProcess.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CallProcess.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 使用此强类型资源类,为所有资源查找 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CallProcess/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /CallProcess/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.18444 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CallProcess.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CallProcess/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CallProcess/Properties/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 54 | -------------------------------------------------------------------------------- /CallProcess/SendMsg.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Windows.Forms; 7 | 8 | namespace CallProcess 9 | { 10 | internal static class SendMsg 11 | { 12 | [DllImport("user32.dll", EntryPoint = "SendMessage")] 13 | private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); 14 | 15 | [DllImport("User32.dll", EntryPoint = "FindWindow")] 16 | private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); 17 | 18 | [DllImport("User32.dll", EntryPoint = "FindWindowEx")] 19 | private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpClassName, string lpWindowName); 20 | 21 | /// 22 | /// 主界面的 停止按钮 23 | /// 24 | internal static void StopMainFormBtn() 25 | { 26 | const int BM_CLICK = 0xF5; 27 | IntPtr maindHwnd = FindWindow(null, "点击主界面"); // 获得 点击主界面 的句柄 28 | if (maindHwnd != IntPtr.Zero) 29 | { 30 | IntPtr childHwnd = FindWindowEx(maindHwnd, IntPtr.Zero, null, "停止点击"); //获得按钮的句柄 31 | if (childHwnd != IntPtr.Zero) 32 | { 33 | SendMessage(childHwnd, BM_CLICK, 0, 0); //发送点击按钮的消息 34 | } 35 | else 36 | { 37 | MessageBox.Show("没有找到子窗口"); 38 | } 39 | } 40 | else 41 | { 42 | MessageBox.Show("没有找到窗口"); 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /CallProcess/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bind-refactor 2 | 百度竞价模拟点击(点击广告结果,测试已失效) 3 | 4 | 已编译-Release 解压可用 5 | 链接: https://pan.baidu.com/s/1pLoQZAr 密码: 4ab4 6 | Gitub(推荐): https://github.com/MrBenWang/bind-refactor/releases/tag/1.0 7 | 8 | 部分代码内容说明 9 | http://www.cnblogs.com/BenAndWang/p/7567982.html 10 | -------------------------------------------------------------------------------- /ReferenceDll/DotRas.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/ReferenceDll/DotRas.dll -------------------------------------------------------------------------------- /ReferenceDll/EasyLicense.Lib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/ReferenceDll/EasyLicense.Lib.dll -------------------------------------------------------------------------------- /ReferenceDll/SQLite.Interop.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/ReferenceDll/SQLite.Interop.dll -------------------------------------------------------------------------------- /ReferenceDll/System.Data.SQLite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/ReferenceDll/System.Data.SQLite.dll -------------------------------------------------------------------------------- /ReferenceDll/WindowsInput.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/ReferenceDll/WindowsInput.dll -------------------------------------------------------------------------------- /ReferenceDll/log4net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/ReferenceDll/log4net.dll -------------------------------------------------------------------------------- /RegisterMachine/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace RegisterMachine 7 | { 8 | internal static class Program 9 | { 10 | /// 11 | /// 应用程序的主入口点。 12 | /// 13 | [STAThread] 14 | private static void Main() 15 | { 16 | Application.EnableVisualStyles(); 17 | Application.SetCompatibleTextRenderingDefault(false); 18 | if (DateTime.Now.Date != RegisterHelper.getWebsiteDatetime().Date) 19 | { 20 | MessageBox.Show("系统时间不正确!请同步互联网时间!", "系统异常", MessageBoxButtons.OK, MessageBoxIcon.Information); 21 | return; 22 | } 23 | 24 | Application.Run(new RegisterForm()); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /RegisterMachine/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("RegisterMachine")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RegisterMachine")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("9581d6cd-f8fc-45e7-82f4-14d9dbcb84f3")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RegisterMachine/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本: 4.0.30319.42000 5 | // 6 | // 对此文件的更改可能导致不正确的行为,如果 7 | // 重新生成代码,则所做更改将丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RegisterMachine.Properties 12 | { 13 | 14 | 15 | /// 16 | /// 强类型资源类,用于查找本地化字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// 返回此类使用的缓存 ResourceManager 实例。 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RegisterMachine.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// 覆盖当前线程的 CurrentUICulture 属性 56 | /// 使用此强类型的资源类的资源查找。 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /RegisterMachine/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /RegisterMachine/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RegisterMachine.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RegisterMachine/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RegisterMachine/RegisterForm.cs: -------------------------------------------------------------------------------- 1 | using EasyLicense.Lib.License; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Windows.Forms; 5 | using System.Xml; 6 | 7 | namespace RegisterMachine 8 | { 9 | public partial class RegisterForm : Form 10 | { 11 | private RegisterHelper reg; 12 | 13 | public RegisterForm() 14 | { 15 | InitializeComponent(); 16 | reg = new RegisterHelper(); 17 | } 18 | 19 | private void btnCopy_Click(object sender, EventArgs e) 20 | { 21 | if (string.IsNullOrEmpty(txtRegisterNum.Text)) 22 | { 23 | MessageBox.Show("未生成注册码!"); 24 | return; 25 | } 26 | 27 | Clipboard.SetDataObject(txtRegisterNum.Text); 28 | MessageBox.Show("复制成功"); 29 | } 30 | 31 | private void btnReg_Click(object sender, EventArgs e) 32 | { 33 | try 34 | { 35 | if (string.IsNullOrEmpty(txtMachineNum.Text)) 36 | { 37 | MessageBox.Show("机器码为空!"); 38 | return; 39 | } 40 | 41 | if (dtp_exp.Value < DateTime.Now) 42 | { 43 | MessageBox.Show("过期时间小于当前时间!", "警 告", MessageBoxButtons.OK, MessageBoxIcon.Warning); 44 | return; 45 | } 46 | 47 | var privateKey = txtMachineNum.Text; 48 | var _xmlDoc = new XmlDocument(); 49 | _xmlDoc.LoadXml(privateKey); 50 | var _newKey = _xmlDoc.SelectSingleNode("/Root/PrivateKey").InnerXml; 51 | var _id = _xmlDoc.SelectSingleNode("/Root/Params/id").InnerText; 52 | var _name = _xmlDoc.SelectSingleNode("/Root/Params/name").InnerText; 53 | var _expDate = _xmlDoc.SelectSingleNode("/Root/Params/expirationDate").InnerText; 54 | var _machineKey = _xmlDoc.SelectSingleNode("/Root/Params/dictionary").InnerText; 55 | 56 | var generator = new LicenseGenerator(_newKey); 57 | var dictionary = new Dictionary(); 58 | dictionary.Add("m", _machineKey); 59 | 60 | // generate the license 61 | var license = generator.Generate(_name, Guid.Parse(_id), dtp_exp.Value, dictionary, LicenseType.Standard); 62 | 63 | txtRegisterNum.Text = license; 64 | } 65 | catch (Exception ex) 66 | { 67 | MessageBox.Show("注册失败,异常:" + ex.Message, "提示", MessageBoxButtons.OK); 68 | } 69 | } 70 | 71 | private void btnSevenDay_Click(object sender, EventArgs e) 72 | { 73 | dtp_exp.Value = DateTime.Now.AddDays(7); 74 | } 75 | 76 | private void btnOneMonth_Click(object sender, EventArgs e) 77 | { 78 | dtp_exp.Value = DateTime.Now.AddMonths(1); 79 | } 80 | 81 | private void btnThreeMonth_Click(object sender, EventArgs e) 82 | { 83 | dtp_exp.Value = DateTime.Now.AddMonths(3); 84 | } 85 | 86 | private void btnSixMonth_Click(object sender, EventArgs e) 87 | { 88 | dtp_exp.Value = DateTime.Now.AddMonths(6); 89 | } 90 | 91 | private void btnOneYear_Click(object sender, EventArgs e) 92 | { 93 | dtp_exp.Value = DateTime.Now.AddYears(1); 94 | } 95 | 96 | private void btnForever_Click(object sender, EventArgs e) 97 | { 98 | dtp_exp.Value = DateTime.Now.AddYears(99); 99 | } 100 | 101 | private void txtMachineNum_Click(object sender, EventArgs e) 102 | { 103 | txtMachineNum.SelectAll(); 104 | } 105 | 106 | private void txtRegisterNum_Click(object sender, EventArgs e) 107 | { 108 | txtRegisterNum.SelectAll(); 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /RegisterMachine/RegisterForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /RegisterMachine/RegisterHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | 4 | namespace RegisterMachine 5 | { 6 | internal class RegisterHelper 7 | { 8 | /// 9 | /// 获取网络时间 10 | /// 11 | /// 12 | internal static DateTime getWebsiteDatetime() 13 | { 14 | HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://www.baidu.com"); 15 | HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); 16 | return Convert.ToDateTime(myResponse.Headers["date"]); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /RegisterMachine/RegisterMachine.csproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrBenWang/bind-refactor/3fb3f1d3962d04aa2c6de8ab63535746c0853842/RegisterMachine/RegisterMachine.csproj -------------------------------------------------------------------------------- /RegisterMachine/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------