private static void Run(string[] args) { Mutex mutex = null; try { mutex = new Mutex(false, @"Global\82E6AC09-0FEF-4390-AD9F-0DD3F5561EFC"); // Required for installer IsSilentRun = CLIHelper.CheckArgs(args, "silent", "s"); IsSandbox = CLIHelper.CheckArgs(args, "sandbox"); if (!IsSandbox) { IsPortable = CLIHelper.CheckArgs(args, "portable", "p"); if (IsPortable) { CustomPersonalPath = PortablePersonalPath; } else { CheckPersonalPathConfig(); } if (!string.IsNullOrEmpty(PersonalPath) && !Directory.Exists(PersonalPath)) { Directory.CreateDirectory(PersonalPath); } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DebugHelper.WriteLine("{0} started", FullTitle); DebugHelper.WriteLine("Operating system: " + Environment.OSVersion.VersionString); DebugHelper.WriteLine("Command line: " + Environment.CommandLine); DebugHelper.WriteLine("Personal path: " + PersonalPath); SettingsResetEvent = new ManualResetEvent(false); UploaderSettingsResetEvent = new ManualResetEvent(false); HotkeySettingsResetEvent = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem(state => LoadSettings()); DebugHelper.WriteLine("MainForm init started"); MainForm = new MainForm(); DebugHelper.WriteLine("MainForm init finished"); if (Settings == null) { SettingsResetEvent.WaitOne(); } Application.Run(MainForm); if (WatchFolderManager != null) WatchFolderManager.Dispose(); SaveSettings(); BackupSettings(); DebugHelper.WriteLine("ShareX closing"); DebugHelper.Logger.SaveLog(LogFilePath); } finally { if (mutex != null) { mutex.Close(); } } }
private static void Run(string[] args) { string appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value.ToString(); using (Mutex mutex = new Mutex(false, appGuid)) // Required for installer { IsSilentRun = CLIHelper.CheckArgs(args, "silent", "s"); IsSandbox = CLIHelper.CheckArgs(args, "sandbox"); if (!IsSandbox) { IsPortable = CLIHelper.CheckArgs(args, "portable", "p"); if (IsPortable) { CustomPersonalPath = PortablePersonalPath; } else { CheckPersonalPathConfig(); } if (!string.IsNullOrEmpty(PersonalPath) && !Directory.Exists(PersonalPath)) { Directory.CreateDirectory(PersonalPath); } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DebugHelper.WriteLine("{0} started", Title); DebugHelper.WriteLine("Operating system: " + Environment.OSVersion.VersionString); DebugHelper.WriteLine("Command line: " + Environment.CommandLine); DebugHelper.WriteLine("Personal path: " + PersonalPath); SettingsResetEvent = new ManualResetEvent(false); UploaderSettingsResetEvent = new ManualResetEvent(false); HotkeySettingsResetEvent = new ManualResetEvent(false); TaskEx.Run(() => LoadSettings()); DebugHelper.WriteLine("MainForm init started"); MainForm = new MainForm(); DebugHelper.WriteLine("MainForm init finished"); if (Settings == null) { SettingsResetEvent.WaitOne(); } Application.Run(MainForm); if (WatchFolderManager != null) WatchFolderManager.Dispose(); SaveSettings(); BackupSettings(); DebugHelper.WriteLine("ShareX closing"); DebugHelper.Logger.SaveLog(LogsFilePath); } }
public CaptureLastRegion(MainForm mainForm) : base(mainForm) { }
private static void Run() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); IsSilentRun = CLI.IsCommandExist("silent", "s"); IsSandbox = CLI.IsCommandExist("sandbox"); if (!IsSandbox) { IsPortable = CLI.IsCommandExist("portable", "p"); if (IsPortable) { CustomPersonalPath = PortablePersonalPath; } else { CheckPersonalPathConfig(); } if (!Directory.Exists(PersonalPath)) { try { Directory.CreateDirectory(PersonalPath); } catch (Exception e) { MessageBox.Show(Resources.Program_Run_Unable_to_create_folder_ + string.Format(" \"{0}\"\r\n\r\n{1}", PersonalPath, e), "ShareX - " + Resources.Program_Run_Error, MessageBoxButtons.OK, MessageBoxIcon.Error); CustomPersonalPath = ""; } } } DebugHelper.WriteLine("{0} started", Title); DebugHelper.WriteLine("Operating system: " + Environment.OSVersion.VersionString); DebugHelper.WriteLine("Command line: " + Environment.CommandLine); DebugHelper.WriteLine("Personal path: " + PersonalPath); string gitHash = GetGitHash(); if (!string.IsNullOrEmpty(gitHash)) { DebugHelper.WriteLine("Git: https://github.com/ShareX/ShareX/tree/" + gitHash); } LoadProgramSettings(); UploaderSettingsResetEvent = new ManualResetEvent(false); HotkeySettingsResetEvent = new ManualResetEvent(false); TaskEx.Run(LoadSettings); LanguageHelper.ChangeLanguage(Settings.Language); DebugHelper.WriteLine("MainForm init started"); MainForm = new MainForm(); DebugHelper.WriteLine("MainForm init finished"); Application.Run(MainForm); if (WatchFolderManager != null) WatchFolderManager.Dispose(); SaveSettings(); BackupSettings(); DebugHelper.WriteLine("ShareX closing"); DebugHelper.Logger.SaveLog(LogsFilePath); }
private static void Run() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); IsSilentRun = CLI.IsCommandExist("silent", "s"); #if STEAM IsFirstTimeConfig = CLI.IsCommandExist("SteamConfig"); #endif NoHotkeys = CLI.IsCommandExist("NoHotkeys"); DebugHelper.WriteLine(TitleLong); DebugHelper.WriteLine("Operating system: " + Environment.OSVersion.VersionString); DebugHelper.WriteLine("Command line: " + Environment.CommandLine); DebugHelper.WriteLine("Personal path: " + PersonalFolder); LoadProgramSettings(); UploaderSettingsResetEvent = new ManualResetEvent(false); HotkeySettingsResetEvent = new ManualResetEvent(false); TaskEx.Run(LoadSettings); LanguageHelper.ChangeLanguage(Settings.Language); DebugHelper.WriteLine("MainForm init started"); MainForm = new MainForm(); DebugHelper.WriteLine("MainForm init finished"); Application.Run(MainForm); if (WatchFolderManager != null) WatchFolderManager.Dispose(); SaveAllSettings(); BackupSettings(); DebugHelper.Logger.Async = false; DebugHelper.WriteLine("ShareX closing"); }
public CaptureScreen(MainForm mainForm) : base(mainForm) { }
public CaptureActiveWindow(MainForm mainForm) : base(mainForm) { }
private static void StartupHandler(object sender, StartupEventArgs e) { string appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value.ToString(); using (Mutex mutex = new Mutex(false, appGuid)) // Required for installer { IsSilentRun = CLIHelper.CheckArgs(Arguments, "silent", "s"); IsSandbox = CLIHelper.CheckArgs(Arguments, "sandbox"); if (!IsSandbox) { IsPortable = CLIHelper.CheckArgs(Arguments, "portable", "p"); if (IsPortable) { CustomPersonalPath = PortablePersonalPath; } else { CheckPersonalPathConfig(); } if (!string.IsNullOrEmpty(PersonalPath) && !Directory.Exists(PersonalPath)) { Directory.CreateDirectory(PersonalPath); } } DebugHelper.WriteLine("{0} started", Title); DebugHelper.WriteLine("Operating system: " + Environment.OSVersion.VersionString); DebugHelper.WriteLine("Command line: " + Environment.CommandLine); DebugHelper.WriteLine("Personal path: " + PersonalPath); string gitHash = GetGitHash(); if (!string.IsNullOrEmpty(gitHash)) { DebugHelper.WriteLine("Git: https://github.com/ShareX/ShareX/tree/" + gitHash); } SettingsResetEvent = new ManualResetEvent(false); UploaderSettingsResetEvent = new ManualResetEvent(false); HotkeySettingsResetEvent = new ManualResetEvent(false); TaskEx.Run(() => LoadSettings()); DebugHelper.WriteLine("MainForm init started"); MainForm = new MainForm(); applicationBase.MainForm = MainForm; DebugHelper.WriteLine("MainForm init finished"); if (Settings == null) { SettingsResetEvent.WaitOne(); } } }
public CaptureStrategy(MainForm mainForm) { this.mainForm = mainForm; }
public CaptureCustomRegion(MainForm mainForm) : base(mainForm) { }
private static void Run() { IsSilentRun = CLIHelper.CheckArgs(Arguments, "silent", "s"); IsSandbox = CLIHelper.CheckArgs(Arguments, "sandbox"); if (!IsSandbox) { IsPortable = CLIHelper.CheckArgs(Arguments, "portable", "p"); if (IsPortable) { CustomPersonalPath = PortablePersonalPath; } else { CheckPersonalPathConfig(); } if (!string.IsNullOrEmpty(PersonalPath) && !Directory.Exists(PersonalPath)) { Directory.CreateDirectory(PersonalPath); } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DebugHelper.WriteLine("{0} started", Title); DebugHelper.WriteLine("Operating system: " + Environment.OSVersion.VersionString); DebugHelper.WriteLine("Command line: " + Environment.CommandLine); DebugHelper.WriteLine("Personal path: " + PersonalPath); string gitHash = GetGitHash(); if (!string.IsNullOrEmpty(gitHash)) { DebugHelper.WriteLine("Git: https://github.com/ShareX/ShareX/tree/" + gitHash); } SettingsResetEvent = new ManualResetEvent(false); UploaderSettingsResetEvent = new ManualResetEvent(false); HotkeySettingsResetEvent = new ManualResetEvent(false); TaskEx.Run(() => LoadSettings()); DebugHelper.WriteLine("MainForm init started"); MainForm = new MainForm(); DebugHelper.WriteLine("MainForm init finished"); if (Settings == null) { SettingsResetEvent.WaitOne(); } Application.Run(MainForm); if (WatchFolderManager != null) WatchFolderManager.Dispose(); SaveSettings(); BackupSettings(); DebugHelper.WriteLine("ShareX closing"); DebugHelper.Logger.SaveLog(LogsFilePath); }
public CaptureActiveMonitor(MainForm mainForm) : base(mainForm) { }
private static void Run() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DebugHelper.WriteLine(Title); DebugHelper.WriteLine("Build: " + Build); DebugHelper.WriteLine("Command line: " + Environment.CommandLine); DebugHelper.WriteLine("Personal path: " + PersonalFolder); DebugHelper.WriteLine("Operating system: " + Helpers.GetWindowsProductName()); SilentRun = CLI.IsCommandExist("silent", "s"); #if STEAM SteamFirstTimeConfig = CLI.IsCommandExist("SteamConfig"); #endif IgnoreHotkeyWarning = CLI.IsCommandExist("NoHotkeys"); CheckPuushMode(); DebugWriteFlags(); CleanTempFiles(); LoadProgramSettings(); UploaderSettingsResetEvent = new ManualResetEvent(false); HotkeySettingsResetEvent = new ManualResetEvent(false); TaskEx.Run(LoadSettings); LanguageHelper.ChangeLanguage(Settings.Language); DebugHelper.WriteLine("MainForm init started"); MainForm = new MainForm(); DebugHelper.WriteLine("MainForm init finished"); Application.Run(MainForm); if (WatchFolderManager != null) WatchFolderManager.Dispose(); SaveAllSettings(); BackupSettings(); DebugHelper.Logger.Async = false; DebugHelper.WriteLine("ShareX closing"); }