From 588a692b0545c497272dc9820f3843c82006b87e Mon Sep 17 00:00:00 2001 From: Shadow Eevee Date: Sun, 8 Mar 2020 22:00:28 -0700 Subject: [PATCH] Added an error and proper codes for not having all the files when packing a wad. Added an error and proper codes for not having all the files when packing a wad. Previously would return the cryptic "Index was outside the bounds of the array." error. --- Sharpii/ERR.cs | 10 ++++++++++ Sharpii/EXT.cs | 11 +++++++++++ Sharpii/Exit Codes.txt | 7 ++++++- Sharpii/WAD.cs | 23 +++++++++++++++++------ 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/Sharpii/ERR.cs b/Sharpii/ERR.cs index ff64c97..1ffd7fa 100644 --- a/Sharpii/ERR.cs +++ b/Sharpii/ERR.cs @@ -572,6 +572,16 @@ namespace Sharpii Console.WriteLine(""); ErrCodeFound = 1; } + if (args[1] == "SHARPII_NET_CORE_NUSD_MISSING_FILES_01") + { + Console.WriteLine(""); + Console.WriteLine("You need to have all the required .app files, a tmd file, a tik file, and a cert file to pack a wad."); + Console.WriteLine("Ensure all files are present"); + Console.WriteLine("If that doesn't help, open an issue on GitHub!"); + Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); + Console.WriteLine(""); + ErrCodeFound = 1; + } if (ErrCodeFound != 1) { Error_help(); diff --git a/Sharpii/EXT.cs b/Sharpii/EXT.cs index 9812685..5ec8344 100644 --- a/Sharpii/EXT.cs +++ b/Sharpii/EXT.cs @@ -344,6 +344,17 @@ namespace Sharpii Console.WriteLine(""); ErrCodeFound = 1; } + if (args[1] == "16029") + { + Console.WriteLine(""); + Console.WriteLine("Not all files needed to pack a wad are present. (SHARPII_NET_CORE_NUSD_MISSING_FILES_01)"); + Console.WriteLine("You need to have all the required .app files, a tmd file, a tik file, and a cert file to pack a wad."); + Console.WriteLine("Ensure all files are present"); + Console.WriteLine("If that doesn't help, open an issue on GitHub!"); + Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); + Console.WriteLine(""); + ErrCodeFound = 1; + } if (ErrCodeFound != 1) { ExitCode_help(); diff --git a/Sharpii/Exit Codes.txt b/Sharpii/Exit Codes.txt index e5d0894..2486223 100644 --- a/Sharpii/Exit Codes.txt +++ b/Sharpii/Exit Codes.txt @@ -143,4 +143,9 @@ Provide a proper wad. Exit Code: 16028 ID Flag was used, but invalid id provided. (SHARPII_NET_CORE_xxx_BAD_ID_01) You used the -ID flag, but an invalid id was provided. -Provide a proper id. \ No newline at end of file +Provide a proper id. + +Exit Code: 16029 +Not all files needed to pack a wad are present. (SHARPII_NET_CORE_NUSD_MISSING_FILES_01) +You need to have all the required .app files, a tmd file, a tik file, and a cert file to pack a wad. +Ensure all files are present. \ No newline at end of file diff --git a/Sharpii/WAD.cs b/Sharpii/WAD.cs index 38104f8..143770a 100644 --- a/Sharpii/WAD.cs +++ b/Sharpii/WAD.cs @@ -23,6 +23,7 @@ namespace Sharpii { partial class WAD_Stuff { + public static int ExceptionListRan = 0; public static void WAD(string[] args) { if (args.Length < 3) @@ -586,12 +587,22 @@ namespace Sharpii } catch (Exception ex) { - Console.WriteLine("An unknown error occured, please try again"); - Console.WriteLine(""); - Console.WriteLine("ERROR DETAILS: {0}", ex.Message); - Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_01"); - Environment.Exit(0x00003E82); - return; + if (ex.Message == "Index was outside the bounds of the array.") + { + Console.WriteLine("You need to have all the required .app files, a tmd file, a tik file, and a cert file to do this."); + Console.WriteLine(""); + Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_MISSING_FILES_01"); + ExceptionListRan = 1; + Environment.Exit(0x00003E9D); + } + if (ExceptionListRan == 0) + { + Console.WriteLine("An unknown error occured, please try again"); + Console.WriteLine(""); + Console.WriteLine("ERROR DETAILS: {0}", ex.Message); + Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_01"); + Environment.Exit(0x00003E82); + } } }