示例#1
0
        public static bool LoadMiscSettings()
        {
            string curDir = Directory.GetCurrentDirectory();
            string path   = Path.Combine(curDir, InternalSettings.Misc_Settings_IO_Path);

            PathHelper.CreateAllPaths(curDir);

            if (!File.Exists(path))
            {
                return(false);
            }

            try
            {
                using (TextReader reader = new StreamReader(path))
                {
                    MiscSettings = (MiscSettings)MiscSettings_Serializer.Deserialize(reader);
                    return(true);
                }
            }
            catch
            {
            }
            return(false);
        }
示例#2
0
        public static List <Hotkey> LoadHotkeySettings()
        {
            string curDir = Directory.GetCurrentDirectory();
            string path   = Path.Combine(curDir, InternalSettings.Hotkey_Settings_IO_Path);

            PathHelper.CreateAllPaths(curDir);

            if (!File.Exists(path))
            {
                return(null);
            }

            try
            {
                using (TextReader reader = new StreamReader(path))
                {
                    List <Hotkey> hotkeys = (List <Hotkey>)Hotkey_Serializer.Deserialize(reader);
                    return(hotkeys);
                }
            }
            catch
            {
            }
            return(null);
        }
示例#3
0
        public static bool SaveMainFormSettings()
        {
            try
            {
                string curDir = Directory.GetCurrentDirectory();
                PathHelper.CreateAllPaths(curDir);

                using (TextWriter writer = new StreamWriter(Path.Combine(curDir, InternalSettings.Main_Form_Settings_IO_Path)))
                {
                    MainFormSettings_Serializer.Serialize(writer, MainFormSettings);
                }
                return(true);
            }
            catch
            {
            }
            return(false);
        }
示例#4
0
        public static bool SaveClipSettings(Configuration conf = null)
        {
            try
            {
                string curDir = Directory.GetCurrentDirectory();
                PathHelper.CreateAllPaths(curDir);

                using (TextWriter writer = new StreamWriter(Path.Combine(curDir, InternalSettings.Clip_Settings_IO_Path)))
                {
                    ClipSettings_Serializer.Serialize(writer, ClipSettings);
                }
                return(true);
            }
            catch
            {
            }
            return(false);
        }
示例#5
0
        public static bool SaveHotkeySettings(List <Hotkey> hotkeys)
        {
            try
            {
                string curDir = Directory.GetCurrentDirectory();
                PathHelper.CreateAllPaths(curDir);

                using (TextWriter writer = new StreamWriter(Path.Combine(curDir, InternalSettings.Hotkey_Settings_IO_Path)))
                {
                    Hotkey_Serializer.Serialize(writer, hotkeys);
                }
                return(true);
            }
            catch
            {
            }
            return(false);
        }