diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ecfe0c7e..0b96632a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -45,7 +45,7 @@ jobs:
run: "msbuild PCK_Studio.sln -p:Configuration=Release"
- name: Package binary
- run: Compress-Archive -Path ${{ github.workspace }}\PCK-Studio\bin\Release\ -Destination ${{ env.RELEASE_NAME }}.zip
+ run: Compress-Archive -Path "${{ github.workspace }}\PCK-Studio\bin\Release\*" -Destination ${{ env.RELEASE_NAME }}.zip
- name: Release
uses: softprops/action-gh-release@v2
diff --git a/.gitignore b/.gitignore
index 15baf62c..8e15384e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -250,3 +250,6 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml
+
+# Deploy util
+makeUpdate.py
diff --git a/PCK-Studio-Updater/API/GithubParams.cs b/PCK-Studio-Updater/API/GithubParams.cs
deleted file mode 100644
index 77aed764..00000000
--- a/PCK-Studio-Updater/API/GithubParams.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Text.RegularExpressions;
-
-namespace PCKStudio_Updater
-{
- public sealed class GithubParams
- {
- public readonly string RepositoryOwnerName;
- public readonly string RepositoryName;
- public readonly string TargetExecutableName;
- public readonly bool UsePreRelease;
- public readonly Regex VersionMatcher;
-
- public GithubParams(string repositoryOwnerName, string repositoryName, string targetExecutableName, bool usePreRelease, Regex versionMatcher)
- {
- RepositoryOwnerName = repositoryOwnerName;
- RepositoryName = repositoryName;
- TargetExecutableName = targetExecutableName;
- UsePreRelease = usePreRelease;
- VersionMatcher = versionMatcher;
- }
- }
-}
diff --git a/PCK-Studio-Updater/API/GithubUpdateDownloader.cs b/PCK-Studio-Updater/API/GithubUpdateDownloader.cs
deleted file mode 100644
index b89c3897..00000000
--- a/PCK-Studio-Updater/API/GithubUpdateDownloader.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO.Compression;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using Octokit;
-
-namespace PCKStudio_Updater
-{
- public sealed class GithubUpdateDownloader : IUpdateDownloader
- {
- private static readonly Assembly updaterAssembly = Assembly.GetAssembly(typeof(GithubUpdateDownloader));
-
- private readonly GithubParams _updateParams;
- private readonly GitHubClient githubClient;
- private Release latestFetchedRelease;
- private Version latestReleaseVersion;
- private DirectoryInfo downloadDirectory;
-
-
- public GithubUpdateDownloader(GithubParams updateParams)
- {
- _updateParams = updateParams;
- var githubClientProductHeader = new ProductHeaderValue(updaterAssembly.GetName().Name);
- githubClient = new GitHubClient(githubClientProductHeader);
- }
-
- public bool IsUpdateAvailable(FileVersionInfo fileVersionInfo)
- {
- return IsUpdateAvailable(fileVersionInfo.ProductVersion);
- }
-
- public bool IsUpdateAvailable(Assembly currentAssembly)
- {
- if (!File.Exists(currentAssembly.Location))
- return false;
- FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(currentAssembly.Location);
- return IsUpdateAvailable(fileVersionInfo.ProductVersion);
- }
-
- public bool IsUpdateAvailable(Version productVersion)
- {
- Debug.WriteLine("Release Product ver.: " + latestReleaseVersion);
- Debug.WriteLine("Current Product ver.: " + productVersion);
- return latestReleaseVersion.CompareTo(productVersion) > 0;
- }
-
- public bool IsUpdateAvailable(string productVersion)
- {
- GetLatestRelease(_updateParams.UsePreRelease);
- if (Version.TryParse(productVersion, out var currentVersion))
- {
- return IsUpdateAvailable(currentVersion);
- }
- return false;
- }
-
- private void UnpackZip(string zipFilePath)
- {
- ZipFile.ExtractToDirectory(zipFilePath, Path.GetDirectoryName(zipFilePath));
- }
-
- private static void DownloadAsset(ReleaseAsset asset, Stream destination)
- {
- string downloadUrl = asset.BrowserDownloadUrl;
- var client = new WebClient();
- using (var serverStream = client.OpenRead(downloadUrl))
- {
- serverStream.CopyTo(destination);
- }
- }
-
- private void GetLatestRelease(bool prerelease)
- {
- Release release;
- if (prerelease)
- {
- var prereleaseTask = githubClient.Repository.Release.GetAll(_updateParams.RepositoryOwnerName, _updateParams.RepositoryName);
- prereleaseTask.Wait();
- var prereleases = prereleaseTask.Result.OrderByDescending(release => release.PublishedAt ?? release.CreatedAt).Where(release => release.Prerelease).ToArray();
- release = latestFetchedRelease = prereleases[0];
- }
- else
- {
- var latestReleaseTask = githubClient.Repository.Release.GetLatest(_updateParams.RepositoryOwnerName, _updateParams.RepositoryName);
- latestReleaseTask.Wait();
- release = latestFetchedRelease = latestReleaseTask.Result;
- }
- var match = _updateParams.VersionMatcher.Match(release.Name);
- if (match.Success)
- {
- string versionString = match.Value;
- Version.TryParse(versionString, out latestReleaseVersion);
- }
- }
-
- private void EmptyDirectory(DirectoryInfo directory)
- {
- string appname = Assembly.GetExecutingAssembly().GetName().Name;
- foreach (FileInfo file in directory.GetFiles())
- {
- if (Path.GetFileNameWithoutExtension(file.Name) != appname && file.Name != "update.zip")
- file.Delete();
- }
- foreach (DirectoryInfo subDirectory in directory.GetDirectories())
- subDirectory.Delete(true);
- }
-
- public void DownloadTo(DirectoryInfo directory)
- {
- if (latestFetchedRelease is null)
- GetLatestRelease(_updateParams.UsePreRelease);
- if (latestFetchedRelease.Assets?.Count > 0)
- {
- var asset = latestFetchedRelease.Assets[0];
- string zipFilePath = Path.Combine(directory.FullName, "update.zip");
- using(var zipFileStream = File.OpenWrite(zipFilePath))
- {
- DownloadAsset(asset, zipFileStream);
- }
- Debug.WriteLine("Download Complete", category: nameof(GithubUpdateDownloader));
- EmptyDirectory(directory);
- UnpackZip(zipFilePath);
- File.Delete(zipFilePath);
- downloadDirectory = directory;
- }
- }
-
- public void Launch()
- {
- if (downloadDirectory is null)
- {
- throw new ArgumentNullException("Download directory not set.");
- }
-
- var files = downloadDirectory.GetFiles(_updateParams.TargetExecutableName + ".exe", SearchOption.TopDirectoryOnly);
- if (files is not null && files.Length > 0)
- {
- Process.Start(files[0].FullName);
- }
- }
- }
-}
diff --git a/PCK-Studio-Updater/API/IUpdateDownloader.cs b/PCK-Studio-Updater/API/IUpdateDownloader.cs
deleted file mode 100644
index ef422762..00000000
--- a/PCK-Studio-Updater/API/IUpdateDownloader.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PCKStudio_Updater
-{
- public interface IUpdateDownloader
- {
- public bool IsUpdateAvailable(Version currentVersion);
- public bool IsUpdateAvailable(string currentVersionString);
-
- public void DownloadTo(DirectoryInfo directory);
-
- public void Launch();
- }
-}
diff --git a/PCK-Studio-Updater/PCK-Studio-Updater.csproj b/PCK-Studio-Updater/PCK-Studio-Updater.csproj
deleted file mode 100644
index a47ab997..00000000
--- a/PCK-Studio-Updater/PCK-Studio-Updater.csproj
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}
- WinExe
- PCKStudio_Updater
- PCK-Studio-Updater
- latest
- enable
- v4.8
- 512
- true
- true
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- PCKStudio_Updater.Program
-
-
- ProjectLogo.ico
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 5.7.0
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- 7.1.0
-
-
-
-
- False
- Microsoft .NET Framework 4.8 %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PCK-Studio-Updater/Program.cs b/PCK-Studio-Updater/Program.cs
deleted file mode 100644
index d150ad4c..00000000
--- a/PCK-Studio-Updater/Program.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Runtime;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace PCKStudio_Updater
-{
- internal class Program
- {
- static void Main(string[] args)
- {
- Uri projectUrl = new Uri("https://github.com/PhoenixARC/-PCK-Studio");
- if (args.Length > 0)
- {
- projectUrl = new Uri(args[0]);
- }
-
- string executableName = "PCK-Studio";
- if (args.Length > 1)
- {
- executableName = args[1];
- }
-
- bool prerelease = false;
- if (args.Length > 2)
- {
- prerelease = args[2].ToLower() == "true" || args[2].ToLower() == "1";
- }
-
- var versionMatcher = new Regex("(\\*|\\d+(\\.\\d+){0,3}(\\.\\*)?)");
- if (args.Length > 3)
- {
- versionMatcher = new Regex(args[3]);
- }
-
- GithubParams updateParams = new GithubParams(
- Path.GetDirectoryName(projectUrl.AbsolutePath).Replace("\\", ""),
- Path.GetFileName(projectUrl.AbsolutePath),
- executableName,
- prerelease,
- versionMatcher
- );
-
- IUpdateDownloader updater = new GithubUpdateDownloader(updateParams);
-
- if (!File.Exists(updateParams.TargetExecutableName + ".exe") || updater.IsUpdateAvailable(FileVersionInfo.GetVersionInfo(updateParams.TargetExecutableName + ".exe").ProductVersion))
- {
- updater.DownloadTo(new DirectoryInfo("."));
- updater.Launch();
- return;
- }
- }
- }
-}
diff --git a/PCK-Studio-Updater/ProjectLogo.ico b/PCK-Studio-Updater/ProjectLogo.ico
deleted file mode 100644
index 85357f6f..00000000
Binary files a/PCK-Studio-Updater/ProjectLogo.ico and /dev/null differ
diff --git a/PCK-Studio-Updater/Properties/AssemblyInfo.cs b/PCK-Studio-Updater/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8e714011..00000000
--- a/PCK-Studio-Updater/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("PckStudio-Updater")]
-[assembly: AssemblyDescription("Updater for PCK-Studio")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("PckStudio-Updater")]
-[assembly: AssemblyCopyright("Copyright © 2023 Miku-666")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("5b223556-15b9-41da-aa0b-5e7f45e743bf")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/PCK-Studio-Updater/Properties/app.manifest b/PCK-Studio-Updater/Properties/app.manifest
deleted file mode 100644
index c02c2d89..00000000
--- a/PCK-Studio-Updater/Properties/app.manifest
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PCK-Studio/Extensions/TreeViewExtensions.cs b/PCK-Studio/Extensions/TreeViewExtensions.cs
index 61583041..7ba0e35b 100644
--- a/PCK-Studio/Extensions/TreeViewExtensions.cs
+++ b/PCK-Studio/Extensions/TreeViewExtensions.cs
@@ -14,6 +14,12 @@ namespace PckStudio.Extensions
{
if (string.IsNullOrWhiteSpace(path))
return Array.Empty();
+
+ if (!path.Contains(treeView.PathSeparator))
+ {
+ return treeView.Nodes.Find(path, false);
+ }
+
string segment = path.Substring(0, path.IndexOf(treeView.PathSeparator));
if (treeView.Nodes.ContainsKey(segment))
{
diff --git a/PCK-Studio/Forms/AppSettingsForm.Designer.cs b/PCK-Studio/Forms/AppSettingsForm.Designer.cs
index f84f10d7..00ed901a 100644
--- a/PCK-Studio/Forms/AppSettingsForm.Designer.cs
+++ b/PCK-Studio/Forms/AppSettingsForm.Designer.cs
@@ -29,149 +29,33 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppSettingsForm));
- this.autoSaveCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.SettingToolTip = new MetroFramework.Components.MetroToolTip();
- this.endianCheckBox = new MetroFramework.Controls.MetroCheckBox();
- this.autoUpdateCheckBox = new MetroFramework.Controls.MetroCheckBox();
- this.autoLoadPckCheckBox = new MetroFramework.Controls.MetroCheckBox();
- this.showPresenceCheckBox = new MetroFramework.Controls.MetroCheckBox();
- this.grf_paramKeyComboBoxCheckBox = new MetroFramework.Controls.MetroCheckBox();
- this.usePrereleaseCheckBox = new MetroFramework.Controls.MetroCheckBox();
- this.validateSkinDimenssionCheckBox = new MetroFramework.Controls.MetroCheckBox();
+ this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
- // autoSaveCheckBox
- //
- this.autoSaveCheckBox.AutoSize = true;
- this.autoSaveCheckBox.Location = new System.Drawing.Point(23, 63);
- this.autoSaveCheckBox.Name = "autoSaveCheckBox";
- this.autoSaveCheckBox.Size = new System.Drawing.Size(76, 15);
- this.autoSaveCheckBox.Style = MetroFramework.MetroColorStyle.White;
- this.autoSaveCheckBox.TabIndex = 0;
- this.autoSaveCheckBox.Text = "Auto Save";
- this.autoSaveCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
- this.SettingToolTip.SetToolTip(this.autoSaveCheckBox, "Whether to automatically save changes inside of file editor such as the loc edito" +
- "r");
- this.autoSaveCheckBox.UseSelectable = true;
- this.autoSaveCheckBox.CheckedChanged += new System.EventHandler(this.autoSaveCheckBox_CheckedChanged);
- //
// SettingToolTip
//
this.SettingToolTip.Style = MetroFramework.MetroColorStyle.White;
this.SettingToolTip.StyleManager = null;
this.SettingToolTip.Theme = MetroFramework.MetroThemeStyle.Dark;
//
- // endianCheckBox
+ // flowLayoutPanel
//
- this.endianCheckBox.AutoSize = true;
- this.endianCheckBox.Location = new System.Drawing.Point(23, 84);
- this.endianCheckBox.Name = "endianCheckBox";
- this.endianCheckBox.Size = new System.Drawing.Size(75, 15);
- this.endianCheckBox.Style = MetroFramework.MetroColorStyle.White;
- this.endianCheckBox.TabIndex = 1;
- this.endianCheckBox.Text = "Open Vita";
- this.endianCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
- this.SettingToolTip.SetToolTip(this.endianCheckBox, "Whether to automatically set the \'Open as Switch/Vita pck\' checkbox");
- this.endianCheckBox.UseSelectable = true;
- this.endianCheckBox.CheckedChanged += new System.EventHandler(this.endianCheckBox_CheckedChanged);
- //
- // autoUpdateCheckBox
- //
- this.autoUpdateCheckBox.AutoSize = true;
- this.autoUpdateCheckBox.Location = new System.Drawing.Point(23, 105);
- this.autoUpdateCheckBox.Name = "autoUpdateCheckBox";
- this.autoUpdateCheckBox.Size = new System.Drawing.Size(90, 15);
- this.autoUpdateCheckBox.Style = MetroFramework.MetroColorStyle.White;
- this.autoUpdateCheckBox.TabIndex = 2;
- this.autoUpdateCheckBox.Text = "Auto Update";
- this.autoUpdateCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
- this.SettingToolTip.SetToolTip(this.autoUpdateCheckBox, "Whether to automatically check for updates");
- this.autoUpdateCheckBox.UseSelectable = true;
- this.autoUpdateCheckBox.CheckedChanged += new System.EventHandler(this.autoUpdateCheckBox_CheckedChanged);
- //
- // autoLoadPckCheckBox
- //
- this.autoLoadPckCheckBox.AutoSize = true;
- this.autoLoadPckCheckBox.Location = new System.Drawing.Point(23, 126);
- this.autoLoadPckCheckBox.Name = "autoLoadPckCheckBox";
- this.autoLoadPckCheckBox.Size = new System.Drawing.Size(331, 15);
- this.autoLoadPckCheckBox.Style = MetroFramework.MetroColorStyle.White;
- this.autoLoadPckCheckBox.TabIndex = 3;
- this.autoLoadPckCheckBox.Text = "Auto load additional pck files (also known as SubPCK files)";
- this.autoLoadPckCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
- this.SettingToolTip.SetToolTip(this.autoLoadPckCheckBox, "Whether to automatically load files inside that end in .pck");
- this.autoLoadPckCheckBox.UseSelectable = true;
- this.autoLoadPckCheckBox.CheckedChanged += new System.EventHandler(this.autoLoadPckCheckBox_CheckedChanged);
- //
- // showPresenceCheckBox
- //
- this.showPresenceCheckBox.AutoSize = true;
- this.showPresenceCheckBox.Location = new System.Drawing.Point(23, 147);
- this.showPresenceCheckBox.Name = "showPresenceCheckBox";
- this.showPresenceCheckBox.Size = new System.Drawing.Size(171, 15);
- this.showPresenceCheckBox.Style = MetroFramework.MetroColorStyle.White;
- this.showPresenceCheckBox.TabIndex = 4;
- this.showPresenceCheckBox.Text = "Show Discord Rich Presence";
- this.showPresenceCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
- this.SettingToolTip.SetToolTip(this.showPresenceCheckBox, "Whether to show a rich presence on discord");
- this.showPresenceCheckBox.UseSelectable = true;
- this.showPresenceCheckBox.CheckedChanged += new System.EventHandler(this.showPresenceCheckBox_CheckedChanged);
- //
- // grf_paramKeyComboBoxCheckBox
- //
- this.grf_paramKeyComboBoxCheckBox.AutoSize = true;
- this.grf_paramKeyComboBoxCheckBox.Location = new System.Drawing.Point(23, 169);
- this.grf_paramKeyComboBoxCheckBox.Name = "grf_paramKeyComboBoxCheckBox";
- this.grf_paramKeyComboBoxCheckBox.Size = new System.Drawing.Size(100, 15);
- this.grf_paramKeyComboBoxCheckBox.Style = MetroFramework.MetroColorStyle.White;
- this.grf_paramKeyComboBoxCheckBox.TabIndex = 5;
- this.grf_paramKeyComboBoxCheckBox.Text = "Select GRF Key";
- this.grf_paramKeyComboBoxCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
- this.SettingToolTip.SetToolTip(this.grf_paramKeyComboBoxCheckBox, "Use a combobox instead of typing the parameter key name");
- this.grf_paramKeyComboBoxCheckBox.UseSelectable = true;
- this.grf_paramKeyComboBoxCheckBox.CheckedChanged += new System.EventHandler(this.grf_paramKeyComboBoxCheckBox_CheckedChanged);
- //
- // usePrereleaseCheckBox
- //
- this.usePrereleaseCheckBox.AutoSize = true;
- this.usePrereleaseCheckBox.Location = new System.Drawing.Point(119, 105);
- this.usePrereleaseCheckBox.Name = "usePrereleaseCheckBox";
- this.usePrereleaseCheckBox.Size = new System.Drawing.Size(98, 15);
- this.usePrereleaseCheckBox.Style = MetroFramework.MetroColorStyle.White;
- this.usePrereleaseCheckBox.TabIndex = 6;
- this.usePrereleaseCheckBox.Text = "Use Beta Build";
- this.usePrereleaseCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
- this.SettingToolTip.SetToolTip(this.usePrereleaseCheckBox, "Whether to automatically check for updates");
- this.usePrereleaseCheckBox.UseSelectable = true;
- this.usePrereleaseCheckBox.Visible = false;
- //
- // validateSkinDimenssionCheckBox
- //
- this.validateSkinDimenssionCheckBox.AutoSize = true;
- this.validateSkinDimenssionCheckBox.Location = new System.Drawing.Point(23, 190);
- this.validateSkinDimenssionCheckBox.Name = "validateSkinDimenssionCheckBox";
- this.validateSkinDimenssionCheckBox.Size = new System.Drawing.Size(149, 15);
- this.validateSkinDimenssionCheckBox.Style = MetroFramework.MetroColorStyle.White;
- this.validateSkinDimenssionCheckBox.TabIndex = 7;
- this.validateSkinDimenssionCheckBox.Text = "Validate Skin Dimension";
- this.validateSkinDimenssionCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
- this.SettingToolTip.SetToolTip(this.validateSkinDimenssionCheckBox, "Use a combobox instead of typing the parameter key name");
- this.validateSkinDimenssionCheckBox.UseSelectable = true;
- this.validateSkinDimenssionCheckBox.CheckedChanged += new System.EventHandler(this.validateSkinDimenssionCheckBox_CheckedChanged);
+ this.flowLayoutPanel.AutoScroll = true;
+ this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.flowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
+ this.flowLayoutPanel.Location = new System.Drawing.Point(20, 60);
+ this.flowLayoutPanel.Name = "flowLayoutPanel";
+ this.flowLayoutPanel.Padding = new System.Windows.Forms.Padding(3);
+ this.flowLayoutPanel.Size = new System.Drawing.Size(487, 190);
+ this.flowLayoutPanel.TabIndex = 0;
//
// AppSettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(527, 270);
- this.Controls.Add(this.validateSkinDimenssionCheckBox);
- this.Controls.Add(this.usePrereleaseCheckBox);
- this.Controls.Add(this.grf_paramKeyComboBoxCheckBox);
- this.Controls.Add(this.showPresenceCheckBox);
- this.Controls.Add(this.autoLoadPckCheckBox);
- this.Controls.Add(this.autoUpdateCheckBox);
- this.Controls.Add(this.endianCheckBox);
- this.Controls.Add(this.autoSaveCheckBox);
+ this.Controls.Add(this.flowLayoutPanel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
@@ -183,20 +67,11 @@
this.Theme = MetroFramework.MetroThemeStyle.Dark;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AppBehaviorSettingsForm_FormClosing);
this.ResumeLayout(false);
- this.PerformLayout();
}
#endregion
-
- private MetroFramework.Controls.MetroCheckBox autoSaveCheckBox;
private MetroFramework.Components.MetroToolTip SettingToolTip;
- private MetroFramework.Controls.MetroCheckBox endianCheckBox;
- private MetroFramework.Controls.MetroCheckBox autoUpdateCheckBox;
- private MetroFramework.Controls.MetroCheckBox autoLoadPckCheckBox;
- private MetroFramework.Controls.MetroCheckBox showPresenceCheckBox;
- private MetroFramework.Controls.MetroCheckBox grf_paramKeyComboBoxCheckBox;
- private MetroFramework.Controls.MetroCheckBox usePrereleaseCheckBox;
- private MetroFramework.Controls.MetroCheckBox validateSkinDimenssionCheckBox;
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
}
}
\ No newline at end of file
diff --git a/PCK-Studio/Forms/AppSettingsForm.cs b/PCK-Studio/Forms/AppSettingsForm.cs
index 79b2baad..8d1927bb 100644
--- a/PCK-Studio/Forms/AppSettingsForm.cs
+++ b/PCK-Studio/Forms/AppSettingsForm.cs
@@ -1,12 +1,9 @@
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.Configuration;
+using System.Diagnostics;
using System.Windows.Forms;
+using MetroFramework.Controls;
using MetroFramework.Forms;
using PckStudio.Properties;
@@ -14,74 +11,65 @@ namespace PckStudio.Forms
{
public partial class AppSettingsForm : MetroForm
{
+ private ApplicationSettingsBase _applicationSettings;
+
public AppSettingsForm()
+ : this(Settings.Default)
+ {
+ }
+
+ public AppSettingsForm(ApplicationSettingsBase applicationSettings)
{
InitializeComponent();
+ _applicationSettings = applicationSettings;
LoadSettings();
}
- private void autoSaveCheckBox_CheckedChanged(object sender, EventArgs e)
+ private static Dictionary CheckBoxText = new Dictionary()
{
- Settings.Default.AutoSaveChanges = autoSaveCheckBox.Checked;
- }
+ ["ShowRichPresence"] = "Show Rich Presence",
+ ["AutoSaveChanges"] = "Auto Save",
+ ["UseLittleEndianAsDefault"] = "Open as Little Endian",
+ ["AutoUpdate"] = "Auto Update",
+ ["LoadSubPcks"] = "Load Sub Pcks",
+ ["UsePrerelease"] = "Use Prerelease",
+ ["UseComboBoxForGRFParameter"] = "Easy Grf Param",
+ };
- private void endianCheckBox_CheckedChanged(object sender, EventArgs e)
+ private void CheckBox_CheckedChanged(object sender, EventArgs e)
{
- Settings.Default.UseLittleEndianAsDefault = endianCheckBox.Checked;
- }
-
- private void autoLoadPckCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- Settings.Default.LoadSubPcks = autoLoadPckCheckBox.Checked;
- }
-
- private void showPresenceCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- Settings.Default.ShowRichPresence = showPresenceCheckBox.Checked;
- }
-
- private void autoUpdateCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- usePrereleaseCheckBox.Visible = Settings.Default.AutoUpdate = autoUpdateCheckBox.Checked;
- }
-
- private void grf_paramKeyComboBoxCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- Settings.Default.UseComboBoxForGRFParameter = grf_paramKeyComboBoxCheckBox.Checked;
- }
-
- private void usePrereleaseCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- Settings.Default.UsePrerelease = usePrereleaseCheckBox.Checked;
- }
-
- private void validateSkinDimenssionCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- Settings.Default.ValidateImageDimension = validateSkinDimenssionCheckBox.Checked;
- }
-
- private void LoadCheckboxState(CheckBox checkBox, EventHandler eventHandler, bool state)
- {
- checkBox.CheckedChanged -= eventHandler;
- checkBox.Checked = state;
- checkBox.CheckedChanged += eventHandler;
+ if (sender is CheckBox checkBox && checkBox.Tag is string settingsKey && _applicationSettings[settingsKey] is bool)
+ {
+ _applicationSettings[settingsKey] = checkBox.Checked;
+ }
}
private void LoadSettings()
{
- LoadCheckboxState(autoSaveCheckBox, autoSaveCheckBox_CheckedChanged, Settings.Default.AutoSaveChanges);
- LoadCheckboxState(endianCheckBox, endianCheckBox_CheckedChanged, Settings.Default.UseLittleEndianAsDefault);
- LoadCheckboxState(autoLoadPckCheckBox, autoLoadPckCheckBox_CheckedChanged, Settings.Default.LoadSubPcks);
- LoadCheckboxState(showPresenceCheckBox, showPresenceCheckBox_CheckedChanged, Settings.Default.ShowRichPresence);
- LoadCheckboxState(autoUpdateCheckBox, autoUpdateCheckBox_CheckedChanged, Settings.Default.AutoUpdate);
- LoadCheckboxState(usePrereleaseCheckBox, usePrereleaseCheckBox_CheckedChanged, Settings.Default.UsePrerelease);
- LoadCheckboxState(grf_paramKeyComboBoxCheckBox, grf_paramKeyComboBoxCheckBox_CheckedChanged, Settings.Default.UseComboBoxForGRFParameter);
- LoadCheckboxState(validateSkinDimenssionCheckBox, validateSkinDimenssionCheckBox_CheckedChanged, Settings.Default.ValidateImageDimension);
+ foreach (SettingsPropertyValue item in _applicationSettings.PropertyValues)
+ {
+ Debug.WriteLine($"{item.Property.Name}: {item.Property.PropertyType}");
+ if (!item.Property.Attributes.ContainsKey(typeof(UserScopedSettingAttribute)) || item.Property.PropertyType != typeof(bool))
+ continue;
+ var checkBox = new MetroCheckBox
+ {
+ Name = item.Name,
+ Tag = item.Name,
+ Text = CheckBoxText.ContainsKey(item.Name) ? CheckBoxText[item.Name] : item.Name,
+ Checked = (bool)item.PropertyValue,
+
+ AutoSize = true,
+ Theme = MetroFramework.MetroThemeStyle.Dark,
+ Style = MetroFramework.MetroColorStyle.White,
+ };
+ checkBox.CheckedChanged += CheckBox_CheckedChanged;
+ flowLayoutPanel.Controls.Add(checkBox);
+ }
}
private void AppBehaviorSettingsForm_FormClosing(object sender, FormClosingEventArgs e)
{
- Settings.Default.Save();
+ _applicationSettings.Save();
}
}
}
diff --git a/PCK-Studio/Forms/ContributorsForm.cs b/PCK-Studio/Forms/ContributorsForm.cs
index 51906542..cd2a528e 100644
--- a/PCK-Studio/Forms/ContributorsForm.cs
+++ b/PCK-Studio/Forms/ContributorsForm.cs
@@ -27,7 +27,7 @@ namespace PckStudio.Forms
#else
buildConfig = "unknown";
#endif
- buildLabel.Text = $"Verion: {Application.ProductVersion}\nBuild Config: {buildConfig}\nBranch: {CommitInfo.BranchName}@{CommitInfo.CommitHash}";
+ buildLabel.Text = $"Verion: {ApplicationScope.CurrentVersion}\nBuild Config: {buildConfig}\nBranch: {CommitInfo.BranchName}@{CommitInfo.CommitHash}";
}
protected override void OnLoad(EventArgs e)
diff --git a/PCK-Studio/Internal/App/ApplicationScope.cs b/PCK-Studio/Internal/App/ApplicationScope.cs
index d489938b..a9578fce 100644
--- a/PCK-Studio/Internal/App/ApplicationScope.cs
+++ b/PCK-Studio/Internal/App/ApplicationScope.cs
@@ -21,6 +21,8 @@ namespace PckStudio.Internal.App
private static Image[] _entityImages;
public static Image[] EntityImages => _entityImages;
+ public static Version CurrentVersion { get; } = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
+
internal static void Initialize()
{
Profiler.Start();
diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs
index b350b5f9..0ba0f7c6 100644
--- a/PCK-Studio/MainForm.cs
+++ b/PCK-Studio/MainForm.cs
@@ -92,7 +92,7 @@ namespace PckStudio
Text = Application.ProductName;
- labelVersion.Text = $"{Application.ProductName}: {Application.ProductVersion}";
+ labelVersion.Text = $"{Application.ProductName}: {ApplicationScope.CurrentVersion}";
ChangelogRichTextBox.Text = Resources.CHANGELOG;
pckFileTypeHandler = new Dictionary>(15)
@@ -2494,12 +2494,7 @@ namespace PckStudio
private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
{
- if (Program.Updater.IsUpdateAvailable(Application.ProductVersion))
- {
- Program.UpdateToLatest("Would you like to download it?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, DialogResult.Yes);
- return;
- }
- MessageBox.Show(this, "Already up to date.", "No update available");
+ Program.UpdateToLatest();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj
index 01c1b746..0b82a937 100644
--- a/PCK-Studio/PckStudio.csproj
+++ b/PCK-Studio/PckStudio.csproj
@@ -712,6 +712,9 @@
1.0.5
+
+ 1.9.1
+
5.8.0-alpha0098
compile; runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -755,10 +758,6 @@
-
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}
- PCK-Studio-Updater
-
{693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}
OMI Filetype Library
diff --git a/PCK-Studio/Program.cs b/PCK-Studio/Program.cs
index 393faaf9..e26bddc9 100644
--- a/PCK-Studio/Program.cs
+++ b/PCK-Studio/Program.cs
@@ -6,8 +6,9 @@ using System.Windows.Forms;
using PckStudio.Internal.Misc;
using PckStudio.Internal;
using PckStudio.Properties;
-using PCKStudio_Updater;
using PckStudio.Internal.App;
+using AutoUpdaterDotNET;
+using Newtonsoft.Json;
namespace PckStudio
@@ -15,22 +16,13 @@ namespace PckStudio
static class Program
{
internal static readonly Uri ProjectUrl = new Uri("https://github.com/PhoenixARC/-PCK-Studio");
+ internal static readonly Uri RawProjectUrl = new Uri("https://raw.githubusercontent.com/PhoenixARC/-PCK-Studio");
internal static readonly string BaseAPIUrl = "http://api.pckstudio.xyz/api/pck";
internal static readonly string BackUpAPIUrl = "https://raw.githubusercontent.com/PhoenixARC/pckstudio.tk/main/studio/PCK/api/";
internal static readonly string AppData = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Application.ProductName);
internal static readonly string AppDataCache = Path.Combine(AppData, "cache");
- private static readonly GithubParams UpdateParams = new GithubParams(
- Path.GetDirectoryName(ProjectUrl.AbsolutePath).Replace("\\", ""),
- Path.GetFileName(ProjectUrl.AbsolutePath),
- Application.ProductName,
- Settings.Default.UsePrerelease,
- new Regex("(\\*|\\d+(\\.\\d+){0,3}(\\.\\*)?)")
- );
- internal static readonly IUpdateDownloader Updater = new GithubUpdateDownloader(UpdateParams);
-
-
internal static MainForm MainInstance { get; private set; }
///
@@ -39,9 +31,23 @@ namespace PckStudio
[STAThread]
static void Main(string[] args)
{
+ AutoUpdater.SetOwner(MainInstance);
+ //AutoUpdater.ClearAppDirectory = true;
+#if DEBUG
+ AutoUpdater.ReportErrors = true;
+#endif
+ AutoUpdater.DownloadPath = Application.StartupPath;
+ AutoUpdater.ExecutablePath = "./PCK-Studio.exe";
+ AutoUpdater.TopMost = true;
+
+ string jsonPath = Path.Combine(Environment.CurrentDirectory, "updates.json");
+ AutoUpdater.PersistenceProvider = new JsonFilePersistenceProvider(jsonPath);
+ AutoUpdater.ParseUpdateInfoEvent += AutoUpdaterOnParseUpdateInfoEvent;
+ AutoUpdater.Icon = Resources.ProjectLogo.ToBitmap();
+
if (Settings.Default.AutoUpdate)
{
- UpdateToLatest("Click Ok to continue.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, DialogResult.OK);
+ UpdateToLatest();
}
ApplicationScope.Initialize();
@@ -51,24 +57,48 @@ namespace PckStudio
if (args.Length > 0 && File.Exists(args[0]) && args[0].EndsWith(".pck"))
MainInstance.InitPckFromFile(args[0]);
Application.ApplicationExit += (sender, e) => { RPC.Deinitialize(); };
+ MainInstance.FocusMe();
Application.Run(MainInstance);
}
- [Conditional("NDEBUG")]
- internal static void UpdateToLatest(string message, MessageBoxButtons buttons, MessageBoxIcon icon, DialogResult dialogResult)
+
+ internal static void UpdateToLatest()
{
- bool updateAvailable = Updater.IsUpdateAvailable(Application.ProductVersion);
- if (updateAvailable && MessageBox.Show(
- MainInstance ?? null,
- "New update available.\n" +
- message,
- "Update Available",
- buttons, icon, MessageBoxDefaultButton.Button1) == dialogResult)
- {
- Updater.DownloadTo(new DirectoryInfo(Application.StartupPath));
- Updater.Launch();
- Application.Exit();
- }
+#if NDEBUG
+ string url = $"{RawProjectUrl}/main/Version.json";
+ AutoUpdater.Start(url);
+#endif
}
+
+ class UpdateInfo
+ {
+ [JsonProperty("version")]
+ public string Version { get; set; }
+
+ [JsonProperty("url")]
+ public string Url { get; set; }
+
+ [JsonProperty("changelog")]
+ public string Changelog { get; set; }
+
+ [JsonProperty("mandatory")]
+ public bool Mandatory { get; set; }
+ }
+
+ private static void AutoUpdaterOnParseUpdateInfoEvent(ParseUpdateInfoEventArgs args)
+ {
+ UpdateInfo json = JsonConvert.DeserializeObject(args.RemoteData);
+ args.UpdateInfo = new UpdateInfoEventArgs
+ {
+ CurrentVersion = json.Version,
+ DownloadURL = json.Url,
+ ChangelogURL = json.Changelog,
+ Mandatory = new Mandatory()
+ {
+ Value = json.Mandatory,
+ }
+ };
+ }
+
}
}
\ No newline at end of file
diff --git a/PCK-Studio/Properties/AssemblyInfo.cs b/PCK-Studio/Properties/AssemblyInfo.cs
index acd3487d..967d6ade 100644
--- a/PCK-Studio/Properties/AssemblyInfo.cs
+++ b/PCK-Studio/Properties/AssemblyInfo.cs
@@ -32,6 +32,6 @@ using System.Security.Permissions;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("7.0.0.0")]
+[assembly: AssemblyVersion("7.0.0.1")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: NeutralResourcesLanguage("")]
diff --git a/PCK_Studio.sln b/PCK_Studio.sln
index 772bd2c5..8062268c 100644
--- a/PCK_Studio.sln
+++ b/PCK_Studio.sln
@@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OMI Filetype Library", "Ven
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpMss32", "Vendor\SharpMss32\SharpMss32\SharpMss32.csproj", "{E8D0B671-3AB1-48B6-A767-58DF67BD5D11}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PCK-Studio-Updater", "PCK-Studio-Updater\PCK-Studio-Updater.csproj", "{5B223556-15B9-41DA-AA0B-5E7F45E743BF}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Beta|Any CPU = Beta|Any CPU
@@ -80,24 +78,6 @@ Global
{E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Release|x64.Build.0 = Release|Any CPU
{E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Release|x86.ActiveCfg = Release|Any CPU
{E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Release|x86.Build.0 = Release|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Beta|Any CPU.ActiveCfg = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Beta|Any CPU.Build.0 = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Beta|x64.ActiveCfg = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Beta|x64.Build.0 = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Beta|x86.ActiveCfg = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Beta|x86.Build.0 = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Debug|x64.ActiveCfg = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Debug|x64.Build.0 = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Debug|x86.ActiveCfg = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Debug|x86.Build.0 = Debug|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Release|Any CPU.Build.0 = Release|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Release|x64.ActiveCfg = Release|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Release|x64.Build.0 = Release|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Release|x86.ActiveCfg = Release|Any CPU
- {5B223556-15B9-41DA-AA0B-5E7F45E743BF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Version.json b/Version.json
new file mode 100644
index 00000000..e4be63b7
--- /dev/null
+++ b/Version.json
@@ -0,0 +1,6 @@
+{
+ "version": "7.0.0.1",
+ "url": "https://github.com/PhoenixARC/-PCK-Studio/releases/download/v7.0.0.1/PCK-Studio.zip",
+ "changelog": "https://raw.githubusercontent.com/PhoenixARC/-PCK-Studio/main/CHANGELOG.md",
+ "mandatory": false
+}
\ No newline at end of file