Beispiel #1
0
        private static void Run()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DebugHelper.WriteLine(Title);
            DebugHelper.WriteLine("Build: " + Build);
            DebugHelper.WriteLine("Command line: " + Environment.CommandLine);

            if (!string.IsNullOrEmpty(PersonalPathDetectionMethod))
            {
                DebugHelper.WriteLine("Personal path detection method: " + PersonalPathDetectionMethod);
            }

            DebugHelper.WriteLine("Personal path: " + PersonalFolder);
            DebugHelper.WriteLine("Operating system: " + Helpers.GetWindowsProductName());

            SilentRun = CLI.IsCommandExist("silent", "s");
#if WindowsStore
            SilentRun = SilentRun || AppInstance.GetActivatedEventArgs().Kind == ActivationKind.StartupTask;
#endif

#if STEAM
            SteamFirstTimeConfig = CLI.IsCommandExist("SteamConfig");
#endif

            IgnoreHotkeyWarning = CLI.IsCommandExist("NoHotkeys");

            CheckPuushMode();
            DebugWriteFlags();
            CleanTempFiles();

            SettingManager.LoadInitialSettings();

            Uploader.UpdateServicePointManager();
            UpdateManager = new GitHubUpdateManager("ShareX", "ShareX", Dev, Portable);

            LanguageHelper.ChangeLanguage(Settings.Language);

            Helpers.TryFixHandCursor();
            DebugHelper.WriteLine("MainForm init started.");
            MainForm = new MainForm();
            DebugHelper.WriteLine("MainForm init finished.");

            Application.Run(MainForm);

            if (WatchFolderManager != null)
            {
                WatchFolderManager.Dispose();
            }
            SettingManager.SaveAllSettings();

            DebugHelper.Logger.AsyncWrite = false;
            DebugHelper.WriteLine("ShareX closing.");
        }
Beispiel #2
0
        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);

            Uploader.UpdateServicePointManager();
            UpdateManager = new GitHubUpdateManager("ShareX", "ShareX", Beta, Portable);

            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");
        }
Beispiel #3
0
        public static void CloseSequence()
        {
            if (!closeSequenceStarted)
            {
                closeSequenceStarted = true;

                DebugHelper.Logger.AsyncWrite = false;
                DebugHelper.WriteLine("ShareX closing.");

                if (WatchFolderManager != null)
                {
                    WatchFolderManager.Dispose();
                }
                SettingManager.SaveAllSettings();

                DebugHelper.WriteLine("ShareX closed.");
            }
        }
Beispiel #4
0
        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");
        }
Beispiel #5
0
        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 = "";
                    }
                }
            }

#if STEAM
            IsFirstTimeConfig = CLI.IsCommandExist("SteamConfig");
#endif

            NoHotkeys = CLI.IsCommandExist("NoHotkeys");

            DebugHelper.WriteLine($"{Title} {Build} build");
            DebugHelper.WriteLine("Operating system: " + Environment.OSVersion.VersionString);
            DebugHelper.WriteLine("Command line: " + Environment.CommandLine);
            DebugHelper.WriteLine("Personal path: " + PersonalPath);

            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.Logger.Async = false;
            DebugHelper.WriteLine("ShareX closing");
        }
Beispiel #6
0
        private static void Run()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            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 (!Directory.Exists(PersonalPath))
                {
                    try
                    {
                        Directory.CreateDirectory(PersonalPath);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("Unable to create folder: \"" + PersonalPath + "\"\r\n\r\n" + e.ToString(), "ShareX - 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);
        }
Beispiel #7
0
        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);
        }