This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 网络工具类 | |
*/ | |
public class NetworkUtil { | |
public static String NETWORK_TYPE_WIFI = "WIFI"; | |
public static String NETWORK_TYPE_MOBILE = "MOBILE"; | |
public static String NETWORK_TYPE_ERROR = "ERROR"; | |
/** | |
* 返回网络是否可用 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ChinaDate | |
{ | |
private static ChineseLunisolarCalendar china = new ChineseLunisolarCalendar(); | |
private static Hashtable gHoliday = new Hashtable(); | |
private static Hashtable nHoliday = new Hashtable(); | |
private static string[] JQ = { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" }; | |
private static int[] JQData = { 0, 21208, 43467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758 }; | |
static ChinaDate() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//工程里添加对system.configuration.dll程序集的引用 | |
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); | |
cfa.AppSettings.Settings.Add("key", "Name");//添加节点 | |
cfa.AppSettings.Settings["key"].Value = "name";//设置节点(如果节点为空,会抛出异常) | |
cfa.Save(); //关键的一步!保存修改。 | |
string ConString = System.Configuration.ConfigurationSettings.AppSettings["key"];//读取节点 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Guid.NewGuid().ToString("N") //结果为:38bddf48f43c48588e0d78761eaa1ce6 | |
Guid.NewGuid().ToString("D") //结果为:57d99d89-caab-482a-a0e9-a0a803eed3ba | |
Guid.NewGuid().ToString("B") //结果为:{09f140d5-af72-44ba-a763-c861304b46f8} | |
Guid.NewGuid().ToString("P") //结果为:(778406c2-efff-4262-ab03-70a77d09c2b5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileDirectoryEnumerator : System.Collections.IEnumerator | |
{ | |
#region 表示对象当前状态的数据和属性 | |
/// <summary> | |
/// 当前对象 | |
/// </summary> | |
private object objCurrentObject = null; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FilePath 为文件路径 | |
Process.Start("explorer.exe ", @"/select,""" + FilePath + @""""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 获取网页源码 | |
/// </summary> | |
/// <param name="Url">链接</param> | |
/// <param name="CharSet">编码</param> | |
/// <returns></returns> | |
public static string GetSource(string Url, string CharSet = "GB2312") | |
{ | |
using (WebClient myWebClient = new WebClient()) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Go_TEST为测试样例 | |
* Go_Core为线程核心执行代码 | |
* | |
* 正在运行的线程数量:RunningThreadNumbers | |
* 暂停线程:Thread_Statu_Pause = checkBox1.Checked; | |
* 暂停取消:Thread_Statu_Exit = true; | |
* 提取线程(标识符GUID为[textBox2.Text]值)返回值 | |
* for (int i = 0; i < ThreadNodeS_Pool.Count; i++) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) | |
{ | |
if ((Keys.Alt & keyData) == Keys.Alt) MessageBox.Show("1"); | |
return base.ProcessCmdKey(ref msg, keyData); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static public bool ExistsWINRAR() | |
{ | |
try | |
{ | |
RegistryKey the_Reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Win11RAR.exe"); | |
return !string.IsNullOrEmpty(the_Reg.GetValue("").ToString()); | |
} | |
catch | |
{ | |
return false; |
NewerOlder