Beispiel #1
0
        public CarboRevitImportSettings DeSerializeXML()
        {
            string importSettingsPath = PathUtils.getRevitImportSettingspath();

            if (File.Exists(importSettingsPath))
            {
                try
                {
                    XmlSerializer            ser = new XmlSerializer(typeof(CarboRevitImportSettings));
                    CarboRevitImportSettings bufferproject;

                    using (FileStream fs = new FileStream(importSettingsPath, FileMode.Open))
                    {
                        bufferproject = ser.Deserialize(fs) as CarboRevitImportSettings;
                    }

                    return(bufferproject);
                }
                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show(ex.Message);
                    return(null);
                }
            }
            else
            {
                CarboRevitImportSettings newsettings = new CarboRevitImportSettings();
                newsettings.SerializeXML();
                return(newsettings);
            }
        }
Beispiel #2
0
        public CarboRevitImportSettings DeSerializeXML()
        {
            string fileName = "db\\RevitImportSettings.xml";
            string myPath   = Utils.getAssemblyPath() + "\\" + fileName;

            if (File.Exists(fileName))
            {
                try
                {
                    XmlSerializer            ser = new XmlSerializer(typeof(CarboRevitImportSettings));
                    CarboRevitImportSettings bufferproject;

                    using (FileStream fs = new FileStream(myPath, FileMode.Open))
                    {
                        bufferproject = ser.Deserialize(fs) as CarboRevitImportSettings;
                    }

                    return(bufferproject);
                }
                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show(ex.Message);
                    return(null);
                }
            }
            else
            {
                CarboRevitImportSettings newsettings = new CarboRevitImportSettings();
                newsettings.SerializeXML();
                return(newsettings);
            }
        }
Beispiel #3
0
        private void SaveSettings()
        {
            CarboRevitImportSettings settings = new CarboRevitImportSettings();

            settings.MainCategory     = cbb_MainGroup.Text;
            settings.SubCategory      = cbb_SecGroup.Text;
            settings.IncludeDemo      = chk_ImportDemolished.IsChecked.Value;
            settings.CutoffLevel      = cbb_Levels.Text;
            settings.CutoffLevelValue = getCutoffLevel();
            settings.IncludeExisting  = chk_ImportExisting.IsChecked.Value;

            settings.SerializeXML();
            importSettings = settings;
        }