diff --git a/GBCLV3.Tests/AssetTest.cs b/GBCLV3.Tests/AssetTest.cs index 239886d..7699617 100644 --- a/GBCLV3.Tests/AssetTest.cs +++ b/GBCLV3.Tests/AssetTest.cs @@ -1,8 +1,5 @@ using System.Diagnostics; using System.Linq; -using GBCLV3.Models; -using GBCLV3.Services; -using GBCLV3.Services.Launcher; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GBCLV3.Tests diff --git a/GBCLV3.Tests/GBCLV3.Tests.csproj b/GBCLV3.Tests/GBCLV3.Tests.csproj index e77a1d1..edee4f9 100644 --- a/GBCLV3.Tests/GBCLV3.Tests.csproj +++ b/GBCLV3.Tests/GBCLV3.Tests.csproj @@ -56,12 +56,6 @@ - - - {d0538262-7697-4a67-804d-1bfc6fdd141b} - GBCLV3 - - 2.0.0 diff --git a/GBCLV3.Tests/InstallTest.cs b/GBCLV3.Tests/InstallTest.cs index 4c9862b..f0906a4 100644 --- a/GBCLV3.Tests/InstallTest.cs +++ b/GBCLV3.Tests/InstallTest.cs @@ -1,8 +1,5 @@ using System.Diagnostics; using System.Linq; -using GBCLV3.Services; -using GBCLV3.Services.Launcher; -using GBCLV3.Services.Installation; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GBCLV3.Tests diff --git a/GBCLV3.Tests/LaunchTest.cs b/GBCLV3.Tests/LaunchTest.cs index cba4a93..24e8d3b 100644 --- a/GBCLV3.Tests/LaunchTest.cs +++ b/GBCLV3.Tests/LaunchTest.cs @@ -1,8 +1,5 @@ using System.Diagnostics; using System.Linq; -using GBCLV3.Models.Launcher; -using GBCLV3.Services; -using GBCLV3.Services.Launcher; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GBCLV3.Tests diff --git a/GBCLV3.Tests/LibraryTest.cs b/GBCLV3.Tests/LibraryTest.cs index bcb7cd0..e692208 100644 --- a/GBCLV3.Tests/LibraryTest.cs +++ b/GBCLV3.Tests/LibraryTest.cs @@ -1,9 +1,5 @@ using System.Diagnostics; using System.Linq; -using GBCLV3.Models; -using GBCLV3.Models.Launcher; -using GBCLV3.Services; -using GBCLV3.Services.Launcher; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GBCLV3.Tests diff --git a/GBCLV3.Tests/ModTest.cs b/GBCLV3.Tests/ModTest.cs index 463db08..7ac7cb0 100644 --- a/GBCLV3.Tests/ModTest.cs +++ b/GBCLV3.Tests/ModTest.cs @@ -1,6 +1,4 @@ using System.Diagnostics; -using GBCLV3.Services; -using GBCLV3.Services.Launcher; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GBCLV3.Tests diff --git a/GBCLV3.Tests/ResourcePackTest.cs b/GBCLV3.Tests/ResourcePackTest.cs index af4fb17..94136b1 100644 --- a/GBCLV3.Tests/ResourcePackTest.cs +++ b/GBCLV3.Tests/ResourcePackTest.cs @@ -1,7 +1,5 @@ using System.Diagnostics; using System.Linq; -using GBCLV3.Services; -using GBCLV3.Services.Launcher; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GBCLV3.Tests diff --git a/GBCLV3.Tests/TestUtils.cs b/GBCLV3.Tests/TestUtils.cs index d0cb282..6066e7c 100644 --- a/GBCLV3.Tests/TestUtils.cs +++ b/GBCLV3.Tests/TestUtils.cs @@ -1,6 +1,5 @@ using System.Net; using System.Net.Http; -using GBCLV3.Models; namespace GBCLV3.Tests { diff --git a/GBCLV3.Tests/UpdateTest.cs b/GBCLV3.Tests/UpdateTest.cs index a998c81..a07ed4d 100644 --- a/GBCLV3.Tests/UpdateTest.cs +++ b/GBCLV3.Tests/UpdateTest.cs @@ -1,6 +1,5 @@ using System.Diagnostics; using System.Linq; -using GBCLV3.Services; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GBCLV3.Tests diff --git a/GBCLV3.Tests/VersionTest.cs b/GBCLV3.Tests/VersionTest.cs index bf13472..18d82bd 100644 --- a/GBCLV3.Tests/VersionTest.cs +++ b/GBCLV3.Tests/VersionTest.cs @@ -1,8 +1,5 @@ using System.Diagnostics; using System.Linq; -using GBCLV3.Models; -using GBCLV3.Services; -using GBCLV3.Services.Launcher; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GBCLV3.Tests diff --git a/GBCLV3.sln b/GBCLV3.sln index 2bc81fc..130ad20 100644 --- a/GBCLV3.sln +++ b/GBCLV3.sln @@ -3,30 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28803.352 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GBCLV3", "GBCLV3\GBCLV3.csproj", "{D0538262-7697-4A67-804D-1BFC6FDD141B}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GBCLV3.Tests", "GBCLV3.Tests\GBCLV3.Tests.csproj", "{EC2B8F3E-4270-4D6A-AFFD-1677BB36F256}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GBCLV3", "GBCLV3\GBCLV3.csproj", "{509B9E05-0B99-448A-B2E4-E1E0ED105D47}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 - Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D0538262-7697-4A67-804D-1BFC6FDD141B}.Debug|Any CPU.ActiveCfg = Debug|x64 - {D0538262-7697-4A67-804D-1BFC6FDD141B}.Debug|x64.ActiveCfg = Debug|x64 - {D0538262-7697-4A67-804D-1BFC6FDD141B}.Debug|x64.Build.0 = Debug|x64 - {D0538262-7697-4A67-804D-1BFC6FDD141B}.Release|Any CPU.ActiveCfg = Release|x64 - {D0538262-7697-4A67-804D-1BFC6FDD141B}.Release|x64.ActiveCfg = Release|x64 - {D0538262-7697-4A67-804D-1BFC6FDD141B}.Release|x64.Build.0 = Release|x64 - {EC2B8F3E-4270-4D6A-AFFD-1677BB36F256}.Debug|Any CPU.ActiveCfg = Debug|x64 {EC2B8F3E-4270-4D6A-AFFD-1677BB36F256}.Debug|x64.ActiveCfg = Debug|x64 {EC2B8F3E-4270-4D6A-AFFD-1677BB36F256}.Debug|x64.Build.0 = Debug|x64 - {EC2B8F3E-4270-4D6A-AFFD-1677BB36F256}.Release|Any CPU.ActiveCfg = Release|x64 {EC2B8F3E-4270-4D6A-AFFD-1677BB36F256}.Release|x64.ActiveCfg = Release|x64 {EC2B8F3E-4270-4D6A-AFFD-1677BB36F256}.Release|x64.Build.0 = Release|x64 + {509B9E05-0B99-448A-B2E4-E1E0ED105D47}.Debug|x64.ActiveCfg = Debug|x64 + {509B9E05-0B99-448A-B2E4-E1E0ED105D47}.Debug|x64.Build.0 = Debug|x64 + {509B9E05-0B99-448A-B2E4-E1E0ED105D47}.Release|x64.ActiveCfg = Release|x64 + {509B9E05-0B99-448A-B2E4-E1E0ED105D47}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/GBCLV3/Bootstrapper.cs b/GBCLV3/Bootstrapper.cs index 452edae..816cc38 100644 Binary files a/GBCLV3/Bootstrapper.cs and b/GBCLV3/Bootstrapper.cs differ diff --git a/GBCLV3/FodyWeavers.xml b/GBCLV3/FodyWeavers.xml index 3ffe73c..035f97a 100644 --- a/GBCLV3/FodyWeavers.xml +++ b/GBCLV3/FodyWeavers.xml @@ -1,5 +1,4 @@  - \ No newline at end of file diff --git a/GBCLV3/FodyWeavers.xsd b/GBCLV3/FodyWeavers.xsd index 112d363..2f1b8aa 100644 --- a/GBCLV3/FodyWeavers.xsd +++ b/GBCLV3/FodyWeavers.xsd @@ -33,92 +33,6 @@ - - - - - - A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks - - - - - A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. - - - - - A list of unmanaged 32 bit assembly names to include, delimited with line breaks. - - - - - A list of unmanaged 64 bit assembly names to include, delimited with line breaks. - - - - - The order of preloaded assemblies, delimited with line breaks. - - - - - - This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. - - - - - Controls if .pdbs for reference assemblies are also embedded. - - - - - Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. - - - - - As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. - - - - - Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. - - - - - Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. - - - - - A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | - - - - - A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. - - - - - A list of unmanaged 32 bit assembly names to include, delimited with |. - - - - - A list of unmanaged 64 bit assembly names to include, delimited with |. - - - - - The order of preloaded assemblies, delimited with |. - - - - diff --git a/GBCLV3/GBCLV3.csproj b/GBCLV3/GBCLV3.csproj index ec542b8..de8f442 100644 --- a/GBCLV3/GBCLV3.csproj +++ b/GBCLV3/GBCLV3.csproj @@ -1,412 +1,39 @@ - - - - - + + - Debug - AnyCPU - {D0538262-7697-4A67-804D-1BFC6FDD141B} WinExe + netcoreapp3.0 + true GBCLV3 GBCL - v4.7.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - app.manifest - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - + false enderman.ico + GBCLV3.App + true + win10-x64 + false + true + AnyCPU;x64 - - - + + + DEBUG;TRACE + - - ..\packages\AdonisUI.1.12.0-preview2\lib\net45\AdonisUI.dll - - - ..\packages\AdonisUI.ClassicTheme.1.12.0-preview2\lib\net45\AdonisUI.ClassicTheme.dll - - - ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll - - - ..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0-preview9.19421.4\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll - - - - ..\packages\Ookii.Dialogs.Wpf.1.1.0\lib\net45\Ookii.Dialogs.Wpf.dll - - - ..\packages\PropertyChanged.Fody.3.1.3\lib\net40\PropertyChanged.dll - - - ..\packages\Stylet.1.2.0\lib\net45\Stylet.dll - - - - ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll - - - - - - - - ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.6.0-preview5.19224.8\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0-preview9.19421.4\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll - - - - - ..\packages\System.Text.Encodings.Web.4.6.0-preview9.19421.4\lib\netstandard2.0\System.Text.Encodings.Web.dll - - - ..\packages\System.Text.Json.4.6.0-preview9.19421.4\lib\net461\System.Text.Json.dll - - - ..\packages\System.Threading.Tasks.Extensions.4.6.0-preview.18571.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll - - - ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - - - - - - - - False - Microsoft .NET Framework 4.7.2 %28x86 和 x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - - - - + + - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + - - - - - 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - - - - - + \ No newline at end of file diff --git a/GBCLV3/Models/Installation/Fabric.cs b/GBCLV3/Models/Installation/Fabric.cs index 90b0252..74f99fc 100644 --- a/GBCLV3/Models/Installation/Fabric.cs +++ b/GBCLV3/Models/Installation/Fabric.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Documents; +using System.Collections.Generic; using GBCLV3.Models.JsonClasses; -using GBCLV3.Models.Launcher; namespace GBCLV3.Models.Installation { diff --git a/GBCLV3/Models/Installation/OptiFine.cs b/GBCLV3/Models/Installation/OptiFine.cs index e26eb6c..ec3c91f 100644 --- a/GBCLV3/Models/Installation/OptiFine.cs +++ b/GBCLV3/Models/Installation/OptiFine.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GBCLV3.Models.Installation +namespace GBCLV3.Models.Installation { class OptiFine { diff --git a/GBCLV3/Properties/AssemblyInfo.cs b/GBCLV3/Properties/AssemblyInfo.cs index 678f7ce..d0205de 100644 --- a/GBCLV3/Properties/AssemblyInfo.cs +++ b/GBCLV3/Properties/AssemblyInfo.cs @@ -11,8 +11,8 @@ [assembly: AssemblyCopyright("Copyright © Goose Bomb 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("3.0.5.50")] -[assembly: AssemblyFileVersion("3.0.5.50")] +[assembly: AssemblyVersion("3.0.6.54")] +[assembly: AssemblyFileVersion("3.0.6.54")] [assembly: ComVisible(false)] diff --git a/GBCLV3/Services/Installation/FabricInstallService.cs b/GBCLV3/Services/Installation/FabricInstallService.cs index ab9d9ee..472a432 100644 --- a/GBCLV3/Services/Installation/FabricInstallService.cs +++ b/GBCLV3/Services/Installation/FabricInstallService.cs @@ -1,14 +1,10 @@ using System; -using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Net.Http; -using System.Runtime.InteropServices; -using System.Text; using System.Text.Json; using System.Threading.Tasks; -using System.Windows.Documents; -using GBCLV3.Models; using GBCLV3.Models.Installation; using GBCLV3.Models.JsonClasses; using GBCLV3.Services.Launcher; @@ -53,8 +49,23 @@ public FabricInstallService( public async Task> GetDownloadListAsync(string id) { - string json = await _client.GetStringAsync(FABRIC_LIST_URL + id); - return JsonSerializer.Deserialize>(json, _jsonOptions); + try + { + string json = await _client.GetStringAsync(FABRIC_LIST_URL + id); + return JsonSerializer.Deserialize>(json, _jsonOptions); + } + catch (HttpRequestException ex) + { + Debug.WriteLine(ex.ToString()); + return null; + } + catch (OperationCanceledException) + { + // Timeout + Debug.WriteLine("[ERROR] Get fabric download list timeout"); + return null; + } + } public Version Install(Fabric fabric) diff --git a/GBCLV3/Services/Installation/ForgeInstallService.cs b/GBCLV3/Services/Installation/ForgeInstallService.cs index 3f03fb8..5a6a481 100644 --- a/GBCLV3/Services/Installation/ForgeInstallService.cs +++ b/GBCLV3/Services/Installation/ForgeInstallService.cs @@ -59,7 +59,7 @@ public async Task> GetDownloadListAsync(string id) string json = await _client.GetStringAsync(FORGE_LIST_URL + id); var forgeList = JsonSerializer.Deserialize>(json); - var nums = id.Split('.') + int[] nums = id.Split('.') .Select(numStr => { if (int.TryParse(numStr, out int num)) @@ -135,7 +135,12 @@ public async Task ManualInstall(Forge forge) // Just a dummy json...but required by forge installer if (!File.Exists(profilePath)) File.WriteAllText(profilePath, "{}"); - var process = Process.Start(installerPath); + var process = Process.Start(new ProcessStartInfo + { + FileName = installerPath, + UseShellExecute = true, + }); + await Task.Run(() => process.WaitForExit()); File.Delete(installerPath); File.Delete($"{forge.GameVersion}-{forge.Version}-installer.jar.log"); @@ -162,19 +167,15 @@ public Version AutoInstall(Forge forge) return null; } - using (var archive = ZipFile.OpenRead(jarPath)) - { - var entry = archive.GetEntry("version.json"); + using var archive = ZipFile.OpenRead(jarPath); + var entry = archive.GetEntry("version.json"); - using (var reader = new StreamReader(entry.Open(), Encoding.UTF8)) - { - string json = reader.ReadToEnd(); - string versionID = $"{forge.GameVersion}-forge-{forge.Version}"; + using var reader = new StreamReader(entry.Open(), Encoding.UTF8); + string json = reader.ReadToEnd(); + string versionID = $"{forge.GameVersion}-forge-{forge.Version}"; - json = Regex.Replace(json, "\"id\":\\s\".*\"", $"\"id\": \"{versionID}\""); - return _versionService.AddNew(json); - } - } + json = Regex.Replace(json, "\"id\":\\s\".*\"", $"\"id\": \"{versionID}\""); + return _versionService.AddNew(json); } #endregion diff --git a/GBCLV3/Services/Installation/OptifineInstallService.cs b/GBCLV3/Services/Installation/OptifineInstallService.cs index 639fdb6..94d1aeb 100644 --- a/GBCLV3/Services/Installation/OptifineInstallService.cs +++ b/GBCLV3/Services/Installation/OptifineInstallService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GBCLV3.Services.Installation +namespace GBCLV3.Services.Installation { class OptiFineInstallService { diff --git a/GBCLV3/Services/Launcher/AssetService.cs b/GBCLV3/Services/Launcher/AssetService.cs index d7ccfc8..6cf8e7b 100644 --- a/GBCLV3/Services/Launcher/AssetService.cs +++ b/GBCLV3/Services/Launcher/AssetService.cs @@ -48,13 +48,12 @@ public bool LoadAllObjects(AssetsInfo info) if (info.Objects != null) return true; - using (var sr = new StreamReader(jsonPath, Encoding.UTF8)) - { - var opetions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; - var jasset = JsonSerializer.Deserialize(sr.ReadToEnd(), opetions); - info.Objects = jasset.objects; - return true; - } + using var reader = new StreamReader(jsonPath, Encoding.UTF8); + var opetions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; + var jasset = JsonSerializer.Deserialize(reader.ReadToEnd(), opetions); + + info.Objects = jasset.objects; + return true; } public async Task> CheckIntegrityAsync(AssetsInfo info) diff --git a/GBCLV3/Services/Launcher/LaunchService.cs b/GBCLV3/Services/Launcher/LaunchService.cs index f7ef373..863a739 100644 --- a/GBCLV3/Services/Launcher/LaunchService.cs +++ b/GBCLV3/Services/Launcher/LaunchService.cs @@ -2,7 +2,6 @@ using System.Diagnostics; using System.Linq; using System.Text; -using System.Threading; using System.Threading.Tasks; using GBCLV3.Models.Launcher; using GBCLV3.Utils; diff --git a/GBCLV3/Services/Launcher/LibraryService.cs b/GBCLV3/Services/Launcher/LibraryService.cs index 3483b04..1b4c95b 100644 --- a/GBCLV3/Services/Launcher/LibraryService.cs +++ b/GBCLV3/Services/Launcher/LibraryService.cs @@ -38,13 +38,11 @@ public void ExtractNatives(IEnumerable nativeLibraries) foreach (var native in nativeLibraries) { - using (var archive = ZipFile.OpenRead($"{_gamePathService.LibrariesDir}/{native.Path}")) + using var archive = ZipFile.OpenRead($"{_gamePathService.LibrariesDir}/{native.Path}"); + // You know what, the "Exclude" property is a joke... + foreach (var entry in archive.Entries.Where(e => !e.FullName.StartsWith("META-INF"))) { - // You know what, the "Exclude" property is a joke... - foreach (var entry in archive.Entries.Where(e => !e.FullName.StartsWith("META-INF"))) - { - entry.ExtractToFile($"{_gamePathService.NativesDir}/{entry.FullName}", true); - } + entry.ExtractToFile($"{_gamePathService.NativesDir}/{entry.FullName}", true); } } } diff --git a/GBCLV3/Services/ModService.cs b/GBCLV3/Services/ModService.cs index db20160..1d8e5a4 100644 --- a/GBCLV3/Services/ModService.cs +++ b/GBCLV3/Services/ModService.cs @@ -66,7 +66,7 @@ public async Task> MoveLoadAll(IEnumerable paths) return await Task.Run(() => paths.Select(path => { - var dstPath = $"{_gamePathService.ModsDir}/{Path.GetFileName(path)}"; + string dstPath = $"{_gamePathService.ModsDir}/{Path.GetFileName(path)}"; if (File.Exists(dstPath)) return null; File.Move(path, dstPath); @@ -83,61 +83,57 @@ public async Task> MoveLoadAll(IEnumerable paths) private static Mod Load(string path) { - using (var archive = ZipFile.OpenRead(path)) + using var archive = ZipFile.OpenRead(path); + bool isEnabled = path.EndsWith(".jar"); + if (!isEnabled) path = path[0..^9]; + + var info = archive.GetEntry("mcmod.info"); + if (info != null) { - bool isEnabled = path.EndsWith(".jar"); - if (!isEnabled) path = path.Substring(0, path.Length - 9); + using var reader = new StreamReader(info.Open(), Encoding.UTF8); + JMod jmod = null; - var info = archive.GetEntry("mcmod.info"); - if (info != null) + try + { + // This is utterly ugly...thanks to the capriciousness of modders + jmod = JsonSerializer.Deserialize(reader.ReadToEnd())[0]; + } + catch (JsonException ex) { - using (var reader = new StreamReader(info.Open(), Encoding.UTF8)) - { - JMod jmod = null; - - try - { - // This is utterly ugly...thanks to the capriciousness of modders - jmod = JsonSerializer.Deserialize(reader.ReadToEnd())[0]; - } - catch (JsonException ex) - { - Debug.WriteLine(ex.ToString()); - } - - if (jmod?.modList != null) - { - // I don't understand what are these modders thinking... - jmod = jmod.modList[0]; - } - - string[] authorList = jmod?.authorList ?? jmod?.authors; - string auhtors = (authorList != null) ? string.Join(", ", authorList) : null; - - return new Mod - { - Name = jmod?.name ?? Path.GetFileNameWithoutExtension(path), - FileName = Path.GetFileName(path), - Description = jmod?.description.Split('.')[0], // Make it terse! - Version = jmod?.version, - GameVersion = jmod?.mcversion, - Url = jmod?.url, - Authors = auhtors, - Path = path, - IsEnabled = isEnabled, - }; - } + Debug.WriteLine(ex.ToString()); } + if (jmod?.modList != null) + { + // I don't understand what are these modders thinking... + jmod = jmod.modList[0]; + } + + string[] authorList = jmod?.authorList ?? jmod?.authors; + string auhtors = (authorList != null) ? string.Join(", ", authorList) : null; + return new Mod { - Name = Path.GetFileNameWithoutExtension(path), + Name = jmod?.name ?? Path.GetFileNameWithoutExtension(path), FileName = Path.GetFileName(path), - Description = "no comment", + Description = jmod?.description.Split('.')[0], // Make it terse! + Version = jmod?.version, + GameVersion = jmod?.mcversion, + Url = jmod?.url, + Authors = auhtors, Path = path, IsEnabled = isEnabled, }; } + + return new Mod + { + Name = Path.GetFileNameWithoutExtension(path), + FileName = Path.GetFileName(path), + Description = "no comment", + Path = path, + IsEnabled = isEnabled, + }; } #endregion diff --git a/GBCLV3/Services/ResourcePackService.cs b/GBCLV3/Services/ResourcePackService.cs index 8f268fd..b8f88c2 100644 --- a/GBCLV3/Services/ResourcePackService.cs +++ b/GBCLV3/Services/ResourcePackService.cs @@ -3,7 +3,6 @@ using System.IO; using System.IO.Compression; using System.Linq; -using System.Runtime.InteropServices; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; @@ -45,20 +44,18 @@ public ResourcePackService(GamePathService gamePathService) if (File.Exists(optionsFile)) { - using (var reader = new StreamReader(optionsFile, Encoding.Default)) + using var reader = new StreamReader(optionsFile, Encoding.Default); + string line; + while ((line = reader.ReadLine()) != null) { - string line; - while ((line = reader.ReadLine()) != null) + if (line.StartsWith("resourcePacks")) { - if (line.StartsWith("resourcePacks")) - { - // Extract “resourcePacks:[${enabledPackIDs}]” - enabledPackIDs = line.Substring(15, line.Length - 16) - .Split(',') - .Select(id => id.Trim('\"')) - .ToArray(); - break; - } + // Extract “resourcePacks:[${enabledPackIDs}]” + enabledPackIDs = line[15..^1] + .Split(',') + .Select(id => id.Trim('\"')) + .ToArray(); + break; } } } @@ -115,7 +112,7 @@ public async Task> MoveLoadAll(IEnumerable pat return await Task.Run(() => paths.Select(path => { - var dstPath = $"{_gamePathService.ResourcePacksDir}/{Path.GetFileName(path)}"; + string dstPath = $"{_gamePathService.ResourcePacksDir}/{Path.GetFileName(path)}"; if (File.Exists(dstPath)) return null; var pack = LoadZip(dstPath, null); @@ -142,10 +139,8 @@ public bool IsValid(string path) { try { - using (var archive = ZipFile.OpenRead(path)) - { - return (archive.GetEntry("pack.mcmeta") != null); - } + using var archive = ZipFile.OpenRead(path); + return (archive.GetEntry("pack.mcmeta") != null); } catch { @@ -155,33 +150,29 @@ public bool IsValid(string path) private static ResourcePack LoadZip(string path, string[] enabledPackIDs) { - using (var archive = ZipFile.OpenRead(path)) + using var archive = ZipFile.OpenRead(path); + ZipArchiveEntry infoEntry; + if ((infoEntry = archive.GetEntry("pack.mcmeta")) == null) { - ZipArchiveEntry infoEntry; - if ((infoEntry = archive.GetEntry("pack.mcmeta")) == null) - { - return null; - } - - var pack = ReadInfo(infoEntry.Open()); - pack.Path = path; - pack.IsEnabled = enabledPackIDs?.Contains(pack.Name) ?? false; - pack.IsExtracted = false; + return null; + } - // Load cover image (if exists) - ZipArchiveEntry imgEntry; - if ((imgEntry = archive.GetEntry("pack.png")) != null) - { - using (var es = imgEntry.Open()) - using (var ms = new MemoryStream()) - { - es.CopyTo(ms); - pack.Image = ReadImage(ms); - } - } + var pack = ReadInfo(infoEntry.Open()); + pack.Path = path; + pack.IsEnabled = enabledPackIDs?.Contains(pack.Name) ?? false; + pack.IsExtracted = false; - return pack; + // Load cover image (if exists) + ZipArchiveEntry imgEntry; + if ((imgEntry = archive.GetEntry("pack.png")) != null) + { + using var es = imgEntry.Open(); + using var ms = new MemoryStream(); + es.CopyTo(ms); + pack.Image = ReadImage(ms); } + + return pack; } private static ResourcePack LoadDir(string packDir, string[] enabledPackIDs) @@ -202,10 +193,8 @@ private static ResourcePack LoadDir(string packDir, string[] enabledPackIDs) // Load cover image (if exists) if (File.Exists(imgPath)) { - using (var fs = File.OpenRead(imgPath)) - { - pack.Image = ReadImage(fs); - } + using var fs = File.OpenRead(imgPath); + pack.Image = ReadImage(fs); } return pack; @@ -213,16 +202,14 @@ private static ResourcePack LoadDir(string packDir, string[] enabledPackIDs) private static ResourcePack ReadInfo(Stream infoStream) { - using (var reader = new StreamReader(infoStream, Encoding.UTF8)) - { - var info = JsonSerializer.Deserialize(reader.ReadToEnd()); + using var reader = new StreamReader(infoStream, Encoding.UTF8); + var info = JsonSerializer.Deserialize(reader.ReadToEnd()); - return new ResourcePack - { - Format = info.pack.pack_format, - Description = info.pack.description, - }; - } + return new ResourcePack + { + Format = info.pack.pack_format, + Description = info.pack.description, + }; } private static BitmapImage ReadImage(Stream imgStream) diff --git a/GBCLV3/Services/ThemeService.cs b/GBCLV3/Services/ThemeService.cs index 2fcf743..1d47603 100644 --- a/GBCLV3/Services/ThemeService.cs +++ b/GBCLV3/Services/ThemeService.cs @@ -40,10 +40,10 @@ public string FontWeight private const string ICONS_SOURCE = "/GBCL;component/Resources/Styles/Icons.xaml"; private const string DEFAULT_BACKGROUND_IMAGE = "pack://application:,,,/Resources/Images/default_background.png"; - private static readonly Color REF_COLOR_SPIKE = Color.FromRgb(15, 105, 200); - private static readonly Color REF_COLOR_BULLZEYE = Color.FromRgb(210, 50, 55); - private static readonly Color REF_COLOR_TBONE = Color.FromRgb(165, 125, 10); - private static readonly Color REF_COLOR_STEGZ = Color.FromRgb(105, 175, 5); + private static readonly Color REF_COLOR_SPIKE = Color.FromRgb(15, 105, 200); + private static readonly Color REF_COLOR_BULLZEYE = Color.FromRgb(210, 50, 55); + private static readonly Color REF_COLOR_TBONE = Color.FromRgb(165, 125, 10); + private static readonly Color REF_COLOR_STEGZ = Color.FromRgb(105, 175, 5); private readonly Config _config; diff --git a/GBCLV3/Utils/CryptUtil.cs b/GBCLV3/Utils/CryptUtil.cs index 232cd9a..7dfa9b7 100644 --- a/GBCLV3/Utils/CryptUtil.cs +++ b/GBCLV3/Utils/CryptUtil.cs @@ -1,95 +1,35 @@ -using System; -using System.IO; +using System.IO; using System.Security.Cryptography; using System.Text; namespace GBCLV3.Utils { - /// - /// - /// static class CryptUtil { - private const string _key = "🐮🍺😹🍻"; - private const string _iv = "🤣🔫🐸🕶"; - - public static string EncryptString(string str) - { - if (string.IsNullOrEmpty(str)) - { - return null; - } - - byte[] key = Encoding.Unicode.GetBytes(_key); - byte[] iv = Encoding.Unicode.GetBytes(_iv); - byte[] data = Encoding.Default.GetBytes(str); - - using (var aes = new AesCryptoServiceProvider() { Mode = CipherMode.CFB }) - using (var ms = new MemoryStream()) - using (var cs = new CryptoStream(ms, aes.CreateEncryptor(key, iv), CryptoStreamMode.Write)) - { - cs.Write(data, 0, data.Length); - cs.FlushFinalBlock(); - return Convert.ToBase64String(ms.ToArray()); - } - } - - public static string DecryptString(string str) - { - if (string.IsNullOrEmpty(str)) - { - return null; - } - - byte[] key = Encoding.Unicode.GetBytes(_key); - byte[] iv = Encoding.Unicode.GetBytes(_iv); - byte[] data = Convert.FromBase64String(str); - - using (var aes = new AesCryptoServiceProvider() { Mode = CipherMode.CFB }) - using (var ms = new MemoryStream()) - using (var cs = new CryptoStream(ms, aes.CreateDecryptor(key, iv), CryptoStreamMode.Write)) - { - cs.Write(data, 0, data.Length); - try - { - cs.FlushFinalBlock(); - } - catch - { - return null; - } - return Encoding.Default.GetString(ms.ToArray()); - } - } - public static string GetStringMD5(string str) { - using (var md5Provider = new MD5CryptoServiceProvider()) - { - byte[] md5Bytes = md5Provider.ComputeHash(Encoding.UTF8.GetBytes(str)); - var sb = new StringBuilder(32); + using var md5Provider = new MD5CryptoServiceProvider(); + byte[] md5Bytes = md5Provider.ComputeHash(Encoding.UTF8.GetBytes(str)); + var sb = new StringBuilder(32); - foreach (byte b in md5Bytes) - { - sb.Append(b.ToString("x2")); - } - return sb.ToString(); + foreach (byte b in md5Bytes) + { + sb.Append(b.ToString("x2")); } + return sb.ToString(); } public static string GetFileSHA1(string path) { - using (var sha1Provider = new SHA1CryptoServiceProvider()) - { - byte[] sha1Bytes = sha1Provider.ComputeHash(File.OpenRead(path)); - var sb = new StringBuilder(40); + using var sha1Provider = new SHA1CryptoServiceProvider(); + byte[] sha1Bytes = sha1Provider.ComputeHash(File.OpenRead(path)); + var sb = new StringBuilder(40); - foreach (byte b in sha1Bytes) - { - sb.Append(b.ToString("x2")); - } - return sb.ToString(); + foreach (byte b in sha1Bytes) + { + sb.Append(b.ToString("x2")); } + return sb.ToString(); } } } \ No newline at end of file diff --git a/GBCLV3/Utils/SystemUtil.cs b/GBCLV3/Utils/SystemUtil.cs index 0e814cd..3167944 100644 --- a/GBCLV3/Utils/SystemUtil.cs +++ b/GBCLV3/Utils/SystemUtil.cs @@ -3,7 +3,6 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using Microsoft.VisualBasic.Devices; using Microsoft.VisualBasic.FileIO; using Microsoft.Win32; @@ -15,15 +14,12 @@ public static string GetJavaDir() { try { - using (var localMachineKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) - using (var javaKey = localMachineKey.OpenSubKey(@"SOFTWARE\JavaSoft\Java Runtime Environment\")) - { - string currentVersion = javaKey.GetValue("CurrentVersion").ToString(); - using (var subkey = javaKey.OpenSubKey(currentVersion)) - { - return subkey.GetValue("JavaHome").ToString() + @"\bin"; - } - } + using var localMachineKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); + using var javaKey = localMachineKey.OpenSubKey(@"SOFTWARE\JavaSoft\Java Runtime Environment\"); + + string currentVersion = javaKey.GetValue("CurrentVersion").ToString(); + using var subkey = javaKey.OpenSubKey(currentVersion); + return subkey.GetValue("JavaHome").ToString() + @"\bin"; } catch (Exception ex) { @@ -32,7 +28,20 @@ public static string GetJavaDir() } } - public static uint GetAvailableMemory() => (uint)(new ComputerInfo().AvailablePhysicalMemory >> 20); + public static void OpenLink(string url) + { + Process.Start(new ProcessStartInfo + { + FileName = url, + UseShellExecute = true, + }); + } + + public static uint GetAvailableMemory() + { + using var counter = new PerformanceCounter("Memory", "Available MBytes", true); + return (uint)counter.NextValue(); + } public static uint GetRecommendedMemory() => (uint)Math.Pow(2.0, Math.Floor(Math.Log(GetAvailableMemory(), 2.0))); diff --git a/GBCLV3/ViewModels/DownloadViewModel.cs b/GBCLV3/ViewModels/DownloadViewModel.cs index 9788ba2..c0d7975 100644 --- a/GBCLV3/ViewModels/DownloadViewModel.cs +++ b/GBCLV3/ViewModels/DownloadViewModel.cs @@ -85,7 +85,7 @@ public void Setup(DownloadType type, DownloadService downloadService) private static string GetBytesProgressText(int downloaded, int total) { - string GetMB(int bytes) => (bytes / (1024.0 * 1024.0)).ToString("0.00"); + static string GetMB(int bytes) => (bytes / (1024.0 * 1024.0)).ToString("0.00"); // In case don't know the sizes of downloads in advance if (downloaded >= total) { diff --git a/GBCLV3/ViewModels/FabricInstallViewModel.cs b/GBCLV3/ViewModels/FabricInstallViewModel.cs index de8de45..feb64b6 100644 --- a/GBCLV3/ViewModels/FabricInstallViewModel.cs +++ b/GBCLV3/ViewModels/FabricInstallViewModel.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using System.Windows; using GBCLV3.Models; @@ -103,13 +101,11 @@ public async void InstallSelected(Fabric fabric) private async Task StartDownloadAsync(DownloadType type, IEnumerable items) { - using (var downloadService = new DownloadService(items)) - { - _downloadVM.Setup(type, downloadService); - this.ActivateItem(_downloadVM); + using var downloadService = new DownloadService(items); + _downloadVM.Setup(type, downloadService); + this.ActivateItem(_downloadVM); - return await downloadService.StartAsync(); - } + return await downloadService.StartAsync(); } protected override async void OnActivate() diff --git a/GBCLV3/ViewModels/ForgeInstallViewModel.cs b/GBCLV3/ViewModels/ForgeInstallViewModel.cs index 1b144e6..52be168 100644 --- a/GBCLV3/ViewModels/ForgeInstallViewModel.cs +++ b/GBCLV3/ViewModels/ForgeInstallViewModel.cs @@ -134,13 +134,11 @@ public async void InstallSelected(Forge forge) private async Task StartDownloadAsync(DownloadType type, IEnumerable items) { - using (var downloadService = new DownloadService(items)) - { - _downloadVM.Setup(type, downloadService); - this.ActivateItem(_downloadVM); + using var downloadService = new DownloadService(items); + _downloadVM.Setup(type, downloadService); + this.ActivateItem(_downloadVM); - return await downloadService.StartAsync(); - } + return await downloadService.StartAsync(); } protected override async void OnActivate() diff --git a/GBCLV3/ViewModels/GameInstallViewModel.cs b/GBCLV3/ViewModels/GameInstallViewModel.cs index aff39be..cd6cc49 100644 --- a/GBCLV3/ViewModels/GameInstallViewModel.cs +++ b/GBCLV3/ViewModels/GameInstallViewModel.cs @@ -157,13 +157,11 @@ public async void InstallSelectedVersion(VersionDownload download) private async Task StartDownloadAsync(DownloadType type, IEnumerable items) { - using (var downloadService = new DownloadService(items)) - { - _downloadVM.Setup(type, downloadService); - this.ActivateItem(_downloadVM); + using var downloadService = new DownloadService(items); + _downloadVM.Setup(type, downloadService); + this.ActivateItem(_downloadVM); - return await downloadService.StartAsync(); - } + return await downloadService.StartAsync(); } protected override async void OnActivate() diff --git a/GBCLV3/ViewModels/GameSettingsViewModel.cs b/GBCLV3/ViewModels/GameSettingsViewModel.cs index 6eaa297..6134cc3 100644 --- a/GBCLV3/ViewModels/GameSettingsViewModel.cs +++ b/GBCLV3/ViewModels/GameSettingsViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.IO; using System.Windows.Controls; using GBCLV3.Models; @@ -15,6 +14,8 @@ class GameSettingsViewModel : Screen { #region Private Members + const string JRE_DOWNLOAD_URL = "https://bmclapi.bangbang93.com/java/jre_x64.exe"; + // IoC private readonly Config _config; private readonly LanguageService _languageService; @@ -135,6 +136,7 @@ public bool IsUseToken set { _config.UseToken = value; + if (value && _config.AccessToken == null) _config.UseToken = false; } } @@ -182,7 +184,7 @@ public void SelectJrePath() } } - public void DonwloadJreInstaller() => Process.Start("https://bmclapi.bangbang93.com/java/jre_x64.exe"); + public void DonwloadJreInstaller() => SystemUtil.OpenLink(JRE_DOWNLOAD_URL); public void SelectGameDir() { diff --git a/GBCLV3/ViewModels/LauncherSettingsViewModel.cs b/GBCLV3/ViewModels/LauncherSettingsViewModel.cs index 2cc63e7..73eb699 100644 --- a/GBCLV3/ViewModels/LauncherSettingsViewModel.cs +++ b/GBCLV3/ViewModels/LauncherSettingsViewModel.cs @@ -30,7 +30,7 @@ public LauncherSettingsViewModel( LanguageService languageService, UpdateService updateService, ThemeService themeService, - + UpdateViewModel updateVM, IWindowManager windowManager) { diff --git a/GBCLV3/ViewModels/ModViewModel.cs b/GBCLV3/ViewModels/ModViewModel.cs index 054ac54..c9243bc 100644 --- a/GBCLV3/ViewModels/ModViewModel.cs +++ b/GBCLV3/ViewModels/ModViewModel.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -8,6 +7,7 @@ using GBCLV3.Models; using GBCLV3.Services; using GBCLV3.Services.Launcher; +using GBCLV3.Utils; using Stylet; using StyletIoC; @@ -83,10 +83,10 @@ public async void Reload() public void OpenDir() { Directory.CreateDirectory(_gamePathService.ModsDir); - Process.Start(_gamePathService.ModsDir); + SystemUtil.OpenLink(_gamePathService.ModsDir); } - public void OpenLink(string url) => Process.Start(url); + public void OpenLink(string url) => SystemUtil.OpenLink(url); public void SelectionChanged(ListBox _, SelectionChangedEventArgs e) { diff --git a/GBCLV3/ViewModels/Pages/AboutViewModel.cs b/GBCLV3/ViewModels/Pages/AboutViewModel.cs index d9b605b..7f07766 100644 --- a/GBCLV3/ViewModels/Pages/AboutViewModel.cs +++ b/GBCLV3/ViewModels/Pages/AboutViewModel.cs @@ -1,7 +1,4 @@ -using System.Diagnostics; -using GBCLV3.Models; -using GBCLV3.Services; -using GBCLV3.Utils; +using GBCLV3.Utils; using Stylet; using StyletIoC; @@ -50,7 +47,7 @@ public AboutViewModel(IWindowManager windowManager) public string Forge => "Support Minecraft Forge"; public string ForgePage => "https://www.patreon.com/LexManos"; - public void OpenLink(string url) => Process.Start(url); + public void OpenLink(string url) => SystemUtil.OpenLink(url); public void DontStop() => _windowManager.ShowMessageBox("${DontStop}", "${FlowerOfHope}"); diff --git a/GBCLV3/ViewModels/Pages/LaunchViewModel.cs b/GBCLV3/ViewModels/Pages/LaunchViewModel.cs index 87588b4..7018200 100644 --- a/GBCLV3/ViewModels/Pages/LaunchViewModel.cs +++ b/GBCLV3/ViewModels/Pages/LaunchViewModel.cs @@ -133,10 +133,7 @@ public LaunchViewModel( public string SelectedVersionID { get => _config.SelectedVersion; - set - { - _config.SelectedVersion = value; - } + set => _config.SelectedVersion = value; } public bool CanLaunch { get; private set; } @@ -303,18 +300,16 @@ private async Task StartDownloadAsync(DownloadType type, IEnumerable DisabledPacks { get; private set; } - public void OpenDir() => Process.Start(_gamePathService.ResourcePacksDir); + public void OpenDir() => SystemUtil.OpenLink(_gamePathService.ResourcePacksDir); - public void Open(string path) => Process.Start(path); + public void Open(string path) => SystemUtil.OpenLink(path); public async void Delete(ResourcePack pack) { diff --git a/GBCLV3/ViewModels/VersionsManagementViewModel.cs b/GBCLV3/ViewModels/VersionsManagementViewModel.cs index 738eaeb..2099e54 100644 --- a/GBCLV3/ViewModels/VersionsManagementViewModel.cs +++ b/GBCLV3/ViewModels/VersionsManagementViewModel.cs @@ -1,12 +1,11 @@ using System; -using System.Diagnostics; using System.IO; using System.Windows; using GBCLV3.Models; using GBCLV3.Models.Installation; -using GBCLV3.Models.Launcher; using GBCLV3.Services; using GBCLV3.Services.Launcher; +using GBCLV3.Utils; using Stylet; using StyletIoC; using Version = GBCLV3.Models.Launcher.Version; @@ -76,13 +75,13 @@ public bool IsSegregateVersions public void OpenDir() { string versionsDir = $"{_gamePathService.VersionsDir}/{SelectedVersionID}"; - if (Directory.Exists(versionsDir)) Process.Start(versionsDir); + if (Directory.Exists(versionsDir)) SystemUtil.OpenLink(versionsDir); } public void OpenJson() { string jsonPath = $"{_gamePathService.VersionsDir}/{SelectedVersionID}/{SelectedVersionID}.json"; - if (File.Exists(jsonPath)) Process.Start(jsonPath); + if (File.Exists(jsonPath)) SystemUtil.OpenLink(jsonPath); } public async void Delete() diff --git a/GBCLV3/ViewModels/Windows/ErrorReportViewModel.cs b/GBCLV3/ViewModels/Windows/ErrorReportViewModel.cs index 5d003d2..a53bdb7 100644 --- a/GBCLV3/ViewModels/Windows/ErrorReportViewModel.cs +++ b/GBCLV3/ViewModels/Windows/ErrorReportViewModel.cs @@ -1,5 +1,4 @@ -using System.Diagnostics; -using System.Media; +using System.Media; using System.Windows; using GBCLV3.Models; using GBCLV3.Services; @@ -13,7 +12,7 @@ class ErrorReportViewModel : Screen { #region Private Members - private const string _issuesUrl = "https://github.com/Goose-Bomb/GBCLV3/issues"; + private const string ISSUES_URL = "https://github.com/Goose-Bomb/GBCLV3/issues"; private string _errorMessage; #endregion @@ -48,7 +47,7 @@ public string ErrorMessage public void Close() => this.RequestClose(); - public void Report() => Process.Start(_issuesUrl); + public void Report() => SystemUtil.OpenLink(ISSUES_URL); public void CopyMessage() => Clipboard.SetText(ErrorMessage, TextDataFormat.UnicodeText); diff --git a/GBCLV3/ViewModels/Windows/MainViewModel.cs b/GBCLV3/ViewModels/Windows/MainViewModel.cs index 075dccd..9b37dcd 100644 Binary files a/GBCLV3/ViewModels/Windows/MainViewModel.cs and b/GBCLV3/ViewModels/Windows/MainViewModel.cs differ diff --git a/GBCLV3/packages.config b/GBCLV3/packages.config deleted file mode 100644 index 78e2b2b..0000000 --- a/GBCLV3/packages.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Screenshots/en_blur_behind.png b/Screenshots/en_blur_behind.png new file mode 100644 index 0000000..7e69ec2 Binary files /dev/null and b/Screenshots/en_blur_behind.png differ