mirror of
https://github.com/TheShadowEevee/Sharpii-NetCore.git
synced 2025-01-11 14:58:51 -06:00
f9198444e2
Added custom exit codes, which allow headless scripts to use Sharpii easier. Exit Codes do NOT interfere with normal system exit codes. (System exit codes are 15999 and below, Custom exits are 16001+.)
372 lines
20 KiB
C#
372 lines
20 KiB
C#
/* 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 <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
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("");
|
|
}
|
|
}
|
|
}
|