static HookLibManager() { string installPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "QTTabBar"); string filename = IntPtr.Size == 8 ? "QTHookLib64.dll" : "QTHookLib32.dll"; hHookLib = PInvoke.LoadLibrary(Path.Combine(installPath, filename)); int retcode = -1; if (hHookLib == IntPtr.Zero) { int error = Marshal.GetLastWin32Error(); QTUtility2.MakeErrorLog(null, "LoadLibrary error: " + error); } else { IntPtr pFunc = PInvoke.GetProcAddress(hHookLib, "Initialize"); if (pFunc != IntPtr.Zero) { InitHookLibDelegate initialize = (InitHookLibDelegate) Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitHookLibDelegate)); try { retcode = initialize(fpHookResult); } catch (Exception e) { QTUtility2.MakeErrorLog(e, ""); } } } if (retcode == 0) { return; } QTUtility2.MakeErrorLog(null, "HookLib Initialize failed: " + retcode); // TODO: Localize this MessageForm.Show(IntPtr.Zero, "Error: Unable to load QTTabBar hook library. " + "Some features might not be functional. " + "You may need to reinstall the applicaiton.", "Error", MessageBoxIcon.Hand, 30000, false, true); }
private void ActivateIt() { //BandObjectLib.Logging.Add_DEBUG("ShowBrowserBar.log", "AutoLoader.SetSite.ActivateIt"); BandObjectLib.Logging.Add_DEBUG("Constructor.log", "AutoLoader.SetSite.ActivateIt"); string installDateString; DateTime installDate; string minDate = DateTime.MinValue.ToString(); using (RegistryKey key = Registry.LocalMachine.OpenSubKey(RegConst.Root)) { installDateString = key == null ? minDate : (string)key.GetValue("InstallDate", minDate); installDate = DateTime.Parse(installDateString); } using (RegistryKey key = Registry.CurrentUser.CreateSubKey(RegConst.Root)) { DateTime lastActivation = DateTime.Parse((string)key.GetValue("ActivationDate", minDate)); if (installDate.CompareTo(lastActivation) <= 0) { return; } object pvaTabBar = new Guid("{d2bf470e-ed1c-487f-a333-2bd8835eb6ce}").ToString("B"); object pvaButtonBar = new Guid("{d2bf470e-ed1c-487f-a666-2bd8835eb6ce}").ToString("B"); object pvarShow = true; object pvarSize = null; try { explorer.ShowBrowserBar(pvaTabBar, pvarShow, pvarSize); explorer.ShowBrowserBar(pvaButtonBar, pvarShow, pvarSize); } catch (COMException) { MessageForm.Show( IntPtr.Zero, QTUtility.TextResourcesDic["ErrorDialogs"][2], QTUtility.TextResourcesDic["ErrorDialogs"][3], MessageBoxIcon.Warning, 30000, false, true ); } key.SetValue("ActivationDate", installDateString); } }
public static void Check(bool fForce) { if (fForce) { string str; ShowMsg(CheckInternal(out str), str); SaveLastCheck(); } else if (!fCheckDone) { fCheckDone = true; if (DayHasCome()) { string str2; int num2 = CheckInternal(out str2); SaveLastCheck(); if (num2 == 2) { MessageForm.Show(string.Format(QTUtility.TextResourcesDic["UpdateCheck"][0], str2), strMsgCaption, Resources_String.SiteURL, MessageBoxIcon.Asterisk, 0xea60); } } } }
private void ActivateIt() { string installDateString; DateTime installDate; string minDate = DateTime.MinValue.ToString(); using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Quizo\QTTabBar")) { installDateString = key == null ? minDate : (string)key.GetValue("InstallDate", minDate); installDate = DateTime.Parse(installDateString); } using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) { DateTime lastActivation = DateTime.Parse((string)key.GetValue("ActivationDate", minDate)); if (installDate.CompareTo(lastActivation) <= 0) { return; } object pvaTabBar = new Guid("{d2bf470e-ed1c-487f-a333-2bd8835eb6ce}").ToString("B"); object pvaButtonBar = new Guid("{d2bf470e-ed1c-487f-a666-2bd8835eb6ce}").ToString("B"); object pvarShow = true; object pvarSize = null; try { explorer.ShowBrowserBar(pvaTabBar, pvarShow, pvarSize); explorer.ShowBrowserBar(pvaButtonBar, pvarShow, pvarSize); } catch (COMException) { // TODO: Localize this MessageForm.Show(IntPtr.Zero, "Warning: Could not automatically enable QTTabBar. " + "To enable it manually, press and release the Alt key, " + "then select QTTabBar from the View/Toolbars menu.", "Could not enable", MessageBoxIcon.Warning, 30000, false, true); } key.SetValue("ActivationDate", installDateString); } }
public static void HandlePluginException(Exception ex, IntPtr hwnd, string pluginID, string strCase) { MessageForm.Show(hwnd, "Error : " + strCase + "\r\nPlugin : \"" + pluginID + "\"\r\nErrorType : " + ex.ToString(), "Plugin Error", MessageBoxIcon.Hand, 0x7530); }
private void ComputeFinished() { if (fCancellationPending) { SetButtonsEnabled(true); Text = MakeHashTypeText(); fCancellationPending = false; qPendings.Clear(); } else if (qPendings.Count > 0) { PathRowPairs pairs = qPendings.Dequeue(); iThreadsCounter++; new HashInvoker(ComputeHashCore).BeginInvoke(pairs.Paths.ToArray(), pairs.Rows.ToArray(), cmbHashType.SelectedIndex, AsyncComplete, null); } else { SetButtonsEnabled(true); Text = MakeHashTypeText(); int num = 0; int num2 = 0; int count = 0; foreach (List <DataGridViewRow> list in dicResult.Values.Where(list => list.Count > 0)) { if (list[0].Cells[2].ToolTipText == VALUE_ERROR) { count = list.Count; } if (list.Count > 1) { num2++; num += list.Count; } } if (chbShowResult.Checked) { string str = (count > 1) ? "s." : "."; if (cMatched_Prv != num2) { string str2 = (num > 1) ? "s" : string.Empty; string str3 = (num2 > 1) ? "s" : string.Empty; MessageForm.Show(Handle, ((num2 > 0) ? string.Concat(new object[] { num, " file", str2, " matched in ", num2, " ", MakeHashTypeText(), str3 }) : string.Empty) + ((count > 0) ? string.Concat(new object[] { (num2 > 0) ? ", " : string.Empty, count, " error", str }) : "."), "Result", MessageBoxIcon.Asterisk, 0x1388); } else if (cErr_Prv != count) { MessageForm.Show(Handle, count + " error" + str, "Result", MessageBoxIcon.Hand, 0x1388); } } else if (cMatched_Prv != num2) { QTUtility.AsteriskPlay(); // QTUtility.AsteriskPlay(); } else if (cErr_Prv != count) { QTUtility.SoundPlay(); } cMatched_Prv = num2; cErr_Prv = count; } }
private static bool TryPing(string path) { if (iPingTimeOutMS < 1) { return(false); } if (path.Length > 2) { string hostNameOrAddress; 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); } } } lstPingSuccessedPaths.Remove(path); return(true); }