Skip to content
This repository has been archived by the owner on Dec 22, 2024. It is now read-only.

Commit

Permalink
Ver 2.1.0-RC2: Remove Banner Because of Useless.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiroiame-Kusu committed Jun 12, 2024
1 parent a375adb commit 202c0d7
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 13 deletions.
4 changes: 1 addition & 3 deletions LoCyanFrpDesktop/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ protected override void OnStartup(StartupEventArgs e)
//string Password;
// 处理启动参数
string[] args = e.Args;
InitialBanner initialBanner = new();

initialBanner.Show();
base.OnStartup(e);

Thread.Sleep(3000);
//MainWindow mainWindow = new();
initialBanner.Hide();


if (args.Length > 0)
{
Expand Down
19 changes: 19 additions & 0 deletions LoCyanFrpDesktop/DashBoard.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ public DashBoard()
Uri iconUri = new Uri("pack://application:,,,/LoCyanFrpDesktop;component/Resource/favicon.ico", UriKind.RelativeOrAbsolute);
this.Icon = new BitmapImage(iconUri);
Access.DashBoard = this;
Task.Run(() => {
string Status;
if (CheckForUpdate(out Status))
{
//Output.Text = "检测到更新,如果没有自动更新记得自己去更新哦~";
Update.Init();
}

});

}
public bool CheckForUpdate(out string reason)
{
Console.WriteLine("Checking Update...");
bool a = false;
string Reason;
Update.CheckVersion(out a, out Reason);
reason = Reason;
return a;
}
public bool CheckIfFrpcInstalled()
{
Expand Down
2 changes: 1 addition & 1 deletion LoCyanFrpDesktop/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static class Global
public static bool LoginedByConsole = false;
public const string Version = "2.1.0";
public const string Branch = "RC";
public const int Revision = 1;
public const int Revision = 2;
public static readonly BuildInfo BuildInfo = new();
public const string Developer = "Shiroiame-Kusu & Daiyangcheng";
public const string Copyright = "Copyright © 2021 - 2024 杭州樱芸网络科技有限公司 All Rights Reserved";
Expand Down
5 changes: 4 additions & 1 deletion LoCyanFrpDesktop/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public partial class MainWindow : UiWindow
public static long Traffic;
public MainWindow()

Check warning on line 53 in LoCyanFrpDesktop/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows

Non-nullable field 'UserInfo' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 53 in LoCyanFrpDesktop/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows

Non-nullable field 'username_auto' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 53 in LoCyanFrpDesktop/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows

Non-nullable field 'UserInfo' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 53 in LoCyanFrpDesktop/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows

Non-nullable field 'username_auto' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 53 in LoCyanFrpDesktop/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows

Non-nullable field 'UserInfo' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
{

//InitialBanner initialBanner = new();

//initialBanner.Show();
//initialBanner.Hide();
InitializeComponent();
Uri iconUri = new Uri("pack://application:,,,/LoCyanFrpDesktop;component/Resource/favicon.ico", UriKind.RelativeOrAbsolute);
this.Icon = new BitmapImage(iconUri);
Expand Down
4 changes: 3 additions & 1 deletion LoCyanFrpDesktop/Utils/InitialBanner.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public InitialBanner()

}
public bool CheckForUpdate(out string reason)
{ bool a = false;
{
Console.WriteLine("Checking Update...");
bool a = false;
string Reason;
Update.CheckVersion(out a,out Reason);
reason = Reason;
Expand Down
8 changes: 7 additions & 1 deletion LoCyanFrpDesktop/Utils/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ public static void Output(LogType type, params object?[] objects)
{
line = line.TrimEnd(' ');
}
Access.Status.Dispatcher.Invoke(() => Access.Status.Append(LogPreProcess.Color(type, line)));
if (type == LogType.Debug || type == LogType.DetailDebug)
{
Console.WriteLine(line);
return;
}

Access.Status.Dispatcher.Invoke(() => Access.Status.Append(LogPreProcess.Color(type, line)));
LogPreProcess.Process.Cache.Add(new(type, line));
if (LogPreProcess.Process.Cache.Count > 200)
{
Expand Down
23 changes: 17 additions & 6 deletions LoCyanFrpDesktop/Utils/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,17 @@ public static void CheckVersion(out bool isProgramHasNewerVersion,out string Int
{
InterruptReason = "";
isProgramHasNewerVersion = false;
if (!Global.Branch.Equals("Release") || !Global.Branch.Equals("RC"))
if (!Global.Branch.Equals("Release") && !Global.Branch.Equals("RC"))
{
InterruptReason = "You Are On Preview Branch!!!";
return;
}


try
{
JObject? jsonObject = JsonConvert.DeserializeObject<JObject>(Net.Get("https://api.github.com/repos/LoCyan-Team/LoCyanFrpCSDesktop/releases/latest", "application/vnd.github.v3+json", "Hakuu").Await().Content.ReadAsStringAsync().Await());
{

JObject? jsonObject = JsonConvert.DeserializeObject<JObject>(Net.Get("https://api.github.com/repos/LoCyan-Team/LoCyanFrpCSDesktop/releases/latest", "application/vnd.github.v3+json", "LoCyanFrpCSDesktop").Await().Content.ReadAsStringAsync().Await());
if (jsonObject is null)
{
InterruptReason = "无法检测更新, 请检查网络连接";
Expand All @@ -92,7 +95,11 @@ public static void CheckVersion(out bool isProgramHasNewerVersion,out string Int
if (version != CurrentVersion)
{
isProgramHasNewerVersion = true;
DownloadNewVersion(jsonObject);

Console.WriteLine("Downloading...");
DownloadNewVersion(jsonObject);



}
}
Expand All @@ -104,8 +111,9 @@ public static void CheckVersion(out bool isProgramHasNewerVersion,out string Int
Logger.Output(LogType.Error, e.Message);
Logger.Output(LogType.Debug, e);

}
}
}


/// <summary>
/// 下载新版本
Expand Down Expand Up @@ -240,9 +248,12 @@ internal static class Net
_httpClient.DefaultRequestHeaders.AcceptCharset.Add(new StringWithQualityHeaderValue("UTF-8"));
_httpClient.DefaultRequestHeaders.Remove("user-agent");
_httpClient.DefaultRequestHeaders.Add("user-agent", userAgent);
_httpClient.Timeout = TimeSpan.FromSeconds(5);
HttpResponseMessage response = await _httpClient.GetAsync(url);
Logger.Output(LogType.DetailDebug, "Response Headers\n", response.Headers.ToString());
Logger.Output(LogType.DetailDebug, "Content\n", await response.Content.ReadAsStringAsync());
var content = await response.Content.ReadAsStringAsync();
Logger.Output(LogType.DetailDebug, "Content\n", content);
Console.WriteLine(content);
return response;
}
}
Expand Down

0 comments on commit 202c0d7

Please sign in to comment.