public FrmSplash() { this.InitializeComponent(); sFrmSplash = this; this.lVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString(); DrawUtil.MakeTransparent(this, (Bitmap) this.BackgroundImage, Color.Black); }
protected override void OnClosing(CancelEventArgs e) { sFrmSplash = null; base.OnClosing(e); }
private static void Main(string[] initParams) { Exception exception; Exception exception3; Application.ThreadException += new ThreadExceptionEventHandler(Program.Application_ThreadException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); FrmSplash splash = new FrmSplash(); splash.Show(); splash.Refresh(); DataAccess.sMainThreadID = Thread.CurrentThread.ManagedThreadId; bool flag = true; string name = ""; bool flag2 = false; foreach (string str2 in initParams) { switch (str2) { case "/version": { string str3 = Assembly.GetEntryAssembly().GetName().Version.ToString(4); StreamWriter writer = new StreamWriter("getversion.bat"); writer.WriteLine("set newver=" + str3); writer.Close(); return; } case "/multiple": flag = false; break; } if (str2.IndexOf("/loc") == 0) { name = str2.Split(new char[] { '=' })[1]; } if (str2.IndexOf("/register") == 0) { flag2 = true; } } try { if (!true) { foreach (Process process in Process.GetProcesses()) { if ((process.Id != Process.GetCurrentProcess().Id) && (process.ProcessName == Process.GetCurrentProcess().ProcessName)) { try { DlgMessage.ShowDialog(Loc.Get("<LOC>GPGnet is already running."), Loc.Get("<LOC>Unable to start")); } catch (Exception exception1) { exception = exception1; } return; } } } } catch (Exception exception4) { exception = exception4; } CommandLineArgs = initParams; bool flag3 = true; try { try { } catch (Exception exception5) { exception = exception5; ErrorLog.WriteLine(exception); } try { Settings.StylePreferences.Register(); DlgLogWatcher.InitLog(); } catch (Exception exception2) { ErrorLog.WriteLine(exception2); } try { string str4 = @"Software\GPG\GPGnet"; if (Registry.LocalMachine.OpenSubKey(str4) == null) { Registry.LocalMachine.CreateSubKey(str4); } Registry.LocalMachine.OpenSubKey(str4, true).SetValue("GPGNetPath", Application.ExecutablePath); } catch (Exception exception7) { exception = exception7; ErrorLog.WriteLine(exception); } Version version = Assembly.GetEntryAssembly().GetName().Version; Version version2 = Settings.Version; if ((Settings.Version == null) || !Settings.Version.Equals(version)) { GPG.Logging.EventLog.WriteLine("Found older user settings from v. {0}, re-initializing to current settings from v. {1}", new object[] { Settings.Version, Assembly.GetAssembly(typeof(UserPrefs)).GetName().Version }); try { string defaultUsername = Settings.Login.DefaultUsername; string defaultPassword = Settings.Login.DefaultPassword; Settings = ProgramSettings.Merge(Settings, new UserPrefs()) as UserPrefs; GPG.Logging.EventLog.WriteLine("Merged settings file from version {0} to current ({1})", new object[] { version2, version }); } catch (Exception exception8) { exception3 = exception8; ErrorLog.WriteLine("Failed to merge settings file from version {0} to current ({1})", new object[] { version2, version }); ErrorLog.WriteLine(exception3); mSettings = new UserPrefs(); } Settings.Save(); } MemRefreshTimer.AutoReset = true; MemRefreshTimer.Elapsed += delegate (object s, ElapsedEventArgs e) { RefreshMemUsage(); }; MemRefreshTimer.Start(); if (name == "") { Loc.SetLoc(); } else { Loc.SetLoc(name); } if (flag2) { DlgRegisterSupcom supcom = new DlgRegisterSupcom(); Application.Run(supcom); return; } FrmMain mainForm = new FrmMain(); mMainForm = mainForm; if (!(mainForm.Disposing || mainForm.IsDisposed)) { Application.Run(mainForm); } else { flag3 = false; } } catch (Exception exception9) { exception3 = exception9; ErrorLog.WriteLine(exception3); } finally { try { if (flag3) { mIsClosing = true; if (Closing != null) { Closing(null, EventArgs.Empty); } Settings.Save(); User.Logout(); } } catch (Exception exception10) { exception3 = exception10; ErrorLog.WriteLine(exception3); } } if (FrmSplash.sFrmSplash != null) { FrmSplash.sFrmSplash.Close(); } }