JavaVersionCatalog
This commit is contained in:
@@ -9,12 +9,12 @@ namespace Млаумчерб.Клиент.сеть.NetworkTaskFactories;
|
||||
public class AssetsDownloadTaskFactory : INetworkTaskFactory
|
||||
{
|
||||
private const string ASSET_SERVER_URL = "https://resources.download.minecraft.net/";
|
||||
private VersionDescriptor _descriptor;
|
||||
private GameVersionDescriptor _descriptor;
|
||||
private SHA1 _hasher;
|
||||
private IOPath _indexFilePath;
|
||||
List<AssetDownloadProperties> _assetsToDownload = new();
|
||||
|
||||
public AssetsDownloadTaskFactory(VersionDescriptor descriptor)
|
||||
public AssetsDownloadTaskFactory(GameVersionDescriptor descriptor)
|
||||
{
|
||||
_descriptor = descriptor;
|
||||
_hasher = SHA1.Create();
|
||||
@@ -86,7 +86,7 @@ public class AssetsDownloadTaskFactory : INetworkTaskFactory
|
||||
public string url;
|
||||
public IOPath filePath;
|
||||
|
||||
public AssetDownloadProperties(string key, AssetProperties p)
|
||||
public AssetDownloadProperties(string key, GameAssetProperties p)
|
||||
{
|
||||
name = key;
|
||||
hash = p.hash;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Security.Cryptography;
|
||||
using EasyCompressor;
|
||||
using Млаумчерб.Клиент.классы;
|
||||
using static Млаумчерб.Клиент.сеть.Сеть;
|
||||
|
||||
@@ -6,15 +7,19 @@ namespace Млаумчерб.Клиент.сеть.NetworkTaskFactories;
|
||||
|
||||
public class JavaDownloadTaskFactory : INetworkTaskFactory
|
||||
{
|
||||
private VersionDescriptor _descriptor;
|
||||
private const string INDEX_URL =
|
||||
"https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json";
|
||||
private GameVersionDescriptor _descriptor;
|
||||
private IOPath _javaVersionDir;
|
||||
private SHA1 _hasher;
|
||||
IOPath _javaVersionDir;
|
||||
private LZMACompressor _lzma;
|
||||
|
||||
public JavaDownloadTaskFactory(VersionDescriptor descriptor)
|
||||
public JavaDownloadTaskFactory(GameVersionDescriptor descriptor)
|
||||
{
|
||||
_descriptor = descriptor;
|
||||
_hasher = SHA1.Create();
|
||||
_javaVersionDir = Пути.GetJavaRuntimeDir(_descriptor.javaVersion.component);
|
||||
_hasher = SHA1.Create();
|
||||
_lzma = new LZMACompressor();
|
||||
}
|
||||
|
||||
public Task<NetworkTask?> CreateAsync(bool checkHashes)
|
||||
@@ -31,16 +36,21 @@ public class JavaDownloadTaskFactory : INetworkTaskFactory
|
||||
|
||||
private bool CheckFiles(bool checkHashes)
|
||||
{
|
||||
//TODO: download catalog
|
||||
//TODO: download manifest for required runtime
|
||||
//TODO: check whether files from manifest exist and match hashes
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private long GetTotalSize()
|
||||
{
|
||||
//TODO: sum up size of all files invalidated by CheckFiles
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Task Download(NetworkProgressReporter pr, CancellationToken ct)
|
||||
{
|
||||
//TODO: download files using lzma decompression
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,13 @@ namespace Млаумчерб.Клиент.сеть.NetworkTaskFactories;
|
||||
|
||||
public class LibrariesDownloadTaskFactory : INetworkTaskFactory
|
||||
{
|
||||
private VersionDescriptor _descriptor;
|
||||
private GameVersionDescriptor _descriptor;
|
||||
private Libraries _libraries;
|
||||
private SHA1 _hasher;
|
||||
private List<Libraries.JarLib> _libsToDownload = new();
|
||||
private IOPath _nativesDir;
|
||||
|
||||
public LibrariesDownloadTaskFactory(VersionDescriptor descriptor, Libraries libraries)
|
||||
public LibrariesDownloadTaskFactory(GameVersionDescriptor descriptor, Libraries libraries)
|
||||
{
|
||||
_descriptor = descriptor;
|
||||
_libraries = libraries;
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace Млаумчерб.Клиент.сеть.NetworkTaskFactories;
|
||||
|
||||
public class VersionFileDownloadTaskFactory : INetworkTaskFactory
|
||||
{
|
||||
private VersionDescriptor _descriptor;
|
||||
private GameVersionDescriptor _descriptor;
|
||||
private IOPath _filePath;
|
||||
private SHA1 _hasher;
|
||||
|
||||
public VersionFileDownloadTaskFactory(VersionDescriptor descriptor)
|
||||
public VersionFileDownloadTaskFactory(GameVersionDescriptor descriptor)
|
||||
{
|
||||
_descriptor = descriptor;
|
||||
_filePath = Пути.GetVersionJarFilePath(_descriptor.id);
|
||||
|
||||
@@ -63,7 +63,7 @@ public static class Сеть
|
||||
try
|
||||
{
|
||||
var manifestText = await http.GetStringAsync(url);
|
||||
var catalog = JsonConvert.DeserializeObject<VersionCatalog>(manifestText);
|
||||
var catalog = JsonConvert.DeserializeObject<GameVersionCatalog>(manifestText);
|
||||
if (catalog != null)
|
||||
descriptors.AddRange(catalog.versions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user