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
30 changes: 19 additions & 11 deletions UFEDLib/ModelParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public class ModelParser
{
if(!File.Exists(xmlReportFile))
{
Console.WriteLine("File not found: " + xmlReportFile);
return new List<T>();
throw new FileNotFoundException("File not found: " + xmlReportFile, xmlReportFile);
}

// get file size
Expand Down Expand Up @@ -79,6 +78,8 @@ public class ModelParser
catch (Exception ex)
{
Console.WriteLine("Error parsing report.xml: " + ex.Message);
if (debugAttributes)
throw;
}
}
}
Expand All @@ -87,6 +88,7 @@ public class ModelParser
catch (Exception ex)
{
Console.WriteLine("Error parsing report.xml" + ex.ToString());
throw;
}
finally
{
Expand All @@ -103,8 +105,7 @@ public class ModelParser

if(!File.Exists(ufdrFileName))
{
Console.WriteLine("File not found: " + ufdrFileName);
return results;
throw new FileNotFoundException("File not found: " + ufdrFileName, ufdrFileName);
}

try
Expand All @@ -117,8 +118,7 @@ public class ModelParser

if (report == null)
{
Console.WriteLine("report.xml not found in the ufdr file");
return null;
throw new InvalidDataException("report.xml not found in the ufdr file: " + ufdrFileName);
}

reportSize = report.Length;
Expand Down Expand Up @@ -177,6 +177,8 @@ public class ModelParser
catch (Exception ex)
{
Console.WriteLine("Error parsing report.xml: " + ex.Message);
if (debugAttributes)
throw;
}
}
}
Expand All @@ -187,6 +189,7 @@ public class ModelParser
catch (Exception ex)
{
Console.WriteLine("Error parsing report.xml: " + ex.ToString());
throw;
}
finally
{
Expand All @@ -199,13 +202,12 @@ public class ModelParser



public static List<string> ScanModels( string fileName, IProgress<int> progress = null)
public static List<string> ScanModels( string fileName, IProgress<int> progress = null, bool debugAttributes = false)
{
List<string> models = new List<string>();
if (!File.Exists(fileName))
{
Console.WriteLine("File not found: " + fileName);
return models;
throw new FileNotFoundException("File not found: " + fileName, fileName);
}
try
{
Expand Down Expand Up @@ -277,6 +279,8 @@ public static List<string> ScanModels( string fileName, IProgress<int> progress
catch (Exception ex)
{
Console.WriteLine("Error parsing report.xml: " + ex.Message);
if (debugAttributes)
throw;
}
}
}
Expand All @@ -285,6 +289,7 @@ public static List<string> ScanModels( string fileName, IProgress<int> progress
catch (Exception ex)
{
Console.WriteLine("Error parsing report.xml: " + ex.ToString());
throw;
}
finally
{
Expand All @@ -304,8 +309,7 @@ public static List<string> ScanModels( string fileName, IProgress<int> progress

if (report == null)
{
Console.WriteLine("report.xml not found in the ufdr file");
return null;
throw new InvalidDataException("report.xml not found in the ufdr file: " + fileName);
}

reportSize = report.Length;
Expand Down Expand Up @@ -374,6 +378,8 @@ public static List<string> ScanModels( string fileName, IProgress<int> progress
catch (Exception ex)
{
Console.WriteLine("Error parsing ufdr: " + ex.Message);
if (debugAttributes)
throw;
}
}
}
Expand All @@ -384,6 +390,7 @@ public static List<string> ScanModels( string fileName, IProgress<int> progress
catch (Exception ex)
{
Console.WriteLine("Error parsing ufdr: " + ex.ToString());
throw;
}
finally
{
Expand All @@ -395,6 +402,7 @@ public static List<string> ScanModels( string fileName, IProgress<int> progress
catch (Exception ex)
{
Console.WriteLine("Error parsing report: " + ex.ToString());
throw;
}
return models;
}
Expand Down
2 changes: 1 addition & 1 deletion UFEDLib/UFEDLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>0.2.15</Version>
<Version>0.2.16</Version>
<PackageId>ufedlibdotnet</PackageId>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
Expand Down