/// <summary>
 /// Deserializes xml markup from file into an ExporterSettings object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output ExporterSettings object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out ExporterSettings obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(ExporterSettings);
     try
     {
         obj = LoadFromFile(fileName);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
 /// <summary>
 /// Deserializes workflow markup into an ExporterSettings object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output ExporterSettings object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out ExporterSettings obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(ExporterSettings);
     try
     {
         obj = Deserialize(xml);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
Ejemplo n.º 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // load exporter settings
            try
            {
                _exporterSettings = ExporterSettings.LoadFromFile(Settings.Default.SettingsFilePath);
            }
            catch (Exception ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(string.Format("File {0} appears to be invalid.", Settings.Default.SettingsFilePath));
                sb.AppendLine(ex.Message);
                MessageBox.Show(sb.ToString());
                Close();
            }

            // fill combo
            foreach (ExporterSettingsTypeCutJob job in _exporterSettings.TypeCutJobs)
            {
                cbCutJobType.Items.Add(job.Name);
            }
            if (cbCutJobType.Items.Count > 0)
            {
                cbCutJobType.SelectedIndex = 0;
            }

            // fill fileSelect control
            string fileName = FileName;

            fileName = FileName.Replace('*', '_');
            fileName = fileName.Replace('-', '_');
            string filePath = Path.Combine(Properties.Settings.Default.OutputDirectory, fileName);

            fileSelectOutput.FileName = Path.ChangeExtension(filePath, "oxf");
        }
 public static bool LoadFromFile(string fileName, out ExporterSettings obj)
 {
     System.Exception exception = null;
     return(LoadFromFile(fileName, out obj, out exception));
 }
 public static bool Deserialize(string xml, out ExporterSettings obj)
 {
     System.Exception exception = null;
     return(Deserialize(xml, out obj, out exception));
 }