public static int Program(string[] args, Action <RunComplexType, Diagnostics, string[]> programAction) { bool exception = false; RunComplexType runSettings = null; Diagnostics diagnostics = null; if (File.Exists(args[1])) { runSettings = FEWSPIProxy.ReadRunFile(args[1]); diagnostics = new Diagnostics(runSettings.outputDiagnosticFile, args[0]); } try { programAction(runSettings, diagnostics, args); } catch (Exception e) { diagnostics.Log(1, string.Format("Exception ({0}: {1}", e.GetType(), e.Message)); exception = true; } finally { if (diagnostics != null) { diagnostics.Save(); } } return(exception ? 1 : 0); }
public void Save() { FEWSPIProxy.WriteToXML <DiagComplexType>(FilePath, diagnosticsDOM); }