mirror of
https://github.com/WiiDatabase/nusdownloader.git
synced 2024-11-30 14:04:17 +01:00
Changed RunScript to hopefully use libwiisharp
This commit is contained in:
parent
3a4a00838e
commit
7caa175fdb
@ -890,7 +890,13 @@ namespace NUS_Downloader
|
|||||||
if (decryptbox.Checked) storeTypes[1] = libWiiSharp.StoreType.DecryptedContent; else storeTypes[1] = libWiiSharp.StoreType.Empty;
|
if (decryptbox.Checked) storeTypes[1] = libWiiSharp.StoreType.DecryptedContent; else storeTypes[1] = libWiiSharp.StoreType.Empty;
|
||||||
if (keepenccontents.Checked) storeTypes[2] = libWiiSharp.StoreType.EncryptedContent; else storeTypes[2] = libWiiSharp.StoreType.Empty;
|
if (keepenccontents.Checked) storeTypes[2] = libWiiSharp.StoreType.EncryptedContent; else storeTypes[2] = libWiiSharp.StoreType.Empty;
|
||||||
|
|
||||||
nusClient.DownloadTitle(titleidbox.Text, titleversion.Text, Path.Combine(CURRENT_DIR, "titles"), wadnamebox.Text, storeTypes);
|
string wadName;
|
||||||
|
if (String.IsNullOrEmpty(WAD_Saveas_Filename))
|
||||||
|
wadName = wadnamebox.Text;
|
||||||
|
else
|
||||||
|
wadName = WAD_Saveas_Filename;
|
||||||
|
|
||||||
|
nusClient.DownloadTitle(titleidbox.Text, titleversion.Text, Path.Combine(CURRENT_DIR, "titles"), wadName, storeTypes);
|
||||||
|
|
||||||
WriteStatus("NUS Download Finished.");
|
WriteStatus("NUS Download Finished.");
|
||||||
|
|
||||||
@ -1947,7 +1953,7 @@ namespace NUS_Downloader
|
|||||||
/// Mods WAD names to be official.
|
/// Mods WAD names to be official.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="titlename">The titlename.</param>
|
/// <param name="titlename">The titlename.</param>
|
||||||
public void OfficialWADNaming(string titlename)
|
public string OfficialWADNaming(string titlename)
|
||||||
{
|
{
|
||||||
if (titlename == "MIOS")
|
if (titlename == "MIOS")
|
||||||
wadnamebox.Text = "RVL-mios-[v].wad";
|
wadnamebox.Text = "RVL-mios-[v].wad";
|
||||||
@ -1970,6 +1976,8 @@ namespace NUS_Downloader
|
|||||||
|
|
||||||
if (titleversion.Text != "")
|
if (titleversion.Text != "")
|
||||||
wadnamebox.Text = wadnamebox.Text.Replace("[v]", "v" + titleversion.Text);
|
wadnamebox.Text = wadnamebox.Text.Replace("[v]", "v" + titleversion.Text);
|
||||||
|
|
||||||
|
return wadnamebox.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void wwitem_regionclicked(object sender, ToolStripItemClickedEventArgs e)
|
private void wwitem_regionclicked(object sender, ToolStripItemClickedEventArgs e)
|
||||||
@ -3076,6 +3084,34 @@ namespace NUS_Downloader
|
|||||||
// don't let the delete issue reappear...
|
// don't let the delete issue reappear...
|
||||||
if (string.IsNullOrEmpty(title_info[0]))
|
if (string.IsNullOrEmpty(title_info[0]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// WebClient configuration
|
||||||
|
WebClient nusWC = new WebClient();
|
||||||
|
nusWC = ConfigureWithProxy(nusWC);
|
||||||
|
nusWC.Headers.Add("User-Agent", "wii libnup/1.0"); // Set UserAgent to Wii value
|
||||||
|
|
||||||
|
// Create\Configure NusClient
|
||||||
|
libWiiSharp.NusClient nusClient = new libWiiSharp.NusClient();
|
||||||
|
nusClient.ConfigureNusClient(nusWC);
|
||||||
|
nusClient.UseLocalFiles = localuse.Checked;
|
||||||
|
nusClient.ContinueWithoutTicket = true;
|
||||||
|
nusClient.Debug += new EventHandler<libWiiSharp.MessageEventArgs>(nusClient_Debug);
|
||||||
|
|
||||||
|
libWiiSharp.StoreType[] storeTypes = new libWiiSharp.StoreType[1];
|
||||||
|
// There's no harm in outputting everything i suppose
|
||||||
|
storeTypes[0] = libWiiSharp.StoreType.All;
|
||||||
|
|
||||||
|
int title_version = int.Parse(title_info[1], System.Globalization.NumberStyles.HexNumber);
|
||||||
|
|
||||||
|
string wadName = NameFromDatabase(title_info[0]);
|
||||||
|
if (wadName != null)
|
||||||
|
wadName = OfficialWADNaming(wadName);
|
||||||
|
else
|
||||||
|
wadName = title_info[0] + "-NUS-v" + title_version + ".wad";
|
||||||
|
|
||||||
|
nusClient.DownloadTitle(title_info[0], title_version.ToString(), Path.Combine(CURRENT_DIR, ("output_" + Path.GetFileNameWithoutExtension(script_filename))), wadName, storeTypes);
|
||||||
|
|
||||||
|
/*
|
||||||
SetTextThreadSafe(titleidbox, title_info[0]);
|
SetTextThreadSafe(titleidbox, title_info[0]);
|
||||||
SetTextThreadSafe(titleversion,
|
SetTextThreadSafe(titleversion,
|
||||||
Convert.ToString(256*
|
Convert.ToString(256*
|
||||||
@ -3093,12 +3129,13 @@ namespace NUS_Downloader
|
|||||||
while (NUSDownloader.IsBusy)
|
while (NUSDownloader.IsBusy)
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
script_mode = false;
|
script_mode = false;
|
||||||
WriteStatus("Script completed!");
|
WriteStatus("Script completed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public static string ByteArrayToHexString(byte[] Bytes)
|
public static string ByteArrayToHexString(byte[] Bytes)
|
||||||
{
|
{
|
||||||
StringBuilder Result = new StringBuilder();
|
StringBuilder Result = new StringBuilder();
|
||||||
@ -3130,7 +3167,7 @@ namespace NUS_Downloader
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Bytes;
|
return Bytes;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/*private void commonKeykeybinToolStripMenuItem_Click(object sender, EventArgs e)
|
/*private void commonKeykeybinToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -3318,8 +3355,8 @@ namespace NUS_Downloader
|
|||||||
WriteStatus("");
|
WriteStatus("");
|
||||||
WriteStatus("Special thanks to:");
|
WriteStatus("Special thanks to:");
|
||||||
WriteStatus(" * Crediar for his wadmaker tool + source, and for the advice!");
|
WriteStatus(" * Crediar for his wadmaker tool + source, and for the advice!");
|
||||||
|
WriteStatus(" * Leathl for libWiiSharp.");
|
||||||
WriteStatus(" * SquidMan/Galaxy/comex/Xuzz for advice/sources.");
|
WriteStatus(" * SquidMan/Galaxy/comex/Xuzz for advice/sources.");
|
||||||
WriteStatus(" * Leathl for portions of libWiiSharp.");
|
|
||||||
WriteStatus(" * Pasta for database compilation assistance.");
|
WriteStatus(" * Pasta for database compilation assistance.");
|
||||||
WriteStatus(" * Napo7 for testing proxy usage.");
|
WriteStatus(" * Napo7 for testing proxy usage.");
|
||||||
WriteStatus(" * Wyatt O'Day for the Windows7ProgressBar Control.");
|
WriteStatus(" * Wyatt O'Day for the Windows7ProgressBar Control.");
|
||||||
|
@ -413,6 +413,9 @@ namespace libWiiSharp
|
|||||||
|
|
||||||
fireDebug(" Creating WAD...");
|
fireDebug(" Creating WAD...");
|
||||||
WAD wad = WAD.Create(cert, tik, tmd, contents);
|
WAD wad = WAD.Create(cert, tik, tmd, contents);
|
||||||
|
if (wadName.Contains(Path.DirectorySeparatorChar.ToString()) || wadName.Contains(Path.AltDirectorySeparatorChar.ToString()))
|
||||||
|
wad.Save(wadName);
|
||||||
|
else
|
||||||
wad.Save(Path.Combine(outputDir, wadName));
|
wad.Save(Path.Combine(outputDir, wadName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user