Exemplo n.º 1
0
        private bool SaveSettingsToIniFile(out string ErrMessage)
        {
            ErrMessage = "";

            try
            {
                string list = ItemsToList();
                INI_Helper.WriteIni("AutoSave", "SOLID_CHECK", SolidRadio.Checked.ToString(), settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "NUMBER_CHECK", NumberRadio.Checked.ToString(), settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "LIST_CHECK", ListRadio.Checked.ToString(), settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "COLOR", MarkColorPicture.BackColor.ToArgb().ToString(), settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "ROTATION", MarkRotationNumeric.Value.ToString(), settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "FONT", MarkFontText.Text, settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "SOLID_TEXT", SolidText.Text, settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "BEGIN", StartNumeric.Value.ToString(), settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "END", EndNumeric.Value.ToString(), settingsFilePath);
                INI_Helper.WriteIni("AutoSave", "LIST", list, settingsFilePath);
                return(true);
            }
            catch (Exception ex)
            {
                ErrMessage = $"{ex.Source}发生错误:{ex.Message}";
                return(false);
            }
        }
Exemplo n.º 2
0
        private bool LoadSettingsFromIniFile(out string ErrMessage)
        {
            ErrMessage = "";

            try
            {
                SolidRadio.Checked         = Convert.ToBoolean(INI_Helper.ReadIni("AutoSave", "SOLID_CHECK", settingsFilePath));
                NumberRadio.Checked        = Convert.ToBoolean(INI_Helper.ReadIni("AutoSave", "NUMBER_CHECK", settingsFilePath));
                ListRadio.Checked          = Convert.ToBoolean(INI_Helper.ReadIni("AutoSave", "LIST_CHECK", settingsFilePath));
                MarkColorPicture.BackColor = Color.FromArgb(Convert.ToInt32(INI_Helper.ReadIni("AutoSave", "COLOR", settingsFilePath)));
                MarkRotationNumeric.Value  = Convert.ToDecimal(INI_Helper.ReadIni("AutoSave", "ROTATION", settingsFilePath));
                MarkFontText.Text          = INI_Helper.ReadIni("AutoSave", "FONT", settingsFilePath);
                SolidText.Text             = INI_Helper.ReadIni("AutoSave", "SOLID_TEXT", settingsFilePath);
                StartNumeric.Value         = Convert.ToDecimal(INI_Helper.ReadIni("AutoSave", "BEGIN", settingsFilePath));
                EndNumeric.Value           = Convert.ToDecimal(INI_Helper.ReadIni("AutoSave", "END", settingsFilePath));
                ListToItems(INI_Helper.ReadIni("AutoSave", "LIST", settingsFilePath));
                return(true);
            }
            catch (Exception ex)
            {
                ErrMessage = $"{ex.Source}发生错误:{ex.Message}";
                return(false);
            }
        }