Skip to content

Commit c86a092

Browse files
authored
[FEAT] EDSSharp: Suggested better error management (#193)
* [README] Typos Patched some typos from the README * [FEAT] Suggested better error management PLEASE NOTE: All of this have been tested but only with CLI. I don't really know neither can test the GUI but I hope it doesn't rely on bad error management. * [FIX] We want to print the error
1 parent 4bab8ac commit c86a092

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

EDSSharp/Program.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,47 @@ static void Main(string[] args)
6666

6767

6868
default:
69+
Program.WriteError("Invalid INFILE extension.");
70+
PrintHelpText();
6971
return;
7072

7173
}
7274
if(eds != null)
7375
{
7476
Export(outfile, outtype);
77+
Console.WriteLine("Successful conversion");
78+
}
79+
else
80+
{
81+
Program.WriteError("Invalid XDD INFILE.");
82+
PrintHelpText();
7583
}
7684
}
7785
else
7886
{
87+
Program.WriteError("INFILE or OUTFILE missing.");
7988
PrintHelpText();
8089
}
8190
}
8291
catch(Exception e)
8392
{
8493
Console.WriteLine(e.ToString());
94+
Console.WriteLine("");
95+
Program.WriteError("Invalid EDS INFILE.");
8596
PrintHelpText();
8697
}
8798
}
8899

100+
private static void WriteError(string message)
101+
{
102+
Console.ForegroundColor = ConsoleColor.Red;
103+
Console.Error.WriteLine(message);
104+
Console.ResetColor();
105+
Console.WriteLine("");
106+
}
107+
89108
private static void openEDSfile(string infile)
90109
{
91-
92110
eds.Loadfile(infile);
93111
}
94112

0 commit comments

Comments
 (0)