Countinue cross-platform Exit Code fixes

This commit is contained in:
Shadow Eevee 2020-04-03 16:36:26 -05:00
parent f1883ba53c
commit a6d77ad008
4 changed files with 346 additions and 43 deletions

View file

@ -41,8 +41,16 @@ namespace Sharpii
Console.WriteLine("This should not appear on the .Net Core port.");
Console.WriteLine("If you see this, report how you got here on https://github.com/TheShadowEevee/Sharpii-NetCore/issues.");
Console.WriteLine("Error: SHARPII_NET_CORE_MAIN_MISSING_DLL_LIBWIISHARP_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E8F);
}
else
{
Environment.Exit(0x00000011);
}
return;
}
for (int i = 1; i < args.Length; i++)
{
@ -159,8 +167,16 @@ namespace Sharpii
//If tuser gets here, they entered something wrong
Console.WriteLine("ERROR: The argument {0} is invalid", args[0]);
Console.WriteLine("Error: SHARPII_NET_CORE_MAIN_INVALID_ARG_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E90);
}
else
{
Environment.Exit(0x00000012);
}
return;
}
string temp = Path.GetTempPath() + "Sharpii.tmp";
if (Directory.Exists(temp) == true)
@ -204,7 +220,14 @@ namespace Sharpii
catch (Exception ex)
{
Console.WriteLine("An unknown error occured, please try again\n\nERROR DETAILS: {0}", ex.Message);
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E82);
}
else
{
Environment.Exit(0x00000004);
}
return;
}
}
@ -224,7 +247,14 @@ namespace Sharpii
catch (Exception ex)
{
Console.WriteLine("An unknown error occured, please try again\n\nERROR DETAILS: {0}", ex.Message);
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E82);
}
else
{
Environment.Exit(0x00000004);
}
return;
}
}

View file

@ -49,7 +49,14 @@ namespace Sharpii
//If tuser gets here, they entered something wrong
Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_INVALID_ARG_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E90);
}
else
{
Environment.Exit(0x00000012);
}
return;
}
@ -65,7 +72,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to open file: {0}", input);
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
@ -99,7 +113,14 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_UNKNOWN_01");
Environment.Exit(0x00003E82);
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
}
@ -117,7 +138,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to open file: {0}", input);
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
@ -131,7 +159,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No format set");
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_NO_FORMAT_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E91);
}
else
{
Environment.Exit(0x00000013);
}
return;
}
tplFormat = args[i + 1];
@ -141,7 +176,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No format set");
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_NO_FORMAT_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E91);
}
else
{
Environment.Exit(0x00000013);
}
return;
}
tplFormat = args[i + 1];
@ -212,7 +254,14 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_UNKNOWN_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E82);
}
else
{
Environment.Exit(0x00000004);
}
return;
}
}

View file

@ -49,7 +49,14 @@ namespace Sharpii
//If tuser gets here, they entered something wrong
Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
Console.WriteLine("Error: SHARPII_NET_CORE_U8_INVALID_ARG_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E90);
}
else
{
Environment.Exit(0x00000012);
}
return;
}
@ -72,7 +79,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: File {0} is not a U8 archive", input);
Console.WriteLine("Error: SHARPII_NET_CORE_U8_NON_U8_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E93);
}
else
{
Environment.Exit(0x00000015);
}
return;
}
@ -107,7 +121,14 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_U8_UNKNOWN_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E82);
}
else
{
Environment.Exit(0x00000004);
}
return;
}
}
@ -127,7 +148,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to open Folder: {0}", input);
Console.WriteLine("Either the folder doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_U8_FOLDER_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E94);
}
else
{
Environment.Exit(0x00000016);
}
return;
}
@ -146,7 +174,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No title set");
Console.WriteLine("Error: SHARPII_NET_CORE_U8_NO_TITLE_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E95);
}
else
{
Environment.Exit(0x00000017);
}
return;
}
imet = args[i + 1];
@ -158,7 +193,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: Cannot use IMET and IMD5 at the same time.");
Console.WriteLine("Error: SHARPII_NET_CORE_U8_TWO_HEADERS_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E96);
}
else
{
Environment.Exit(0x00000018);
}
return;
}
@ -211,7 +253,14 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_U8_UNKNOWN_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E82);
}
else
{
Environment.Exit(0x00000004);
}
return;
}
}

View file

@ -82,7 +82,14 @@ namespace Sharpii
//If tuser gets here, they entered something wrong
Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_INVALID_ARG_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E90);
}
else
{
Environment.Exit(0x00000012);
}
return;
}
@ -99,7 +106,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to open file: {0}", input);
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
@ -112,7 +126,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No output set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_OUTPUT_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E8D);
}
else
{
Environment.Exit(0x0000000F);
}
return;
}
output = args[i + 1];
@ -122,7 +143,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No output set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_OUTPUT_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E8D);
}
else
{
Environment.Exit(0x0000000F);
}
return;
}
output = args[i + 1];
@ -216,7 +244,14 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E82);
}
else
{
Environment.Exit(0x00000004);
}
return;
}
}
@ -243,7 +278,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to open file: {0}", input);
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
if (edit == false)
@ -252,7 +294,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to open folder: {0}", input);
Console.WriteLine("Either the folder doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_FOLDER_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E94);
}
else
{
Environment.Exit(0x00000016);
}
return;
}
@ -268,7 +317,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No ID set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_ID_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E8E);
}
else
{
Environment.Exit(0x00000010);
}
return;
}
id = args[i + 1];
@ -276,7 +332,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: ID too short");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_SHORT_ID_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E97);
}
else
{
Environment.Exit(0x00000019);
}
return;
}
id = id.Substring(0, 4);
@ -286,7 +349,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No type set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TYPE_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E98);
}
else
{
Environment.Exit(0x0000001A);
}
return;
}
lwrid = args[i + 1].ToUpper();
@ -294,7 +364,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: Unknown WAD type: {0}", args[i + 1]);
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_TYPE_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E99);
}
else
{
Environment.Exit(0x0000001B);
}
return;
}
break;
@ -303,14 +380,28 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No type set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TYPE_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E98);
}
else
{
Environment.Exit(0x0000001A);
}
return;
}
if (!int.TryParse(args[i + 1], out ios))
{
Console.WriteLine("Invalid slot {0}...", args[i + 1]);
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_INVALID_SLOT_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E8A);
}
else
{
Environment.Exit(0x0000000C);
}
return;
}
if (ios < 0 || ios > 255)
@ -336,7 +427,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No sound set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_SOUND_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E9A);
}
else
{
Environment.Exit(0x0000001C);
}
return;
}
sound = args[i + 1];
@ -345,7 +443,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to find sound wad");
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
break;
@ -354,7 +459,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No banner set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_BANNER_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E9B);
}
else
{
Environment.Exit(0x0000001D);
}
return;
}
banner = args[i + 1];
@ -363,7 +475,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to find banner wad");
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
break;
@ -372,7 +491,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No sound set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_SOUND_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E9A);
}
else
{
Environment.Exit(0x0000001C);
}
return;
}
icon = args[i + 1];
@ -381,7 +507,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to find icon wad");
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
break;
@ -390,7 +523,14 @@ namespace Sharpii
{
Console.WriteLine("ERROR: No dol set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_DOL_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E84);
}
else
{
Environment.Exit(0x00000006);
}
return;
}
app = args[i + 1];
@ -399,7 +539,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to find dol wad/file");
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
break;
@ -594,16 +741,30 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_MISSING_FILES_01");
ExceptionListRan = 1;
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E9D);
}
else
{
Environment.Exit(0x0000001F);
}
}
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");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E82);
}
else
{
Environment.Exit(0x00000004);
}
}
}
}
@ -620,7 +781,14 @@ namespace Sharpii
Console.WriteLine("ERROR: Unable to open file: {0}", input);
Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_FILE_ERR_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E81);
}
else
{
Environment.Exit(0x00000003);
}
return;
}
@ -665,7 +833,14 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_01");
if (OperatingSystem.Windows())
{
Environment.Exit(0x00003E82);
}
else
{
Environment.Exit(0x00000004);
}
return;
}
}