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;
 }