diff --git a/Sharpii/BNS.cs b/Sharpii/BNS.cs index 67bfd65..ef663f7 100644 --- a/Sharpii/BNS.cs +++ b/Sharpii/BNS.cs @@ -58,6 +58,7 @@ 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_BNS_FILE_ERR_01"); + Environment.Exit(0x00000641); return; } @@ -93,6 +94,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_BNS_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } } @@ -110,6 +112,7 @@ 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_BNS_FILE_ERR_01"); + Environment.Exit(0x00000641); return; } @@ -178,6 +181,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_BNS_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } } diff --git a/Sharpii/ERR.cs b/Sharpii/ERR.cs index 14718ae..ff64c97 100644 --- a/Sharpii/ERR.cs +++ b/Sharpii/ERR.cs @@ -37,7 +37,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_HBC_FILE_ERR_01") { @@ -48,7 +47,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_IOS_FILE_ERR_01") @@ -60,7 +58,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_NUSD_FILE_ERR_01") @@ -72,7 +69,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_TPL_FILE_ERR_01") @@ -84,7 +80,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_U8_FILE_ERR_01") @@ -96,7 +91,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_WAD_FILE_ERR_01") { @@ -107,7 +101,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_BNS_UNKNOWN_01") { @@ -118,7 +111,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_HBC_UNKNOWN_01") { @@ -129,7 +121,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_IOS_UNKNOWN_01") { @@ -140,7 +131,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_NUSD_UNKNOWN_01") { @@ -151,7 +141,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_MAIN_UNKNOWN_01") { @@ -162,7 +151,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_TPL_UNKNOWN_01") { @@ -173,7 +161,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_U8_UNKNOWN_01") { @@ -184,7 +171,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_WAD_UNKNOWN_01") { @@ -195,7 +181,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_HBC_NO_IP_01") { @@ -206,7 +191,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_HBC_NO_DOL_01") { @@ -217,7 +201,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_HBC_MISSING_DLL_WADINSTALLER_01") { @@ -228,7 +211,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_HBC_NO_IOS_01") { @@ -239,7 +221,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_HBC_INVALID_IOS_01") { @@ -250,7 +231,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_HBC_NO_WAD_01") { @@ -261,7 +241,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_IOS_NO_SLOT_01") { @@ -272,7 +251,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_IOS_INVALID_SLOT_01") { @@ -283,7 +261,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_IOS_NO_VERSION_01") { @@ -294,7 +271,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_IOS_INVALID_VERSION_01") { @@ -305,7 +281,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_IOS_NO_OUTPUT_01") { @@ -316,7 +291,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_NUSD_NO_VERSION_01") { @@ -327,7 +301,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_NUSD_INVALID_VERSION_01") { @@ -338,7 +311,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_NUSD_NO_OUTPUT_01") { @@ -349,7 +321,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_NUSD_NO_ID_01") { @@ -360,7 +331,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_NUSD_NO_IOS_01") { @@ -371,7 +341,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_MAIN_MISSING_DLL_LIBWIISHARP_01") { @@ -382,7 +351,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_MAIN_INVALID_ARG_01") { @@ -393,7 +361,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_TPL_INVALID_ARG_01") { @@ -404,7 +371,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_U8_INVALID_ARG_01") { @@ -415,7 +381,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_WAD_INVALID_ARG_01") { @@ -426,7 +391,6 @@ namespace Sharpii Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); Console.WriteLine(""); ErrCodeFound = 1; - return; } if (args[1] == "SHARPII_NET_CORE_TPL_NO_FORMAT_01") { @@ -588,16 +552,6 @@ namespace Sharpii Console.WriteLine(""); ErrCodeFound = 1; } - if (args[1] == "SHARPII_NET_CORE_WAD_NO_ICON_01") - { - Console.WriteLine(""); - Console.WriteLine("You used the -ICON flag, but no wad file to provide an icon was provided."); - Console.WriteLine("Provide a proper wad."); - 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 (args[1] == "SHARPII_NET_CORE_WAD_NO_DOL_01") { Console.WriteLine(""); @@ -608,6 +562,16 @@ namespace Sharpii Console.WriteLine(""); ErrCodeFound = 1; } + if (args[1] == "SHARPII_NET_CORE_NUSD_BAD_ID_01") + { + Console.WriteLine(""); + Console.WriteLine("You used the -ID flag, but an invalid id was provided."); + Console.WriteLine("Provide a proper id."); + 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 new file mode 100644 index 0000000..a086e9b --- /dev/null +++ b/Sharpii/EXT.cs @@ -0,0 +1,372 @@ +/* This file is part of Sharpii. +* Copyright (C) 2013 Person66 +* +* Sharpii is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Sharpii is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Sharpii. If not, see . +*/ + +using System; +using System.IO; +using System.Numerics; +using libWiiSharp; + +namespace Sharpii +{ + partial class ERRORCODE_Stuff + { + public static int ErrCodeFound = 0; + public static void ERRORCODE(string[] args) + { + try + { + if (args[1] == "0") + { + Console.WriteLine(""); + Console.WriteLine("No errors reported/Likely successful exit"); + Console.WriteLine(""); + } + if (args[1] == "1601") + { + Console.WriteLine(""); + Console.WriteLine("File Access Issue/Missing File. (SHARPII_NET_CORE_xxx_FILE_ERR_01)"); + Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it."); + Console.WriteLine("Check the file's permissions and that it's in the right place."); + 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 (args[1] == "1602") + { + Console.WriteLine(""); + Console.WriteLine("Unknown Error/Untracked Error. (SHARPII_NET_CORE_xxx_UNKNOWN_01)"); + Console.WriteLine("An untracked error has occured."); + Console.WriteLine("Use the error text to self-diagnose."); + 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 (args[1] == "1603") + { + Console.WriteLine(""); + Console.WriteLine("No IP was provided for remote Wii access. (SHARPII_NET_CORE_HBC_NO_IP_01)"); + Console.WriteLine("No IP address was listed for the Wii."); + Console.WriteLine("Furthermore, no IP address is saved from previous uses."); + Console.WriteLine("If this doesn't help, open an issue on GitHub!"); + Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); + Console.WriteLine(""); + ErrCodeFound = 1; + } + if (args[1] == "1604") + { + Console.WriteLine("DOL Flag was used, but no file provided. (SHARPII_NET_CORE_xxx_NO_DOL_01)"); + Console.WriteLine("You used the -DOL flag, but no DOL file was provided."); + Console.WriteLine("Provide the proper DOL file."); + 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 (args[1] == "1605") + { + Console.WriteLine(""); + Console.WriteLine("A Critical DLL (WadInstaller.dll) couldn't be found. (SHARPII_NET_CORE_HBC_MISSING_DLL_WADINSTALLER_01)"); + Console.WriteLine("The WadInstaller.dll couldn't be found."); + Console.WriteLine("This error SHOULD NOT APPEAR in this Sharpii port."); + Console.WriteLine("Open an issue on GitHub!"); + Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); + Console.WriteLine(""); + ErrCodeFound = 1; + } + if (args[1] == "1606") + { + Console.WriteLine(""); + Console.WriteLine("IOS Flag was used, but no IOS provided. (SHARPII_NET_CORE_xxx_NO_IOS_01)"); + Console.WriteLine("You used the -IOS flag, but no IOS was provided."); + Console.WriteLine("Provide a proper IOS."); + 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 (args[1] == "1607") + { + Console.WriteLine(""); + Console.WriteLine("IOS Flag was used, but an invalid IOS provided. (SHARPII_NET_CORE_xxx_INVALID_IOS_01)"); + Console.WriteLine("You used the -IOS flag, but an invalid IOS was provided."); + Console.WriteLine("Provide a proper IOS."); + 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 (args[1] == "1608") + { + Console.WriteLine(""); + Console.WriteLine("WAD Flag was used, but no wad provided. (SHARPII_NET_CORE_HBC_NO_WAD_01)"); + Console.WriteLine("You used the -WAD flag, but no WAD was provided."); + Console.WriteLine("Provide a proper WAD."); + 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 (args[1] == "1609") + { + Console.WriteLine(""); + Console.WriteLine("Slot Flag was used, but no slot provided. (SHARPII_NET_CORE_IOS_NO_SLOT_01)"); + Console.WriteLine("You used the -SLOT flag, but no slot was provided."); + Console.WriteLine("Provide a proper slot."); + 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 (args[1] == "1610") + { + Console.WriteLine(""); + Console.WriteLine("Slot Flag was used, but an invalid slot provided. (SHARPII_NET_CORE_xxx_INVALID_SLOT_01)"); + Console.WriteLine("You used the -SLOT flag, but an invalid slot was provided."); + Console.WriteLine("Provide a proper slot."); + 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 (args[1] == "1611") + { + Console.WriteLine(""); + Console.WriteLine("V Flag was used, but no version provided. (SHARPII_NET_CORE_xxx_NO_VERSION_01)"); + Console.WriteLine("You used the -V flag, but no version was provided."); + Console.WriteLine("Provide a proper version."); + 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 (args[1] == "1612") + { + Console.WriteLine(""); + Console.WriteLine("V Flag was used, but an invalid version provided. (SHARPII_NET_CORE_xxx_INVALID_VERSION_01)"); + Console.WriteLine("You used the -V flag, but no version was provided."); + Console.WriteLine("Provide a proper version."); + 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 (args[1] == "1613") + { + Console.WriteLine(""); + Console.WriteLine("O Flag was used, but no output provided. (SHARPII_NET_CORE_xxx_NO_OUTPUT_01)"); + Console.WriteLine("You used the -O flag, but no output was provided."); + Console.WriteLine("Provide a proper output."); + 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 (args[1] == "1614") + { + Console.WriteLine(""); + Console.WriteLine("ID Flag was used, but no id provided. (SHARPII_NET_CORE_xxx_NO_ID_01)"); + Console.WriteLine("You used the -ID flag, but no id was provided."); + Console.WriteLine("Provide a proper id."); + 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 (args[1] == "1615") + { + Console.WriteLine(""); + Console.WriteLine("A Critical DLL (libWiiSharp.dll) couldn't be found. (SHARPII_NET_CORE_HBC_MISSING_DLL_LIBWIISHARP_01)"); + Console.WriteLine("The libWiiSharp.dll couldn't be found."); + Console.WriteLine("This error SHOULD NOT APPEAR in this Sharpii port."); + Console.WriteLine("Open an issue on GitHub!"); + Console.WriteLine("https://github.com/TheShadowEevee/Sharpii-NetCore/issues"); + Console.WriteLine(""); + ErrCodeFound = 1; + } + if (args[1] == "1616") + { + Console.WriteLine(""); + Console.WriteLine("An invalid argument was passed when starting Sharpii. (SHARPII_NET_CORE_xxx_INVALID_ARG_01)"); + Console.WriteLine("An invalid argument was provided."); + Console.WriteLine("Check the options you are using to start Sharpii."); + 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 (args[1] == "1617") + { + Console.WriteLine(""); + Console.WriteLine("FORMAT Flag was used, but no format provided. (SHARPII_NET_CORE_TPL_NO_FORMAT_01)"); + Console.WriteLine("You used the -FORMAT flag, but no format was provided."); + Console.WriteLine("Provide a proper format."); + 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 (args[1] == "1618") + { + Console.WriteLine(""); + Console.WriteLine("FORMAT Flag was used, but invalid format provided. (SHARPII_NET_CORE_TPL_INVALID_FORMAT_01)"); + Console.WriteLine("You used the -FORMAT flag, but an invalid format was provided."); + Console.WriteLine("Provide a proper format."); + 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 (args[1] == "1619") + { + Console.WriteLine(""); + Console.WriteLine("A non U8 archive file was provided. (SHARPII_NET_CORE_U8_NON_U8_01)"); + Console.WriteLine("The provided file is not a U8 archive."); + Console.WriteLine("Provide a U8 archive."); + 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 (args[1] == "1620") + { + Console.WriteLine(""); + Console.WriteLine("Folder Access Issue/Missing Folder. (SHARPII_NET_CORE_xxx_FOLDER_ERR_01)"); + Console.WriteLine("Either the folder doesn't exist, or Sharpii doesn't have permission to open it."); + Console.WriteLine("Check the folders's permissions and that it's in the right place."); + 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 (args[1] == "1621") + { + Console.WriteLine(""); + Console.WriteLine("IMET Flag was used, but no title provided. (SHARPII_NET_CORE_xxx_NO_TITLE_01"); + Console.WriteLine("You used the -IMET flag, but no title was provided."); + Console.WriteLine("Provide a proper title."); + 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 (args[1] == "1622") + { + Console.WriteLine(""); + Console.WriteLine("IMET and IMD5 Flags were used, but only one can be used. (SHARPII_NET_CORE_U8_TWO_HEADERS"); + Console.WriteLine("You used the -IMET and -IMD5 flags, but you can't use two headers."); + Console.WriteLine("Provide only one flag."); + 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 (args[1] == "1623") + { + Console.WriteLine(""); + Console.WriteLine("ID Flag was used, but short ID provided. (SHARPII_NET_CORE_WAD_SHORT_ID_01)"); + Console.WriteLine("You used the -ID flag, but the provided id was too short to be correct."); + Console.WriteLine("Provide a proper id."); + 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 (args[1] == "1624") + { + Console.WriteLine(""); + Console.WriteLine("TYPE or IOS Flag used, but no type provided. (SHARPII_NET_CORE_WAD_NO_TYPE_01)"); + Console.WriteLine("You used the -TYPE or -IOS flag, but no type was provided."); + Console.WriteLine("Provide a proper type."); + 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 (args[1] == "1625") + { + Console.WriteLine(""); + Console.WriteLine("TYPE or IOS Flag used, but provided type unknown. (SHARPII_NET_CORE_WAD_UNKNOWN_TYPE_01)"); + Console.WriteLine("You used the -TYPE flag, but an unknown type was provided."); + Console.WriteLine("Provide a proper type."); + 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 (args[1] == "1626") + { + Console.WriteLine(""); + Console.WriteLine("SOUND Flag used, but no wad provided. (SHARPII_NET_CORE_WAD_NO_SOUND)"); + Console.WriteLine("You used the -SOUND flag, but no wad file to provide sound was provided."); + Console.WriteLine("Provide a proper wad."); + 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 (args[1] == "1627") + { + Console.WriteLine(""); + Console.WriteLine("BANNER Flag used, but no wad provided. (SHARPII_NET_CORE_WAD_NO_BANNER)"); + Console.WriteLine("You used the BANNER flag, but no wad file to provide a banner was provided."); + Console.WriteLine("Provide a proper wad."); + 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(); + } + if (args[1] == "1628") + { + Console.WriteLine(""); + Console.WriteLine("ID Flag was used, but invalid id provided. (SHARPII_NET_CORE_xxx_BAD_ID_01)"); + Console.WriteLine("You used the -ID flag, but an invalid id was provided."); + Console.WriteLine("Provide a proper id."); + 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; + } + } + catch (Exception) + { + ExitCode_help(); + } + } + public static void ExitCode_help() + { + Console.WriteLine(""); + Console.WriteLine("Sharpii {0} - Exit Codes - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version); + Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee"); + Console.WriteLine(""); + Console.WriteLine(""); + Console.WriteLine(" Usage:"); + Console.WriteLine(""); + Console.WriteLine(" Sharpii EXITCODES [Exit]"); + Console.WriteLine(""); + Console.WriteLine(" Ex. \"Sharpii EXITCODES 1601\""); + Console.WriteLine(""); + } + } +} diff --git a/Sharpii/Exit Codes.txt b/Sharpii/Exit Codes.txt new file mode 100644 index 0000000..fb6eff2 --- /dev/null +++ b/Sharpii/Exit Codes.txt @@ -0,0 +1,146 @@ + +Exit Code: 0 +No errors reported/Likely successful exit + +Exit Code: 1601 +File Access Issue/Missing File. (SHARPII_NET_CORE_xxx_FILE_ERR_01) +Either the file doesn't exist, or Sharpii doesn't have permission to open it. +Check the file's permissions and that it's in the right place. + +Exit Code: 1602 +Unknown Error/Untracked Error. (SHARPII_NET_CORE_xxx_UNKNOWN_01) +An untracked error has occured. +Use the error text to self-diagnose. + +Exit Code: 1603 +No IP was provided for remote Wii access. (SHARPII_NET_CORE_HBC_NO_IP_01) +No IP address was listed for the Wii. +Furthermore, no IP address is saved from previous uses. +If this doesn't help, open an issue on GitHub! + +Exit Code: 1604 +DOL Flag was used, but no file provided. (SHARPII_NET_CORE_xxx_NO_DOL_01) +You used the -DOL flag, but no DOL file was provided. +Provide the proper DOL file. + +Exit Code: 1605 +A Critical DLL (WadInstaller.dll) couldn't be found. (SHARPII_NET_CORE_HBC_MISSING_DLL_WADINSTALLER_01) +The WadInstaller.dll couldn't be found. +This error SHOULD NOT APPEAR in this Sharpii port. +Open an issue on GitHub! + +Exit Code: 1606 +IOS Flag was used, but no IOS provided. (SHARPII_NET_CORE_xxx_NO_IOS_01) +You used the -IOS flag, but no IOS was provided. +Provide a proper IOS. + +Exit Code: 1607 +IOS Flag was used, but an invalid IOS provided. (SHARPII_NET_CORE_xxx_INVALID_IOS_01) +You used the -IOS flag, but an invalid IOS was provided. +Provide a proper IOS. + +Exit Code: 1608 +WAD Flag was used, but no wad provided. (SHARPII_NET_CORE_HBC_NO_WAD_01) +You used the -WAD flag, but no WAD was provided. +Provide a proper WAD. + +Exit Code: 1609 +Slot Flag was used, but no slot provided. (SHARPII_NET_CORE_IOS_NO_SLOT_01) +You used the -SLOT flag, but no slot was provided. +Provide a proper slot. + +Exit Code: 1610 +Slot Flag was used, but an invalid slot provided. (SHARPII_NET_CORE_xxx_INVALID_SLOT_01) +You used the -SLOT flag, but an invalid slot was provided. +Provide a proper slot. + +Exit Code: 1611 +V Flag was used, but no version provided. (SHARPII_NET_CORE_xxx_NO_VERSION_01) +You used the -V flag, but no version was provided. +Provide a proper version. + +Exit Code: 1612 +V Flag was used, but an invalid version provided. (SHARPII_NET_CORE_xxx_INVALID_VERSION_01) +You used the -V flag, but no version was provided. +Provide a proper version. + +Exit Code: 1613 +O Flag was used, but no output provided. (SHARPII_NET_CORE_xxx_NO_OUTPUT_01) +You used the -O flag, but no output was provided. +Provide a proper output. + +Exit Code: 1614 +ID Flag was used, but no id provided. (SHARPII_NET_CORE_xxx_NO_ID_01) +You used the -ID flag, but no id was provided. +Provide a proper id. + +Exit Code: 1615 +A Critical DLL (libWiiSharp.dll) couldn't be found. (SHARPII_NET_CORE_MAIN_MISSING_DLL_LIBWIISHARP_01) +The libWiiSharp.dll couldn't be found. +This error SHOULD NOT APPEAR in this Sharpii port. +Open an issue on GitHub! + +Exit Code: 1616 +An invalid argument was passed when starting Sharpii. (SHARPII_NET_CORE_xxx_INVALID_ARG_01) +An invalid argument was provided. +Check the options you are using to start Sharpii. + +Exit Code: 1617 +FORMAT Flag was used, but no format provided. (SHARPII_NET_CORE_TPL_NO_FORMAT_01) +You used the -FORMAT flag, but no format was provided. +Provide a proper format. + +Exit Code: 1618 +FORMAT Flag was used, but invalid format provided. (SHARPII_NET_CORE_TPL_INVALID_FORMAT_01) +You used the -FORMAT flag, but an invalid format was provided. +Provide a proper format. + +Exit Code: 1619 +A non U8 archive file was provided. (SHARPII_NET_CORE_U8_NON_U8_01) +The provided file is not a U8 archive. +Provide a U8 archive. + +Exit Code: 1620 +Folder Access Issue/Missing Folder. (SHARPII_NET_CORE_xxx_FOLDER_ERR_01) +Either the folder doesn't exist, or Sharpii doesn't have permission to open it. +Check the folders's permissions and that it's in the right place. + +Exit Code: 1621 +IMET Flag was used, but no title provided. (SHARPII_NET_CORE_xxx_NO_TITLE_01 +You used the -IMET flag, but no title was provided. +Provide a proper title. + +Exit Code: 1622 +IMET and IMD5 Flags were used, but only one can be used. (SHARPII_NET_CORE_U8_TWO_HEADERS +You used the -IMET and -IMD5 flags, but you can't use two headers. +Provide only one flag. + +Exit Code: 1623 +ID Flag was used, but short ID provided. (SHARPII_NET_CORE_WAD_SHORT_ID_01) +You used the -ID flag, but the provided id was too short to be correct. +Provide a proper id. + +Exit Code: 1624 +TYPE or IOS Flag used, but no type provided. (SHARPII_NET_CORE_WAD_NO_TYPE_01) +You used the -TYPE or -IOS flag, but no type was provided. +Provide a proper type. + +Exit Code: 1625 +TYPE or IOS Flag used, but provided type unknown. (SHARPII_NET_CORE_WAD_UNKNOWN_TYPE_01) +You used the -TYPE flag, but an unknown type was provided. +Provide a proper type. + +Exit Code: 1626 +SOUND Flag used, but no wad provided. (SHARPII_NET_CORE_WAD_NO_SOUND) +You used the -SOUND flag, but no wad file to provide sound was provided. +Provide a proper wad. + +Exit Code: 1627 +BANNER Flag used, but no wad provided. (SHARPII_NET_CORE_WAD_NO_BANNER) +You used the BANNER flag, but no wad file to provide a banner was provided. +Provide a proper wad. + +Exit Code: 1618 +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 diff --git a/Sharpii/HBC.cs b/Sharpii/HBC.cs index b7b054d..0ac4932 100644 --- a/Sharpii/HBC.cs +++ b/Sharpii/HBC.cs @@ -54,6 +54,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No ip set"); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IP_01"); + Environment.Exit(0x00000643); return; } ip = args[i + 1]; @@ -67,6 +68,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No dol set"); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_DOL_01"); + Environment.Exit(0x00000644); return; } input = args[i + 1]; @@ -76,6 +78,7 @@ 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_HBC_FILE_ERR_01"); + Environment.Exit(0x00000641); return; } @@ -115,6 +118,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No IP set"); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IP_01"); + Environment.Exit(0x00000643); return; } if (noip == true && BeQuiet.quiet > 2) @@ -159,6 +163,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } @@ -185,23 +190,7 @@ 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_HBC_MISSING_DLL_WADINSTALLER_01"); - Console.WriteLine("\n\nAttemp to download? [Y/N]"); - Console.Write("\n>>"); - string ans = Console.ReadLine(); - if (ans.ToUpper() == "Y") - { - try - { - Console.Write("\nGrabbing WadInstaller.dll..."); - WebClient DLwadInstaller = new WebClient(); - DLwadInstaller.DownloadFile("https://github.com/mogzol/sharpii/raw/master/Sharpii/WadInstaller.dll", Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\WadInstaller.dll"); - Console.Write("Done!\n"); - } - catch (Exception ex) - { Console.WriteLine("An error occured: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_UNKNOWN_01"); return false; } - } - else - return false; + Environment.Exit(0x00000645); } return true; @@ -227,6 +216,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No ios set"); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IOS_01"); + Environment.Exit(0x00000646); return; } ios = args[i + 1]; @@ -234,6 +224,7 @@ namespace Sharpii { Console.WriteLine("ERROR: Invalid IOS number"); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_INVALID_IOS_01"); + Environment.Exit(0x00000647); return; } break; @@ -245,6 +236,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No ip set"); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IP_01"); + Environment.Exit(0x00000643); return; } ip = args[i + 1]; @@ -258,6 +250,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No WAD set"); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_WAD_01"); + Environment.Exit(0x00000648); return; } input = args[i + 1]; @@ -266,6 +259,7 @@ namespace Sharpii { Console.WriteLine("ERROR: Unable to open file: {0}", input); Console.WriteLine("Error: SHARPII_NET_CORE_BNS_FILE_ERR_01"); + Environment.Exit(0x00000641); return; } break; @@ -300,6 +294,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No IP set"); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IP_01"); + Environment.Exit(0x00000643); return; } if (noip == true && BeQuiet.quiet > 2) @@ -336,6 +331,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } diff --git a/Sharpii/IOS.cs b/Sharpii/IOS.cs index 27cf037..3b3a62a 100644 --- a/Sharpii/IOS.cs +++ b/Sharpii/IOS.cs @@ -45,6 +45,7 @@ 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_IOS_FILE_ERR_01"); + Environment.Exit(0x00000641); return; } @@ -70,18 +71,21 @@ namespace Sharpii { Console.WriteLine("ERROR: No slot set"); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_NO_SLOT_01"); + Environment.Exit(0x00000649); return; } if (!int.TryParse(args[i + 1], out slot)) { Console.WriteLine("Invalid slot {0}...", args[i + 1]); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_SLOT_01"); + Environment.Exit(0x0000064A); return; } if (slot < 3 || slot > 255) { Console.WriteLine("Invalid slot {0}...", slot); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_SLOT_01"); + Environment.Exit(0x0000064A); return; } break; @@ -90,18 +94,21 @@ namespace Sharpii { Console.WriteLine("ERROR: No slot set"); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_NO_SLOT_01"); + Environment.Exit(0x00000649); return; } if (!int.TryParse(args[i + 1], out slot)) { Console.WriteLine("Invalid slot {0}...", args[i + 1]); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_SLOT_01"); + Environment.Exit(0x0000064A); return; } if (slot < 3 || slot > 255) { Console.WriteLine("Invalid slot {0}...", slot); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_SLOT_01"); + Environment.Exit(0x0000064A); return; } break; @@ -110,18 +117,21 @@ namespace Sharpii { Console.WriteLine("ERROR: No version set"); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_NO_VERSION_01"); + Environment.Exit(0x0000064B); return; } if (!int.TryParse(args[i + 1], out version)) { Console.WriteLine("Invalid version {0}...", args[i + 1]); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_VERSION_01"); + Environment.Exit(0x0000064C); return; } if (version < 0 || version > 65535) { Console.WriteLine("Invalid version {0}...", version); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_VERSION_01"); + Environment.Exit(0x0000064C); return; } break; @@ -130,6 +140,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No output set"); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_NO_OUTPUT_01"); + Environment.Exit(0x0000064D); return; } output = args[i + 1]; @@ -240,6 +251,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_IOS_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } diff --git a/Sharpii/NUSD.cs b/Sharpii/NUSD.cs index 6756daf..32c64c8 100644 --- a/Sharpii/NUSD.cs +++ b/Sharpii/NUSD.cs @@ -88,6 +88,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No version set"); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_VERSION_01"); + Environment.Exit(0x0000064B); return; } version = args[i + 1]; @@ -97,12 +98,14 @@ namespace Sharpii { Console.WriteLine("Invalid version {0}...", args[i + 1]); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_INVALID_VERSION_01"); + Environment.Exit(0x0000064C); return; } if (intver < 0 || intver > 65535) { Console.WriteLine("Invalid version {0}...", version); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_INVALID_VERSION_01"); + Environment.Exit(0x0000064C); return; } break; @@ -111,6 +114,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No version set"); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_VERSION_01"); + Environment.Exit(0x0000064B); return; } version = args[i + 1]; @@ -120,12 +124,14 @@ namespace Sharpii { Console.WriteLine("Invalid version {0}...", args[i + 1]); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_INVALID_VERSION_01"); + Environment.Exit(0x0000064C); return; } if (intver < 0 || intver > 65535) { Console.WriteLine("Invalid version {0}...", version); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_INVALID_VERSION_01"); + Environment.Exit(0x0000064C); return; } break; @@ -134,6 +140,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No output set"); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_OUTPUT_01"); + Environment.Exit(0x0000064D); return; } output = args[i + 1]; @@ -143,6 +150,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No ID specified"); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_ID_01"); + Environment.Exit(0x0000064E); return; } id = args[i + 1]; @@ -152,6 +160,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No IOS specified"); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_IOS_01"); + Environment.Exit(0x00000646); return; } id = "00000001000000" + Convert.ToInt32(args[i + 1]).ToString("X2"); @@ -161,6 +170,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No ID specified"); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_ID_01"); + Environment.Exit(0x0000064E); return; } content = args[i + 1]; @@ -170,6 +180,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No ID specified"); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_ID_01"); + Environment.Exit(0x0000064E); return; } content = args[i + 1]; @@ -182,6 +193,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No ID specified"); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_ID_01"); + Environment.Exit(0x0000064E); return; } @@ -192,16 +204,41 @@ namespace Sharpii version = "LATEST"; } - if (version.ToUpper() == "LATEST") + try { - //Grab the TMD and get the latest version - NusClient grabtmd = new NusClient(); - TMD tmd = grabtmd.DownloadTMD(id, ""); - version = tmd.TitleVersion.ToString(); - - if (BeQuiet.quiet > 2) - Console.WriteLine("Found latest version: v{0}", version); + if (version.ToUpper() == "LATEST") + { + //Grab the TMD and get the latest version + NusClient grabtmd = new NusClient(); + TMD tmd = grabtmd.DownloadTMD(id, ""); + version = tmd.TitleVersion.ToString(); + } } + catch (Exception ex) + { + if (ex.Message == "Title ID must be 16 characters long!") + { + Console.WriteLine(""); + Console.WriteLine("The ID needs to be 16 Characters."); + Console.WriteLine(""); + Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_BAD_ID_01"); + Console.WriteLine(""); + Environment.Exit(0x0000065C); + return; + } + if (ex.Message == "The remote server returned an error: (404) Not Found.") + { + Console.WriteLine(""); + Console.WriteLine("The ID is not a valid title ID"); + Console.WriteLine(""); + Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_BAD_ID_01"); + Console.WriteLine(""); + Environment.Exit(0x0000065C); + return; + } + } + if (BeQuiet.quiet > 2) + Console.WriteLine("Found latest version: v{0}", version); if (entered == false) //Will only be false if no store type argument was given { @@ -279,6 +316,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } @@ -295,6 +333,7 @@ namespace Sharpii Console.WriteLine("ERROR: Can't find WAD"); Console.WriteLine("Either the file doesn't exist, or Sharpii doesn't have permission to open it."); Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_FILE_ERR_01"); + Environment.Exit(0x00000641); return; } if (ios != "" && NoOut == true) diff --git a/Sharpii/Program.cs b/Sharpii/Program.cs index b81fac1..4623bf3 100644 --- a/Sharpii/Program.cs +++ b/Sharpii/Program.cs @@ -39,23 +39,7 @@ 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"); - Console.WriteLine("\n\nAttempt to download? [Y/N]"); - Console.Write("\n>>"); - string ans = Console.ReadLine(); - if (ans.ToUpper() == "Y") - { - try - { - Console.Write("\nGrabbing libWiiSharp.dll..."); - WebClient DLlibWiiSharp = new WebClient(); - DLlibWiiSharp.DownloadFile("https://github.com/mogzol/sharpii/raw/master/Sharpii/libWiiSharp.dll", Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\libWiiSharp.dll"); - Console.Write("Done!\n"); - } - catch (Exception ex) - { Console.WriteLine("An error occured: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_MAIN_UNKNOWN_01"); Environment.Exit(0); } - } - else - Environment.Exit(0); + Environment.Exit(0x0000064F); } for (int i = 1; i < args.Length; i++) @@ -152,6 +136,13 @@ namespace Sharpii ERROR_Stuff.ERROR(args); gotSomewhere = true; } + + if (Function == "EXITCODES") + { + ERRORCODE_Stuff.ERRORCODE(args); + gotSomewhere = true; + } + if (Function == "WHICH CAME FIRST" || Function == "WHICH CAME FIRST?" || (Function == "WHICH" && args[1].ToUpper() == "CAME" && args[2].Substring(0,5).ToUpper() == "FIRST")) { @@ -166,6 +157,7 @@ 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"); + Environment.Exit(0x00000650); } string temp = Path.GetTempPath() + "Sharpii.tmp"; @@ -210,6 +202,7 @@ namespace Sharpii catch (Exception ex) { Console.WriteLine("An unknown error occured, please try again\n\nERROR DETAILS: {0}", ex.Message); + Environment.Exit(0x00000642); return; } } @@ -229,6 +222,7 @@ namespace Sharpii catch (Exception ex) { Console.WriteLine("An unknown error occured, please try again\n\nERROR DETAILS: {0}", ex.Message); + Environment.Exit(0x00000642); return; } } @@ -277,6 +271,7 @@ namespace Sharpii Console.WriteLine(" SendDol Send a dol to the HBC over wifi"); Console.WriteLine(" SendWad Send a wad to the HBC over wifi"); Console.WriteLine(" Errors Get a Sharpii error's description"); + Console.WriteLine(" ExitCodes List of all Sharpii exit codes"); Console.WriteLine(""); Console.WriteLine(" NOTE: Too see more detailed descriptions of any of the above,"); Console.WriteLine(" use 'Sharpii [function] -h'"); @@ -284,9 +279,9 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine(" Other Functions:"); Console.WriteLine(""); - Console.WriteLine(" Install Install Sharpii to your computer so you can run it"); - Console.WriteLine(" from anywhere without needing the exe"); - Console.WriteLine(" Uninstall Uninstall Sharpii from your computer"); + //Console.WriteLine(" Install Install Sharpii to your computer so you can run it"); + //Console.WriteLine(" from anywhere without needing the exe"); + //Console.WriteLine(" Uninstall Uninstall Sharpii from your computer"); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine(" Global Arguments:"); @@ -295,8 +290,7 @@ namespace Sharpii Console.WriteLine(" -lots Display lots of output"); Console.WriteLine(" -nolog Don't create a log file"); Console.WriteLine(""); - - + Environment.Exit(0x0000064E); } } diff --git a/Sharpii/TPL.cs b/Sharpii/TPL.cs index 8347db0..26a1255 100644 --- a/Sharpii/TPL.cs +++ b/Sharpii/TPL.cs @@ -48,6 +48,7 @@ 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"); + Environment.Exit(0x00000650); return; } @@ -63,6 +64,7 @@ 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"); + Environment.Exit(0x00000641); return; } @@ -96,6 +98,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_TPL_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } } @@ -113,6 +116,7 @@ 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"); + Environment.Exit(0x00000641); return; } @@ -126,6 +130,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No format set"); Console.WriteLine("Error: SHARPII_NET_CORE_TPL_NO_FORMAT_01"); + Environment.Exit(0x00000651); return; } tplFormat = args[i + 1]; @@ -135,6 +140,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No format set"); Console.WriteLine("Error: SHARPII_NET_CORE_TPL_NO_FORMAT_01"); + Environment.Exit(0x00000651); return; } tplFormat = args[i + 1]; @@ -147,6 +153,7 @@ namespace Sharpii { Console.WriteLine("ERROR: Unknown format type: {0}", tplFormat); Console.WriteLine("Error: SHARPII_NET_CORE_TPL_UNKNOWN_FORMAT_01"); + Environment.Exit(0x00000652); return; } @@ -204,6 +211,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_TPL_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } } diff --git a/Sharpii/U8.cs b/Sharpii/U8.cs index 1627b9e..8c362e4 100644 --- a/Sharpii/U8.cs +++ b/Sharpii/U8.cs @@ -48,6 +48,7 @@ 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"); + Environment.Exit(0x00000650); return; } @@ -70,6 +71,7 @@ namespace Sharpii { Console.WriteLine("ERROR: File {0} is not a U8 archive", input); Console.WriteLine("Error: SHARPII_NET_CORE_U8_NON_U8_01"); + Environment.Exit(0x00000653); return; } @@ -104,6 +106,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_U8_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } } @@ -123,6 +126,7 @@ 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"); + Environment.Exit(0x00000654); return; } @@ -141,6 +145,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No title set"); Console.WriteLine("Error: SHARPII_NET_CORE_U8_NO_TITLE_01"); + Environment.Exit(0x00000655); return; } imet = args[i + 1]; @@ -152,6 +157,7 @@ namespace Sharpii { Console.WriteLine("ERROR: Cannot use IMET and IMD5 at the same time."); Console.WriteLine("Error: SHARPII_NET_CORE_U8_TWO_HEADERS_01"); + Environment.Exit(0x00000656); return; } @@ -204,6 +210,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_U8_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } } diff --git a/Sharpii/WAD.cs b/Sharpii/WAD.cs index cf793e1..4ef1b5f 100644 --- a/Sharpii/WAD.cs +++ b/Sharpii/WAD.cs @@ -80,6 +80,7 @@ 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"); + Environment.Exit(0x00000650); return; } @@ -96,6 +97,7 @@ 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"); + Environment.Exit(0x00000641); return; } @@ -108,6 +110,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No output set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_OUTPUT_01"); + Environment.Exit(0x0000064D); return; } output = args[i + 1]; @@ -117,6 +120,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No output set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_OUTPUT_01"); + Environment.Exit(0x0000064D); return; } output = args[i + 1]; @@ -210,6 +214,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } } @@ -236,6 +241,7 @@ 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"); + Environment.Exit(0x00000641); return; } if (edit == false) @@ -244,6 +250,7 @@ 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"); + Environment.Exit(0x00000654); return; } @@ -259,6 +266,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No ID set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_ID_01"); + Environment.Exit(0x0000064E); return; } id = args[i + 1]; @@ -266,6 +274,7 @@ namespace Sharpii { Console.WriteLine("ERROR: ID too short"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_SHORT_ID_01"); + Environment.Exit(0x00000657); return; } id = id.Substring(0, 4); @@ -275,6 +284,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No type set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TYPE_01"); + Environment.Exit(0x00000658); return; } lwrid = args[i + 1].ToUpper(); @@ -282,6 +292,7 @@ namespace Sharpii { Console.WriteLine("ERROR: Unknown WAD type: {0}", args[i + 1]); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_TYPE_01"); + Environment.Exit(0x00000659); return; } break; @@ -290,18 +301,21 @@ namespace Sharpii { Console.WriteLine("ERROR: No type set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TYPE_01"); + Environment.Exit(0x00000658); 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"); + Environment.Exit(0x0000064A); return; } if (ios < 0 || ios > 255) { Console.WriteLine("Invalid slot {0}...", ios); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_INVALID_SLOT_01"); + Environment.Exit(0x0000064A); return; } break; @@ -310,6 +324,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No title set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TITLE_01"); + Environment.Exit(0x00000655); return; } title = args[i + 1]; @@ -319,6 +334,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No sound set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_SOUND_01"); + Environment.Exit(0x0000065A); return; } sound = args[i + 1]; @@ -327,6 +343,7 @@ 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"); + Environment.Exit(0x00000641); return; } break; @@ -335,6 +352,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No banner set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_BANNER_01"); + Environment.Exit(0x0000065B); return; } banner = args[i + 1]; @@ -343,6 +361,7 @@ 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"); + Environment.Exit(0x00000641); return; } break; @@ -351,6 +370,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No sound set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_SOUND_01"); + Environment.Exit(0x0000065A); return; } icon = args[i + 1]; @@ -359,6 +379,7 @@ 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"); + Environment.Exit(0x00000641); return; } break; @@ -367,6 +388,7 @@ namespace Sharpii { Console.WriteLine("ERROR: No dol set"); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_DOL_01"); + Environment.Exit(0x00000644); return; } app = args[i + 1]; @@ -375,6 +397,7 @@ 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"); + Environment.Exit(0x00000641); return; } break; @@ -567,6 +590,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } } @@ -584,6 +608,7 @@ 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"); + Environment.Exit(0x00000641); return; } @@ -628,6 +653,7 @@ namespace Sharpii Console.WriteLine(""); Console.WriteLine("ERROR DETAILS: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_01"); + Environment.Exit(0x00000642); return; } }