Skip to content
This repository has been archived by the owner on Nov 14, 2017. It is now read-only.

Commit

Permalink
Catch exceptions in npkdiff.
Browse files Browse the repository at this point in the history
  • Loading branch information
LHCGreg authored and LHCGreg committed Aug 19, 2015
1 parent f435511 commit 4330834
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
11 changes: 10 additions & 1 deletion npkdiff/CommandLineArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ class CommandLineArgs
public CommandLineArgs(string[] args)
{
OptionSet optionSet = GetOptionSet();
optionSet.Parse(args);

try
{
optionSet.Parse(args);
}
catch (OptionException ex)
{
Console.Error.WriteLine(ex.Message);
Environment.Exit(1);
}

if (ShowHelp)
{
Expand Down
23 changes: 15 additions & 8 deletions npkdiff/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ class Program
{
static void Main(string[] args)
{
CommandLineArgs cmdline = new CommandLineArgs(args);
try
{
CommandLineArgs cmdline = new CommandLineArgs(args);

// read *.NPK in NpkDir1
// read *.NPK in NpkDir2
// Compare
// read *.NPK in NpkDir1
// read *.NPK in NpkDir2
// Compare

NpkDirContents dir1Contents = GetNpkDirContents(cmdline.NpkDir1);
NpkDirContents dir2Contents = GetNpkDirContents(cmdline.NpkDir2);
NpkDirDifferences differences = dir1Contents.GetDifferences(dir2Contents);
DisplayDifferences(differences);
NpkDirContents dir1Contents = GetNpkDirContents(cmdline.NpkDir1);
NpkDirContents dir2Contents = GetNpkDirContents(cmdline.NpkDir2);
NpkDirDifferences differences = dir1Contents.GetDifferences(dir2Contents);
DisplayDifferences(differences);
}
catch (Exception ex)
{
Console.Error.WriteLine("Unexpected error: {0}", ex.Message);
}
}

static NpkDirContents GetNpkDirContents(string npkDir)
Expand Down

0 comments on commit 4330834

Please sign in to comment.