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

Commit

Permalink
Ver 2.2.0-Alpha.7: Finished URL Protocol Handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiroiame-Kusu committed Sep 10, 2024
1 parent 32cc96d commit 703f68e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
7 changes: 2 additions & 5 deletions LoCyanFrpDesktop/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public partial class App : Application
private static string? Username = null;
private static string? Password = null;
private static bool DebugMode = Global.Config.DebugMode;
private static bool TokenMode = false;
public static bool TokenMode = false;
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();
Expand All @@ -56,10 +56,7 @@ protected override void OnStartup(StartupEventArgs e)
string[] args = e.Args;

ProcessStartupParameters(args);
if (!TokenMode)
{
base.OnStartup(e);
}
base.OnStartup(e);

}
protected override void OnExit(ExitEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion LoCyanFrpDesktop/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static class Global
public static bool LoginedByConsole = false;
public const string Version = "2.2.0";
public const string Branch = "Alpha";
public const int Revision = 6;
public const int Revision = 7;
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
20 changes: 15 additions & 5 deletions LoCyanFrpDesktop/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ public partial class MainWindow : UiWindow
private static string password;

public MainWindow()

Check warning on line 45 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 adding the 'required' modifier or declaring the field as nullable.

Check warning on line 45 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 adding the 'required' modifier or declaring the field as nullable.

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

View workflow job for this annotation

GitHub Actions / BuildForWindows

Non-nullable field 'token_auto' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
{
Init(App.TokenMode);
if (App.TokenMode)
{
this.Hide();
}



}
private void Init(bool TokenMode)
{
InitializeComponent();
if (Random.Shared.Next(0, 10000) == 5000)
Expand All @@ -57,14 +68,13 @@ public MainWindow()
Login(Global.Config.Username, ConvertToUnsecureString(Global.Password));
}
Tips.Text = Global.Tips[Random.Shared.Next(0, Global.Tips.Count - 1)];
CheckNetworkAvailability();
if (!TokenMode) CheckNetworkAvailability();
_Login.IsEnabled = true;
DataContext = this;
Access.MainWindow = this;
Update.Init();
ScheduledTask.Init();
ProtocolHandler.Init();

if (!TokenMode) Update.Init();
if (!TokenMode) ScheduledTask.Init();
if (!TokenMode) ProtocolHandler.Init();
}
private async void CheckNetworkAvailability()
{
Expand Down
2 changes: 1 addition & 1 deletion LoCyanFrpDesktop/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"LoCyanFrpDesktop": {
"commandName": "Project",
"commandLineArgs": "--debug"
"commandLineArgs": "--debug locyanfrp://7296178fe9bb7cb3b88d27bb700a81a6/55158"
}
}
}
2 changes: 1 addition & 1 deletion LoCyanFrpDesktop/Utils/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class Config
//public string Password = "";
public string FrpToken = "";
public string FrpcPath = "";
public bool DebugMode = false;
public bool DebugMode = true;
public bool AutoStartUp = false;
public int AppliedTheme = 0;
public List<Proxy> AutoLaunch = new();
Expand Down
2 changes: 1 addition & 1 deletion LoCyanFrpDesktop/Utils/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void Output(LogType type, params object?[] objects)
if (type == LogType.Error) {
Console.WriteLine("[Error] " + line); return;
}
Access.Status.Dispatcher.Invoke(() => Access.Status.Append(LogPreProcess.Color(type, line)));
try { Access.Status.Dispatcher.Invoke(() => Access.Status.Append(LogPreProcess.Color(type, line))); } catch (Exception e) { }
LogPreProcess.Process.Cache.Add(new(type, line));
if (LogPreProcess.Process.Cache.Count > 200)
{
Expand Down

0 comments on commit 703f68e

Please sign in to comment.