#region //ping
/// <summary>
/// Get client speed by ping bytes/million second, bytes/ms
/// </summary>
/// <param name="Target"></param>
/// <returns></returns>
public static int Ping(string Target)
{
int Time=10;
try
{
Time=0;
SelectQuery query = new SelectQuery("Win32_PingStatus", string.Format("Address='{0}'", Target));
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
foreach (ManagementObject result in searcher.Get())
{
for(int i=0;i<20;i++)
{
if (result["StatusCode"] != null && (0 == (UInt32)result["StatusCode"])&&result["ResponseTime"]!=null)//connected
{
Time=Time+Convert.ToInt32(result["ResponseTime"]);
}
}
}
Time=Time/20;
}
catch{}
if (Time==0)
Time=10;
return 32/Time;
}
#endregion
[ 1 comment ] ( 134 views ) | permalink | related link |




( 2.9 / 5088 )Float
(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?
Number:
\d{1,}
[ add comment ] | permalink | related link |




( 3 / 4951 )Me.BtnDelete.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")
[ add comment ] | permalink | related link |




( 3 / 2652 )1. Close Visual Studio if it is running.
2. Start the Registry Editor (run regedit).
Registry Editor
3. Navigate to this registry key:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ProjectMRUList
Registry Editor 2
4. Then delete the key that has the project you do not want to keep in the list.
[ 1 comment ] ( 91 views ) | permalink | related link |




( 3 / 11057 )System.Diagnostics.Process process1;
process1= new System.Diagnostics.Process();
//Do not receive an event when the process exits.
process1.EnableRaisingEvents = false;
string strCmdLine="/C curl -E \""+CertFile+"\":\""+CertPass+"\" -F orgid="+OrgID+" -F batchid="+this.BatchID+" -F userid="+PDSOID+" -F xml=@\""+this.XMLFilePath+this.XMLFileName+"\" "+UploadURL+" -o \""+this.XMLFilePath+"\\ServerResponse.xml\"";
try
{
System.Diagnostics.ProcessStartInfo sinf = new System.Diagnostics.ProcessStartInfo ("cmd.exe", @strCmdLine);
sinf.UseShellExecute = false;
sinf.CreateNoWindow = true;
process1.StartInfo=sinf;
process1.Start();
process1.WaitForExit();
process1.Close();
// or System.Diagnostics.Process.Start("cmd.exe",@strCmdLine);
this.ReadTransferLog("ServerResponse.xml");
return this.TranStatus;
}
catch (Exception ex)
{
process1.Kill();
npuInfoDB.DBConnection.LogErrorMessage(strCmdLine+"\n"+ex.Message);
return false;
}
[ add comment ] | permalink | related link |




( 3 / 9986 )
Back Next

Avatar










