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 ();
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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();
                }
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
 }