Skip to content

Commit

Permalink
Tackle problems of migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Nullkooland committed Nov 2, 2019
1 parent 7f8e48b commit 7dcd217
Show file tree
Hide file tree
Showing 37 changed files with 59 additions and 786 deletions.
3 changes: 0 additions & 3 deletions GBCLV3.Tests/AssetTest.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 0 additions & 3 deletions GBCLV3.Tests/InstallTest.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 0 additions & 3 deletions GBCLV3.Tests/LaunchTest.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions GBCLV3.Tests/LibraryTest.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions GBCLV3.Tests/ModTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Diagnostics;
using GBCLV3.Services;
using GBCLV3.Services.Launcher;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace GBCLV3.Tests
Expand Down
2 changes: 0 additions & 2 deletions GBCLV3.Tests/ResourcePackTest.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion GBCLV3.Tests/TestUtils.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Net;
using System.Net.Http;
using GBCLV3.Models;

namespace GBCLV3.Tests
{
Expand Down
1 change: 0 additions & 1 deletion GBCLV3.Tests/UpdateTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Diagnostics;
using System.Linq;
using GBCLV3.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace GBCLV3.Tests
Expand Down
3 changes: 0 additions & 3 deletions GBCLV3.Tests/VersionTest.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Binary file modified GBCLV3/Bootstrapper.cs
Binary file not shown.
1 change: 0 additions & 1 deletion GBCLV3/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged/>
<Costura/>
</Weavers>
86 changes: 0 additions & 86 deletions GBCLV3/FodyWeavers.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -33,92 +33,6 @@
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>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.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>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.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>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.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
Expand Down
14 changes: 10 additions & 4 deletions GBCLV3/GBCLV3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Resource Include="Resources\Images\*.png" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AdonisUI" Version="1.12.1" />
<PackageReference Include="AdonisUI.ClassicTheme">
<Version>1.12.0-preview2</Version>
<Version>1.12.1</Version>
</PackageReference>
<PackageReference Include="Costura.Fody">
<Version>4.1.0</Version>
<PackageReference Include="Fody" Version="6.0.4-beta.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Ookii.Dialogs.Wpf">
<Version>1.1.0</Version>
Expand All @@ -30,7 +36,7 @@
<Version>3.1.3</Version>
</PackageReference>
<PackageReference Include="Stylet">
<Version>1.2.0</Version>
<Version>1.3.0</Version>
</PackageReference>
</ItemGroup>

Expand Down
8 changes: 1 addition & 7 deletions GBCLV3/Models/Installation/Fabric.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
8 changes: 1 addition & 7 deletions GBCLV3/Models/Installation/OptiFine.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
5 changes: 0 additions & 5 deletions GBCLV3/Services/Installation/FabricInstallService.cs
Original file line number Diff line number Diff line change
@@ -1,15 +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;
Expand Down
9 changes: 7 additions & 2 deletions GBCLV3/Services/Installation/ForgeInstallService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task<IEnumerable<Forge>> GetDownloadListAsync(string id)
string json = await _client.GetStringAsync(FORGE_LIST_URL + id);
var forgeList = JsonSerializer.Deserialize<List<JForgeVersion>>(json);

var nums = id.Split('.')
int[] nums = id.Split('.')
.Select(numStr =>
{
if (int.TryParse(numStr, out int num))
Expand Down Expand Up @@ -135,7 +135,12 @@ public async Task<Version> 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");
Expand Down
8 changes: 1 addition & 7 deletions GBCLV3/Services/Installation/OptifineInstallService.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
1 change: 0 additions & 1 deletion GBCLV3/Services/Launcher/LaunchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions GBCLV3/Services/ModService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public async Task<IEnumerable<Mod>> MoveLoadAll(IEnumerable<string> 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);
Expand All @@ -85,7 +85,7 @@ private static Mod Load(string path)
{
using var archive = ZipFile.OpenRead(path);
bool isEnabled = path.EndsWith(".jar");
if (!isEnabled) path = path.Substring(0, path.Length - 9);
if (!isEnabled) path = path[0..^9];

var info = archive.GetEntry("mcmod.info");
if (info != null)
Expand Down
5 changes: 2 additions & 3 deletions GBCLV3/Services/ResourcePackService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,7 +51,7 @@ public ResourcePackService(GamePathService gamePathService)
if (line.StartsWith("resourcePacks"))
{
// Extract “resourcePacks:[${enabledPackIDs}]”
enabledPackIDs = line.Substring(15, line.Length - 16)
enabledPackIDs = line[15..^1]
.Split(',')
.Select(id => id.Trim('\"'))
.ToArray();
Expand Down Expand Up @@ -113,7 +112,7 @@ public async Task<IEnumerable<ResourcePack>> MoveLoadAll(IEnumerable<string> 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);
Expand Down
8 changes: 4 additions & 4 deletions GBCLV3/Services/ThemeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions GBCLV3/Utils/CryptUtil.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.IO;
using System.Security.Cryptography;
using System.Text;

Expand Down
9 changes: 9 additions & 0 deletions GBCLV3/Utils/SystemUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ public static string GetJavaDir()
}
}

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);
Expand Down
2 changes: 1 addition & 1 deletion GBCLV3/ViewModels/DownloadViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 1 addition & 3 deletions GBCLV3/ViewModels/FabricInstallViewModel.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading

0 comments on commit 7dcd217

Please sign in to comment.