///定义Ini写入对象///privateIniWriteini=newIniWrite(ADSLPath);//////判断第一登录///privateboolIsFirst=true;/////////privateMD5.DES.Md5Classmd5=newMD5.DES.Md5Class();/////////publicstaticstringkey=null;#endregion//////构造函数///publicfrmMain(){InitializeComponent();}#region窗体事件//////窗体初始/////////privatevoidfrmMain_Load(objectsender,EventArgse){SetToolTip();IntiLoad(sender,e);}#endregion#region控件按钮事件//////复制账号/////////privatevoidbtnCopyAccount_Click(objectsender,EventArgse){if(this.chkSpecial.Checked)//判断特殊拨号是否勾选{//进行加密UsernameEncodeencode=newUsernameEncode();Clipboard.SetDataObject(encode.EncodeUsername(this.txtAccount.Text,this.txtPassword.Text));}else{Clipboard.SetDataObject(this.txtAccount.Text);}MessageBox.Show("账号已经复制到剪贴板!","复制成功");}//////拨号/////////privatevoidbtnDia_Click(objectsender,EventArgse){if(this.txtAccount.Text.Trim()==""){MessageBox.Show("账号不能为空","输入错误");txtAccount.Focus();return;}if(this.txtPassword.Text.Trim()==""){MessageBox.Show("密码不能为空","输入错误");txtPassword.Focus();return;}this.NetDia();}//////找不到电话簿?/////////privatevoidlblNotFind_LinkClicked(objectsender,LinkLabelLinkClickedEventArgse){this.CreateConnections();}//////记住账号联动/////////privatevoidchkRemAccount_CheckedChanged(objectsender,EventArgse){if(!this.chkRemAccount.Checked){this.chkRemPassword.Checked=false;}}//////记住密码联动/////////privatevoidchkRemPassword_CheckedChanged(objectsender,EventArgse){if(this.chkRemPassword.Checked){this.chkRemAccount.Checked=true;}}//////自动登录启动/////////privatevoidAutoConectTimer_Tick(objectsender,EventArgse){this.AutoConectTimer.Enabled=false;newfrmLinkInfo(this).Show();base.Hide();}#endregion#region自定义方法//////初始登录/////////privatevoidIntiLoad(objectsender,EventArgse){FileInfoinfo=newFileInfo(ADSLPath);try{if(info.Exists){this.ReadConfig();}if(this.chkAutoDia.Checked)//是否自动登录{this.AutoConectTimer.Start();}}catch(Exception){File.Delete(ADSLPath);this.frmMain_Load(sender,e);}}//////设置控件提示///privatevoidSetToolTip(){ToolTiptip=newToolTip();tip.BackColor=System.Drawing.Color.Transparent;tip.SetToolTip(this.btnCopyAccount,"复制账号到剪贴板。如果勾选了特殊拨号,复制的则是加密过的账号。");tip.SetToolTip(this.btnDia,"手动进行拨号。");tip.SetToolTip(this.chkAutoDia,"勾选后,下次启动将自动拨号。");tip.SetToolTip(this.chkSpecial,"如果你原本使用协同拨号器拨号,请勾选此项。");tip.SetToolTip(this.chkRemPassword,"勾选后,将会保存密码信息,同时保存账号信息。");tip.SetToolTip(this.chkRemAccount,"勾选后,将会保存账号信息,但不会保存密码信息。");tip.SetToolTip(this.txtPassword,"在这里输入你的密码。如果有字母,有大小写之分。");tip.SetToolTip(this.lblNotFind,"如果拨号时提示找不到电话簿,请点击这里。");tip.SetToolTip(this.txtAccount,"在这里输入你的用户名,如果是特殊拨号不分大小写。");tip.SetToolTip(this.chkAutoClo,"勾选后拨号成功将自动关闭程序,如果拨号失败,则不会自动关闭。");}//////写入配置信息///privatevoidWriteConfig(){this.ini.Writue("用户设置","记住账号",this.chkRemAccount.Checked.ToString());this.ini.Writue("用户设置","记住密码",this.chkRemPassword.Checked.ToString());this.ini.Writue("用户设置","特殊拨号",this.chkSpecial.Checked.ToString());this.ini.Writue("用户设置","自动连接",this.chkAutoDia.Checked.ToString());this.ini.Writue("用户设置","自动关闭",this.chkAutoClo.Checked.ToString());this.ini.Writue("用户设置","首次使用",this.IsFirst.ToString());if(this.chkRemAccount.Checked){this.ini.Writue("用户信息","账号",this.md5.Encryption(this.txtAccount.Text));this.ini.Writue("加密密钥","账号",key);}if(this.chkRemPassword.Checked){this.ini.Writue("用户信息","密码",this.md5.Encryption(this.txtPassword.Text));this.ini.Writue("加密密钥","密码",key);}}//////读取配置信息///privatevoidReadConfig(){this.chkRemAccount.Checked=bool.Parse(this.ini.ReadValue("用户设置","记住账号"));this.chkRemPassword.Checked=bool.Parse(this.ini.ReadValue("用户设置","记住密码"));this.chkSpecial.Checked=bool.Parse(this.ini.ReadValue("用户设置","特殊拨号"));this.chkAutoDia.Checked=bool.Parse(this.ini.ReadValue("用户设置","自动连接"));this.chkAutoClo.Checked=bool.Parse(this.ini.ReadValue("用户设置","自动关闭"));this.IsFirst=bool.Parse(this.ini.ReadValue("用户设置","首次使用"));if(this.chkRemAccount.Checked){this.txtAccount.Text=this.md5.Decryption(this.ini.ReadValue("加密密钥","账号"),this.ini.ReadValue("用户信息","账号"));if(this.txtAccount.Text.Trim()==""){this.txtAccount.Text=null;}}if(this.chkRemPassword.Checked){this.txtPassword.Text=this.md5.Decryption(this.ini.ReadValue("加密密钥","密码"),this.ini.ReadValue("用户信息","密码"));if(this.txtPassword.Text.Trim()==""){this.txtPassword.Text=null;}}}//////判断是否是第一次使用本软件///privatevoidIsFirstUse(){if(this.IsFirst){if(MessageBox.Show("检测到您是初次使用本软件,是否自动创建一个名为【宽带连接】的连接?如果已经存在,请选否。","初次使用",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes){this.CreateConnections();}this.IsFirst=false;this.WriteConfig();}}//////连接宽带///privatevoidNetDia(){this.IsFirstUse();newfrmLinkInfo(this).Show();base.Hide();}//////电话簿///privatevoidCreateConnections(){Process[]processArray;StreamWriterwriter=newStreamWriter(ConnectionsPath,false,Encoding.Default);writer.Write(this.GetVersion());writer.Close();Processprocess=newProcess();process.StartInfo.FileName=ConnectionsPath;process.StartInfo.CreateNoWindow=true;base.Hide();process.Start();process.WaitForExit();File.Delete(ConnectionsPath);Label_006A:processArray=Process.GetProcesses();foreach(Processprocess2inprocessArray){if(process2.ProcessName.ToString()=="rasphone"){gotoLabel_006A;}}base.Show();}//////获取版本?//////privatestringGetVersion(){StringBuilderstr=newStringBuilder();str.Append("");str.Append("setws=createobject("wscript.shell")");str.Append("ws.run"rasphone-a宽带连接"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{t}"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{n}"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{enter}"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{enter}"");if(Registry.LocalMachine.OpenSubKey(@"SoftwareMicrosoftWindowsNTCurrentVersion").GetValue("ProductName").ToString()=="Windows7Ultimate"){str.Append("");str.Append("setws=createobject("wscript.shell")");str.Append("ws.run"rasphone-a宽带连接"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{enter}"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{enter}"");}returnstr.ToString();}#endregion}}-IMDN开发者社群-imdn.cn">
///定义Ini写入对象///privateIniWriteini=newIniWrite(ADSLPath);//////判断第一登录///privateboolIsFirst=true;/////////privateMD5.DES.Md5Classmd5=newMD5.DES.Md5Class();/////////publicstaticstringkey=null;#endregion//////构造函数///publicfrmMain(){InitializeComponent();}#region窗体事件//////窗体初始/////////privatevoidfrmMain_Load(objectsender,EventArgse){SetToolTip();IntiLoad(sender,e);}#endregion#region控件按钮事件//////复制账号/////////privatevoidbtnCopyAccount_Click(objectsender,EventArgse){if(this.chkSpecial.Checked)//判断特殊拨号是否勾选{//进行加密UsernameEncodeencode=newUsernameEncode();Clipboard.SetDataObject(encode.EncodeUsername(this.txtAccount.Text,this.txtPassword.Text));}else{Clipboard.SetDataObject(this.txtAccount.Text);}MessageBox.Show("账号已经复制到剪贴板!","复制成功");}//////拨号/////////privatevoidbtnDia_Click(objectsender,EventArgse){if(this.txtAccount.Text.Trim()==""){MessageBox.Show("账号不能为空","输入错误");txtAccount.Focus();return;}if(this.txtPassword.Text.Trim()==""){MessageBox.Show("密码不能为空","输入错误");txtPassword.Focus();return;}this.NetDia();}//////找不到电话簿?/////////privatevoidlblNotFind_LinkClicked(objectsender,LinkLabelLinkClickedEventArgse){this.CreateConnections();}//////记住账号联动/////////privatevoidchkRemAccount_CheckedChanged(objectsender,EventArgse){if(!this.chkRemAccount.Checked){this.chkRemPassword.Checked=false;}}//////记住密码联动/////////privatevoidchkRemPassword_CheckedChanged(objectsender,EventArgse){if(this.chkRemPassword.Checked){this.chkRemAccount.Checked=true;}}//////自动登录启动/////////privatevoidAutoConectTimer_Tick(objectsender,EventArgse){this.AutoConectTimer.Enabled=false;newfrmLinkInfo(this).Show();base.Hide();}#endregion#region自定义方法//////初始登录/////////privatevoidIntiLoad(objectsender,EventArgse){FileInfoinfo=newFileInfo(ADSLPath);try{if(info.Exists){this.ReadConfig();}if(this.chkAutoDia.Checked)//是否自动登录{this.AutoConectTimer.Start();}}catch(Exception){File.Delete(ADSLPath);this.frmMain_Load(sender,e);}}//////设置控件提示///privatevoidSetToolTip(){ToolTiptip=newToolTip();tip.BackColor=System.Drawing.Color.Transparent;tip.SetToolTip(this.btnCopyAccount,"复制账号到剪贴板。如果勾选了特殊拨号,复制的则是加密过的账号。");tip.SetToolTip(this.btnDia,"手动进行拨号。");tip.SetToolTip(this.chkAutoDia,"勾选后,下次启动将自动拨号。");tip.SetToolTip(this.chkSpecial,"如果你原本使用协同拨号器拨号,请勾选此项。");tip.SetToolTip(this.chkRemPassword,"勾选后,将会保存密码信息,同时保存账号信息。");tip.SetToolTip(this.chkRemAccount,"勾选后,将会保存账号信息,但不会保存密码信息。");tip.SetToolTip(this.txtPassword,"在这里输入你的密码。如果有字母,有大小写之分。");tip.SetToolTip(this.lblNotFind,"如果拨号时提示找不到电话簿,请点击这里。");tip.SetToolTip(this.txtAccount,"在这里输入你的用户名,如果是特殊拨号不分大小写。");tip.SetToolTip(this.chkAutoClo,"勾选后拨号成功将自动关闭程序,如果拨号失败,则不会自动关闭。");}//////写入配置信息///privatevoidWriteConfig(){this.ini.Writue("用户设置","记住账号",this.chkRemAccount.Checked.ToString());this.ini.Writue("用户设置","记住密码",this.chkRemPassword.Checked.ToString());this.ini.Writue("用户设置","特殊拨号",this.chkSpecial.Checked.ToString());this.ini.Writue("用户设置","自动连接",this.chkAutoDia.Checked.ToString());this.ini.Writue("用户设置","自动关闭",this.chkAutoClo.Checked.ToString());this.ini.Writue("用户设置","首次使用",this.IsFirst.ToString());if(this.chkRemAccount.Checked){this.ini.Writue("用户信息","账号",this.md5.Encryption(this.txtAccount.Text));this.ini.Writue("加密密钥","账号",key);}if(this.chkRemPassword.Checked){this.ini.Writue("用户信息","密码",this.md5.Encryption(this.txtPassword.Text));this.ini.Writue("加密密钥","密码",key);}}//////读取配置信息///privatevoidReadConfig(){this.chkRemAccount.Checked=bool.Parse(this.ini.ReadValue("用户设置","记住账号"));this.chkRemPassword.Checked=bool.Parse(this.ini.ReadValue("用户设置","记住密码"));this.chkSpecial.Checked=bool.Parse(this.ini.ReadValue("用户设置","特殊拨号"));this.chkAutoDia.Checked=bool.Parse(this.ini.ReadValue("用户设置","自动连接"));this.chkAutoClo.Checked=bool.Parse(this.ini.ReadValue("用户设置","自动关闭"));this.IsFirst=bool.Parse(this.ini.ReadValue("用户设置","首次使用"));if(this.chkRemAccount.Checked){this.txtAccount.Text=this.md5.Decryption(this.ini.ReadValue("加密密钥","账号"),this.ini.ReadValue("用户信息","账号"));if(this.txtAccount.Text.Trim()==""){this.txtAccount.Text=null;}}if(this.chkRemPassword.Checked){this.txtPassword.Text=this.md5.Decryption(this.ini.ReadValue("加密密钥","密码"),this.ini.ReadValue("用户信息","密码"));if(this.txtPassword.Text.Trim()==""){this.txtPassword.Text=null;}}}//////判断是否是第一次使用本软件///privatevoidIsFirstUse(){if(this.IsFirst){if(MessageBox.Show("检测到您是初次使用本软件,是否自动创建一个名为【宽带连接】的连接?如果已经存在,请选否。","初次使用",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes){this.CreateConnections();}this.IsFirst=false;this.WriteConfig();}}//////连接宽带///privatevoidNetDia(){this.IsFirstUse();newfrmLinkInfo(this).Show();base.Hide();}//////电话簿///privatevoidCreateConnections(){Process[]processArray;StreamWriterwriter=newStreamWriter(ConnectionsPath,false,Encoding.Default);writer.Write(this.GetVersion());writer.Close();Processprocess=newProcess();process.StartInfo.FileName=ConnectionsPath;process.StartInfo.CreateNoWindow=true;base.Hide();process.Start();process.WaitForExit();File.Delete(ConnectionsPath);Label_006A:processArray=Process.GetProcesses();foreach(Processprocess2inprocessArray){if(process2.ProcessName.ToString()=="rasphone"){gotoLabel_006A;}}base.Show();}//////获取版本?//////privatestringGetVersion(){StringBuilderstr=newStringBuilder();str.Append("");str.Append("setws=createobject("wscript.shell")");str.Append("ws.run"rasphone-a宽带连接"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{t}"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{n}"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{enter}"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{enter}"");if(Registry.LocalMachine.OpenSubKey(@"SoftwareMicrosoftWindowsNTCurrentVersion").GetValue("ProductName").ToString()=="Windows7Ultimate"){str.Append("");str.Append("setws=createobject("wscript.shell")");str.Append("ws.run"rasphone-a宽带连接"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{enter}"");str.Append("wscript.sleep200");str.Append("ws.sendkeys"{enter}"");}returnstr.ToString();}#endregion}} - IMDN开发者社群-imdn.cn">
首页 »
C# »
ADSL宽带拨号 (C#)实例源码下载
于 2014-07-16 发布
0 474
实例截图: 部分源码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Lqarpjj.Study.Demo.ADLSTool.Class;using System.Diagnostics;using System.IO;using Microsoft.Win32;namespace Lqarpjj.Study.Demo.ADLSTool{ public partial class frmMain : Form { #region 自定义变量 /// /// 静态变量存储信息的地址文件 /// private static string ADSLPath = Application.StartupPath @"ADSL.ini"; private static string ConnectionsPath = Application.StartupPath @"create.vbs"; /// /// 定义Ini写入对象 /// private IniWrite ini = new IniWrite(ADSLPath); /// /// 判断第一登录 /// private bool IsFirst = true; /// /// /// private MD5.DES.Md5Class md5 = new MD5.DES.Md5Class(); /// /// /// public static string key = null; #endregion /// /// 构造函数 /// public frmMain() { InitializeComponent(); } #region 窗体事件 /// /// 窗体初始 /// /// /// private void frmMain_Load(object sender, EventArgs e) { SetToolTip(); IntiLoad(sender, e); } #endregion #region 控件按钮事件 /// /// 复制账号 /// /// /// private void btnCopyAccount_Click(object sender, EventArgs e) { if (this.chkSpecial.Checked)//判断特殊拨号是否勾选 { //进行加密 UsernameEncode encode = new UsernameEncode(); Clipboard.SetDataObject(encode.EncodeUsername(this.txtAccount.Text, this.txtPassword.Text)); } else { Clipboard.SetDataObject(this.txtAccount.Text); } MessageBox.Show("账号已经复制到剪贴板!", "复制成功"); } /// /// 拨号 /// /// /// private void btnDia_Click(object sender, EventArgs e) { if (this.txtAccount.Text.Trim() == "") { MessageBox.Show("账号不能为空", "输入错误"); txtAccount.Focus(); return; } if (this.txtPassword.Text.Trim() == "") { MessageBox.Show("密码不能为空", "输入错误"); txtPassword.Focus(); return; } this.NetDia(); } /// /// 找不到电话簿? /// /// /// private void lblNotFind_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { this.CreateConnections(); } /// /// 记住账号联动 /// /// /// private void chkRemAccount_CheckedChanged(object sender, EventArgs e) { if (!this.chkRemAccount.Checked) { this.chkRemPassword.Checked = false; } } /// /// 记住密码联动 /// /// /// private void chkRemPassword_CheckedChanged(object sender, EventArgs e) { if (this.chkRemPassword.Checked) { this.chkRemAccount.Checked = true; } } /// /// 自动登录启动 /// /// /// private void AutoConectTimer_Tick(object sender, EventArgs e) { this.AutoConectTimer.Enabled = false; new frmLinkInfo(this).Show(); base.Hide(); } #endregion #region 自定义方法 /// /// 初始登录 /// /// /// private void IntiLoad(object sender, EventArgs e) { FileInfo info = new FileInfo(ADSLPath); try { if (info.Exists) { this.ReadConfig(); } if (this.chkAutoDia.Checked)//是否自动登录 { this.AutoConectTimer.Start(); } } catch (Exception) { File.Delete(ADSLPath); this.frmMain_Load(sender, e); } } /// ///设置控件提示 /// private void SetToolTip() { ToolTip tip = new ToolTip(); tip.BackColor = System.Drawing.Color.Transparent; tip.SetToolTip(this.btnCopyAccount, "复制账号到剪贴板。如果勾选了特殊拨号,复制的则是加密过的账号。"); tip.SetToolTip(this.btnDia, "手动进行拨号。"); tip.SetToolTip(this.chkAutoDia, "勾选后,下次启动将自动拨号。"); tip.SetToolTip(this.chkSpecial, "如果你原本使用协同拨号器拨号,请勾选此项。"); tip.SetToolTip(this.chkRemPassword, "勾选后,将会保存密码信息,同时保存账号信息。"); tip.SetToolTip(this.chkRemAccount, "勾选后,将会保存账号信息,但不会保存密码信息。"); tip.SetToolTip(this.txtPassword, "在这里输入你的密码。如果有字母,有大小写之分。"); tip.SetToolTip(this.lblNotFind, "如果拨号时提示找不到电话簿,请点击这里。"); tip.SetToolTip(this.txtAccount, "在这里输入你的用户名,如果是特殊拨号不分大小写。"); tip.SetToolTip(this.chkAutoClo, "勾选后拨号成功将自动关闭程序,如果拨号失败,则不会自动关闭。"); } /// /// 写入配置信息 /// private void WriteConfig() { this.ini.Writue("用户设置", "记住账号", this.chkRemAccount.Checked.ToString()); this.ini.Writue("用户设置", "记住密码", this.chkRemPassword.Checked.ToString()); this.ini.Writue("用户设置", "特殊拨号", this.chkSpecial.Checked.ToString()); this.ini.Writue("用户设置", "自动连接", this.chkAutoDia.Checked.ToString()); this.ini.Writue("用户设置", "自动关闭", this.chkAutoClo.Checked.ToString()); this.ini.Writue("用户设置", "首次使用", this.IsFirst.ToString()); if (this.chkRemAccount.Checked) { this.ini.Writue("用户信息", "账号", this.md5.Encryption(this.txtAccount.Text)); this.ini.Writue("加密密钥", "账号", key); } if (this.chkRemPassword.Checked) { this.ini.Writue("用户信息", "密码", this.md5.Encryption(this.txtPassword.Text)); this.ini.Writue("加密密钥", "密码", key); } } /// /// 读取配置信息 /// private void ReadConfig() { this.chkRemAccount.Checked = bool.Parse(this.ini.ReadValue("用户设置", "记住账号")); this.chkRemPassword.Checked = bool.Parse(this.ini.ReadValue("用户设置", "记住密码")); this.chkSpecial.Checked = bool.Parse(this.ini.ReadValue("用户设置", "特殊拨号")); this.chkAutoDia.Checked = bool.Parse(this.ini.ReadValue("用户设置", "自动连接")); this.chkAutoClo.Checked = bool.Parse(this.ini.ReadValue("用户设置", "自动关闭")); this.IsFirst = bool.Parse(this.ini.ReadValue("用户设置", "首次使用")); if (this.chkRemAccount.Checked) { this.txtAccount.Text = this.md5.Decryption(this.ini.ReadValue("加密密钥", "账号"), this.ini.ReadValue("用户信息", "账号")); if (this.txtAccount.Text.Trim() == "") { this.txtAccount.Text = null; } } if (this.chkRemPassword.Checked) { this.txtPassword.Text = this.md5.Decryption(this.ini.ReadValue("加密密钥", "密码"), this.ini.ReadValue("用户信息", "密码")); if (this.txtPassword.Text.Trim() == "") { this.txtPassword.Text = null; } } } /// /// 判断是否是第一次使用本软件 /// private void IsFirstUse() { if (this.IsFirst) { if (MessageBox.Show("检测到您是初次使用本软件,是否自动创建一个名为【宽带连接】的连接?如果已经存在,请选否。", "初次使用", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.CreateConnections(); } this.IsFirst = false; this.WriteConfig(); } } /// /// 连接宽带 /// private void NetDia() { this.IsFirstUse(); new frmLinkInfo(this).Show(); base.Hide(); } /// /// 电话簿 /// private void CreateConnections() { Process[] processArray; StreamWriter writer = new StreamWriter(ConnectionsPath, false, Encoding.Default); writer.Write(this.GetVersion()); writer.Close(); Process process = new Process(); process.StartInfo.FileName = ConnectionsPath; process.StartInfo.CreateNoWindow = true; base.Hide(); process.Start(); process.WaitForExit(); File.Delete(ConnectionsPath); Label_006A: processArray = Process.GetProcesses(); foreach (Process process2 in processArray) { if (process2.ProcessName.ToString() == "rasphone") { goto Label_006A; } } base.Show(); } /// /// 获取版本? /// /// private string GetVersion() { StringBuilder str = new StringBuilder(); str.Append(""); str.Append("set ws=createobject("wscript.shell") "); str.Append(" ws.run "rasphone -a 宽带连接" "); str.Append(" wscript.sleep 200 "); str.Append(" ws.sendkeys "{t}" "); str.Append(" wscript.sleep 200 "); str.Append(" ws.sendkeys "{n}" "); str.Append(" wscript.sleep 200 "); str.Append(" ws.sendkeys "{enter}" "); str.Append(" wscript.sleep 200 "); str.Append(" ws.sendkeys "{enter}" "); if (Registry.LocalMachine.OpenSubKey(@"SoftwareMicrosoftWindows NTCurrentVersion").GetValue("ProductName").ToString() == "Windows 7 Ultimate") { str.Append(""); str.Append("set ws=createobject("wscript.shell")"); str.Append(" ws.run "rasphone -a 宽带连接""); str.Append(" wscript.sleep 200"); str.Append(" ws.sendkeys "{enter}""); str.Append(" wscript.sleep 200"); str.Append(" ws.sendkeys "{enter}""); } return str.ToString(); } #endregion }}
下载说明:请别用迅雷下载,失败请重下,重下不扣分!
-
c++ 串口 发送消息、接收消息实例源代码(支持2进制、ASCII码、16进制)
VC 串口通讯源代码
- 2019-10-27下载
- 积分:1
-
webapi jwt身份验证请求token(亲测通过)源码
webapi jwt身份验证请求token(亲测通过)源码
- 2018-07-22下载
- 积分:1
-
Environment示例源码
Environment示例源码
- 2014-04-14下载
- 积分:1
-
XLT Unity3D 热修复示例源码
使用ILRuntime实现的类似XLUA功能的Unity3D下热修复BUG的解决方案请使用Unity2019.2.17f1版本打开,其他版本问题,请自行修复报错提示!Unity3D 5.x版本以下可以使用Unity4.7.2分支~ 和XLUA一样的地方和XLUA原理类似,注入和XLUA基本一致。 不一样的地方使用C#来进行代码的热更,避免项目内lua与C#代码交叉混杂,修复BUG时,需要C#一份,lua一份。 目录以及文件说明: Project-----Assets/XIL --- 所有XIL所用到的文件----Assets/XIL/ILSource --- ILRuntime插件源文件----Assets/XIL/Scripts --- 注入以及初始化代码----Assets/XIL/Auto --- 自动生成注入的代码以及自动生成的委托和函数的注册(如有此目录下的脚本报错,则可以直接删除此目录,然后重新生成委托,CLR绑定以及重新注册注入类型)----Hot --- 补丁源文件存放目录----Hot.sln --- 补丁源文件VS解决方案----DyncDll.csproj --- 补丁项目工程文件----Data/DyncDll.dll --- 补丁dll文件----Data/DyncDll.pdb --- 补丁dll的调试文件使用步骤以及菜单项说明:注意:菜单项会根据是否开启热更宏而有所不同 XIL/插件/开启 -- 开启热补丁宏XIL/插件/取消 -- 关闭热补丁宏XIL/插件/PDB开启 -- 加载PDB调试文件XIL/插件/PDB取消 -- 不加载PDB调试文件XIL/注册需要热更的类 -- 生成注入所需要的成员接口XIL/取消需要热更的类 -- 清除注入所需要的成员接口XIL/一键清除 -- 清除自动生成的脚本XIL/一键生成 -- 自动生成委托注册以及注入所需要的脚本XIL/委托自动生成 -- 热更当中操作C#层的委托,需要注册委托相关的类型以及转换代码 这里可自动分析项目当中所有用到的委托,自动注册XIL/清除委托自动生成的脚本 --清除委托自动生成的脚本,删除一些C#脚本,或修改,有可能引起报错,这时可以清除掉自动生成的注册脚本XIL/CLR绑定 -- 非反射的方式调用C#层的接口,可大幅度提高运行效率,一些常用的接口可考虑在GenerateCLRBinding文件当中添加需要CLR绑定的类型。XIL/Hotfix Inject In Editor -- 编辑器下注入接口只需要两步即可1 先开启补丁宏2 点击一键生成初始化以及资源接口1 需要在项目启动或适当位置调用初始化接口:wxb.hotMgr.Init();2 非编辑器下,需要自己创建加载文件的接口,可参考编辑器下的资源加载类EditorResLoad。生成补丁dll1 打开Hot解决方案2 替换DyncDll工程依赖UnityEngine.dll以及UnityEngine.UI.dll的文件,在目录Hot下,默认是Unity2018.2.11f1版本的,可以替换为自己项目对应的版本3 编译运行DyncDll工程,编译成功,即可在Data目录下生成补丁库。如何添加需要热更的类型:1 使用HotfixAttribute属性宏来修饰类型2 默认情况下所有类型都会被热更注入,如需要自己调整,可修改源文件ExportIL.cs里,FixMarkIL接口,自定义需要热更的类型生成静态DelegateBridge字段名称的规则 没有同名函数,则固定使用"__Hotfix_函数名"方式 有多个同名函数,对这些同名函数进行排序,排序规则如下(可参考接口wxb.Editor.Hotfix.getDelegateName的逻辑):1 参数个数少的在前2 进行字符串拼接,组成key值,规则如下"返回值全名 函数名(参数类型全名1,参数类型全名2,...)",之后通过key值比较,理论上,不同函数,key值是不会相同的 排序之后,取得对应函数在数组当中的下标来进行拼接如何,规则如下"__Hotfix_函数名_下标"的方式 为什么排序,主要是希望能够一眼看过去就知道函数对应的下标是多少,方便Hotfix,以及保证源脚本不变的情况下,每次Hotfix生成的字段名是一致的 如何替换函数一般有三种方式 通过函数名直接替换hotMgr.ReplaceFunc,可参考函数HotHelloWorld.Reg 通过自动生成的接口DelegateBridge对应的字段名,可直接使用hotMgr.ReplaceField,可参考函数HotHelloWorld.Reg 通过添加属性来自动注册,可参考脚本HotHelloWorld.cs与HotTemplate.cs,这里简单说明下, 要替换一个接口,要知道至少三个信息 替换的原类型 替换的接口对应的DelegateBridge字段的名字 热更当中,要替换的MethodInfo可添加属性ReplaceType到热更的类当中,表示此类型下的接口,默认替换的类型可添加属性ReplaceFunction到热更的接口当中,表示此接口需要替换哪个类型的哪个接口,可使用三种方式初始化1 ReplaceFunction(System.Type type) 替换type类型下同名的接口2 ReplaceFunction() 替换ReplaceType类型下同名的接口3 ReplaceFunction(string fieldNameOrTypeName), fieldNameOrTypeName值前缀不同,有不同的含义 a __Hotfix_开头,替换ReplaceType类型fieldName字段对应的接口 b 替换类型全名为fieldNameOrTypeName下同名的接口4 ReplaceFunction(System.Type type, string fieldName) 替换type类型fieldName字段对应的接口5 ReplaceFunction(string type, string fieldName) 替换类型全名为type下fieldName字段对应的接口 一般在没有同名函数情况下,可使用1,2种方式注册,有些类型为非公有类型的,可通过3,5接口,通过类型名来注册有同名函数情况下,就需要使用3,4, 5方式进行注册,可参考HotHelloWorld.cs脚本 通过属性进行自动注册的,假如在类型中含有对应DelegateBridge静态字段的Hotfix变量,则会自动对此变量进行赋值,保存一些参数在实际使用补丁方式热更时,经常遇到一些,只是需要在原有函数之前或之后添加一些代码的情况,这时,你可以通过Hotfix来执行原先代码可参考HotHelloWorld.Start的使用建议使用第3种方式进行接口替换 建议:最好安装下.NET Reflector,可用来反编译被注入的dll,查看源文件,可加深理解XIL的实现原理。项目下文件Library/ScriptAssemblies/Assembly-CSharp.dll这u3d生成的dll文件,原理上,也是修改此文件实现热更新功能,可使用.NET Reflector进行反编译查看源码 热更下模拟MonoBehaviour组件,用法可以参考hotScripts下脚本,可以做到平时在非热更环境下开发调试,到要发版本时再转换为热更方式Unity5.6以下版本,编辑器下使用的Mono库,会报错,应该是Unity3D的Bug。可以使用源文件来替换dll,源文件在压缩包Mono.Cecil.zip下,可解压此文件,放到在Assets/XIL/Scripts/ILHotfix/Editor/下,并删除这三个Dll(Mono.Cecil.dll, Mono.Cecil.Mdb.dll,MonoCecil.Pdb.dll)
- 2020-11-27下载
- 积分:1
-
模拟QQ2013登陆器并实现登陆密码的获取
模拟QQ2013登陆器并实现登陆密码的获取
- 2015-01-17下载
- 积分:1
-
C++实战源码-图像旋转(入门级实例512).zip
C++实战源码-图像旋转(入门级实例512).zip
- 2019-10-01下载
- 积分:1
-
.NET 后台管理系统(源码+数据库)
【实例简介】
.NET 通用后台角色权限管理系统
软件架构
通用三层架构,面向接口编程。
技术选型
MVC5
Mysql
Dapper
Autofac
Layui
阿里巴巴矢量库
- 2021-07-04 00:31:14下载
- 积分:1
-
C#员工考勤管理系统源码[vs2010+SQL2005]
C#考勤管理系统源码下载——C#员工考勤管理系统基于vs2010 SQL2005,数据库文件在DB文件夹下,运行前请先附加好数据库并连接。本考勤管理系统是多界面管理程序,分工资管理界面、考勤查询界面、人事管理界面、系统设置界面、员工资料界面等,可作为一个C#数据库编程的范例来参考,也可完善功能,使其真正成为一套功能实用的员工考勤管理系统。运行环境:Visual Studio2010
- 2021-05-06下载
- 积分:1
-
kepOPC 通讯示例源码(c#)
kepOPC 通讯示例源码(c#)
- 2019-07-31下载
- 积分:1
-
微信框架 WeiXin.Framework 完整源码+实例 非常不错<赞>
微信框架 WeiXin.Framework 完整源码+实例 非常不错
- 2014-04-24下载
- 积分:1