Added Error codes and Fixed some missed lines from v1.0.1

This commit is contained in:
Shadow Eevee 2020-03-07 12:44:42 -08:00
parent efabed2e35
commit 87a5c784b9
8 changed files with 127 additions and 9 deletions

View file

@ -56,6 +56,8 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
@ -90,6 +92,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_BNS_UNKNOWN_01");
return;
}
}
@ -105,6 +108,8 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
@ -172,6 +177,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_BNS_UNKNOWN_01");
return;
}
}

View file

@ -65,6 +65,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No dol set");
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_DOL_01");
return;
}
input = args[i + 1];
@ -72,6 +73,8 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
@ -110,6 +113,7 @@ namespace Sharpii
if (String.IsNullOrEmpty(ip))
{
Console.WriteLine("ERROR: No IP set");
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IP_01");
return;
}
if (noip == true && BeQuiet.quiet > 2)
@ -153,6 +157,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_UNKNOWN_01");
return;
}
@ -176,6 +181,9 @@ namespace Sharpii
if (!File.Exists(Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory), "WadInstaller.dll")))
{
Console.WriteLine("ERROR: WadInstaller.dll not found");
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();
@ -189,7 +197,7 @@ namespace Sharpii
Console.Write("Done!\n");
}
catch (Exception ex)
{ Console.WriteLine("An error occured: {0}", ex.Message); return false; }
{ Console.WriteLine("An error occured: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_HBC_UNKNOWN_01"); return false; }
}
else
return false;
@ -217,12 +225,14 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No ios set");
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IOS_01");
return;
}
ios = args[i + 1];
if (!(Convert.ToInt32(ios) >= 3 && Convert.ToInt32(ios) <= 255))
{
Console.WriteLine("ERROR: Invalid IOS number");
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_INVALID_IOS_01");
return;
}
break;
@ -233,6 +243,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No ip set");
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IP_01");
return;
}
ip = args[i + 1];
@ -245,6 +256,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No WAD set");
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_WAD_01");
return;
}
input = args[i + 1];
@ -252,6 +264,7 @@ namespace Sharpii
if (File.Exists(input) == false)
{
Console.WriteLine("ERROR: Unable to open file: {0}", input);
Console.WriteLine("Error: SHARPII_NET_CORE_BNS_UNKNOWN_01");
return;
}
break;
@ -285,6 +298,7 @@ namespace Sharpii
if (String.IsNullOrEmpty(ip))
{
Console.WriteLine("ERROR: No IP set");
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_NO_IP_01");
return;
}
if (noip == true && BeQuiet.quiet > 2)
@ -320,6 +334,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_HBC_UNKNOWN_01");
return;
}
@ -358,6 +373,7 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine("Sharpii {0} - SendWad - A tool by person66, using libWiiSharp.dll by leathl,", ProgramVersion.version);
Console.WriteLine(" and CRAP's installer by WiiCrazy/I.R.on");
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
Console.WriteLine("");
Console.WriteLine(" Usage:");
Console.WriteLine("");

View file

@ -43,6 +43,8 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
@ -67,16 +69,19 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No slot set");
Console.WriteLine("Error: SHARPII_NET_CORE_IOS_NO_SLOT_01");
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");
return;
}
if (slot < 3 || slot > 255)
{
Console.WriteLine("Invalid slot {0}...", slot);
Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_SLOT_01");
return;
}
break;
@ -84,16 +89,19 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No slot set");
Console.WriteLine("Error: SHARPII_NET_CORE_IOS_NO_SLOT_01");
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");
return;
}
if (slot < 3 || slot > 255)
{
Console.WriteLine("Invalid slot {0}...", slot);
Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_SLOT_01");
return;
}
break;
@ -101,16 +109,19 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No version set");
Console.WriteLine("Error: SHARPII_NET_CORE_IOS_NO_VERSION_01");
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");
return;
}
if (version < 0 || version > 65535)
{
Console.WriteLine("Invalid version {0}...", version);
Console.WriteLine("Error: SHARPII_NET_CORE_IOS_INVALID_VERSION_01");
return;
}
break;
@ -118,6 +129,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No output set");
Console.WriteLine("Error: SHARPII_NET_CORE_IOS_NO_OUTPUT_01");
return;
}
output = args[i + 1];
@ -227,6 +239,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_IOS_UNKNOWN_01");
return;
}

View file

@ -87,6 +87,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No version set");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_VERSION_01");
return;
}
version = args[i + 1];
@ -95,11 +96,13 @@ namespace Sharpii
if (!int.TryParse(version, out intver))
{
Console.WriteLine("Invalid version {0}...", args[i + 1]);
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_INVALID_VERSION_01");
return;
}
if (intver < 0 || intver > 65535)
{
Console.WriteLine("Invalid version {0}...", version);
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_INVALID_VERSION_01");
return;
}
break;
@ -107,6 +110,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No version set");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_VERSION_01");
return;
}
version = args[i + 1];
@ -115,11 +119,13 @@ namespace Sharpii
if (!int.TryParse(version, out intver))
{
Console.WriteLine("Invalid version {0}...", args[i + 1]);
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_INVALID_VERSION_01");
return;
}
if (intver < 0 || intver > 65535)
{
Console.WriteLine("Invalid version {0}...", version);
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_INVALID_VERSION_01");
return;
}
break;
@ -127,6 +133,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No output set");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_OUTPUT_01");
return;
}
output = args[i + 1];
@ -135,6 +142,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No ID specified");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_ID_01");
return;
}
id = args[i + 1];
@ -143,6 +151,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No IOS specified");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_IOS_01");
return;
}
id = "00000001000000" + Convert.ToInt32(args[i + 1]).ToString("X2");
@ -151,6 +160,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No ID specified");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_ID_01");
return;
}
content = args[i + 1];
@ -159,6 +169,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No ID specified");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_ID_01");
return;
}
content = args[i + 1];
@ -170,6 +181,7 @@ namespace Sharpii
if (id == "")
{
Console.WriteLine("ERROR: No ID specified");
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_ID_01");
return;
}
@ -266,6 +278,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_UNKNOWN_01");
return;
}
@ -280,6 +293,8 @@ namespace Sharpii
if (!File.Exists(Path.Combine(temp, id + "v" + version + ".wad")))
{
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");
return;
}
if (ios != "" && NoOut == true)

View file

@ -36,6 +36,9 @@ namespace Sharpii
if (!File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + Path.DirectorySeparatorChar + "libWiiSharp.dll"))
{
Console.WriteLine("ERROR: libWiiSharp.dll not found");
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();
@ -49,7 +52,7 @@ namespace Sharpii
Console.Write("Done!\n");
}
catch (Exception ex)
{ Console.WriteLine("An error occured: {0}", ex.Message); Environment.Exit(0); }
{ Console.WriteLine("An error occured: {0}", ex.Message); Console.WriteLine("Error: SHARPII_NET_CORE_MAIN_UNKNOWN_01"); Environment.Exit(0); }
}
else
Environment.Exit(0);
@ -68,6 +71,9 @@ namespace Sharpii
case "-LOTS":
BeQuiet.quiet = 3;
break;
case "-NOLOG":
Logging.log = 0;
break;
}
}
@ -280,6 +286,7 @@ namespace Sharpii
Console.WriteLine("");
Console.WriteLine(" -quiet | -q Try not to display any output");
Console.WriteLine(" -lots Display lots of output");
Console.WriteLine(" -nolog Don't create a log file");
Console.WriteLine("");
@ -323,3 +330,10 @@ public class ProgramVersion
{
public static string version = "1.0.1; .Net Core Port (Based on Sharpii 1.7.3)";
}
public class Logging
{
//By default, Sharpii should create a log.
//Using the option -NoLog will disable it.
//Everything should check this when it checks the BeQuiet.Quiet variable.
public static int log = 1;
}

View file

@ -47,6 +47,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");
return;
}
@ -60,6 +61,8 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
@ -92,6 +95,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_UNKNOWN_01");
return;
}
}
@ -107,6 +111,8 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
@ -119,6 +125,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No format set");
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_NO_FORMAT_01");
return;
}
tplFormat = args[i + 1];
@ -127,6 +134,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No format set");
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_NO_FORMAT_01");
return;
}
tplFormat = args[i + 1];
@ -138,6 +146,7 @@ namespace Sharpii
if (tplFormat != "I4" & tplFormat != "I8" & tplFormat != "IA4" & tplFormat != "IA8" & tplFormat != "RGB565" & tplFormat != "RGB5A3" & tplFormat != "RGBA8")
{
Console.WriteLine("ERROR: Unknown format type: {0}", tplFormat);
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_UNKNOWN_FORMAT_01");
return;
}
@ -194,6 +203,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_TPL_UNKNOWN_01");
return;
}
}

View file

@ -47,6 +47,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");
return;
}
@ -60,12 +61,15 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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_U8_FILE_ERR_01");
return;
}
//Check if file is U8
if (libWiiSharp.U8.IsU8(input) != true)
{
Console.WriteLine("ERROR: File {0} is not a U8 archive", input);
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NON_U8_01");
return;
}
@ -99,6 +103,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_U8_UNKNOWN_01");
return;
}
}
@ -116,6 +121,8 @@ namespace Sharpii
if (Directory.Exists(input) == false)
{
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");
return;
}
@ -133,6 +140,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No title set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TITLE_01");
return;
}
imet = args[i + 1];
@ -143,6 +151,7 @@ namespace Sharpii
if (imd5 == true && imet != "")
{
Console.WriteLine("ERROR: Cannot use IMET and IMD5 at the same time.");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_TWO_HEADERS_01");
return;
}
@ -194,6 +203,7 @@ namespace Sharpii
Console.WriteLine("An unknown error occured, please try again");
Console.WriteLine("");
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
Console.WriteLine("Error: SHARPII_NET_CORE_U8_UNKNOWN_01");
return;
}
}

View file

@ -79,6 +79,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");
return;
}
@ -93,6 +94,8 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
@ -104,6 +107,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No output set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_OUTPUT_01");
return;
}
output = args[i + 1];
@ -112,6 +116,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No output set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_OUTPUT_01");
return;
}
output = args[i + 1];
@ -204,6 +209,7 @@ namespace Sharpii
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");
return;
}
}
@ -228,12 +234,16 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
if (edit == false)
if (Directory.Exists(input) == false)
{
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");
return;
}
@ -248,12 +258,14 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No ID set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_ID_01");
return;
}
id = args[i + 1];
if (id.Length < 4)
{
Console.WriteLine("ERROR: ID too short");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_SHORT_ID_01");
return;
}
id = id.Substring(0, 4);
@ -262,12 +274,14 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No type set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TYPE_01");
return;
}
lwrid = args[i + 1].ToUpper();
if (lwrid != "CHANNEL" && lwrid != "DLC" && lwrid != "GAMECHANNEL" && lwrid != "HIDDENCHANNELS" && lwrid != "SYSTEMCHANNELS" && lwrid != "SYSTEMTITLES")
{
Console.WriteLine("ERROR: Unknown WAD type: {0}", args[i + 1]);
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_UNKNOWN_TYPE_01");
return;
}
break;
@ -275,16 +289,19 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No type set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TYPE_01");
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");
return;
}
if (ios < 0 || ios > 255)
{
Console.WriteLine("Invalid slot {0}...", ios);
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_INVALID_SLOT_01");
return;
}
break;
@ -292,6 +309,7 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No title set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_TITLE_01");
return;
}
title = args[i + 1];
@ -300,12 +318,15 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No sound set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_SOUND_01");
return;
}
sound = args[i + 1];
if (File.Exists(sound) == false)
{
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");
return;
}
break;
@ -313,12 +334,15 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No banner set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_BANNER_01");
return;
}
banner = args[i + 1];
if (File.Exists(banner) == false)
{
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");
return;
}
break;
@ -326,12 +350,15 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No sound set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_SOUND_01");
return;
}
icon = args[i + 1];
if (File.Exists(icon) == false)
{
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");
return;
}
break;
@ -339,12 +366,15 @@ namespace Sharpii
if (i + 1 >= args.Length)
{
Console.WriteLine("ERROR: No dol set");
Console.WriteLine("Error: SHARPII_NET_CORE_WAD_NO_DOL_01");
return;
}
app = args[i + 1];
if (File.Exists(app) == false)
{
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");
return;
}
break;
@ -448,7 +478,7 @@ namespace Sharpii
else
{
twad.LoadFile(app);
twad.Unpack(temp + "\\dol");
twad.Unpack(Path.Combine(temp, "dol"));
}
File.Copy(Path.Combine(temp, "dol", "00000001.app"), Path.Combine(temp, "main", "00000001.app"), true);
@ -460,8 +490,8 @@ namespace Sharpii
u.ReplaceFile(2, Path.Combine(temp, "main", "00000000", "meta", "icon.bin"));
u.ReplaceFile(3, Path.Combine(temp, "main", "00000000", "meta", "sound.bin"));
u.Save(Path.Combine(temp, "main", "00000000.app"));
DeleteADir.DeleteDirectory(temp + "\\main\\00000000\\");
wad.CreateNew(temp + "\\main");
DeleteADir.DeleteDirectory(Path.Combine(temp, "main", "00000000"));
wad.CreateNew(Path.Combine(temp, "main"));
DeleteADir.DeleteDirectory(temp);
}
@ -536,6 +566,7 @@ namespace Sharpii
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");
return;
}
}
@ -551,6 +582,8 @@ namespace Sharpii
if (File.Exists(input) == false)
{
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");
return;
}
@ -594,6 +627,7 @@ namespace Sharpii
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");
return;
}
}