mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 08:35:42 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34da90408f | ||
|
|
3cdfcfea85 |
+1
-49
@@ -1,53 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace EagleInstaller {
|
||||
public class CredentialManager {
|
||||
private const string RegistryKeyPath = @"SOFTWARE\Eagle0\Launcher";
|
||||
private const string ServerUrlValueName = "ServerUrl";
|
||||
private const string DefaultServerUrl = "https://assets.eagle0.net";
|
||||
|
||||
/// <summary>
|
||||
/// Loads saved server URL. Returns default if none found.
|
||||
/// </summary>
|
||||
public static string LoadServerUrl() {
|
||||
try {
|
||||
using (var key = Registry.CurrentUser.OpenSubKey(RegistryKeyPath, false)) {
|
||||
if (key != null) {
|
||||
var url = key.GetValue(ServerUrlValueName) as string;
|
||||
if (!string.IsNullOrEmpty(url)) { return url; }
|
||||
}
|
||||
}
|
||||
} catch (Exception) {
|
||||
// If anything fails, return default
|
||||
}
|
||||
return DefaultServerUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves server URL to registry.
|
||||
/// </summary>
|
||||
public static void SaveServerUrl(string serverUrl) {
|
||||
try {
|
||||
using (var key = Registry.CurrentUser.CreateSubKey(RegistryKeyPath)) {
|
||||
key.SetValue(ServerUrlValueName, serverUrl ?? DefaultServerUrl);
|
||||
}
|
||||
} catch (Exception) {
|
||||
// Ignore errors when saving
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears saved settings.
|
||||
/// </summary>
|
||||
public static void ClearSettings() {
|
||||
try {
|
||||
using (var key = Registry.CurrentUser.OpenSubKey(RegistryKeyPath, true)) {
|
||||
if (key != null) { key.DeleteValue(ServerUrlValueName, false); }
|
||||
}
|
||||
} catch (Exception) {
|
||||
// Ignore errors when clearing
|
||||
}
|
||||
}
|
||||
public const string ServerUrl = "https://assets.eagle0.net";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,9 @@ namespace EagleInstaller {
|
||||
private Label _statusLabel;
|
||||
private Button _exitButton;
|
||||
|
||||
public string ServerUrl { get; private set; }
|
||||
public string ServerUrl => CredentialManager.ServerUrl;
|
||||
|
||||
public MainForm(string serverUrl = null) {
|
||||
ServerUrl = serverUrl ?? CredentialManager.LoadServerUrl();
|
||||
InitializeComponent();
|
||||
}
|
||||
public MainForm() { InitializeComponent(); }
|
||||
|
||||
private void InitializeComponent() {
|
||||
// Form properties
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
manifest_name = eagle0_manifest.txt
|
||||
remote_manifest_prefix = assets/installer/
|
||||
remote_asset_prefix = assets/unity3d/win/
|
||||
remote_manifest_prefix = installer/
|
||||
remote_asset_prefix = unity3d/win/
|
||||
|
||||
Reference in New Issue
Block a user