Ejemplo n.º 1
0
        public frm_Main()
        {
            InitializeComponent();

            // Delete older executable on update
            try {
                if (Convert.ToInt32(Settings.Read("hyperdesktop2", "build")) < Settings.build)
                {
                    File.Delete(Settings.exe_path);
                    Settings.Write("hyperdesktop2", "build", Settings.build.ToString());
                }
            } catch (Exception ex) {
                Console.WriteLine("Couldn't delete old hyperdesktop2 executable.");
                Console.WriteLine(ex.Message);
            }

            Global_Func.app_data_folder_create();
            Global_Func.copy_files();

            var   web_client = new WebClient();
            Int32 build      = Convert.ToInt32(web_client.DownloadString(Settings.build_url));

            // Confirm if user wants to add to system startup
            // on first run
            if (!File.Exists(Settings.ini_path))
            {
                DialogResult result = MessageBox.Show(
                    "Do you want to run Hyperdesktop2 at Windows startup?",
                    "First time run",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button1
                    );

                if (result == DialogResult.Yes)
                {
                    Global_Func.run_at_startup(true);
                }
            }
            // Update notification
            else if (build > Settings.build)
            {
                DialogResult result = MessageBox.Show(
                    "A new version of Hyperdesktop2 has been released. Would you like to download it?",
                    "Update available",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button1
                    );

                if (result == DialogResult.Yes)
                {
                    Process.Start(Settings.release_url);
                    Process.GetCurrentProcess().Kill();
                }
            }

            register_hotkeys();
        }
Ejemplo n.º 2
0
        public static void get_settings()
        {
            Global_Func.app_data_folder_create();
            settings_build = Exists("hyperdesktop2", "build", Convert.ToString(build));

            imgur_client_id = Exists("upload", "imgur_client_id", "84c55d06b4c9686");

            save_screenshots = Global_Func.str_to_bool(Exists("general", "save_screenshots", "false"));
            save_folder      = Exists("general", "save_folder", Environment.CurrentDirectory + "\\captures\\");
            save_format      = Exists("general", "save_format", "png");
            save_quality     = Convert.ToInt16(Exists("general", "save_quality", "100"));

            upload_method = Exists("upload", "upload_method", "imgur");
            upload_format = Exists("upload", "upload_format", "png");

            copy_links_to_clipboard = Global_Func.str_to_bool(Exists("behavior", "copy_links_to_clipboard", "true"));
            show_cursor             = Global_Func.str_to_bool(Exists("behavior", "show_cursor", "false"));
            sound_effects           = Global_Func.str_to_bool(Exists("behavior", "sound_effects", "true"));
            balloon_messages        = Global_Func.str_to_bool(Exists("behavior", "balloon_messages", "true"));
            launch_browser          = Global_Func.str_to_bool(Exists("behavior", "launch_browser", "false"));
            edit_screenshot         = Global_Func.str_to_bool(Exists("behavior", "edit_screenshot", "true"));

            screen_res = Exists("screen", "screen_res", Screen_Bounds.reset());
        }