Errors.cs 800 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. namespace ArcToolkitCLI.Util
  3. {
  4. public static class Errors
  5. {
  6. public enum ErrorCodes
  7. {
  8. NotAFile = 100,
  9. UnknownArcType,
  10. KeyNotFound,
  11. InvalidKeyFile,
  12. NoCorrectKey
  13. }
  14. public static readonly string[] ErrorMessages =
  15. {
  16. "{0} is not a file",
  17. "{0} is not a known ARC file",
  18. "No key specified or the key file does not exist",
  19. "The provided keyfile is not valid",
  20. "The ARC {0} needs a key from {1}"
  21. };
  22. public static int Error(ErrorCodes code, params object[] args)
  23. {
  24. Console.Error.WriteLine(ErrorMessages[code - ErrorCodes.NotAFile], args);
  25. return (int) code;
  26. }
  27. }
  28. }