private static void LoadTranslation() { string strPath = m_appConfig.Application.GetLanguageFilePath(); if (string.IsNullOrEmpty(strPath)) { return; } try { // Performance optimization if (!File.Exists(strPath)) { return; } XmlSerializerEx xs = new XmlSerializerEx(typeof(KPTranslation)); m_kpTranslation = KPTranslation.Load(strPath, xs); KPRes.SetTranslatedStrings( m_kpTranslation.SafeGetStringTableDictionary( "KeePass.Resources.KPRes")); KLRes.SetTranslatedStrings( m_kpTranslation.SafeGetStringTableDictionary( "KeePassLib.Resources.KLRes")); StrUtil.RightToLeft = m_kpTranslation.Properties.RightToLeft; } // catch(DirectoryNotFoundException) { } // Ignore // catch(FileNotFoundException) { } // Ignore catch (Exception) { Debug.Assert(false); } }
private static void LoadTranslation() { string strLangFile = m_appConfig.Application.LanguageFile; if (string.IsNullOrEmpty(strLangFile)) { return; } string[] vLangDirs = new string[] { AppConfigSerializer.AppDataDirectory, AppConfigSerializer.LocalAppDataDirectory, UrlUtil.GetFileDirectory(WinUtil.GetExecutable(), false, false) }; foreach (string strLangDir in vLangDirs) { string strLangPath = UrlUtil.EnsureTerminatingSeparator( strLangDir, false) + strLangFile; try { // Performance optimization if (!File.Exists(strLangPath)) { continue; } XmlSerializerEx xs = new XmlSerializerEx(typeof(KPTranslation)); m_kpTranslation = KPTranslation.Load(strLangPath, xs); KPRes.SetTranslatedStrings( m_kpTranslation.SafeGetStringTableDictionary( "KeePass.Resources.KPRes")); KLRes.SetTranslatedStrings( m_kpTranslation.SafeGetStringTableDictionary( "KeePassLib.Resources.KLRes")); StrUtil.RightToLeft = m_kpTranslation.Properties.RightToLeft; break; } // catch(DirectoryNotFoundException) { } // Ignore // catch(FileNotFoundException) { } // Ignore catch (Exception) { Debug.Assert(false); } } }
public static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); int nRandomSeed = (int)DateTime.Now.Ticks; // Prevent overflow (see Random class constructor) if (nRandomSeed == int.MinValue) { nRandomSeed = 17; } m_rndGlobal = new Random(nRandomSeed); // Set global localized strings PwDatabase.LocalizedAppName = PwDefs.ShortProductName; Kdb4File.DetermineLanguageId(); m_appConfig = AppConfigSerializer.Load(); if (m_appConfig.Logging.Enabled) { AppLogEx.Open(PwDefs.ShortProductName); } AppPolicy.Current = m_appConfig.Security.Policy.CloneDeep(); string strHelpFile = UrlUtil.StripExtension(WinUtil.GetExecutable()) + ".chm"; AppHelp.LocalHelpFile = strHelpFile; string strLangFile = m_appConfig.Application.LanguageFile; if ((strLangFile != null) && (strLangFile.Length > 0)) { strLangFile = UrlUtil.GetFileDirectory(WinUtil.GetExecutable(), true) + strLangFile; try { m_kpTranslation = KPTranslation.LoadFromFile(strLangFile); KPRes.SetTranslatedStrings( m_kpTranslation.SafeGetStringTableDictionary( "KeePass.Resources.KPRes")); KLRes.SetTranslatedStrings( m_kpTranslation.SafeGetStringTableDictionary( "KeePassLib.Resources.KLRes")); } catch (FileNotFoundException) { } // Ignore catch (Exception) { Debug.Assert(false); } } m_cmdLineArgs = new CommandLineArgs(args); if (m_cmdLineArgs[AppDefs.CommandLineOptions.FileExtRegister] != null) { ShellUtil.RegisterExtension(AppDefs.FileExtension.FileExt, AppDefs.FileExtension.ExtId, KPRes.FileExtName, WinUtil.GetExecutable(), PwDefs.ShortProductName, false); MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.FileExtUnregister] != null) { ShellUtil.UnregisterExtension(AppDefs.FileExtension.FileExt, AppDefs.FileExtension.ExtId); MainCleanUp(); return; } else if ((m_cmdLineArgs[AppDefs.CommandLineOptions.Help] != null) || (m_cmdLineArgs[AppDefs.CommandLineOptions.HelpLong] != null)) { AppHelp.ShowHelp(AppDefs.HelpTopics.CommandLine, null); MainCleanUp(); return; } try { m_nAppMessage = NativeMethods.RegisterWindowMessage(m_strWndMsgID); } catch (Exception) { Debug.Assert(false); } if (m_cmdLineArgs[AppDefs.CommandLineOptions.ExitAll] != null) { try { NativeMethods.SendMessage((IntPtr)NativeMethods.HWND_BROADCAST, m_nAppMessage, (IntPtr)AppMessage.Exit, IntPtr.Zero); } catch (Exception) { Debug.Assert(false); } MainCleanUp(); return; } Mutex mSingleLock = TrySingleInstanceLock(AppDefs.MutexName, true); if ((mSingleLock == null) && m_appConfig.Integration.LimitToSingleInstance) { ActivatePreviousInstance(args); MainCleanUp(); return; } Mutex mGlobalNotify = TryGlobalInstanceNotify(AppDefs.MutexNameGlobal); #if DEBUG m_formMain = new MainForm(); Application.Run(m_formMain); #else try { m_formMain = new MainForm(); Application.Run(m_formMain); } catch (Exception exPrg) { MessageService.ShowFatal(exPrg); } #endif Debug.Assert(GlobalWindowManager.WindowCount == 0); Debug.Assert(MessageService.CurrentMessageCount == 0); MainCleanUp(); if (mGlobalNotify != null) { GC.KeepAlive(mGlobalNotify); } if (mSingleLock != null) { GC.KeepAlive(mSingleLock); } }
private void CreateStringTableUI() { int nWidth = m_lvStrings.ClientSize.Width - 20; m_ilStr.ColorDepth = ColorDepth.Depth32Bit; m_ilStr.ImageSize = new Size(16, 16); m_ilStr.Images.Add(Properties.Resources.B16x16_Binary); m_ilStr.Images.Add(Properties.Resources.B16x16_KRec_Record); m_ilStr.Images.Add(Properties.Resources.B16x16_LedGreen); m_ilStr.Images.Add(Properties.Resources.B16x16_LedLightBlue); m_ilStr.Images.Add(Properties.Resources.B16x16_LedLightGreen); m_ilStr.Images.Add(Properties.Resources.B16x16_LedOrange); m_ilStr.Images.Add(Properties.Resources.B16x16_View_Remove); m_lvStrings.SmallImageList = m_ilStr; m_tvControls.ImageList = m_ilStr; m_lvStrings.Columns.Add("ID", nWidth / 5); m_lvStrings.Columns.Add("English", (nWidth * 2) / 5); m_lvStrings.Columns.Add("Translated", (nWidth * 2) / 5); m_trl.StringTables.Clear(); KPStringTable kpstP = new KPStringTable(); kpstP.Name = "KeePass.Resources.KPRes"; m_trl.StringTables.Add(kpstP); KPStringTable kpstL = new KPStringTable(); kpstL.Name = "KeePassLib.Resources.KLRes"; m_trl.StringTables.Add(kpstL); KPStringTable kpstM = new KPStringTable(); kpstM.Name = "KeePass.Forms.MainForm.m_menuMain"; m_trl.StringTables.Add(kpstM); KPStringTable kpstE = new KPStringTable(); kpstE.Name = "KeePass.Forms.MainForm.m_ctxPwList"; m_trl.StringTables.Add(kpstE); KPStringTable kpstG = new KPStringTable(); kpstG.Name = "KeePass.Forms.MainForm.m_ctxGroupList"; m_trl.StringTables.Add(kpstG); KPStringTable kpstT = new KPStringTable(); kpstT.Name = "KeePass.Forms.MainForm.m_ctxTray"; m_trl.StringTables.Add(kpstT); KPStringTable kpstET = new KPStringTable(); kpstET.Name = "KeePass.Forms.PwEntryForm.m_ctxTools"; m_trl.StringTables.Add(kpstET); KPStringTable kpstDT = new KPStringTable(); kpstDT.Name = "KeePass.Forms.PwEntryForm.m_ctxDefaultTimes"; m_trl.StringTables.Add(kpstDT); KPStringTable kpstLO = new KPStringTable(); kpstLO.Name = "KeePass.Forms.PwEntryForm.m_ctxListOperations"; m_trl.StringTables.Add(kpstLO); KPStringTable kpstPG = new KPStringTable(); kpstPG.Name = "KeePass.Forms.PwEntryForm.m_ctxPwGen"; m_trl.StringTables.Add(kpstPG); KPStringTable kpstSM = new KPStringTable(); kpstSM.Name = "KeePass.Forms.PwEntryForm.m_ctxStrMoveToStandard"; m_trl.StringTables.Add(kpstSM); KPStringTable kpstBA = new KPStringTable(); kpstBA.Name = "KeePass.Forms.PwEntryForm.m_ctxBinAttach"; m_trl.StringTables.Add(kpstBA); KPStringTable kpstTT = new KPStringTable(); kpstTT.Name = "KeePass.Forms.EcasTriggersForm.m_ctxTools"; m_trl.StringTables.Add(kpstTT); KPStringTable kpstDE = new KPStringTable(); kpstDE.Name = "KeePass.Forms.DataEditorForm.m_menuMain"; m_trl.StringTables.Add(kpstDE); KPStringTable kpstSD = new KPStringTable(); kpstSD.Name = "KeePassLib.Resources.KSRes"; m_trl.StringTables.Add(kpstSD); Type tKP = typeof(KPRes); ListViewGroup lvg = new ListViewGroup("KeePass Strings"); m_lvStrings.Groups.Add(lvg); foreach (string strKey in KPRes.GetKeyNames()) { PropertyInfo pi = tKP.GetProperty(strKey); MethodInfo mi = pi.GetGetMethod(); if (mi.ReturnType != typeof(string)) { MessageBox.Show(this, "Return type is not string:\r\n" + strKey, TrlUtilName + ": Fatal Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string strEng = (mi.Invoke(null, null) as string); if (strEng == null) { MessageBox.Show(this, "English string is null:\r\n" + strKey, TrlUtilName + ": Fatal Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } KPStringTableItem kpstItem = new KPStringTableItem(); kpstItem.Name = strKey; kpstItem.ValueEnglish = strEng; kpstP.Strings.Add(kpstItem); ListViewItem lvi = new ListViewItem(); lvi.Group = lvg; lvi.Text = strKey; lvi.SubItems.Add(strEng); lvi.SubItems.Add(string.Empty); lvi.Tag = kpstItem; lvi.ImageIndex = 0; m_lvStrings.Items.Add(lvi); } Type tKL = typeof(KLRes); lvg = new ListViewGroup("KeePass Library Strings"); m_lvStrings.Groups.Add(lvg); foreach (string strLibKey in KLRes.GetKeyNames()) { PropertyInfo pi = tKL.GetProperty(strLibKey); MethodInfo mi = pi.GetGetMethod(); if (mi.ReturnType != typeof(string)) { MessageBox.Show(this, "Return type is not string:\r\n" + strLibKey, TrlUtilName + ": Fatal Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string strEng = (mi.Invoke(null, null) as string); if (strEng == null) { MessageBox.Show(this, "English string is null:\r\n" + strLibKey, TrlUtilName + ": Fatal Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } KPStringTableItem kpstItem = new KPStringTableItem(); kpstItem.Name = strLibKey; kpstItem.ValueEnglish = strEng; kpstL.Strings.Add(kpstItem); ListViewItem lvi = new ListViewItem(); lvi.Group = lvg; lvi.Text = strLibKey; lvi.SubItems.Add(strEng); lvi.SubItems.Add(string.Empty); lvi.Tag = kpstItem; lvi.ImageIndex = 0; m_lvStrings.Items.Add(lvi); } lvg = new ListViewGroup("Main Menu Commands"); m_lvStrings.Groups.Add(lvg); KeePass.Forms.MainForm mf = new KeePass.Forms.MainForm(); TrlAddMenuCommands(kpstM, lvg, mf.MainMenu.Items); lvg = new ListViewGroup("Entry Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstE, lvg, mf.EntryContextMenu.Items); lvg = new ListViewGroup("Group Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstG, lvg, mf.GroupContextMenu.Items); lvg = new ListViewGroup("System Tray Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstT, lvg, mf.TrayContextMenu.Items); KeePass.Forms.PwEntryForm ef = new KeePass.Forms.PwEntryForm(); lvg = new ListViewGroup("Entry Tools Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstET, lvg, ef.ToolsContextMenu.Items); lvg = new ListViewGroup("Default Times Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstDT, lvg, ef.DefaultTimesContextMenu.Items); lvg = new ListViewGroup("List Operations Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstLO, lvg, ef.ListOperationsContextMenu.Items); lvg = new ListViewGroup("Password Generator Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstPG, lvg, ef.PasswordGeneratorContextMenu.Items); KeePass.Forms.EcasTriggersForm tf = new KeePass.Forms.EcasTriggersForm(); lvg = new ListViewGroup("Ecas Trigger Tools Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstTT, lvg, tf.ToolsContextMenu.Items); KeePass.Forms.DataEditorForm df = new KeePass.Forms.DataEditorForm(); lvg = new ListViewGroup("Data Editor Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstDE, lvg, df.MainMenuEx.Items); lvg = new ListViewGroup("Standard String Movement Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstSM, lvg, ef.StandardStringMovementContextMenu.Items); lvg = new ListViewGroup("Entry Attachments Context Menu Commands"); m_lvStrings.Groups.Add(lvg); TrlAddMenuCommands(kpstBA, lvg, ef.AttachmentsContextMenu.Items); Type tSD = typeof(KSRes); lvg = new ListViewGroup("KeePassLibSD Strings"); m_lvStrings.Groups.Add(lvg); foreach (string strLibSDKey in KSRes.GetKeyNames()) { PropertyInfo pi = tSD.GetProperty(strLibSDKey); MethodInfo mi = pi.GetGetMethod(); if (mi.ReturnType != typeof(string)) { MessageBox.Show(this, "Return type is not string:\r\n" + strLibSDKey, TrlUtilName + ": Fatal Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string strEng = (mi.Invoke(null, null) as string); if (strEng == null) { MessageBox.Show(this, "English string is null:\r\n" + strLibSDKey, TrlUtilName + ": Fatal Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } KPStringTableItem kpstItem = new KPStringTableItem(); kpstItem.Name = strLibSDKey; kpstItem.ValueEnglish = strEng; kpstL.Strings.Add(kpstItem); ListViewItem lvi = new ListViewItem(); lvi.Group = lvg; lvi.Text = strLibSDKey; lvi.SubItems.Add(strEng); lvi.SubItems.Add(string.Empty); lvi.Tag = kpstItem; lvi.ImageIndex = 0; m_lvStrings.Items.Add(lvi); } }
public static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); // Required InitEnvSecurity(); int nRandomSeed = (int)DateTime.Now.Ticks; // Prevent overflow (see Random class constructor) if (nRandomSeed == int.MinValue) { nRandomSeed = 17; } m_rndGlobal = new Random(nRandomSeed); // Set global localized strings PwDatabase.LocalizedAppName = PwDefs.ShortProductName; Kdb4File.DetermineLanguageId(); m_appConfig = AppConfigSerializer.Load(); if (m_appConfig.Logging.Enabled) { AppLogEx.Open(PwDefs.ShortProductName); } AppPolicy.Current = m_appConfig.Security.Policy.CloneDeep(); m_ecasTriggers = m_appConfig.Application.TriggerSystem; m_ecasTriggers.SetToInitialState(); string strHelpFile = UrlUtil.StripExtension(WinUtil.GetExecutable()) + ".chm"; AppHelp.LocalHelpFile = strHelpFile; string strLangFile = m_appConfig.Application.LanguageFile; if ((strLangFile != null) && (strLangFile.Length > 0)) { strLangFile = UrlUtil.GetFileDirectory(WinUtil.GetExecutable(), true, false) + strLangFile; try { m_kpTranslation = KPTranslation.LoadFromFile(strLangFile); KPRes.SetTranslatedStrings( m_kpTranslation.SafeGetStringTableDictionary( "KeePass.Resources.KPRes")); KLRes.SetTranslatedStrings( m_kpTranslation.SafeGetStringTableDictionary( "KeePassLib.Resources.KLRes")); StrUtil.RightToLeft = m_kpTranslation.Properties.RightToLeft; } catch (FileNotFoundException) { } // Ignore catch (Exception) { Debug.Assert(false); } } if (m_appConfig.Application.Start.PluginCacheClearOnce) { PlgxCache.Clear(); m_appConfig.Application.Start.PluginCacheClearOnce = false; AppConfigSerializer.Save(Program.Config); } m_cmdLineArgs = new CommandLineArgs(args); if (m_cmdLineArgs[AppDefs.CommandLineOptions.FileExtRegister] != null) { ShellUtil.RegisterExtension(AppDefs.FileExtension.FileExt, AppDefs.FileExtension.ExtId, KPRes.FileExtName, WinUtil.GetExecutable(), PwDefs.ShortProductName, false); MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.FileExtUnregister] != null) { ShellUtil.UnregisterExtension(AppDefs.FileExtension.FileExt, AppDefs.FileExtension.ExtId); MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.PreLoad] != null) { // All important .NET assemblies are in memory now already try { SelfTest.Perform(); } catch (Exception) { Debug.Assert(false); } MainCleanUp(); return; } /* else if(m_cmdLineArgs[AppDefs.CommandLineOptions.PreLoadRegister] != null) * { * string strPreLoadPath = WinUtil.GetExecutable().Trim(); * if(strPreLoadPath.StartsWith("\"") == false) * strPreLoadPath = "\"" + strPreLoadPath + "\""; * ShellUtil.RegisterPreLoad(AppDefs.PreLoadName, strPreLoadPath, * @"--" + AppDefs.CommandLineOptions.PreLoad, true); * MainCleanUp(); * return; * } * else if(m_cmdLineArgs[AppDefs.CommandLineOptions.PreLoadUnregister] != null) * { * ShellUtil.RegisterPreLoad(AppDefs.PreLoadName, string.Empty, * string.Empty, false); * MainCleanUp(); * return; * } */ else if ((m_cmdLineArgs[AppDefs.CommandLineOptions.Help] != null) || (m_cmdLineArgs[AppDefs.CommandLineOptions.HelpLong] != null)) { AppHelp.ShowHelp(AppDefs.HelpTopics.CommandLine, null); MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.ConfigSetUrlOverride] != null) { Program.Config.Integration.UrlOverride = m_cmdLineArgs[ AppDefs.CommandLineOptions.ConfigSetUrlOverride]; AppConfigSerializer.Save(Program.Config); MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.ConfigClearUrlOverride] != null) { Program.Config.Integration.UrlOverride = string.Empty; AppConfigSerializer.Save(Program.Config); MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.ConfigGetUrlOverride] != null) { try { string strFileOut = UrlUtil.EnsureTerminatingSeparator( Path.GetTempPath(), false) + "KeePass_UrlOverride.tmp"; string strContent = ("[KeePass]\r\nKeeURLOverride=" + Program.Config.Integration.UrlOverride + "\r\n"); File.WriteAllText(strFileOut, strContent); } catch (Exception) { Debug.Assert(false); } MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.ConfigSetLanguageFile] != null) { Program.Config.Application.LanguageFile = m_cmdLineArgs[ AppDefs.CommandLineOptions.ConfigSetLanguageFile]; AppConfigSerializer.Save(Program.Config); MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.PlgxCreate] != null) { PlgxPlugin.CreateFromCommandLine(); MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.PlgxCreateInfo] != null) { PlgxPlugin.CreateInfoFile(m_cmdLineArgs.FileName); MainCleanUp(); return; } #if (DEBUG && !KeePassLibSD) else if (m_cmdLineArgs[AppDefs.CommandLineOptions.MakePopularPasswordTable] != null) { PopularPasswords.MakeList(); MainCleanUp(); return; } #endif try { m_nAppMessage = NativeMethods.RegisterWindowMessage(m_strWndMsgID); } catch (Exception) { Debug.Assert(false); } if (m_cmdLineArgs[AppDefs.CommandLineOptions.ExitAll] != null) { BroadcastAppMessageAndCleanUp(AppMessage.Exit); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.AutoType] != null) { BroadcastAppMessageAndCleanUp(AppMessage.AutoType); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.OpenEntryUrl] != null) { string strEntryUuid = m_cmdLineArgs[AppDefs.CommandLineOptions.Uuid]; if (!string.IsNullOrEmpty(strEntryUuid)) { IpcParamEx ipUrl = new IpcParamEx(IpcUtilEx.CmdOpenEntryUrl, strEntryUuid, null, null, null, null); IpcUtilEx.SendGlobalMessage(ipUrl); } MainCleanUp(); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.LockAll] != null) { BroadcastAppMessageAndCleanUp(AppMessage.Lock); return; } else if (m_cmdLineArgs[AppDefs.CommandLineOptions.UnlockAll] != null) { BroadcastAppMessageAndCleanUp(AppMessage.Unlock); return; } Mutex mSingleLock = TrySingleInstanceLock(AppDefs.MutexName, true); if ((mSingleLock == null) && m_appConfig.Integration.LimitToSingleInstance) { ActivatePreviousInstance(args); MainCleanUp(); return; } Mutex mGlobalNotify = TryGlobalInstanceNotify(AppDefs.MutexNameGlobal); AutoType.InitStatic(); UserActivityNotifyFilter nfActivity = new UserActivityNotifyFilter(); Application.AddMessageFilter(nfActivity); #if DEBUG m_formMain = new MainForm(); Application.Run(m_formMain); #else try { m_formMain = new MainForm(); Application.Run(m_formMain); } catch (Exception exPrg) { MessageService.ShowFatal(exPrg); } #endif Application.RemoveMessageFilter(nfActivity); Debug.Assert(GlobalWindowManager.WindowCount == 0); Debug.Assert(MessageService.CurrentMessageCount == 0); MainCleanUp(); if (mGlobalNotify != null) { GC.KeepAlive(mGlobalNotify); } if (mSingleLock != null) { GC.KeepAlive(mSingleLock); } }