Example #1
0
        private void DownloadOneTitle(string titleId, string version, int curr, int total)
        {
            titleId = titleId.ToUpper();

            mLastDownSize = 0;
            string outputDir = Path.Combine(Environment.CurrentDirectory, "NusData");

            WebClient nusWC = new TimeoutWebClient(60 * 1000);

            // Create\Configure NusClient
            mNusClient = new libWiiSharp.WiiuNusClient(titleId, version, outputDir);
            mNusClient.ConfigureNusClient(nusWC);
            mNusClient.UseLocalFiles = true;

            mNusClient.SetToWiiServer();

            // Events
            mNusClient.Debug         += nusClient_Debug;
            mNusClient.CurrProgress  += NusClient_CurrProgress;
            mNusClient.TotalProgress += NusClient_TotalProgress;

            mNusClient.cancelDownload = false;

            ShowLog("");
            ShowLog(string.Format("  Download [{0}/{1}] - TitleId:{2} Start...", curr + 1, total, titleId));
            mNusClient.downloadTitle();
            ShowLog(string.Format("  Download [{0}/{1}] - TitleId:{2} Finish...", curr + 1, total, titleId));
        }
Example #2
0
        private void ExportOneTitle(string titleId, string version, int curr, int total)
        {
            titleId = titleId.ToUpper();

            string outputDir = Path.Combine(Environment.CurrentDirectory, "NusExport");

            WebClient nusWC = new TimeoutWebClient(60 * 1000);

            // Create\Configure NusClient
            mNusClient = new libWiiSharp.WiiuNusClient(titleId, version, outputDir);
            mNusClient.ConfigureNusClient(nusWC);
            mNusClient.UseLocalFiles = true;

            mNusClient.SetToWiiServer();

            // Events
            mNusClient.Debug += nusClient_Debug;

            ShowLog("");
            ShowLog(string.Format("  Export [{0}/{1}] - TitleId:{2} Start...", curr + 1, total, titleId));
            mNusClient.exportTitle();
            ShowLog(string.Format("  Export [{0}/{1}] - TitleId:{2} Finish...", curr + 1, total, titleId));
        }
Example #3
0
        private void MNusDownload_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                mTimer = new System.Threading.Timer(MTimer_Tick, null, 0, 1000);


                mNusClient = null;
                ShowLog("Start download list...");
                List <string> successList = new List <string>();
                List <string> todoList    = parseTitleList();

                int total = todoList.Count;
                if (todoList != null && todoList.Count > 0)
                {
                    for (int i = 0; i < total; i++)
                    {
                        var title = todoList[i];
                        if (mNusClient == null || !mNusClient.cancelDownload)
                        {
                            if (successList.Contains(title))
                            {
                                ShowLog("Already download " + i + ", ignore it.");
                            }
                            else
                            {
                                while (true)
                                {
                                    try
                                    {
                                        DownloadOneTitle(title, "", i, total);
                                        successList.Add(title);
                                        break;
                                    }
                                    catch (OperationCanceledException ex)
                                    {
                                        ShowLog("\r\nDownload canceled!");
                                        break;
                                    }
                                    catch (Exception ex)
                                    {
                                        ShowLog("\r\nDownload fail: \"" + ex.Message + "\"");
                                        if (!checkBox_auto_retry.Checked || mNusClient.cancelDownload)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    ShowLog("Title list is empty!");
                }
            }
            catch (Exception ex)
            {
                ShowLog("Download fail: \"" + ex.Message + "\"");
            }
        }