Commit c55a2b81 authored by Amyn Bennamane's avatar Amyn Bennamane
Browse files

Add a settings screen with banners repo and Fixed output folder

parent e6a2b08a
......@@ -16,6 +16,12 @@
<setting name="GameFilePath" serializeAs="String">
<value />
</setting>
<setting name="OutputPathFixed" serializeAs="String">
<value />
</setting>
<setting name="BannersRepository" serializeAs="String">
<value>https://raw.githubusercontent.com/cucholix/wiivc-bis/master/</value>
</setting>
</TeconMoon_s_WiiVC_Injector.Properties.Settings>
</userSettings>
<runtime>
......@@ -24,6 +30,10 @@
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
......@@ -116,7 +116,8 @@
this.TitleKey = new System.Windows.Forms.TextBox();
this.RHFKeyLabel = new System.Windows.Forms.Label();
this.CommonLabel = new System.Windows.Forms.Label();
this.WiiUCommonKey = new System.Windows.Forms.TextBox();
this.WiiUCommonKey = new System.Windows.Forms.TextBox();
this.SettingsButton = new System.Windows.Forms.Button();
this.SDCardStuff = new System.Windows.Forms.Button();
this.GCRetail = new System.Windows.Forms.RadioButton();
this.WiiNAND = new System.Windows.Forms.RadioButton();
......@@ -151,6 +152,7 @@
this.MainTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.MainTableLayout.Controls.Add(this.WiiRetail, 0, 0);
this.MainTableLayout.Controls.Add(this.MainTabs, 0, 2);
this.MainTableLayout.Controls.Add(this.SettingsButton, 1, 1);
this.MainTableLayout.Controls.Add(this.SDCardStuff, 2, 1);
this.MainTableLayout.Controls.Add(this.GCRetail, 2, 0);
this.MainTableLayout.Controls.Add(this.WiiNAND, 0, 1);
......@@ -1196,6 +1198,16 @@
this.WiiUCommonKey.Size = new System.Drawing.Size(288, 20);
this.WiiUCommonKey.TabIndex = 0;
//
// SettingsButton
//
this.SettingsButton.Location = new System.Drawing.Point(164, 28);
this.SettingsButton.Name = "SettingsButton";
this.SettingsButton.Size = new System.Drawing.Size(157, 19);
this.SettingsButton.TabIndex = 5;
this.SettingsButton.Text = "Settings";
this.SettingsButton.UseVisualStyleBackColor = true;
this.SettingsButton.Click += new System.EventHandler(this.SettingsButton_Click);
//
// SDCardStuff
//
this.SDCardStuff.Location = new System.Drawing.Point(325, 28);
......@@ -1414,6 +1426,7 @@
private System.Windows.Forms.ProgressBar BuildProgress;
private System.Windows.Forms.Label BuildStatus;
private System.Windows.Forms.Label AdvanceCheck;
private System.Windows.Forms.Button SettingsButton;
private System.Windows.Forms.Button SDCardStuff;
private System.Windows.Forms.Label GC2SourceDirectory;
private System.Windows.Forms.Button GC2SourceButton;
......
......@@ -177,13 +177,13 @@ namespace TeconMoon_s_WiiVC_Injector
public void DownloadFromRepo()
{
var client = new WebClient();
IconPreviewBox.Load("https://raw.githubusercontent.com/cucholix/wiivc-bis/master/" + SystemType + "/image/" + CucholixRepoID + "/iconTex.png");
IconPreviewBox.Load(Properties.Settings.Default.BannersRepository + SystemType + "/image/" + CucholixRepoID + "/iconTex.png");
if (File.Exists(Path.GetTempPath() + "WiiVCInjector\\SOURCETEMP\\iconTex.png")) { File.Delete(Path.GetTempPath() + "WiiVCInjector\\SOURCETEMP\\iconTex.png"); }
client.DownloadFile(IconPreviewBox.ImageLocation, Path.GetTempPath() + "WiiVCInjector\\SOURCETEMP\\iconTex.png");
IconSourceDirectory.Text = "iconTex.png downloaded from Cucholix's Repo";
IconSourceDirectory.ForeColor = Color.Black;
FlagIconSpecified = true;
BannerPreviewBox.Load("https://raw.githubusercontent.com/cucholix/wiivc-bis/master/" + SystemType + "/image/" + CucholixRepoID + "/bootTvTex.png");
BannerPreviewBox.Load(Properties.Settings.Default.BannersRepository + SystemType + "/image/" + CucholixRepoID + "/bootTvTex.png");
if (File.Exists(Path.GetTempPath() + "WiiVCInjector\\SOURCETEMP\\bootTvTex.png")) { File.Delete(Path.GetTempPath() + "WiiVCInjector\\SOURCETEMP\\bootTvTex.png"); }
client.DownloadFile(BannerPreviewBox.ImageLocation, Path.GetTempPath() + "WiiVCInjector\\SOURCETEMP\\bootTvTex.png");
BannerSourceDirectory.Text = "bootTvTex.png downloaded from Cucholix's Repo";
......@@ -493,6 +493,13 @@ namespace TeconMoon_s_WiiVC_Injector
Force43NAND.Enabled = false;
}
}
private void SettingsButton_Click(object sender, EventArgs e)
{
using (var settingsForm = new SettingsForm())
{
settingsForm.ShowDialog(this);
}
}
private void SDCardStuff_Click(object sender, EventArgs e)
{
new SDCardMenu().Show();
......@@ -1691,29 +1698,36 @@ namespace TeconMoon_s_WiiVC_Injector
}
}
var outputFolderSelect = new CommonOpenFileDialog("Specify your output folder")
if (!string.IsNullOrEmpty(Properties.Settings.Default.OutputPathFixed))
{
InitialDirectory = Properties.Settings.Default.OutputPath,
IsFolderPicker = true,
EnsurePathExists = true
};
//Specify Path Variables to be called later
if (outputFolderSelect.ShowDialog() == CommonFileDialogResult.Cancel)
selectedOutputPath = Properties.Settings.Default.OutputPathFixed;
}
else
{
MessageBox.Show("Output folder selection has been cancelled, conversion will not continue."
, "Cancelled"
, MessageBoxButtons.OK
, MessageBoxIcon.Warning
, MessageBoxDefaultButton.Button1
, (MessageBoxOptions)0x40000);
MainTabs.Enabled = true;
goto BuildProcessFin;
var outputFolderSelect = new CommonOpenFileDialog("Specify your output folder")
{
InitialDirectory = Properties.Settings.Default.OutputPath,
IsFolderPicker = true,
EnsurePathExists = true
};
//Specify Path Variables to be called later
if (outputFolderSelect.ShowDialog() == CommonFileDialogResult.Cancel)
{
MessageBox.Show("Output folder selection has been cancelled, conversion will not continue."
, "Cancelled"
, MessageBoxButtons.OK
, MessageBoxIcon.Warning
, MessageBoxDefaultButton.Button1
, (MessageBoxOptions)0x40000);
MainTabs.Enabled = true;
goto BuildProcessFin;
}
selectedOutputPath = outputFolderSelect.FileName;
Properties.Settings.Default.OutputPath = selectedOutputPath;
Properties.Settings.Default.Save();
}
BuildProgress.Value = 2;
selectedOutputPath = outputFolderSelect.FileName;
Properties.Settings.Default.OutputPath = selectedOutputPath;
Properties.Settings.Default.Save();
//////////////////////////
//Download base files with JNUSTool, store them for future use
......
......@@ -12,7 +12,7 @@ namespace TeconMoon_s_WiiVC_Injector.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......@@ -46,5 +46,29 @@ namespace TeconMoon_s_WiiVC_Injector.Properties {
this["GameFilePath"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string OutputPathFixed {
get {
return ((string)(this["OutputPathFixed"]));
}
set {
this["OutputPathFixed"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://raw.githubusercontent.com/cucholix/wiivc-bis/master/")]
public string BannersRepository {
get {
return ((string)(this["BannersRepository"]));
}
set {
this["BannersRepository"] = value;
}
}
}
}
......@@ -8,5 +8,11 @@
<Setting Name="GameFilePath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="OutputPathFixed" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="BannersRepository" Type="System.String" Scope="User">
<Value Profile="(Default)">https://raw.githubusercontent.com/cucholix/wiivc-bis/master/</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
using TeconMoon_s_WiiVC_Injector.Properties;
namespace TeconMoon_s_WiiVC_Injector
{
partial class SettingsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.BannersRepositoryLabel = new System.Windows.Forms.Label();
this.BannersRepository = new System.Windows.Forms.TextBox();
this.OutputDirLabel = new System.Windows.Forms.Label();
this.OutputDir = new System.Windows.Forms.TextBox();
this.OutputDirButton = new System.Windows.Forms.Button();
this.OkButton = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// BannersRepositoryLabel
//
this.BannersRepositoryLabel.Location = new System.Drawing.Point(12, 9);
this.BannersRepositoryLabel.Name = "BannersRepositoryLabel";
this.BannersRepositoryLabel.Size = new System.Drawing.Size(118, 16);
this.BannersRepositoryLabel.TabIndex = 0;
this.BannersRepositoryLabel.Text = "Banners Repository";
//
// BannersRepository
//
this.BannersRepository.Location = new System.Drawing.Point(12, 28);
this.BannersRepository.Name = "BannersRepository";
this.BannersRepository.Size = new System.Drawing.Size(345, 20);
this.BannersRepository.TabIndex = 1;
this.BannersRepository.Text = global::TeconMoon_s_WiiVC_Injector.Properties.Settings.Default.BannersRepository;
//
// OutputDirLabel
//
this.OutputDirLabel.Location = new System.Drawing.Point(12, 60);
this.OutputDirLabel.Name = "OutputDirLabel";
this.OutputDirLabel.Size = new System.Drawing.Size(262, 15);
this.OutputDirLabel.TabIndex = 2;
this.OutputDirLabel.Text = "Output Directory (leave empty to always ask)";
//
// OutputDir
//
this.OutputDir.Location = new System.Drawing.Point(12, 78);
this.OutputDir.Name = "OutputDir";
this.OutputDir.Size = new System.Drawing.Size(255, 20);
this.OutputDir.TabIndex = 3;
this.OutputDir.Text = global::TeconMoon_s_WiiVC_Injector.Properties.Settings.Default.OutputPathFixed;
//
// OutputDirButton
//
this.OutputDirButton.Location = new System.Drawing.Point(273, 74);
this.OutputDirButton.Name = "OutputDirButton";
this.OutputDirButton.Size = new System.Drawing.Size(84, 26);
this.OutputDirButton.TabIndex = 4;
this.OutputDirButton.Text = "Browse...";
this.OutputDirButton.UseVisualStyleBackColor = false;
this.OutputDirButton.Click += new System.EventHandler(this.OutputDirButton_Click);
//
// OkButton
//
this.OkButton.Location = new System.Drawing.Point(183, 257);
this.OkButton.Name = "OkButton";
this.OkButton.Size = new System.Drawing.Size(84, 26);
this.OkButton.TabIndex = 5;
this.OkButton.Text = "OK";
this.OkButton.UseVisualStyleBackColor = false;
this.OkButton.Click += new System.EventHandler(this.OkButton_Click);
//
// Cancel
//
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(273, 257);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(84, 26);
this.Cancel.TabIndex = 6;
this.Cancel.Text = "Cancel";
this.Cancel.UseVisualStyleBackColor = false;
//
// SettingsForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(369, 295);
this.Controls.Add(this.OutputDirLabel);
this.Controls.Add(this.OutputDir);
this.Controls.Add(this.BannersRepositoryLabel);
this.Controls.Add(this.BannersRepository);
this.Controls.Add(this.OutputDirButton);
this.Controls.Add(this.OkButton);
this.Controls.Add(this.Cancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SettingsForm";
this.ShowInTaskbar = false;
this.Text = "Application Settings";
this.Load += new System.EventHandler(this.SettingsForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label BannersRepositoryLabel;
private System.Windows.Forms.TextBox BannersRepository;
private System.Windows.Forms.Label OutputDirLabel;
private System.Windows.Forms.TextBox OutputDir;
private System.Windows.Forms.Button OutputDirButton;
private System.Windows.Forms.Button OkButton;
private System.Windows.Forms.Button Cancel;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Diagnostics;
using TeconMoon_s_WiiVC_Injector.Properties;
using Microsoft.WindowsAPICodePack.Dialogs;
namespace TeconMoon_s_WiiVC_Injector
{
public partial class SettingsForm : Form
{
public SettingsForm()
{
InitializeComponent();
}
//Load Drives and set drive variable on load
private void SettingsForm_Load(object sender, EventArgs e)
{
BannersRepository.Text = Settings.Default.BannersRepository;
}
private void OkButton_Click(object sender, EventArgs e)
{
Settings.Default.BannersRepository = BannersRepository.Text;
Settings.Default.OutputPathFixed = OutputDir.Text;
Settings.Default.Save();
Close();
}
private void OutputDirButton_Click(object sender, EventArgs e)
{
var outputFolderSelect = new CommonOpenFileDialog("Specify your output folder")
{
InitialDirectory = Settings.Default.OutputPath,
IsFolderPicker = true,
EnsurePathExists = true
};
//Specify Path Variables to be called later
if (outputFolderSelect.ShowDialog() == CommonFileDialogResult.Ok)
{
OutputDir.Text = outputFolderSelect.FileName;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -155,6 +155,12 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
......@@ -166,6 +172,9 @@
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SettingsForm.resx">
<DependentUpon>SettingsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment