mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-30 08:20:24 +00:00
04eec01042
- The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
127 lines
No EOL
4.4 KiB
C#
127 lines
No EOL
4.4 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Octokit;
|
|
using System.IO;
|
|
using System.Diagnostics;
|
|
using System.Security.Cryptography;
|
|
using Toolbox.Library;
|
|
|
|
namespace Toolbox
|
|
{
|
|
public class UpdateProgram
|
|
{
|
|
static List<Release> Releases = new List<Release>();
|
|
public static bool CanUpdate = false;
|
|
public static bool Downloaded = false;
|
|
public static Release LatestRelease;
|
|
public static List<GitHubCommit> CommitList = new List<GitHubCommit>();
|
|
public static DateTime LatestReleaseTime;
|
|
|
|
|
|
public static void CheckLatest()
|
|
{
|
|
try
|
|
{
|
|
var client = new GitHubClient(new ProductHeaderValue("ST_UpdateTool"));
|
|
GetReleases(client).Wait();
|
|
GetCommits(client).Wait();
|
|
|
|
foreach (Release latest in Releases)
|
|
{
|
|
Console.WriteLine(
|
|
"The latest release is tagged at {0} and is named {1} commit {2} date {3}",
|
|
latest.TagName,
|
|
latest.Name,
|
|
latest.TargetCommitish,
|
|
latest.Assets[0].UpdatedAt.ToString());
|
|
|
|
if (Runtime.CompileDate != latest.Assets[0].UpdatedAt.ToString())
|
|
{
|
|
LatestReleaseTime = latest.Assets[0].UpdatedAt.DateTime;
|
|
LatestRelease = latest;
|
|
CanUpdate = true;
|
|
|
|
/* DownloadRelease();
|
|
if (CanUpdate)
|
|
{
|
|
LatestReleaseTime = latest.Assets[0].UpdatedAt.DateTime;
|
|
LatestRelease = latest;
|
|
}
|
|
else
|
|
{
|
|
|
|
}*/
|
|
}
|
|
break;
|
|
}
|
|
|
|
Releases.Clear();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Toolbox.Library.Forms.STErrorDialog.Show($"Failed to get latest update", "Updater", ex.ToString());
|
|
}
|
|
}
|
|
|
|
static void DownloadRelease()
|
|
{
|
|
ProcessStartInfo p = new ProcessStartInfo();
|
|
p.WindowStyle = ProcessWindowStyle.Hidden;
|
|
p.CreateNoWindow = true;
|
|
p.FileName = Path.Combine(Runtime.ExecutableDir, "Updater.exe");
|
|
p.WorkingDirectory = Path.Combine(Runtime.ExecutableDir, "updater/");
|
|
Console.WriteLine($"Updater: {p.FileName}");
|
|
p.Arguments = "-d";
|
|
|
|
Process process = new Process();
|
|
process.StartInfo = p;
|
|
Console.WriteLine("Downloading...");
|
|
process.Start();
|
|
process.WaitForExit();
|
|
if (process.ExitCode != 0)
|
|
throw new TimeoutException();
|
|
Console.WriteLine("Finished downloading");
|
|
string updateExe = Path.Combine(Runtime.ExecutableDir, "master\\Toolbox.exe"),
|
|
currentExe = System.Reflection.Assembly.GetEntryAssembly().Location;
|
|
if (!Utils.CreateMD5Hash(currentExe).SequenceEqual(Utils.CreateMD5Hash(updateExe)))
|
|
CanUpdate = true;
|
|
}
|
|
|
|
static async Task GetCommits(GitHubClient client)
|
|
{
|
|
var options = new ApiOptions
|
|
{
|
|
PageSize = 20,
|
|
PageCount = 1
|
|
};
|
|
|
|
DateTimeOffset CurrentRelease;
|
|
bool IsValidTime = DateTimeOffset.TryParse(Runtime.CompileDate, out CurrentRelease);
|
|
|
|
foreach (GitHubCommit c in await client.Repository.Commit.GetAll("KillzXGaming", "Switch-Toolbox", options))
|
|
{
|
|
if (IsValidTime)
|
|
{
|
|
if (CurrentRelease.DateTime < c.Commit.Author.Date.DateTime)
|
|
CommitList.Add(c);
|
|
else
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
//Just add extra commits. This shouldn't happen unless the user actually edits the file
|
|
CommitList.Add(c);
|
|
}
|
|
}
|
|
}
|
|
|
|
static async Task GetReleases(GitHubClient client)
|
|
{
|
|
Releases = new List<Release>();
|
|
foreach (Release r in await client.Repository.Release.GetAll("KillzXGaming", "Switch-Toolbox"))
|
|
Releases.Add(r);
|
|
}
|
|
}
|
|
} |