tried auto update
This commit is contained in:
parent
a0756e9072
commit
c2f763a29c
10
MainForm.Designer.cs
generated
10
MainForm.Designer.cs
generated
@ -857,14 +857,14 @@
|
||||
this.SortByIdToolStripMenuItem,
|
||||
this.NoSortToolStripMenuItem});
|
||||
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";
|
||||
//
|
||||
// SortByGenreToolStripMenuItem
|
||||
//
|
||||
this.SortByGenreToolStripMenuItem.CheckOnClick = true;
|
||||
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.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click);
|
||||
//
|
||||
@ -872,7 +872,7 @@
|
||||
//
|
||||
this.SortByIdToolStripMenuItem.CheckOnClick = true;
|
||||
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.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click);
|
||||
//
|
||||
@ -880,7 +880,7 @@
|
||||
//
|
||||
this.NoSortToolStripMenuItem.CheckOnClick = true;
|
||||
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.Click += new System.EventHandler(this.MusicOrderSortToolStripMenuItem_Click);
|
||||
//
|
||||
@ -889,6 +889,8 @@
|
||||
this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
|
||||
this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(115, 20);
|
||||
this.checkForUpdatesToolStripMenuItem.Text = "Check for updates";
|
||||
this.checkForUpdatesToolStripMenuItem.Visible = false;
|
||||
this.checkForUpdatesToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdatesToolStripMenuItem_Click);
|
||||
//
|
||||
// RemoveSongButton
|
||||
//
|
||||
|
@ -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
47
Utils/Updates.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user