diff --git a/TrxerConsole/Program.cs b/TrxerConsole/Program.cs index 5fb92b1..c83c169 100644 --- a/TrxerConsole/Program.cs +++ b/TrxerConsole/Program.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Xml; using System.Xml.Xsl; @@ -22,7 +23,7 @@ class Program /// Main entry of TrxerConsole /// /// First cell shoud be TRX path - static void Main(string[] args) + internal static void Main(string[] args) { if (args.Any() == false) { @@ -43,7 +44,16 @@ private static void Transform(string fileName, XmlDocument xsl) XslCompiledTransform x = new XslCompiledTransform(true); x.Load(xsl, new XsltSettings(true, true), null); Console.WriteLine("Transforming..."); - x.Transform(fileName, fileName + OUTPUT_FILE_EXT); + + try + { + x.Transform(fileName, fileName + OUTPUT_FILE_EXT); + } + catch (FileNotFoundException) + { + Console.WriteLine("ERROR. File not found: " + fileName); + } + Console.WriteLine("Done transforming xml into html"); } diff --git a/TrxerConsole/Trxer.xslt b/TrxerConsole/Trxer.xslt index 1ada859..17528b2 100644 --- a/TrxerConsole/Trxer.xslt +++ b/TrxerConsole/Trxer.xslt @@ -40,8 +40,12 @@ public string ToExactTimeDefinition(string duration) { - return ToExtactTime(TimeSpan.Parse(duration).TotalMilliseconds); - } + // Fix in order to prevent crash when execution is aborted + if(duration != null && duration.Length > 0) + return ToExtactTime(TimeSpan.Parse(duration).TotalMilliseconds); + else + return "0"; + } public string ToExactTimeDefinition(string start,string finish) {