DSi/Wii server selection (NusClient)

Progress bar updates status
This commit is contained in:
givememystuffplease 2010-07-08 20:32:29 +00:00
parent 72d4215429
commit 3775e0a9a4
2 changed files with 28 additions and 5 deletions

View File

@ -41,9 +41,6 @@ namespace NUS_Downloader
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
private const string WII_NUS_URL = "http://nus.cdn.shop.wii.com/ccs/download/";
private const string DSI_NUS_URL = "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/";
private readonly string CURRENT_DIR = Directory.GetCurrentDirectory(); private readonly string CURRENT_DIR = Directory.GetCurrentDirectory();
// TODO: Always remember to change version! // TODO: Always remember to change version!
@ -440,7 +437,7 @@ namespace NUS_Downloader
WriteStatus(String.Format(" Content {0}: {1} ({2} bytes)", a, tmdLocal.Contents[a].ContentID.ToString(), tmdLocal.Contents[a].Size.ToString())); WriteStatus(String.Format(" Content {0}: {1} ({2} bytes)", a, tmdLocal.Contents[a].ContentID.ToString(), tmdLocal.Contents[a].Size.ToString()));
WriteStatus(String.Format(" - Index: {0}", tmdLocal.Contents[a].Index.ToString())); WriteStatus(String.Format(" - Index: {0}", tmdLocal.Contents[a].Index.ToString()));
WriteStatus(String.Format(" - Type: {0}", tmdLocal.Contents[a].Type.ToString())); WriteStatus(String.Format(" - Type: {0}", tmdLocal.Contents[a].Type.ToString()));
WriteStatus(String.Format(" - Hash: {0}...", DisplayBytes(tmdLocal.Contents[a].Hash, String.Empty).Substring(0, 8))); WriteStatus(String.Format(" - Hash: {0}...", DisplayBytes(tmdLocal.Contents[a].Hash, String.Empty).Substring(0, 8)));
} }
WriteStatus("TMD information parsed!"); WriteStatus("TMD information parsed!");
@ -868,7 +865,16 @@ namespace NUS_Downloader
nusClient.ConfigureNusClient(nusWC); nusClient.ConfigureNusClient(nusWC);
nusClient.UseLocalFiles = localuse.Checked; nusClient.UseLocalFiles = localuse.Checked;
nusClient.ContinueWithoutTicket = true; nusClient.ContinueWithoutTicket = true;
// Server
if (consoleCBox.SelectedIndex == 0)
nusClient.SetToWiiServer();
else if (consoleCBox.SelectedIndex == 1)
nusClient.SetToDSiServer();
// Events
nusClient.Debug += new EventHandler<libWiiSharp.MessageEventArgs>(nusClient_Debug); nusClient.Debug += new EventHandler<libWiiSharp.MessageEventArgs>(nusClient_Debug);
nusClient.Progress += new EventHandler<ProgressChangedEventArgs>(nusClient_Progress);
libWiiSharp.StoreType[] storeTypes = new libWiiSharp.StoreType[3]; libWiiSharp.StoreType[] storeTypes = new libWiiSharp.StoreType[3];
if (packbox.Checked) storeTypes[0] = libWiiSharp.StoreType.WAD; else storeTypes[0] = libWiiSharp.StoreType.Empty; if (packbox.Checked) storeTypes[0] = libWiiSharp.StoreType.WAD; else storeTypes[0] = libWiiSharp.StoreType.Empty;
@ -894,6 +900,11 @@ namespace NUS_Downloader
} }
void nusClient_Progress(object sender, ProgressChangedEventArgs e)
{
dlprogress.Value = e.ProgressPercentage;
}
void nusClient_Debug(object sender, libWiiSharp.MessageEventArgs e) void nusClient_Debug(object sender, libWiiSharp.MessageEventArgs e)
{ {
WriteStatus(e.Message); WriteStatus(e.Message);

View File

@ -34,7 +34,10 @@ namespace libWiiSharp
public class NusClient : IDisposable public class NusClient : IDisposable
{ {
private const string nusUrl = "http://nus.cdn.shop.wii.com/ccs/download/"; private const string WII_NUS_URL = "http://nus.cdn.shop.wii.com/ccs/download/";
private const string DSI_NUS_URL = "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/";
private string nusUrl = WII_NUS_URL;
private WebClient wcNus = new WebClient(); private WebClient wcNus = new WebClient();
private bool useLocalFiles = false; private bool useLocalFiles = false;
private bool continueWithoutTicket = false; private bool continueWithoutTicket = false;
@ -80,6 +83,15 @@ namespace libWiiSharp
wcNus = wcReady; wcNus = wcReady;
} }
public void SetToWiiServer()
{
nusUrl = WII_NUS_URL;
}
public void SetToDSiServer()
{
nusUrl = DSI_NUS_URL;
}
/// <summary> /// <summary>
/// Grabs a title from NUS, you can define several store types. /// Grabs a title from NUS, you can define several store types.