public PreferencesDTO DeserializePreferences() { XmlSerializer xmlSerializer = new XmlSerializer (typeof (PreferencesDTO)); FileStream fileStream = new FileStream (Path.Combine ("resources", "ComponentBuilder.config"), FileMode.Open); preferencesDTO = (PreferencesDTO) xmlSerializer.Deserialize (fileStream); fileStream.Close (); return preferencesDTO; }
public ComponentBuilderComponentModel() { try { preferencesDTO = DeserializePreferences (); } catch (Exception exception) { preferencesDTO = new PreferencesDTO (); } }
public IDataTransferObject GetDataForm() { Dialog preferencesDialog = (Dialog) GetWidget (); PreferencesDTO preferencesDTO = null; switch (preferencesDialog.Run ()) { case (int) ResponseType.Ok: if (defaultOutputPathEntry.Text.Length != 0 && prefixNamespaceEntry.Text.Length != 0) { preferencesDTO = new PreferencesDTO (); preferencesDTO.OutputPath = defaultOutputPathEntry.Text; preferencesDTO.PrefixNamespace = prefixNamespaceEntry.Text; } break; case (int) ResponseType.Cancel: break; default: break; } preferencesDialog.Destroy (); preferencesDialog = null; return preferencesDTO; }