Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions TrxerConsole/Program.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -22,7 +23,7 @@ class Program
/// Main entry of TrxerConsole
/// </summary>
/// <param name="args">First cell shoud be TRX path</param>
static void Main(string[] args)
internal static void Main(string[] args)
{
if (args.Any() == false)
{
Expand All @@ -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");
}

Expand Down
8 changes: 6 additions & 2 deletions TrxerConsole/Trxer.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down