示例#1
0
文件: AppConfig.cs 项目: sgryjp/azuki
        /// <summary>
        /// Saves application configuration.
        /// </summary>
        public static void Save()
        {
            try
            {
                Ini.Set("Default", "FontSize", AppConfig.FontInfo.Size);
                Ini.Set("Default", "Font", AppConfig.FontInfo.Name);
                Ini.Set("Default", "WindowWidth", AppConfig.WindowSize.Width);
                Ini.Set("Default", "WindowHeight", AppConfig.WindowSize.Height);
                Ini.Set("Default", "WindowMaximized", AppConfig.WindowMaximized);
                Ini.Set("Default", "TabPanelEnabled", AppConfig.TabPanelEnabled);
                Ini.Set("Default", "UseScreenLineNumber", AppConfig.UseScreenLineNumber);
                Ini.Set("Default", "DrawsEolCode", AppConfig.DrawsEolCode);
                Ini.Set("Default", "DrawsFullWidthSpace", AppConfig.DrawsFullWidthSpace);
                Ini.Set("Default", "DrawsSpace", AppConfig.DrawsSpace);
                Ini.Set("Default", "DrawsTab", AppConfig.DrawsTab);
                Ini.Set("Default", "DrawsEofMark", AppConfig.DrawsEofMark);
                Ini.Set("Default", "HighlightsCurrentLine", AppConfig.HighlightsCurrentLine);
                Ini.Set("Default", "HighlightsMatchedBracket", AppConfig.HighlightsMatchedBracket);
                Ini.Set("Default", "ShowsLineNumber", AppConfig.ShowsLineNumber);
                Ini.Set("Default", "ShowsHRuler", AppConfig.ShowsHRuler);
                Ini.Set("Default", "ShowsDirtBar", AppConfig.ShowsDirtBar);
                Ini.Set("Default", "TabWidth", AppConfig.TabWidth);
                Ini.Set("Default", "LinePadding", AppConfig.LinePadding);
                Ini.Set("Default", "LeftMargin", AppConfig.LeftMargin);
                Ini.Set("Default", "TopMargin", AppConfig.TopMargin);
                Ini.Set("Default", "ViewType", AppConfig.ViewType);
                Ini.Set("Default", "UsesTabForIndent", AppConfig.UsesTabForIndent);
                Ini.Set("Default", "UnindentsWithBackspace", AppConfig.UnindentsWithBackspace);
                Ini.Set("Default", "ConvertsFullWidthSpaceToSpace", AppConfig.ConvertsFullWidthSpaceToSpace);
                Ini.Set("Default", "HRulerIndicatorType", AppConfig.HRulerIndicatorType);
                Ini.Set("Default", "ScrollsBeyondLastLine", AppConfig.ScrollsBeyondLastLine);
                Ini.Set("Default", "Mru", AppConfig.MruFiles.ToString());
                Ini.Set("Default", "Antialias", UserPref.Antialias);

                using (var file = new StreamWriter(IniFilePath, false, Encoding.UTF8))
                {
                    file.NewLine = "\r\n";
                    Ini.Save(file);
                }
            }
            catch
            {}
        }