diff --git a/Source/GrasscutterTools/Forms/FormMain.cs b/Source/GrasscutterTools/Forms/FormMain.cs
index f20d98f..1d8c682 100644
--- a/Source/GrasscutterTools/Forms/FormMain.cs
+++ b/Source/GrasscutterTools/Forms/FormMain.cs
@@ -142,7 +142,7 @@ namespace GrasscutterTools.Forms
{
try
{
- var info = Github.ReleaseAPI.GetReleasesLastest("jie65535", "GrasscutterCommandGenerator").Result;
+ var info = ReleaseAPI.GetReleasesLastest("jie65535", "GrasscutterCommandGenerator").Result;
if (Version.TryParse(info.TagName.Substring(1), out Version lastestVersion) && AppVersion < lastestVersion)
{
if (!string.IsNullOrEmpty(Settings.Default.CheckedLastVersion)
diff --git a/Source/GrasscutterTools/GrasscutterTools.csproj b/Source/GrasscutterTools/GrasscutterTools.csproj
index 3f61c01..9746611 100644
--- a/Source/GrasscutterTools/GrasscutterTools.csproj
+++ b/Source/GrasscutterTools/GrasscutterTools.csproj
@@ -85,7 +85,6 @@
-
@@ -102,6 +101,7 @@
+
FormGachaBannerEditor2.cs
diff --git a/Source/GrasscutterTools/Github/ReleaseAPI.cs b/Source/GrasscutterTools/Utils/ReleaseAPI.cs
similarity index 57%
rename from Source/GrasscutterTools/Github/ReleaseAPI.cs
rename to Source/GrasscutterTools/Utils/ReleaseAPI.cs
index ecbbe33..1317070 100644
--- a/Source/GrasscutterTools/Github/ReleaseAPI.cs
+++ b/Source/GrasscutterTools/Utils/ReleaseAPI.cs
@@ -1,32 +1,12 @@
-/**
- * Grasscutter Tools
- * Copyright (C) 2022 jie65535
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- **/
-using System;
+using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
-using GrasscutterTools.Utils;
-
using Newtonsoft.Json;
-namespace GrasscutterTools.Github
+namespace GrasscutterTools.Utils
{
- public static class ReleaseAPI
+ internal class ReleaseAPI
{
public static async Task GetReleasesLastest(string username, string repo)
{
@@ -36,6 +16,13 @@ namespace GrasscutterTools.Github
HttpHelper.HttpClient.DefaultRequestHeaders.UserAgent.Add(headerValue);
return await HttpHelper.GetAsync($"https://api.github.com/repos/{username}/{repo}/releases/latest");
}
+ catch
+ {
+ // 如果Github无法访问,尝试从Gitee获取
+ var release = await HttpHelper.GetAsync($"https://gitee.com/api/v5/repos/{username}/{repo}/releases/latest");
+ release.Url = $"https://gitee.com/{username}/{repo}/releases";
+ return release;
+ }
finally
{
HttpHelper.HttpClient.DefaultRequestHeaders.UserAgent.Remove(headerValue);