1
0
mirror of synced 2024-11-27 21:10:48 +01:00

tried auto update

This commit is contained in:
NotImplementedLife 2023-08-16 19:57:47 +03:00
parent a0756e9072
commit c2f763a29c
3 changed files with 57 additions and 4 deletions

10
MainForm.Designer.cs generated
View File

@ -857,14 +857,14 @@
this.SortByIdToolStripMenuItem, this.SortByIdToolStripMenuItem,
this.NoSortToolStripMenuItem}); this.NoSortToolStripMenuItem});
this.musicOrderToolStripMenuItem.Name = "musicOrderToolStripMenuItem"; this.musicOrderToolStripMenuItem.Name = "musicOrderToolStripMenuItem";
this.musicOrderToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.musicOrderToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.musicOrderToolStripMenuItem.Text = "Music order"; this.musicOrderToolStripMenuItem.Text = "Music order";
// //
// SortByGenreToolStripMenuItem // SortByGenreToolStripMenuItem
// //
this.SortByGenreToolStripMenuItem.CheckOnClick = true; this.SortByGenreToolStripMenuItem.CheckOnClick = true;
this.SortByGenreToolStripMenuItem.Name = "SortByGenreToolStripMenuItem"; this.SortByGenreToolStripMenuItem.Name = "SortByGenreToolStripMenuItem";
this.SortByGenreToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.SortByGenreToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.SortByGenreToolStripMenuItem.Text = "Sort by genre"; this.SortByGenreToolStripMenuItem.Text = "Sort by genre";
this.SortByGenreToolStripMenuItem.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click); this.SortByGenreToolStripMenuItem.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click);
// //
@ -872,7 +872,7 @@
// //
this.SortByIdToolStripMenuItem.CheckOnClick = true; this.SortByIdToolStripMenuItem.CheckOnClick = true;
this.SortByIdToolStripMenuItem.Name = "SortByIdToolStripMenuItem"; this.SortByIdToolStripMenuItem.Name = "SortByIdToolStripMenuItem";
this.SortByIdToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.SortByIdToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.SortByIdToolStripMenuItem.Text = "Sort by Id"; this.SortByIdToolStripMenuItem.Text = "Sort by Id";
this.SortByIdToolStripMenuItem.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click); this.SortByIdToolStripMenuItem.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click);
// //
@ -880,7 +880,7 @@
// //
this.NoSortToolStripMenuItem.CheckOnClick = true; this.NoSortToolStripMenuItem.CheckOnClick = true;
this.NoSortToolStripMenuItem.Name = "NoSortToolStripMenuItem"; this.NoSortToolStripMenuItem.Name = "NoSortToolStripMenuItem";
this.NoSortToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.NoSortToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.NoSortToolStripMenuItem.Text = "No sort"; this.NoSortToolStripMenuItem.Text = "No sort";
this.NoSortToolStripMenuItem.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click); this.NoSortToolStripMenuItem.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click);
// //
@ -889,6 +889,8 @@
this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem"; this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(115, 20); this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(115, 20);
this.checkForUpdatesToolStripMenuItem.Text = "Check for updates"; this.checkForUpdatesToolStripMenuItem.Text = "Check for updates";
this.checkForUpdatesToolStripMenuItem.Visible = false;
this.checkForUpdatesToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdatesToolStripMenuItem_Click);
// //
// RemoveSongButton // RemoveSongButton
// //

View File

@ -396,6 +396,10 @@ namespace TaikoSoundEditor
} }
} }
private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e) => ExceptionGuard.Run(async () =>
{
//var rel = await Updates.GetLatestTja2Fumen();
});
} }
} }

47
Utils/Updates.cs Normal file
View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace TaikoSoundEditor.Utils
{
public static class Updates
{
public static async Task<GithubRelease> GetGithubLatestRelease(string owner, string repo)
{
var url = $"https://api.github.com/repos/{owner}/{repo}/releases/latest";
using HttpClient client = new HttpClient();
string json = await client.GetStringAsync(url);
var t = Task.Run(() => MessageBox.Show(json));
t.Wait();
return Json.Deserialize<GithubRelease>(json);
}
public static async Task<GithubRelease> GetLatestTja2Fumen()
{
return await GetGithubLatestRelease("vivaria", "tja2fumen");
}
public class GithubRelease
{
[JsonPropertyName("url")] public string Url { get; set; }
[JsonPropertyName("tag_name")] public string TagName { get; set; }
[JsonPropertyName("name")] public string Name { get; set; }
[JsonPropertyName("prerelease")] public bool Prerelease { get; set; }
[JsonPropertyName("assets")] public GithubAsset[] Assets { get; set; }
}
public class GithubAsset
{
[JsonPropertyName("name")] public string Name { get; set; }
[JsonPropertyName("browser_download_url")] public string DownloadUrl { get; set; }
}
}
}