public static void HandlePluginException(Exception ex, IntPtr hwnd, string pluginID, string strCase)
 {
     MessageForm.Show(hwnd, "Error : " + strCase + "\r\nPlugin : \"" + pluginID + "\"\r\nErrorType : " + ex, "Plugin Error", MessageBoxIcon.Hand, 0x7530);
 }
Exemple #2
0
 private void ComputeFinished()
 {
     if (this.fCancellationPending)
     {
         this.SetButtonsEnabled(true);
         this.Text = this.MakeHashTypeText();
         this.fCancellationPending = false;
         this.qPendings.Clear();
     }
     else if (this.qPendings.Count > 0)
     {
         PathRowPairs pairs = this.qPendings.Dequeue();
         this.iThreadsCounter++;
         new HashInvoker(this.ComputeHashCore).BeginInvoke(pairs.Paths.ToArray(), pairs.Rows.ToArray(), this.cmbHashType.SelectedIndex, new AsyncCallback(this.AsyncComplete), null);
     }
     else
     {
         this.SetButtonsEnabled(true);
         this.Text = this.MakeHashTypeText();
         int num   = 0;
         int num2  = 0;
         int count = 0;
         foreach (List <DataGridViewRow> list in this.dicResult.Values)
         {
             if (list.Count > 0)
             {
                 if (list[0].Cells[2].ToolTipText == VALUE_ERROR)
                 {
                     count = list.Count;
                 }
                 if (list.Count > 1)
                 {
                     num2++;
                     num += list.Count;
                 }
             }
         }
         if (this.chbShowResult.Checked)
         {
             string str = (count > 1) ? "s." : ".";
             if (this.cMatched_Prv != num2)
             {
                 string str2 = (num > 1) ? "s" : string.Empty;
                 string str3 = (num2 > 1) ? "s" : string.Empty;
                 MessageForm.Show(base.Handle, ((num2 > 0) ? string.Concat(new object[] { num, " file", str2, " matched in ", num2, " ", this.MakeHashTypeText(), str3 }) : string.Empty) + ((count > 0) ? string.Concat(new object[] { (num2 > 0) ? ", " : string.Empty, count, " error", str }) : "."), "Result", MessageBoxIcon.Asterisk, 0x1388);
             }
             else if (this.cErr_Prv != count)
             {
                 MessageForm.Show(base.Handle, count + " error" + str, "Result", MessageBoxIcon.Hand, 0x1388);
             }
         }
         else if (this.cMatched_Prv != num2)
         {
             SystemSounds.Asterisk.Play();
         }
         else if (this.cErr_Prv != count)
         {
             SystemSounds.Hand.Play();
         }
         this.cMatched_Prv = num2;
         this.cErr_Prv     = count;
     }
 }
Exemple #3
0
 private static bool TryPing(string path)
 {
     if (iPingTimeOutMS < 1)
     {
         return(false);
     }
     if (path.Length > 2)
     {
         string hostNameOrAddress = string.Empty;
         if (path.StartsWith("http://") || path.StartsWith("ftp://"))
         {
             int startIndex = path.StartsWith("http://") ? 7 : 6;
             int index      = path.IndexOf("/", startIndex);
             if (index != -1)
             {
                 if (index <= startIndex)
                 {
                     return(true);
                 }
                 hostNameOrAddress = path.Substring(startIndex, index - startIndex);
             }
             else
             {
                 hostNameOrAddress = path.Substring(startIndex);
             }
         }
         else
         {
             path = path.Substring(2);
             int length = path.IndexOf(@"\");
             if (length == -1)
             {
                 hostNameOrAddress = path;
             }
             else
             {
                 hostNameOrAddress = path.Substring(0, length);
             }
         }
         if (hostNameOrAddress.Length > 0)
         {
             try {
                 if (!lstPingSuccessedPaths.Contains(path))
                 {
                     MessageForm.Show(IntPtr.Zero, path + "\r\n\r\nWait a moment...", "Accessing network...", MessageBoxIcon.None, 0);
                     Application.DoEvents();
                 }
                 using (Ping ping = new Ping()) {
                     if (ping.Send(hostNameOrAddress, iPingTimeOutMS).Status == IPStatus.Success)
                     {
                         lstPingSuccessedPaths.Add(path);
                         return(false);
                     }
                 }
             }
             catch (Exception exception) {
                 QTUtility2.MakeErrorLog(exception, null, true);
             }
         }
     }
     lstPingSuccessedPaths.Remove(path);
     return(true);
 }