-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,448 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 2 additions & 123 deletions
125
CollapseLauncher/CollapseLauncher/Classes/Properties/GameConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,131 +1,10 @@ | ||
using System; | ||
using System.IO; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Drawing; | ||
using System.Threading.Tasks; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Windowing; | ||
|
||
using Windows.UI.ViewManagement; | ||
using Windows.Graphics.Display; | ||
|
||
using Hi3Helper.Preset; | ||
using Hi3Helper.Data; | ||
using Hi3Helper.Screen; | ||
|
||
using static Hi3Helper.Preset.ConfigStore; | ||
using Microsoft.UI.Windowing; | ||
|
||
namespace CollapseLauncher | ||
{ | ||
public struct AppIniStruct | ||
{ | ||
public IniFile Profile; | ||
public Stream ProfileStream; | ||
public string ProfilePath; | ||
} | ||
|
||
public enum GameInstallStateEnum | ||
{ | ||
Installed = 0, | ||
InstalledHavePreload = 1, | ||
NotInstalled = 2, | ||
NeedsUpdate = 3, | ||
GameBroken = 4, | ||
} | ||
|
||
public static class LauncherConfig | ||
public static class AppConfig | ||
{ | ||
public static AppWindow _apw; | ||
public static OverlappedPresenter _presenter; | ||
|
||
public static string startupBackgroundPath; | ||
public static RegionBackgroundProp regionBackgroundProp = new RegionBackgroundProp(); | ||
public static RegionResourceProp regionResourceProp = new RegionResourceProp(); | ||
public static PresetConfigClasses CurrentRegion = new PresetConfigClasses(); | ||
public static List<string> GameConfigName = new List<string>(); | ||
public static List<string> ScreenResolutionsList = new List<string>(); | ||
|
||
public static AppIniStruct appIni = new AppIniStruct(); | ||
|
||
public static string AppFolder = AppDomain.CurrentDomain.BaseDirectory; | ||
public static string AppDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "AppData", "LocalLow", "CollapseLauncher"); | ||
public static string AppGameFolder = Path.Combine(AppDataFolder, "GameFolder"); | ||
public static string AppConfigFile = Path.Combine(AppDataFolder, "config.ini"); | ||
|
||
public static bool RequireAdditionalDataDownload; | ||
public static bool IsThisRegionInstalled; | ||
public static GameInstallStateEnum GameInstallationState = GameInstallStateEnum.NotInstalled; | ||
|
||
public static void LoadGamePreset() | ||
{ | ||
AppGameFolder = Path.Combine(GetAppConfigValue("GameFolder").ToString()); | ||
LoadConfigFromFile(Path.Combine(AppFolder, "config", "fileconfig.json")); | ||
GameConfigName = Config.Select(x => x.ZoneName).ToList(); | ||
} | ||
|
||
public static void GetScreenResolutionString() | ||
{ | ||
foreach (ScreenResolution res in ScreenProp.screenResolutions) | ||
ScreenResolutionsList.Add(res.ToString()); | ||
} | ||
|
||
public static void LoadAppPreset() | ||
{ | ||
ScreenProp.InitScreenResolution(); | ||
GetCurrentScreenResolution(); | ||
GetScreenResolutionString(); | ||
if (!Directory.Exists(AppDataFolder)) | ||
Directory.CreateDirectory(AppDataFolder); | ||
|
||
appIni.Profile = new IniFile(); | ||
appIni.ProfilePath = AppConfigFile; | ||
|
||
if (!File.Exists(appIni.ProfilePath)) | ||
{ | ||
PrepareAppInstallation(); | ||
SaveAppConfig(); | ||
} | ||
|
||
LoadAppConfig(); | ||
startupBackgroundPath = GetAppConfigValue("CurrentBackground").ToString(); | ||
} | ||
|
||
private static void GetCurrentScreenResolution() | ||
{ | ||
var bounds = ApplicationView.GetForCurrentView().VisibleBounds; | ||
var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel; | ||
var size = new Size((int)((double)bounds.Width * scaleFactor), (int)((double)bounds.Height * scaleFactor)); | ||
} | ||
|
||
public static IniValue GetAppConfigValue(string key) => appIni.Profile["app"][key]; | ||
|
||
public static void LoadAppConfig() => appIni.Profile.Load(appIni.ProfileStream = new FileStream(appIni.ProfilePath, FileMode.Open, FileAccess.Read)); | ||
public static void SaveAppConfig() => appIni.Profile.Save(appIni.ProfileStream = new FileStream(appIni.ProfilePath, FileMode.OpenOrCreate, FileAccess.Write)); | ||
|
||
public static void PrepareAppInstallation() => BuildAppIniProfile(); | ||
|
||
static void BuildAppIniProfile() | ||
{ | ||
appIni.Profile.Add("app", new Dictionary<string, IniValue> | ||
{ | ||
{ "CurrentRegion", new IniValue(0) }, | ||
{ "CurrentBackground", new IniValue(@"Assets\BG\default_bg.png") }, | ||
{ "DownloadThread", new IniValue(16) }, | ||
{ "GameFolder", new IniValue(AppGameFolder) } | ||
}); | ||
|
||
SaveAppConfig(); | ||
} | ||
} | ||
|
||
public partial class MainPage : Page | ||
{ | ||
public void LoadConfig() | ||
{ | ||
ComboBoxGameRegion.ItemsSource = LauncherConfig.GameConfigName; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+597 KB
(110%)
CollapseLauncher/CollapseLauncher/CollapseLauncher.Invoker.exe
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.