mirror of
https://github.com/WiiDatabase/nusdownloader.git
synced 2024-12-24 17:41:51 +01:00
Win7 Taskbar features added to DownloadNUSFile
This commit is contained in:
parent
e1ff5fd55c
commit
a078b06732
70
NUS Downloader/COMTypes.cs
Normal file
70
NUS Downloader/COMTypes.cs
Normal file
@ -0,0 +1,70 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace wyDay.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the thumbnail progress bar state.
|
||||
/// </summary>
|
||||
public enum ThumbnailProgressState
|
||||
{
|
||||
/// <summary>
|
||||
/// No progress is displayed.
|
||||
/// </summary>
|
||||
NoProgress = 0,
|
||||
/// <summary>
|
||||
/// The progress is indeterminate (marquee).
|
||||
/// </summary>
|
||||
Indeterminate = 0x1,
|
||||
/// <summary>
|
||||
/// Normal progress is displayed.
|
||||
/// </summary>
|
||||
Normal = 0x2,
|
||||
/// <summary>
|
||||
/// An error occurred (red).
|
||||
/// </summary>
|
||||
Error = 0x4,
|
||||
/// <summary>
|
||||
/// The operation is paused (yellow).
|
||||
/// </summary>
|
||||
Paused = 0x8
|
||||
}
|
||||
|
||||
//Based on Rob Jarett's wrappers for the desktop integration PDC demos.
|
||||
[ComImportAttribute()]
|
||||
[GuidAttribute("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")]
|
||||
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface ITaskbarList3
|
||||
{
|
||||
// ITaskbarList
|
||||
[PreserveSig]
|
||||
void HrInit();
|
||||
[PreserveSig]
|
||||
void AddTab(IntPtr hwnd);
|
||||
[PreserveSig]
|
||||
void DeleteTab(IntPtr hwnd);
|
||||
[PreserveSig]
|
||||
void ActivateTab(IntPtr hwnd);
|
||||
[PreserveSig]
|
||||
void SetActiveAlt(IntPtr hwnd);
|
||||
|
||||
// ITaskbarList2
|
||||
[PreserveSig]
|
||||
void MarkFullscreenWindow(
|
||||
IntPtr hwnd,
|
||||
[MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
|
||||
|
||||
// ITaskbarList3
|
||||
void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal);
|
||||
void SetProgressState(IntPtr hwnd, ThumbnailProgressState tbpFlags);
|
||||
|
||||
// yadda, yadda - there's more to the interface, but we don't need it.
|
||||
}
|
||||
|
||||
[GuidAttribute("56FDF344-FD6D-11d0-958A-006097C9A090")]
|
||||
[ClassInterfaceAttribute(ClassInterfaceType.None)]
|
||||
[ComImportAttribute()]
|
||||
internal class CTaskbarList { }
|
||||
}
|
225
NUS Downloader/Form1.Designer.cs
generated
225
NUS Downloader/Form1.Designer.cs
generated
@ -35,7 +35,6 @@
|
||||
this.downloadstartbtn = new System.Windows.Forms.Button();
|
||||
this.statusbox = new System.Windows.Forms.TextBox();
|
||||
this.packbox = new System.Windows.Forms.CheckBox();
|
||||
this.dlprogress = new System.Windows.Forms.ProgressBar();
|
||||
this.localuse = new System.Windows.Forms.CheckBox();
|
||||
this.NUSDownloader = new System.ComponentModel.BackgroundWorker();
|
||||
this.titleversion = new System.Windows.Forms.TextBox();
|
||||
@ -96,8 +95,15 @@
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.contentsEdit = new System.Windows.Forms.ListBox();
|
||||
this.contentModBox = new System.Windows.Forms.GroupBox();
|
||||
this.button16 = new System.Windows.Forms.Button();
|
||||
this.button13 = new System.Windows.Forms.Button();
|
||||
this.button15 = new System.Windows.Forms.Button();
|
||||
this.button14 = new System.Windows.Forms.Button();
|
||||
this.button12 = new System.Windows.Forms.Button();
|
||||
this.button8 = new System.Windows.Forms.Button();
|
||||
this.button11 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button17 = new System.Windows.Forms.Button();
|
||||
this.extrasStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.loadInfoFromTMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -116,21 +122,15 @@
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.ProxyUser = new System.Windows.Forms.TextBox();
|
||||
this.SaveProxyBtn = new System.Windows.Forms.Button();
|
||||
this.ProxyURL = new System.Windows.Forms.TextBox();
|
||||
this.ProxyAssistBtn = new System.Windows.Forms.Button();
|
||||
this.button16 = new System.Windows.Forms.Button();
|
||||
this.button13 = new System.Windows.Forms.Button();
|
||||
this.button12 = new System.Windows.Forms.Button();
|
||||
this.button8 = new System.Windows.Forms.Button();
|
||||
this.button11 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.ProxyURL = new System.Windows.Forms.TextBox();
|
||||
this.radioButton1 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton2 = new System.Windows.Forms.RadioButton();
|
||||
this.ProxyVerifyBox = new System.Windows.Forms.GroupBox();
|
||||
this.SaveProxyPwdBtn = new System.Windows.Forms.Button();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.ProxyPwdBox = new System.Windows.Forms.TextBox();
|
||||
this.SaveProxyPwdBtn = new System.Windows.Forms.Button();
|
||||
this.dlprogress = new wyDay.Controls.Windows7ProgressBar();
|
||||
this.databaseStrip.SuspendLayout();
|
||||
this.tmdgpbox.SuspendLayout();
|
||||
this.ticketgpbox.SuspendLayout();
|
||||
@ -195,14 +195,6 @@
|
||||
this.packbox.CheckedChanged += new System.EventHandler(this.packbox_CheckedChanged);
|
||||
this.packbox.EnabledChanged += new System.EventHandler(this.packbox_EnabledChanged);
|
||||
//
|
||||
// dlprogress
|
||||
//
|
||||
this.dlprogress.Location = new System.Drawing.Point(12, 95);
|
||||
this.dlprogress.Name = "dlprogress";
|
||||
this.dlprogress.Size = new System.Drawing.Size(250, 15);
|
||||
this.dlprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
||||
this.dlprogress.TabIndex = 7;
|
||||
//
|
||||
// localuse
|
||||
//
|
||||
this.localuse.AutoSize = true;
|
||||
@ -770,6 +762,28 @@
|
||||
this.contentModBox.Text = "Edit Title Contents";
|
||||
this.contentModBox.Visible = false;
|
||||
//
|
||||
// button16
|
||||
//
|
||||
this.button16.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button16.Image = global::NUS_Downloader.Properties.Resources.bug_add;
|
||||
this.button16.Location = new System.Drawing.Point(136, 198);
|
||||
this.button16.Name = "button16";
|
||||
this.button16.Size = new System.Drawing.Size(26, 26);
|
||||
this.button16.TabIndex = 44;
|
||||
this.button16.UseVisualStyleBackColor = true;
|
||||
this.button16.Click += new System.EventHandler(this.button16_Click);
|
||||
//
|
||||
// button13
|
||||
//
|
||||
this.button13.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button13.Image = global::NUS_Downloader.Properties.Resources.link;
|
||||
this.button13.Location = new System.Drawing.Point(104, 198);
|
||||
this.button13.Name = "button13";
|
||||
this.button13.Size = new System.Drawing.Size(26, 26);
|
||||
this.button13.TabIndex = 43;
|
||||
this.button13.UseVisualStyleBackColor = true;
|
||||
this.button13.Click += new System.EventHandler(this.button13_Click);
|
||||
//
|
||||
// button15
|
||||
//
|
||||
this.button15.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
@ -792,6 +806,61 @@
|
||||
this.button14.UseVisualStyleBackColor = true;
|
||||
this.button14.Click += new System.EventHandler(this.button14_Click);
|
||||
//
|
||||
// button12
|
||||
//
|
||||
this.button12.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button12.Image = ((System.Drawing.Image)(resources.GetObject("button12.Image")));
|
||||
this.button12.Location = new System.Drawing.Point(72, 198);
|
||||
this.button12.Name = "button12";
|
||||
this.button12.Size = new System.Drawing.Size(26, 26);
|
||||
this.button12.TabIndex = 40;
|
||||
this.button12.UseVisualStyleBackColor = true;
|
||||
this.button12.Click += new System.EventHandler(this.button12_Click);
|
||||
//
|
||||
// button8
|
||||
//
|
||||
this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button8.Image = ((System.Drawing.Image)(resources.GetObject("button8.Image")));
|
||||
this.button8.Location = new System.Drawing.Point(213, 19);
|
||||
this.button8.Name = "button8";
|
||||
this.button8.Size = new System.Drawing.Size(26, 26);
|
||||
this.button8.TabIndex = 33;
|
||||
this.button8.UseVisualStyleBackColor = true;
|
||||
this.button8.Click += new System.EventHandler(this.button8_Click);
|
||||
//
|
||||
// button11
|
||||
//
|
||||
this.button11.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button11.Image = ((System.Drawing.Image)(resources.GetObject("button11.Image")));
|
||||
this.button11.Location = new System.Drawing.Point(9, 198);
|
||||
this.button11.Name = "button11";
|
||||
this.button11.Size = new System.Drawing.Size(26, 26);
|
||||
this.button11.TabIndex = 36;
|
||||
this.button11.UseVisualStyleBackColor = true;
|
||||
this.button11.Click += new System.EventHandler(this.button11_Click);
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button9.Image = ((System.Drawing.Image)(resources.GetObject("button9.Image")));
|
||||
this.button9.Location = new System.Drawing.Point(213, 53);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(26, 26);
|
||||
this.button9.TabIndex = 34;
|
||||
this.button9.UseVisualStyleBackColor = true;
|
||||
this.button9.Click += new System.EventHandler(this.button9_Click);
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button10.Image = ((System.Drawing.Image)(resources.GetObject("button10.Image")));
|
||||
this.button10.Location = new System.Drawing.Point(41, 198);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(26, 26);
|
||||
this.button10.TabIndex = 35;
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
this.button10.Click += new System.EventHandler(this.button10_Click);
|
||||
//
|
||||
// button17
|
||||
//
|
||||
this.button17.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
@ -952,14 +1021,6 @@
|
||||
this.SaveProxyBtn.UseVisualStyleBackColor = true;
|
||||
this.SaveProxyBtn.Click += new System.EventHandler(this.SaveProxyBtn_Click);
|
||||
//
|
||||
// ProxyURL
|
||||
//
|
||||
this.ProxyURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ProxyURL.Location = new System.Drawing.Point(55, 27);
|
||||
this.ProxyURL.Name = "ProxyURL";
|
||||
this.ProxyURL.Size = new System.Drawing.Size(151, 20);
|
||||
this.ProxyURL.TabIndex = 0;
|
||||
//
|
||||
// ProxyAssistBtn
|
||||
//
|
||||
this.ProxyAssistBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
@ -969,83 +1030,15 @@
|
||||
this.ProxyAssistBtn.Size = new System.Drawing.Size(29, 26);
|
||||
this.ProxyAssistBtn.TabIndex = 28;
|
||||
this.ProxyAssistBtn.UseVisualStyleBackColor = true;
|
||||
this.ProxyAssistBtn.Click += new System.EventHandler(this.ProxyAssistBtn_Click);
|
||||
//
|
||||
// button16
|
||||
// ProxyURL
|
||||
//
|
||||
this.button16.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button16.Image = global::NUS_Downloader.Properties.Resources.bug_add;
|
||||
this.button16.Location = new System.Drawing.Point(136, 198);
|
||||
this.button16.Name = "button16";
|
||||
this.button16.Size = new System.Drawing.Size(26, 26);
|
||||
this.button16.TabIndex = 44;
|
||||
this.button16.UseVisualStyleBackColor = true;
|
||||
this.button16.Click += new System.EventHandler(this.button16_Click);
|
||||
//
|
||||
// button13
|
||||
//
|
||||
this.button13.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button13.Image = global::NUS_Downloader.Properties.Resources.link;
|
||||
this.button13.Location = new System.Drawing.Point(104, 198);
|
||||
this.button13.Name = "button13";
|
||||
this.button13.Size = new System.Drawing.Size(26, 26);
|
||||
this.button13.TabIndex = 43;
|
||||
this.button13.UseVisualStyleBackColor = true;
|
||||
this.button13.Click += new System.EventHandler(this.button13_Click);
|
||||
//
|
||||
// button12
|
||||
//
|
||||
this.button12.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button12.Image = ((System.Drawing.Image)(resources.GetObject("button12.Image")));
|
||||
this.button12.Location = new System.Drawing.Point(72, 198);
|
||||
this.button12.Name = "button12";
|
||||
this.button12.Size = new System.Drawing.Size(26, 26);
|
||||
this.button12.TabIndex = 40;
|
||||
this.button12.UseVisualStyleBackColor = true;
|
||||
this.button12.Click += new System.EventHandler(this.button12_Click);
|
||||
//
|
||||
// button8
|
||||
//
|
||||
this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button8.Image = ((System.Drawing.Image)(resources.GetObject("button8.Image")));
|
||||
this.button8.Location = new System.Drawing.Point(213, 19);
|
||||
this.button8.Name = "button8";
|
||||
this.button8.Size = new System.Drawing.Size(26, 26);
|
||||
this.button8.TabIndex = 33;
|
||||
this.button8.UseVisualStyleBackColor = true;
|
||||
this.button8.Click += new System.EventHandler(this.button8_Click);
|
||||
//
|
||||
// button11
|
||||
//
|
||||
this.button11.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button11.Image = ((System.Drawing.Image)(resources.GetObject("button11.Image")));
|
||||
this.button11.Location = new System.Drawing.Point(9, 198);
|
||||
this.button11.Name = "button11";
|
||||
this.button11.Size = new System.Drawing.Size(26, 26);
|
||||
this.button11.TabIndex = 36;
|
||||
this.button11.UseVisualStyleBackColor = true;
|
||||
this.button11.Click += new System.EventHandler(this.button11_Click);
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button9.Image = ((System.Drawing.Image)(resources.GetObject("button9.Image")));
|
||||
this.button9.Location = new System.Drawing.Point(213, 53);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(26, 26);
|
||||
this.button9.TabIndex = 34;
|
||||
this.button9.UseVisualStyleBackColor = true;
|
||||
this.button9.Click += new System.EventHandler(this.button9_Click);
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button10.Image = ((System.Drawing.Image)(resources.GetObject("button10.Image")));
|
||||
this.button10.Location = new System.Drawing.Point(41, 198);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(26, 26);
|
||||
this.button10.TabIndex = 35;
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
this.button10.Click += new System.EventHandler(this.button10_Click);
|
||||
this.ProxyURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ProxyURL.Location = new System.Drawing.Point(55, 27);
|
||||
this.ProxyURL.Name = "ProxyURL";
|
||||
this.ProxyURL.Size = new System.Drawing.Size(151, 20);
|
||||
this.ProxyURL.TabIndex = 0;
|
||||
//
|
||||
// radioButton1
|
||||
//
|
||||
@ -1085,6 +1078,17 @@
|
||||
this.ProxyVerifyBox.Text = "Verify Credentials";
|
||||
this.ProxyVerifyBox.Visible = false;
|
||||
//
|
||||
// SaveProxyPwdBtn
|
||||
//
|
||||
this.SaveProxyPwdBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.SaveProxyPwdBtn.Location = new System.Drawing.Point(9, 43);
|
||||
this.SaveProxyPwdBtn.Name = "SaveProxyPwdBtn";
|
||||
this.SaveProxyPwdBtn.Size = new System.Drawing.Size(197, 23);
|
||||
this.SaveProxyPwdBtn.TabIndex = 34;
|
||||
this.SaveProxyPwdBtn.Text = "Save (This Session Only)";
|
||||
this.SaveProxyPwdBtn.UseVisualStyleBackColor = true;
|
||||
this.SaveProxyPwdBtn.Click += new System.EventHandler(this.button18_Click);
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
@ -1104,22 +1108,20 @@
|
||||
this.ProxyPwdBox.UseSystemPasswordChar = true;
|
||||
this.ProxyPwdBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ProxyPwdBox_KeyPress);
|
||||
//
|
||||
// SaveProxyPwdBtn
|
||||
// dlprogress
|
||||
//
|
||||
this.SaveProxyPwdBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.SaveProxyPwdBtn.Location = new System.Drawing.Point(9, 43);
|
||||
this.SaveProxyPwdBtn.Name = "SaveProxyPwdBtn";
|
||||
this.SaveProxyPwdBtn.Size = new System.Drawing.Size(197, 23);
|
||||
this.SaveProxyPwdBtn.TabIndex = 34;
|
||||
this.SaveProxyPwdBtn.Text = "Save (This Session Only)";
|
||||
this.SaveProxyPwdBtn.UseVisualStyleBackColor = true;
|
||||
this.SaveProxyPwdBtn.Click += new System.EventHandler(this.button18_Click);
|
||||
this.dlprogress.ContainerControl = this;
|
||||
this.dlprogress.Location = new System.Drawing.Point(12, 95);
|
||||
this.dlprogress.Name = "dlprogress";
|
||||
this.dlprogress.Size = new System.Drawing.Size(250, 15);
|
||||
this.dlprogress.TabIndex = 47;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(539, 492);
|
||||
this.Controls.Add(this.dlprogress);
|
||||
this.Controls.Add(this.deletecontentsbox);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.ProxyVerifyBox);
|
||||
@ -1144,7 +1146,6 @@
|
||||
this.Controls.Add(this.button7);
|
||||
this.Controls.Add(this.radioButton1);
|
||||
this.Controls.Add(this.radioButton2);
|
||||
this.Controls.Add(this.dlprogress);
|
||||
this.Controls.Add(this.packbox);
|
||||
this.Controls.Add(this.statusbox);
|
||||
this.Controls.Add(this.ignoreticket);
|
||||
@ -1184,7 +1185,6 @@
|
||||
private System.Windows.Forms.Button downloadstartbtn;
|
||||
private System.Windows.Forms.TextBox statusbox;
|
||||
private System.Windows.Forms.CheckBox packbox;
|
||||
private System.Windows.Forms.ProgressBar dlprogress;
|
||||
private System.Windows.Forms.CheckBox localuse;
|
||||
private System.ComponentModel.BackgroundWorker NUSDownloader;
|
||||
private System.Windows.Forms.TextBox titleversion;
|
||||
@ -1280,6 +1280,7 @@
|
||||
private System.Windows.Forms.Button SaveProxyPwdBtn;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.TextBox ProxyPwdBox;
|
||||
private wyDay.Controls.Windows7ProgressBar dlprogress;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ using System.Text.RegularExpressions;
|
||||
using System.ComponentModel;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using wyDay.Controls;
|
||||
|
||||
|
||||
namespace NUS_Downloader
|
||||
@ -47,6 +48,9 @@ namespace NUS_Downloader
|
||||
string proxy_url;
|
||||
string proxy_usr;
|
||||
string proxy_pwd;
|
||||
|
||||
// Common Key hash
|
||||
byte[] wii_commonkey_sha1 = new byte[20] { 0xEB, 0xEA, 0xE6, 0xD2, 0x76, 0x2D, 0x4D, 0x3E, 0xA1, 0x60, 0xA6, 0xD8, 0x32, 0x7F, 0xAC, 0x9A, 0x25, 0xF8, 0x06, 0x2B };
|
||||
/*
|
||||
public struct WADHeader
|
||||
{
|
||||
@ -195,6 +199,8 @@ namespace NUS_Downloader
|
||||
else
|
||||
{
|
||||
WriteStatus("Common Key detected.");
|
||||
if ((Convert.ToBase64String(ComputeSHA(LoadCommonKey("key.bin")))) != (Convert.ToBase64String(wii_commonkey_sha1)))
|
||||
WriteStatus(" - (PS: Your common key isn't hashing right!");
|
||||
}
|
||||
|
||||
// Check for Wii KOR common key bin file...
|
||||
@ -793,6 +799,14 @@ namespace NUS_Downloader
|
||||
|
||||
downloadstartbtn.Text = "Prerequisites: (0/2)";
|
||||
|
||||
// Windows 7?
|
||||
if (IsWin7())
|
||||
{
|
||||
// Windows 7 Taskbar progress can be used.
|
||||
dlprogress.ShowInTaskbar = true;
|
||||
|
||||
}
|
||||
|
||||
// Download TMD before the rest...
|
||||
string tmdfull = "tmd";
|
||||
if (titleversion.Text != "")
|
||||
@ -1153,6 +1167,9 @@ namespace NUS_Downloader
|
||||
downloadstartbtn.Text = "Start NUS Download!";
|
||||
dlprogress.Value = 0;
|
||||
|
||||
if (IsWin7())
|
||||
dlprogress.ShowInTaskbar = false;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1442,8 +1459,8 @@ namespace NUS_Downloader
|
||||
else
|
||||
WriteStatus("Database: OK");
|
||||
|
||||
/* if (IsWin7())
|
||||
WriteStatus("Windows 7 Features: Enabled"); */
|
||||
if (IsWin7())
|
||||
WriteStatus("Windows 7 Features: Enabled");
|
||||
|
||||
WriteStatus("");
|
||||
WriteStatus("Special thanks to:");
|
||||
@ -1453,6 +1470,7 @@ namespace NUS_Downloader
|
||||
WriteStatus(" * #WiiDev for answering the tough questions.");
|
||||
WriteStatus(" * Anyone who helped beta test on GBATemp!");
|
||||
WriteStatus(" * Famfamfam for the Silk Icon Set.");
|
||||
WriteStatus(" * Wyatt O'Day for the Windows7ProgressBar Control.");
|
||||
}
|
||||
|
||||
private void packbox_CheckedChanged(object sender, EventArgs e)
|
||||
@ -3763,5 +3781,12 @@ namespace NUS_Downloader
|
||||
if (e.KeyChar == Convert.ToChar(Keys.Enter))
|
||||
button18_Click("LOLWUT", EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void ProxyAssistBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("If you are behind a proxy, set these settings to get through to NUS." +
|
||||
" If you have an alternate port for accessing your proxy, add ':' followed by the port." +
|
||||
" You will be prompted for your password each time you run NUSD, for privacy purposes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,9 +123,6 @@
|
||||
<metadata name="databaseStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>159, 17</value>
|
||||
</metadata>
|
||||
<metadata name="extrasStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>285, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="button12.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
@ -209,6 +206,9 @@
|
||||
c3rr+88Wyom3k23LfyYpTu77C4h89ngRLmtIAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="extrasStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>285, 17</value>
|
||||
</metadata>
|
||||
<data name="radioButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAADYAAAAZCAYAAAB6v90+AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
|
||||
|
@ -61,9 +61,10 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="COMTypes.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
@ -96,6 +97,10 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="WADPacker.cs" />
|
||||
<Compile Include="Windows7ProgressBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Windows7Taskbar.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\wilolgoi.png" />
|
||||
|
242
NUS Downloader/Windows7ProgressBar.cs
Normal file
242
NUS Downloader/Windows7ProgressBar.cs
Normal file
@ -0,0 +1,242 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
//Windows7ProgressBar v1.0, created by Wyatt O'Day
|
||||
//Visit: http://wyday.com/windows-7-progress-bar/
|
||||
|
||||
namespace wyDay.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// A Windows progress bar control with Windows Vista & 7 functionality.
|
||||
/// </summary>
|
||||
[ToolboxBitmap(typeof(ProgressBar))]
|
||||
public class Windows7ProgressBar : ProgressBar
|
||||
{
|
||||
bool showInTaskbar;
|
||||
private ProgressBarState m_State = ProgressBarState.Normal;
|
||||
ContainerControl ownerForm;
|
||||
|
||||
public Windows7ProgressBar () {}
|
||||
|
||||
public Windows7ProgressBar(ContainerControl parentControl)
|
||||
{
|
||||
ContainerControl = parentControl;
|
||||
}
|
||||
public ContainerControl ContainerControl
|
||||
{
|
||||
get { return ownerForm; }
|
||||
set
|
||||
{
|
||||
ownerForm = value;
|
||||
|
||||
if(!ownerForm.Visible)
|
||||
((Form)ownerForm).Shown += Windows7ProgressBar_Shown;
|
||||
}
|
||||
}
|
||||
public override ISite Site
|
||||
{
|
||||
set
|
||||
{
|
||||
// Runs at design time, ensures designer initializes ContainerControl
|
||||
base.Site = value;
|
||||
if (value == null) return;
|
||||
IDesignerHost service = value.GetService(typeof(IDesignerHost)) as IDesignerHost;
|
||||
if (service == null) return;
|
||||
IComponent rootComponent = service.RootComponent;
|
||||
|
||||
ContainerControl = rootComponent as ContainerControl;
|
||||
}
|
||||
}
|
||||
|
||||
void Windows7ProgressBar_Shown(object sender, System.EventArgs e)
|
||||
{
|
||||
if (ShowInTaskbar)
|
||||
{
|
||||
if (Style != ProgressBarStyle.Marquee)
|
||||
SetValueInTB();
|
||||
|
||||
SetStateInTB();
|
||||
}
|
||||
|
||||
((Form)ownerForm).Shown -= Windows7ProgressBar_Shown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Show progress in taskbar
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
public bool ShowInTaskbar
|
||||
{
|
||||
get
|
||||
{
|
||||
return showInTaskbar;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (showInTaskbar != value)
|
||||
{
|
||||
showInTaskbar = value;
|
||||
|
||||
// send signal to the taskbar.
|
||||
if (ownerForm != null)
|
||||
{
|
||||
if (Style != ProgressBarStyle.Marquee)
|
||||
SetValueInTB();
|
||||
|
||||
SetStateInTB();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current position of the progress bar.
|
||||
/// </summary>
|
||||
/// <returns>The position within the range of the progress bar. The default is 0.</returns>
|
||||
public new int Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Value = value;
|
||||
|
||||
// send signal to the taskbar.
|
||||
SetValueInTB();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the manner in which progress should be indicated on the progress bar.
|
||||
/// </summary>
|
||||
/// <returns>One of the ProgressBarStyle values. The default is ProgressBarStyle.Blocks</returns>
|
||||
public new ProgressBarStyle Style
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Style;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Style = value;
|
||||
|
||||
// set the style of the progress bar
|
||||
if (showInTaskbar && ownerForm != null)
|
||||
{
|
||||
SetStateInTB();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The progress bar state for Windows Vista & 7
|
||||
/// </summary>
|
||||
[DefaultValue(ProgressBarState.Normal)]
|
||||
public ProgressBarState State
|
||||
{
|
||||
get { return m_State; }
|
||||
set
|
||||
{
|
||||
m_State = value;
|
||||
|
||||
bool wasMarquee = Style == ProgressBarStyle.Marquee;
|
||||
|
||||
if(wasMarquee)
|
||||
// sets the state to normal (and implicity calls SetStateInTB() )
|
||||
Style = ProgressBarStyle.Blocks;
|
||||
|
||||
// set the progress bar state (Normal, Error, Paused)
|
||||
Windows7Taskbar.SendMessage(Handle, 0x410, (int)value, 0);
|
||||
|
||||
|
||||
if (wasMarquee)
|
||||
// the Taskbar PB value needs to be reset
|
||||
SetValueInTB();
|
||||
else
|
||||
// there wasn't a marquee, thus we need to update the taskbar
|
||||
SetStateInTB();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the current position of the progress bar by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="value">The amount by which to increment the progress bar's current position.</param>
|
||||
public new void Increment(int value)
|
||||
{
|
||||
base.Increment(value);
|
||||
|
||||
// send signal to the taskbar.
|
||||
SetValueInTB();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the current position of the progress bar by the amount of the System.Windows.Forms.ProgressBar.Step property.
|
||||
/// </summary>
|
||||
public new void PerformStep()
|
||||
{
|
||||
base.PerformStep();
|
||||
|
||||
// send signal to the taskbar.
|
||||
SetValueInTB();
|
||||
}
|
||||
|
||||
private void SetValueInTB()
|
||||
{
|
||||
if (showInTaskbar)
|
||||
{
|
||||
ulong maximum = (ulong) (Maximum - Minimum);
|
||||
ulong progress = (ulong) (Value - Minimum);
|
||||
|
||||
Windows7Taskbar.SetProgressValue(ownerForm.Handle, progress, maximum);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStateInTB()
|
||||
{
|
||||
if (ownerForm == null) return;
|
||||
|
||||
ThumbnailProgressState thmState = ThumbnailProgressState.Normal;
|
||||
|
||||
if (!showInTaskbar)
|
||||
thmState = ThumbnailProgressState.NoProgress;
|
||||
else if (Style == ProgressBarStyle.Marquee)
|
||||
thmState = ThumbnailProgressState.Indeterminate;
|
||||
else if (m_State == ProgressBarState.Error)
|
||||
thmState = ThumbnailProgressState.Error;
|
||||
else if (m_State == ProgressBarState.Pause)
|
||||
thmState = ThumbnailProgressState.Paused;
|
||||
|
||||
Windows7Taskbar.SetProgressState(ownerForm.Handle, thmState);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The progress bar state for Windows Vista & 7
|
||||
/// </summary>
|
||||
public enum ProgressBarState
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates normal progress
|
||||
/// </summary>
|
||||
Normal = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates an error in the progress
|
||||
/// </summary>
|
||||
Error = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates paused progress
|
||||
/// </summary>
|
||||
Pause = 3
|
||||
}
|
||||
}
|
72
NUS Downloader/Windows7Taskbar.cs
Normal file
72
NUS Downloader/Windows7Taskbar.cs
Normal file
@ -0,0 +1,72 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace wyDay.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// The primary coordinator of the Windows 7 taskbar-related activities.
|
||||
/// </summary>
|
||||
public static class Windows7Taskbar
|
||||
{
|
||||
private static ITaskbarList3 _taskbarList;
|
||||
internal static ITaskbarList3 TaskbarList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_taskbarList == null)
|
||||
{
|
||||
lock (typeof(Windows7Taskbar))
|
||||
{
|
||||
if (_taskbarList == null)
|
||||
{
|
||||
_taskbarList = (ITaskbarList3)new CTaskbarList();
|
||||
_taskbarList.HrInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
return _taskbarList;
|
||||
}
|
||||
}
|
||||
|
||||
static readonly OperatingSystem osInfo = Environment.OSVersion;
|
||||
|
||||
internal static bool Windows7OrGreater
|
||||
{
|
||||
get
|
||||
{
|
||||
return (osInfo.Version.Major == 6 && osInfo.Version.Minor >= 1)
|
||||
|| (osInfo.Version.Major > 6);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the progress state of the specified window's
|
||||
/// taskbar button.
|
||||
/// </summary>
|
||||
/// <param name="hwnd">The window handle.</param>
|
||||
/// <param name="state">The progress state.</param>
|
||||
public static void SetProgressState(IntPtr hwnd, ThumbnailProgressState state)
|
||||
{
|
||||
if(Windows7OrGreater)
|
||||
TaskbarList.SetProgressState(hwnd, state);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the progress value of the specified window's
|
||||
/// taskbar button.
|
||||
/// </summary>
|
||||
/// <param name="hwnd">The window handle.</param>
|
||||
/// <param name="current">The current value.</param>
|
||||
/// <param name="maximum">The maximum value.</param>
|
||||
public static void SetProgressValue(IntPtr hwnd, ulong current, ulong maximum)
|
||||
{
|
||||
if(Windows7OrGreater)
|
||||
TaskbarList.SetProgressValue(hwnd, current, maximum);
|
||||
}
|
||||
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
internal static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user