Skip to content

Commit

Permalink
Merge pull request #13 from Goose-Bomb/dev
Browse files Browse the repository at this point in the history
Ready for 5th release version
  • Loading branch information
Nullkooland authored Sep 6, 2019
2 parents e972823 + 3b542b1 commit fe8596b
Show file tree
Hide file tree
Showing 49 changed files with 775 additions and 125 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.user
*.userosscache
*.sln.docstates
changelog.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
6 changes: 4 additions & 2 deletions GBCLV3.Tests/GBCLV3.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssetTest.cs" />
Expand All @@ -51,6 +52,7 @@
<Compile Include="ResourcePackTest.cs" />
<Compile Include="InstallTest.cs" />
<Compile Include="UpdateTest.cs" />
<Compile Include="TestUtils.cs" />
<Compile Include="VersionTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand All @@ -62,10 +64,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter">
<Version>2.0.0-beta4</Version>
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>2.0.0-beta4</Version>
<Version>2.0.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
Expand Down
43 changes: 29 additions & 14 deletions GBCLV3.Tests/InstallTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
using System.Linq;
using GBCLV3.Services;
using GBCLV3.Services.Launcher;
using GBCLV3.Services.Installation;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace GBCLV3.Tests
{
[TestClass]
public class InstallTest
{
private const string GAME_ROOT_DIR = "G:/Minecraft/1.12.2/.minecraft";
private const string ID = "1.12.2";
private const string GAME_ROOT_DIR = "G:/Minecraft/1.14.4/.minecraft";
private const string ID = "1.14.4";

private readonly ConfigService _configService;
private readonly VersionService _versionService;
private readonly ForgeInstallService _forgeInstallService;
private readonly FabricInstallService _fabricInstallService;

public InstallTest()
{
Expand All @@ -30,6 +32,7 @@ public InstallTest()

_versionService = new VersionService(gamePathService, urlServie);
_forgeInstallService = new ForgeInstallService(gamePathService, urlServie, _versionService);
_fabricInstallService = new FabricInstallService(gamePathService, _versionService);
}

[TestMethod]
Expand All @@ -49,30 +52,42 @@ public void GetVersionDownloadListTest()
}

[TestMethod]
public void GetForgeDownloadListTest()
public void ForgeInstallTest()
{
var forgeDownloads = _forgeInstallService.GetDownloadListAsync(ID).Result;
var forges = _forgeInstallService.GetDownloadListAsync(ID).Result.Take(5);

Debug.WriteLine($"[Available Forge Downloads for {ID}]");

foreach (var download in forgeDownloads)
foreach (var forge in forges)
{
Debug.WriteLine("---------------------------------------------------------------");
Debug.WriteLine($"ID: {download.Build}");
Debug.WriteLine($"Version: {download.Version}");
Debug.WriteLine($"Date: {download.ReleaseTime}");
Debug.WriteLine($"ID: {forge.Build}");
Debug.WriteLine($"Version: {forge.Version}");
Debug.WriteLine($"Date: {forge.ReleaseTime}");
}

var installer = _forgeInstallService.GetDownload(forges.Last()).FirstOrDefault();

Debug.WriteLine($"[Latest Forge Installer]");

Debug.WriteLine($"Name: {installer.Name}");
Debug.WriteLine($"Path: {installer.Path}");
Debug.WriteLine($"Url: {installer.Url}");
}

[TestMethod]
public void ForgeInstallTest()
public void FabricInstallTest()
{
var forgeDownloads = _forgeInstallService.GetDownloadListAsync(ID).Result;
var installer = _forgeInstallService.GetDownload(forgeDownloads.Last(), true).FirstOrDefault();
var fabrics = _fabricInstallService.GetDownloadListAsync(ID).Result.Take(5);

Debug.WriteLine($"[Available Fabric Downloads for {ID}]");

Debug.WriteLine($"Name: {installer.Name}");
Debug.WriteLine($"Path: {installer.Path}");
Debug.WriteLine($"Url: {installer.Url}");
foreach (var fabric in fabrics)
{
Debug.WriteLine("---------------------------------------------------------------");
Debug.WriteLine($"ID: {fabric.Loader.Build}");
Debug.WriteLine($"Version: {fabric.Loader.Version}");
}
}
}
}
11 changes: 6 additions & 5 deletions GBCLV3.Tests/LibraryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ public void GetDownloadsTest()
Debug.WriteLine($"downloads TotalBytes: {totalBytes}");

Debug.WriteLine("[Library Downloads]");
foreach (var item in downloads)
foreach (var download in downloads)
{
Debug.WriteLine("---------------------------------------------------------------");
Debug.WriteLine($"Name: {item.Name}");
Debug.WriteLine($"Size: {item.Size}");
Debug.WriteLine($"Url: {item.Url}");
Debug.WriteLine($"Path: {item.Path}");
Debug.WriteLine($"Name: {download.Name}");
Debug.WriteLine($"Path: {download.Path}");
Debug.WriteLine($"Size: {download.Size}");
Debug.WriteLine($"Url: {download.Url}");
Debug.WriteLine($"Downloadable: {TestUtils.IsDownloadable(download)}");
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions GBCLV3.Tests/TestUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Net;
using System.Net.Http;
using GBCLV3.Models;

namespace GBCLV3.Tests
{
static class TestUtils
{
private static readonly HttpClient _client = new HttpClient();

public static bool IsDownloadable(DownloadItem item)
{
using (var response = _client.GetAsync(item.Url).Result)
{
return (response.StatusCode == HttpStatusCode.OK);
}
}
}
}
Binary file modified GBCLV3/App.xaml
Binary file not shown.
Binary file modified GBCLV3/Bootstrapper.cs
Binary file not shown.
33 changes: 26 additions & 7 deletions GBCLV3/GBCLV3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0-preview8.19405.3\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0-preview9.19421.4\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Ookii.Dialogs.Wpf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=66aa232afad40158, processorArchitecture=MSIL">
Expand Down Expand Up @@ -102,15 +102,15 @@
<HintPath>..\packages\System.Numerics.Vectors.4.6.0-preview5.19224.8\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0-preview8.19405.3\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0-preview9.19421.4\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Text.Encodings.Web, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.4.6.0-preview8.19405.3\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
<HintPath>..\packages\System.Text.Encodings.Web.4.6.0-preview9.19421.4\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.4.6.0-preview8.19405.3\lib\net461\System.Text.Json.dll</HintPath>
<HintPath>..\packages\System.Text.Json.4.6.0-preview9.19421.4\lib\net461\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0-preview.18571.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
Expand Down Expand Up @@ -138,8 +138,10 @@
</ApplicationDefinition>
<Compile Include="Behaviors\WindowBehavior.cs" />
<Compile Include="Models\ErrorReport.cs" />
<Compile Include="Models\Forge.cs" />
<Compile Include="Models\Install.cs" />
<Compile Include="Models\Installation\Fabric.cs" />
<Compile Include="Models\Installation\Forge.cs" />
<Compile Include="Models\Installation\Install.cs" />
<Compile Include="Models\Installation\OptiFine.cs" />
<Compile Include="Models\JsonClasses\JArguments.cs" />
<Compile Include="Models\JsonClasses\JForge.cs" />
<Compile Include="Models\Launcher\Asset.cs" />
Expand All @@ -159,8 +161,10 @@
<Compile Include="Models\Launcher\Version.cs" />
<Compile Include="Models\Save.cs" />
<Compile Include="Models\Update.cs" />
<Compile Include="Services\Installation\FabricInstallService.cs" />
<Compile Include="Services\Installation\OptiFineInstallService.cs" />
<Compile Include="Services\ThemeService.cs" />
<Compile Include="Services\ForgeInstallService.cs" />
<Compile Include="Services\Installation\ForgeInstallService.cs" />
<Compile Include="Services\Launcher\AssetService.cs" />
<Compile Include="Services\ConfigService.cs" />
<Compile Include="Services\DownloadService.cs" />
Expand All @@ -182,6 +186,7 @@
<Compile Include="Utils\LocalizedDescriptionAttribute.cs" />
<Compile Include="Utils\NativeUtil.cs" />
<Compile Include="Utils\VersionTypeIconConverter.cs" />
<Compile Include="ViewModels\FabricInstallViewModel.cs" />
<Compile Include="ViewModels\ForgeInstallViewModel.cs" />
<Compile Include="ViewModels\GameInstallViewModel.cs" />
<Compile Include="ViewModels\Pages\VersionsRootViewModel.cs" />
Expand Down Expand Up @@ -257,6 +262,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Styles\LinkButtonStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Styles\ListBoxStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -281,6 +290,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\FabricInstallView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ForgeInstallView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -380,6 +393,12 @@
<ItemGroup>
<Resource Include="Resources\Images\observer.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\snow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\glass.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.6.0.0\build\Fody.targets" Condition="Exists('..\packages\Fody.6.0.0\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
3 changes: 3 additions & 0 deletions GBCLV3/Models/Download.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ enum DownloadType

[LocalizedDescription("InstallForge")]
InstallForge,

[LocalizedDescription("InstallFabric")]
InstallFabric,
}

enum DownloadResult
Expand Down
58 changes: 58 additions & 0 deletions GBCLV3/Models/Installation/Fabric.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using GBCLV3.Models.JsonClasses;
using GBCLV3.Models.Launcher;

namespace GBCLV3.Models.Installation
{
class FabricLoader
{
public string Separator { get; set; }

public int Build { get; set; }

public string Maven { get; set; }

public string Version { get; set; }

public bool Stable { get; set; }
}

class FabricIntermediary
{
public string Maven { get; set; }

public string Version { get; set; }

public bool Stable { get; set; }
}

class FabricLibraries
{
public List<JLibrary> Common { get; set; }

public List<JLibrary> Client { get; set; }

public List<JLibrary> Server { get; set; }
}

class FabricMeta
{
public int Version { get; set; }

public FabricLibraries Libraries { get; set; }
}

class Fabric
{
public FabricLoader Loader { get; set; }

public FabricIntermediary Intermediary { get; set; }

public FabricMeta LauncherMeta { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace GBCLV3.Models
namespace GBCLV3.Models.Installation
{
class Forge
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
using System.ComponentModel;
using GBCLV3.Utils;

namespace GBCLV3.Models
namespace GBCLV3.Models.Installation
{
enum InstallType
{
Version,
Forge,
Fabric,
OptiFine,
}

[TypeConverter(typeof(EnumDescriptionTypeConverter))]
enum VersionInstallStatus
{
Expand Down Expand Up @@ -40,4 +48,17 @@ enum ForgeInstallStatus
[LocalizedDescription("ForgeDownloadingLibraries")]
DownloadingLibraries,
}

[TypeConverter(typeof(EnumDescriptionTypeConverter))]
enum FabricInstallStatus
{
[LocalizedDescription("FabricListLoading")]
ListLoading,

[LocalizedDescription("SelectFabricVersion")]
ListLoaded,

[LocalizedDescription("FabricDownloadingLibraries")]
DownloadingLibraries,
}
}
12 changes: 12 additions & 0 deletions GBCLV3/Models/Installation/OptiFine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GBCLV3.Models.Installation
{
class OptiFine
{
}
}
1 change: 0 additions & 1 deletion GBCLV3/Models/Launcher/Launch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ enum AfterLaunchBehavior
}

[TypeConverter(typeof(EnumDescriptionTypeConverter))]

enum LaunchStatus
{
Downloading,
Expand Down
Loading

0 comments on commit fe8596b

Please sign in to comment.