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