private static void Save(XsdTidyConfig config, string toFile)
 {
     XmlSerializer serializer = new XmlSerializer (typeof (XsdTidyConfig));
     FileStream stream = null;
     try{
         stream = new FileStream (toFile, FileMode.Create);
         serializer.Serialize (stream, config);
         stream.Flush ();
     }
     catch(IOException ex){
         throw new ApplicationException("There was an error while attempting to save the configuration file '" + toFile + "'.", ex);
     }
     finally{
         if (stream != null )
             stream.Close ();
     }
 }
Пример #2
0
        private bool LoadDefaultSettings(bool silent)
        {
            bool success = false;

            try
            {
                grid.SelectedObject = this.config = XsdTidyConfigManager.LoadDefault();
                success             = true;
            }
            catch (Exception ex)
            {
                if (!silent)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            return(success);
        }
Пример #3
0
        private static void Save(XsdTidyConfig config, string toFile)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(XsdTidyConfig));
            FileStream    stream     = null;

            try{
                stream = new FileStream(toFile, FileMode.Create);
                serializer.Serialize(stream, config);
                stream.Flush();
            }
            catch (IOException ex) {
                throw new ApplicationException("There was an error while attempting to save the configuration file '" + toFile + "'.", ex);
            }
            finally{
                if (stream != null)
                {
                    stream.Close();
                }
            }
        }
Пример #4
0
        public XsdTidyForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.config = new XsdTidyConfig();
            grid        = new PropertyGrid();
            grid.CommandsVisibleIfAvailable = true;
            grid.Dock           = DockStyle.Fill;
            grid.SelectedObject = config;

            this.panel1.Controls.Add(grid);

            this.statusBar1.Text = string.Empty;

            InitSettings();
        }
Пример #5
0
        public XsdTidyForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.config = new XsdTidyConfig();
            grid = new PropertyGrid();
            grid.CommandsVisibleIfAvailable = true;
            grid.Dock = DockStyle.Fill;
            grid.SelectedObject = config;

            this.panel1.Controls.Add(grid);

            this.statusBar1.Text = string.Empty;

            InitSettings();
        }
Пример #6
0
 /// <summary>
 /// Save the config to disk as default settings.
 /// </summary>
 /// <param name="config">Configuration settings to be saved.</param>
 internal static void SaveAsDefault(XsdTidyConfig config)
 {
     Save(config, _DEFAULT);
 }
Пример #7
0
 /// <summary>
 /// Save the config to disk as normal settings.
 /// </summary>
 /// <param name="config">Configuration settings to be saved.</param>
 internal static void Save(XsdTidyConfig config)
 {
     Save(config, _SAVED);
 }
 /// <summary>
 /// Save the config to disk as default settings.
 /// </summary>
 /// <param name="config">Configuration settings to be saved.</param>
 internal static void SaveAsDefault(XsdTidyConfig config)
 {
     Save(config, _DEFAULT);
 }
 /// <summary>
 /// Save the config to disk as normal settings.
 /// </summary>
 /// <param name="config">Configuration settings to be saved.</param>
 internal static void Save(XsdTidyConfig config)
 {
     Save(config, _SAVED);
 }
Пример #10
0
 private bool LoadSettings(bool silent)
 {
     bool success = false;
     try
     {
         grid.SelectedObject = this.config = XsdTidyConfigManager.Load();
         success = true;
     }
     catch(Exception ex)
     {
         if (!silent) MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     return success;
 }