mirror of
https://github.com/TheShadowEevee/Sharpii-NetCore.git
synced 2025-01-11 14:58:51 -06:00
Add -URL argument to NUS, Remove SecondRun
This commit is contained in:
parent
cc73424ead
commit
39f2f86823
1 changed files with 48 additions and 29 deletions
|
@ -26,8 +26,7 @@ namespace Sharpii
|
||||||
partial class NUS_Stuff
|
partial class NUS_Stuff
|
||||||
{
|
{
|
||||||
public static int ExceptionListRan = 0;
|
public static int ExceptionListRan = 0;
|
||||||
public static bool SecondRun;
|
public static void NUS(string[] args)
|
||||||
public static void NUS(string[] args, bool SecondRun)
|
|
||||||
{
|
{
|
||||||
if (args.Length < 2)
|
if (args.Length < 2)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +41,7 @@ namespace Sharpii
|
||||||
|
|
||||||
//Set up variables
|
//Set up variables
|
||||||
string id = "";
|
string id = "";
|
||||||
|
string url = "";
|
||||||
string content = "";
|
string content = "";
|
||||||
string version = "";
|
string version = "";
|
||||||
int intver = -1;
|
int intver = -1;
|
||||||
|
@ -55,12 +55,6 @@ namespace Sharpii
|
||||||
string temp = Path.GetTempPath() + "Sharpii.tmp";
|
string temp = Path.GetTempPath() + "Sharpii.tmp";
|
||||||
bool ContinueWithoutTicket = false;
|
bool ContinueWithoutTicket = false;
|
||||||
|
|
||||||
//Remove need for CETK
|
|
||||||
if (SecondRun == true)
|
|
||||||
{
|
|
||||||
ContinueWithoutTicket = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get arguments
|
//Get arguments
|
||||||
for (int i = 1; i < args.Length; i++)
|
for (int i = 1; i < args.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -222,6 +216,23 @@ namespace Sharpii
|
||||||
id = args[i + 1];
|
id = args[i + 1];
|
||||||
id = id.ToUpper();
|
id = id.ToUpper();
|
||||||
break;
|
break;
|
||||||
|
case "-URL":
|
||||||
|
if (i + 1 >= args.Length)
|
||||||
|
{
|
||||||
|
Console.WriteLine("ERROR: No URL specified");
|
||||||
|
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_NO_URL");
|
||||||
|
if (OperatingSystem.Windows())
|
||||||
|
{
|
||||||
|
Environment.Exit(0x00003E8E);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Environment.Exit(0x00000010);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
url = args[i + 1];
|
||||||
|
break;
|
||||||
case "-IOS":
|
case "-IOS":
|
||||||
if (i + 1 >= args.Length)
|
if (i + 1 >= args.Length)
|
||||||
{
|
{
|
||||||
|
@ -415,7 +426,11 @@ namespace Sharpii
|
||||||
if (BeQuiet.quiet > 1)
|
if (BeQuiet.quiet > 1)
|
||||||
Console.Write("Downloading content...");
|
Console.Write("Downloading content...");
|
||||||
|
|
||||||
nus.DownloadSingleContent(id, version, content, output);
|
if (url != "") {
|
||||||
|
nus.DownloadSingleContent(id, version, content, output, url);
|
||||||
|
} else {
|
||||||
|
nus.DownloadSingleContent(id, version, content, output);
|
||||||
|
}
|
||||||
|
|
||||||
if (BeQuiet.quiet > 1)
|
if (BeQuiet.quiet > 1)
|
||||||
Console.Write("Done!\n");
|
Console.Write("Done!\n");
|
||||||
|
@ -426,12 +441,18 @@ namespace Sharpii
|
||||||
Console.Write("Downloading title...\n");
|
Console.Write("Downloading title...\n");
|
||||||
|
|
||||||
string realout = output;
|
string realout = output;
|
||||||
if (wad == true && !SecondRun)
|
if (wad == true) {
|
||||||
output = temp;
|
output = temp;
|
||||||
|
}
|
||||||
|
|
||||||
nus.DownloadTitle(id, version, output, store.ToArray());
|
if (url != "") {
|
||||||
|
nus.DownloadTitle(id, version, output, url, store.ToArray());
|
||||||
|
} else {
|
||||||
|
nus.DownloadTitle(id, version, output, store.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
WadIosNamingStuff(wad, temp, id, version, ios, NoOut, output, realout, SecondRun);
|
|
||||||
|
WadIosNamingStuff(wad, temp, id, version, ios, NoOut, output, realout);
|
||||||
|
|
||||||
if (BeQuiet.quiet > 1)
|
if (BeQuiet.quiet > 1)
|
||||||
Console.Write("Done!\n");
|
Console.Write("Done!\n");
|
||||||
|
@ -444,15 +465,6 @@ namespace Sharpii
|
||||||
{
|
{
|
||||||
if (ex.Message == "CETK Doesn't Exist and Downloading Ticket Failed:\nThe remote server returned an error: (404) Not Found.")
|
if (ex.Message == "CETK Doesn't Exist and Downloading Ticket Failed:\nThe remote server returned an error: (404) Not Found.")
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (!SecondRun)
|
|
||||||
{
|
|
||||||
Console.WriteLine("It appears that there is no ticket for this app on the remote server, and there is no CETK file provided.");
|
|
||||||
Console.WriteLine("Attempting to redownload without a ticket.");
|
|
||||||
Console.WriteLine("The -WAD and -Decrypt commands will not work.");
|
|
||||||
NUS_Stuff.NUS(args, true);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Console.WriteLine("The remote server returned a 404 error. Check your Title ID.");
|
Console.WriteLine("The remote server returned a 404 error. Check your Title ID.");
|
||||||
Console.WriteLine("If you have a CETK file, please place it in the same directory as Sharpii saves the NUS Files to.");
|
Console.WriteLine("If you have a CETK file, please place it in the same directory as Sharpii saves the NUS Files to.");
|
||||||
|
@ -523,17 +535,16 @@ namespace Sharpii
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WadIosNamingStuff(bool wad, string temp, string id, string version, string ios, bool NoOut, string output, string realout, bool SecondRun)
|
private static void WadIosNamingStuff(bool wad, string temp, string id, string version, string ios, bool NoOut, string output, string realout)
|
||||||
{
|
{
|
||||||
bool LowercaseWad = false;
|
bool LowercaseWad = false;
|
||||||
bool OperationDone = false;
|
bool OperationDone = false;
|
||||||
if (wad == true && !SecondRun)
|
if (wad == true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!File.Exists(Path.Combine(temp, id + "v" + version + ".wad")))
|
if (!File.Exists(Path.Combine(temp, id + "v" + version + ".wad")))
|
||||||
{
|
{
|
||||||
Console.WriteLine("Can't find WAD using normal conventions. Retrying...");
|
|
||||||
LowercaseWad = true;
|
LowercaseWad = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -555,7 +566,19 @@ namespace Sharpii
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Still having errors... {0}", ex2.Message);
|
Console.WriteLine("ERROR: Can't find WAD {0}", id.ToLower());
|
||||||
|
Console.WriteLine("Try running without the -WAD or -ALL tag. If it still doesn't work, open an issue on Github.");
|
||||||
|
Console.WriteLine("Exact Error: {0}", ex2.Message);
|
||||||
|
Console.WriteLine("Error: SHARPII_NET_CORE_NUSD_FILE_ERR");
|
||||||
|
if (OperatingSystem.Windows())
|
||||||
|
{
|
||||||
|
Environment.Exit(0x00003E81);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Environment.Exit(0x00000003);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -637,10 +660,6 @@ namespace Sharpii
|
||||||
File.Move(Path.Combine(output, id.ToLower() + "v" + version + ".wad"), Path.Combine(output, ios));
|
File.Move(Path.Combine(output, id.ToLower() + "v" + version + ".wad"), Path.Combine(output, ios));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wad == true && SecondRun)
|
|
||||||
{
|
|
||||||
Console.WriteLine("A Wad was not created, as no CETK could be downloaded or was provided.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public static void NUS_help()
|
public static void NUS_help()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue