mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Wabbajack.Lib nullability finished up
This commit is contained in:
parent
a30bba2c0b
commit
806ff74893
@ -53,14 +53,14 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
public async Task CanNotifyOfInis()
|
public async Task CanNotifyOfInis()
|
||||||
{
|
{
|
||||||
var archive =
|
var archive =
|
||||||
new Archive
|
new Archive(
|
||||||
{
|
new NexusDownloader.State
|
||||||
State = new NexusDownloader.State
|
|
||||||
{
|
{
|
||||||
Game = Game.SkyrimSpecialEdition,
|
Game = Game.SkyrimSpecialEdition,
|
||||||
ModID = long.MaxValue >> 3,
|
ModID = long.MaxValue >> 3,
|
||||||
FileID = long.MaxValue >> 3,
|
FileID = long.MaxValue >> 3,
|
||||||
},
|
})
|
||||||
|
{
|
||||||
Name = Guid.NewGuid().ToString()
|
Name = Guid.NewGuid().ToString()
|
||||||
};
|
};
|
||||||
Assert.True(await AuthorAPI.UploadPackagedInis(new[] {archive}));
|
Assert.True(await AuthorAPI.UploadPackagedInis(new[] {archive}));
|
||||||
|
@ -121,19 +121,14 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var modListData = new ModList
|
var modListData = new ModList();
|
||||||
{
|
modListData.Archives.Add(
|
||||||
Archives = new List<Archive>
|
new Archive(new HTTPDownloader.State(MakeURL("test_archive.txt")))
|
||||||
{
|
|
||||||
new Archive
|
|
||||||
{
|
{
|
||||||
Hash = await test_archive_path.FileHashAsync(),
|
Hash = await test_archive_path.FileHashAsync(),
|
||||||
Name = "test_archive",
|
Name = "test_archive",
|
||||||
Size = test_archive_path.Size,
|
Size = test_archive_path.Size,
|
||||||
State = new HTTPDownloader.State(MakeURL("test_archive.txt"))
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var modListPath = "test_modlist.wabbajack".RelativeTo(Fixture.ServerPublicFolder);
|
var modListPath = "test_modlist.wabbajack".RelativeTo(Fixture.ServerPublicFolder);
|
||||||
|
|
||||||
|
@ -42,10 +42,9 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
{
|
{
|
||||||
Payload = new IndexJob
|
Payload = new IndexJob
|
||||||
{
|
{
|
||||||
Archive = new Archive
|
Archive = new Archive(new HTTPDownloader.State(MakeURL("old_file_data.random")))
|
||||||
{
|
{
|
||||||
Name = "Oldfile",
|
Name = "Oldfile",
|
||||||
State = new HTTPDownloader.State(MakeURL("old_file_data.random"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -54,10 +53,9 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
{
|
{
|
||||||
Payload = new IndexJob
|
Payload = new IndexJob
|
||||||
{
|
{
|
||||||
Archive = new Archive
|
Archive = new Archive(new HTTPDownloader.State(MakeURL("new_file_data.random")))
|
||||||
{
|
{
|
||||||
Name = "Newfile",
|
Name = "Newfile",
|
||||||
State = new HTTPDownloader.State(MakeURL("new_file_data.random"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -120,6 +118,5 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
Assert.True($"{oldDataHash.ToHex()}_{newDataHash.ToHex()}".RelativeTo(Fixture.ServerUpdatesFolder).IsFile);
|
Assert.True($"{oldDataHash.ToHex()}_{newDataHash.ToHex()}".RelativeTo(Fixture.ServerUpdatesFolder).IsFile);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,10 +102,9 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
Priority = Job.JobPriority.Low,
|
Priority = Job.JobPriority.Low,
|
||||||
Payload = new IndexJob
|
Payload = new IndexJob
|
||||||
{
|
{
|
||||||
Archive = new Archive
|
Archive = new Archive(data)
|
||||||
{
|
{
|
||||||
Name = entry.Name,
|
Name = entry.Name,
|
||||||
State = data
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -175,15 +175,19 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
var allMods = await api.GetModFiles(state.Game, state.ModID);
|
var allMods = await api.GetModFiles(state.Game, state.ModID);
|
||||||
var archive = allMods.files.Where(m => !string.IsNullOrEmpty(m.category_name))
|
var archive = allMods.files.Where(m => !string.IsNullOrEmpty(m.category_name))
|
||||||
.OrderBy(s => Math.Abs((long)s.size - origSize))
|
.OrderBy(s => Math.Abs((long)s.size - origSize))
|
||||||
.Select(s => new Archive {
|
.Select(s =>
|
||||||
Name = s.file_name,
|
new Archive(
|
||||||
Size = (long)s.size,
|
new NexusDownloader.State
|
||||||
State = new NexusDownloader.State
|
|
||||||
{
|
{
|
||||||
Game = state.Game,
|
Game = state.Game,
|
||||||
ModID = state.ModID,
|
ModID = state.ModID,
|
||||||
FileID = s.file_id
|
FileID = s.file_id
|
||||||
}}).FirstOrDefault();
|
})
|
||||||
|
{
|
||||||
|
Name = s.file_name,
|
||||||
|
Size = (long)s.size,
|
||||||
|
})
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (archive == null)
|
if (archive == null)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
|||||||
|
|
||||||
var with_hash = states.Where(state => state.Hash != default).ToList();
|
var with_hash = states.Where(state => state.Hash != default).ToList();
|
||||||
Utils.Log($"Inserting {with_hash.Count} jobs.");
|
Utils.Log($"Inserting {with_hash.Count} jobs.");
|
||||||
var jobs = states.Select(state => new IndexJob {Archive = new Archive {Name = state.GameFile.FileName.ToString(), State = state}})
|
var jobs = states.Select(state => new IndexJob {Archive = new Archive(state) { Name = state.GameFile.FileName.ToString()}})
|
||||||
.Select(j => new Job {Payload = j, RequiresNexus = j.UsesNexus})
|
.Select(j => new Job {Payload = j, RequiresNexus = j.UsesNexus})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -38,10 +38,9 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
|||||||
{
|
{
|
||||||
Payload = new IndexJob
|
Payload = new IndexJob
|
||||||
{
|
{
|
||||||
Archive = new Archive
|
Archive = new Archive(new MegaDownloader.State(url.ToString()))
|
||||||
{
|
{
|
||||||
Name = Guid.NewGuid() + ".7z",
|
Name = Guid.NewGuid() + ".7z",
|
||||||
State = new MegaDownloader.State(url.ToString())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -56,12 +56,11 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
|||||||
Priority = Job.JobPriority.High,
|
Priority = Job.JobPriority.High,
|
||||||
Payload = new IndexJob
|
Payload = new IndexJob
|
||||||
{
|
{
|
||||||
Archive = new Archive
|
Archive = new Archive(new HTTPDownloader.State(file.Uri))
|
||||||
{
|
{
|
||||||
Name = file.MungedName,
|
Name = file.MungedName,
|
||||||
Size = file.Size,
|
Size = file.Size,
|
||||||
Hash = file.Hash,
|
Hash = file.Hash,
|
||||||
State = new HTTPDownloader.State(file.Uri)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -519,9 +519,8 @@ namespace Wabbajack.BuildServer.Model.Models
|
|||||||
var result = await conn.QueryFirstOrDefaultAsync<string>(@"SELECT JsonState FROM dbo.DownloadStates
|
var result = await conn.QueryFirstOrDefaultAsync<string>(@"SELECT JsonState FROM dbo.DownloadStates
|
||||||
WHERE Hash = @hash AND PrimaryKey like 'NexusDownloader+State|%'",
|
WHERE Hash = @hash AND PrimaryKey like 'NexusDownloader+State|%'",
|
||||||
new {Hash = (long)startingHash});
|
new {Hash = (long)startingHash});
|
||||||
return result == null ? null : new Archive
|
return result == null ? null : new Archive(result.FromJsonString<AbstractDownloadState>())
|
||||||
{
|
{
|
||||||
State = result.FromJsonString<AbstractDownloadState>(),
|
|
||||||
Hash = startingHash
|
Hash = startingHash
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -531,9 +530,8 @@ namespace Wabbajack.BuildServer.Model.Models
|
|||||||
await using var conn = await Open();
|
await using var conn = await Open();
|
||||||
var result = await conn.QueryFirstOrDefaultAsync<(long Hash, string State)>(@"SELECT Hash, JsonState FROM dbo.DownloadStates WHERE PrimaryKey = @PrimaryKey",
|
var result = await conn.QueryFirstOrDefaultAsync<(long Hash, string State)>(@"SELECT Hash, JsonState FROM dbo.DownloadStates WHERE PrimaryKey = @PrimaryKey",
|
||||||
new {PrimaryKey = primaryKey});
|
new {PrimaryKey = primaryKey});
|
||||||
return result == default ? null : new Archive
|
return result == default ? null : new Archive(result.State.FromJsonString<AbstractDownloadState>())
|
||||||
{
|
{
|
||||||
State = result.State.FromJsonString<AbstractDownloadState>(),
|
|
||||||
Hash = Hash.FromLong(result.Hash)
|
Hash = Hash.FromLong(result.Hash)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ namespace Wabbajack.CLI.Verbs
|
|||||||
|
|
||||||
private static async Task<string> GetTextFileFromModlist(AbsolutePath archive, ModList modlist, RelativePath sourceID)
|
private static async Task<string> GetTextFileFromModlist(AbsolutePath archive, ModList modlist, RelativePath sourceID)
|
||||||
{
|
{
|
||||||
var installer = new MO2Installer(archive, modlist, default, default, null);
|
var installer = new MO2Installer(archive, modlist, default, default, parameters: null!);
|
||||||
byte[] bytes = await installer.LoadBytesFromPath(sourceID);
|
byte[] bytes = await installer.LoadBytesFromPath(sourceID);
|
||||||
return Encoding.Default.GetString(bytes);
|
return Encoding.Default.GetString(bytes);
|
||||||
}
|
}
|
||||||
@ -328,9 +328,9 @@ namespace Wabbajack.CLI.Verbs
|
|||||||
return header.Trim().Replace(" ", "").Replace(".", "");
|
return header.Trim().Replace(" ", "").Replace(".", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetModName(Archive a)
|
private static string? GetModName(Archive a)
|
||||||
{
|
{
|
||||||
var result = a.Name;
|
string? result = a.Name;
|
||||||
|
|
||||||
if (a.State is IMetaState metaState)
|
if (a.State is IMetaState metaState)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ namespace Wabbajack.CLI.Verbs
|
|||||||
public class DeleteFile : AVerb
|
public class DeleteFile : AVerb
|
||||||
{
|
{
|
||||||
[Option('n', "name", Required = true, HelpText = @"Full name (as returned by my-files) of the file")]
|
[Option('n', "name", Required = true, HelpText = @"Full name (as returned by my-files) of the file")]
|
||||||
public string? Name { get; set; }
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
protected override async Task<ExitCode> Run()
|
protected override async Task<ExitCode> Run()
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ namespace Wabbajack.CLI.Verbs
|
|||||||
new[] {state}
|
new[] {state}
|
||||||
.PMap(queue, async s =>
|
.PMap(queue, async s =>
|
||||||
{
|
{
|
||||||
await s.Download(new Archive {Name = Path.GetFileName(Output)}, (AbsolutePath)Output);
|
await s.Download(new Archive(state: null!) {Name = Path.GetFileName(Output)}, (AbsolutePath)Output);
|
||||||
}).Wait();
|
}).Wait();
|
||||||
|
|
||||||
File.WriteAllLines(Output + ".meta", state.GetMetaIni());
|
File.WriteAllLines(Output + ".meta", state.GetMetaIni());
|
||||||
|
@ -11,7 +11,7 @@ namespace Wabbajack.Common.Http
|
|||||||
{
|
{
|
||||||
public class Client
|
public class Client
|
||||||
{
|
{
|
||||||
public List<(string, string)> Headers = new List<(string, string)>();
|
public List<(string, string?)> Headers = new List<(string, string?)>();
|
||||||
public List<Cookie> Cookies = new List<Cookie>();
|
public List<Cookie> Cookies = new List<Cookie>();
|
||||||
public async Task<HttpResponseMessage> GetAsync(string url, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseHeadersRead)
|
public async Task<HttpResponseMessage> GetAsync(string url, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseHeadersRead)
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Security;
|
using System.Security;
|
||||||
using DynamicData;
|
using DynamicData;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
namespace Wabbajack.Common.StoreHandlers
|
namespace Wabbajack.Common.StoreHandlers
|
||||||
{
|
{
|
||||||
@ -21,9 +22,14 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
|
|
||||||
public class SteamWorkshopItem
|
public class SteamWorkshopItem
|
||||||
{
|
{
|
||||||
public SteamGame? Game;
|
public readonly SteamGame Game;
|
||||||
public int ItemID;
|
public int ItemID;
|
||||||
public int Size;
|
public int Size;
|
||||||
|
|
||||||
|
public SteamWorkshopItem(SteamGame game)
|
||||||
|
{
|
||||||
|
Game = game;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SteamHandler : AStoreHandler
|
public class SteamHandler : AStoreHandler
|
||||||
@ -202,14 +208,14 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
var bracketStart = 0;
|
var bracketStart = 0;
|
||||||
var bracketEnd = 0;
|
var bracketEnd = 0;
|
||||||
|
|
||||||
SteamWorkshopItem? currentItem = new SteamWorkshopItem();
|
SteamWorkshopItem? currentItem = new SteamWorkshopItem(game);
|
||||||
|
|
||||||
lines.Do(l =>
|
lines.Do(l =>
|
||||||
{
|
{
|
||||||
if (end)
|
if (end)
|
||||||
return;
|
return;
|
||||||
if (currentItem == null)
|
if (currentItem == null)
|
||||||
currentItem = new SteamWorkshopItem();
|
currentItem = new SteamWorkshopItem(game);
|
||||||
|
|
||||||
var currentLine = lines.IndexOf(l);
|
var currentLine = lines.IndexOf(l);
|
||||||
if (l.ContainsCaseInsensitive("\"appid\"") && !foundAppID)
|
if (l.ContainsCaseInsensitive("\"appid\"") && !foundAppID)
|
||||||
@ -271,7 +277,6 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
|
|
||||||
bracketStart = 0;
|
bracketStart = 0;
|
||||||
bracketEnd = 0;
|
bracketEnd = 0;
|
||||||
currentItem.Game = game;
|
|
||||||
game.WorkshopItems.Add(currentItem);
|
game.WorkshopItems.Add(currentItem);
|
||||||
|
|
||||||
Utils.Log($"Found Steam Workshop item {currentItem.ItemID}");
|
Utils.Log($"Found Steam Workshop item {currentItem.ItemID}");
|
||||||
|
@ -8,7 +8,6 @@ using System.Threading.Tasks;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.StatusFeed;
|
using Wabbajack.Common.StatusFeed;
|
||||||
using Wabbajack.VirtualFileSystem;
|
using Wabbajack.VirtualFileSystem;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,6 @@ using Wabbajack.VirtualFileSystem;
|
|||||||
using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
||||||
using File = Alphaleonis.Win32.Filesystem.File;
|
using File = Alphaleonis.Win32.Filesystem.File;
|
||||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
@ -243,10 +242,7 @@ namespace Wabbajack.Lib
|
|||||||
Error(
|
Error(
|
||||||
$"No download metadata found for {archive.Name}, please use MO2 to query info or add a .meta file and try again.");
|
$"No download metadata found for {archive.Name}, please use MO2 to query info or add a .meta file and try again.");
|
||||||
|
|
||||||
var result = new Archive
|
var result = new Archive(await DownloadDispatcher.ResolveArchive(archive.IniData));
|
||||||
{
|
|
||||||
State = await DownloadDispatcher.ResolveArchive(archive.IniData)
|
|
||||||
};
|
|
||||||
|
|
||||||
if (result.State == null)
|
if (result.State == null)
|
||||||
Error($"{archive.Name} could not be handled by any of the downloaders");
|
Error($"{archive.Name} could not be handled by any of the downloaders");
|
||||||
|
@ -13,7 +13,6 @@ using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
|||||||
using File = Alphaleonis.Win32.Filesystem.File;
|
using File = Alphaleonis.Win32.Filesystem.File;
|
||||||
using FileInfo = Alphaleonis.Win32.Filesystem.FileInfo;
|
using FileInfo = Alphaleonis.Win32.Filesystem.FileInfo;
|
||||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
@ -30,9 +29,9 @@ namespace Wabbajack.Lib
|
|||||||
public ModList ModList { get; private set; }
|
public ModList ModList { get; private set; }
|
||||||
public Dictionary<Hash, AbsolutePath> HashedArchives { get; } = new Dictionary<Hash, AbsolutePath>();
|
public Dictionary<Hash, AbsolutePath> HashedArchives { get; } = new Dictionary<Hash, AbsolutePath>();
|
||||||
|
|
||||||
public SystemParameters SystemParameters { get; set; }
|
public SystemParameters? SystemParameters { get; set; }
|
||||||
|
|
||||||
public AInstaller(AbsolutePath archive, ModList modList, AbsolutePath outputFolder, AbsolutePath downloadFolder, SystemParameters parameters, int steps)
|
public AInstaller(AbsolutePath archive, ModList modList, AbsolutePath outputFolder, AbsolutePath downloadFolder, SystemParameters? parameters, int steps)
|
||||||
: base(steps)
|
: base(steps)
|
||||||
{
|
{
|
||||||
ModList = modList;
|
ModList = modList;
|
||||||
@ -168,6 +167,10 @@ namespace Wabbajack.Lib
|
|||||||
.PDoIndexed(queue, async (idx, group) =>
|
.PDoIndexed(queue, async (idx, group) =>
|
||||||
{
|
{
|
||||||
Utils.Status("Installing files", Percent.FactoryPutInRange(idx, vFiles.Count));
|
Utils.Status("Installing files", Percent.FactoryPutInRange(idx, vFiles.Count));
|
||||||
|
if (group.Key == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("FromFile was null");
|
||||||
|
}
|
||||||
var firstDest = OutputFolder.Combine(group.First().To);
|
var firstDest = OutputFolder.Combine(group.First().To);
|
||||||
await CopyFile(group.Key.StagedPath, firstDest, true);
|
await CopyFile(group.Key.StagedPath, firstDest, true);
|
||||||
|
|
||||||
@ -175,7 +178,6 @@ namespace Wabbajack.Lib
|
|||||||
{
|
{
|
||||||
await CopyFile(firstDest, OutputFolder.Combine(copy.To), false);
|
await CopyFile(firstDest, OutputFolder.Combine(copy.To), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Status("Unstaging files");
|
Status("Unstaging files");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Lib.Exceptions;
|
using Wabbajack.Lib.Exceptions;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,6 @@ using Newtonsoft.Json;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.StatusFeed.Errors;
|
using Wabbajack.Common.StatusFeed.Errors;
|
||||||
using Wabbajack.VirtualFileSystem;
|
using Wabbajack.VirtualFileSystem;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
@ -80,12 +79,12 @@ namespace Wabbajack.Lib.CompilationSteps
|
|||||||
CreateBSA directive;
|
CreateBSA directive;
|
||||||
using (var bsa = BSADispatch.OpenRead(source.AbsolutePath))
|
using (var bsa = BSADispatch.OpenRead(source.AbsolutePath))
|
||||||
{
|
{
|
||||||
directive = new CreateBSA
|
directive = new CreateBSA(
|
||||||
|
state: bsa.State,
|
||||||
|
items: bsa.Files.Select(f => f.State).ToList())
|
||||||
{
|
{
|
||||||
To = source.Path,
|
To = source.Path,
|
||||||
TempID = (RelativePath)id,
|
TempID = (RelativePath)id,
|
||||||
State = bsa.State,
|
|
||||||
FileStates = bsa.Files.Select(f => f.State).ToList()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ using Alphaleonis.Win32.Filesystem;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.VirtualFileSystem;
|
using Wabbajack.VirtualFileSystem;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.StoreHandlers;
|
using Wabbajack.Common.StoreHandlers;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
|||||||
using Alphaleonis.Win32.Filesystem;
|
using Alphaleonis.Win32.Filesystem;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ using Newtonsoft.Json;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using File = Alphaleonis.Win32.Filesystem.File;
|
using File = Alphaleonis.Win32.Filesystem.File;
|
||||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.CompilationSteps
|
namespace Wabbajack.Lib.CompilationSteps
|
||||||
{
|
{
|
||||||
|
@ -43,22 +43,22 @@ namespace Wabbajack.Lib
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Archives required by this modlist
|
/// Archives required by this modlist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Archive> Archives;
|
public List<Archive> Archives = new List<Archive>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Author of the ModList
|
/// Author of the ModList
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Author;
|
public string Author = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of the ModList
|
/// Description of the ModList
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Description;
|
public string Description = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Install directives
|
/// Install directives
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Directive> Directives;
|
public List<Directive> Directives = new List<Directive>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The game variant to which this game applies
|
/// The game variant to which this game applies
|
||||||
@ -78,12 +78,12 @@ namespace Wabbajack.Lib
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name of the ModList
|
/// Name of the ModList
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name;
|
public string Name = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// readme path or website
|
/// readme path or website
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Readme;
|
public string Readme = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether readme is a website
|
/// Whether readme is a website
|
||||||
@ -93,12 +93,12 @@ namespace Wabbajack.Lib
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The build version of Wabbajack used when compiling the Modlist
|
/// The build version of Wabbajack used when compiling the Modlist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Version WabbajackVersion;
|
public Version? WabbajackVersion;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Website of the ModList
|
/// Website of the ModList
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Uri Website;
|
public Uri? Website;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The size of all the archives once they're downloaded
|
/// The size of all the archives once they're downloaded
|
||||||
@ -134,7 +134,7 @@ namespace Wabbajack.Lib
|
|||||||
|
|
||||||
public class IgnoredDirectly : Directive
|
public class IgnoredDirectly : Directive
|
||||||
{
|
{
|
||||||
public string Reason;
|
public string Reason = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NoMatch : IgnoredDirectly
|
public class NoMatch : IgnoredDirectly
|
||||||
@ -190,12 +190,12 @@ namespace Wabbajack.Lib
|
|||||||
[JsonName("FromArchive")]
|
[JsonName("FromArchive")]
|
||||||
public class FromArchive : Directive
|
public class FromArchive : Directive
|
||||||
{
|
{
|
||||||
private string _fullPath;
|
private string? _fullPath;
|
||||||
|
|
||||||
public HashRelativePath ArchiveHashPath { get; set; }
|
public HashRelativePath ArchiveHashPath { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public VirtualFile FromFile { get; set; }
|
public VirtualFile? FromFile { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string FullPath => _fullPath ??= string.Join("|", ArchiveHashPath);
|
public string FullPath => _fullPath ??= string.Join("|", ArchiveHashPath);
|
||||||
@ -205,8 +205,17 @@ namespace Wabbajack.Lib
|
|||||||
public class CreateBSA : Directive
|
public class CreateBSA : Directive
|
||||||
{
|
{
|
||||||
public RelativePath TempID { get; set; }
|
public RelativePath TempID { get; set; }
|
||||||
public ArchiveStateObject State { get; set; }
|
public ArchiveStateObject State { get; }
|
||||||
public List<FileStateObject> FileStates { get; set; }
|
public List<FileStateObject> FileStates { get; set; } = new List<FileStateObject>();
|
||||||
|
|
||||||
|
public CreateBSA(ArchiveStateObject state, IEnumerable<FileStateObject>? items = null)
|
||||||
|
{
|
||||||
|
State = state;
|
||||||
|
if (items != null)
|
||||||
|
{
|
||||||
|
FileStates.AddRange(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonName("PatchedFromArchive")]
|
[JsonName("PatchedFromArchive")]
|
||||||
@ -231,7 +240,7 @@ namespace Wabbajack.Lib
|
|||||||
public class MergedPatch : Directive
|
public class MergedPatch : Directive
|
||||||
{
|
{
|
||||||
public RelativePath PatchID { get; set; }
|
public RelativePath PatchID { get; set; }
|
||||||
public List<SourcePatch> Sources { get; set; }
|
public List<SourcePatch> Sources { get; set; } = new List<SourcePatch>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonName("Archive")]
|
[JsonName("Archive")]
|
||||||
@ -245,49 +254,33 @@ namespace Wabbajack.Lib
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Meta INI for the downloaded archive
|
/// Meta INI for the downloaded archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Meta { get; set; }
|
public string? Meta { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Human friendly name of this archive
|
/// Human friendly name of this archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
|
|
||||||
public AbstractDownloadState State { get; set; }
|
public AbstractDownloadState State { get; }
|
||||||
|
|
||||||
|
public Archive(AbstractDownloadState state)
|
||||||
|
{
|
||||||
|
State = state;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IndexedArchive
|
public class IndexedArchive
|
||||||
{
|
{
|
||||||
public dynamic IniData;
|
public dynamic? IniData;
|
||||||
public string Meta;
|
public string Meta = string.Empty;
|
||||||
public string Name;
|
public string Name = string.Empty;
|
||||||
public VirtualFile File { get; internal set; }
|
public VirtualFile File { get; }
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public IndexedArchive(VirtualFile file)
|
||||||
/// A archive entry
|
|
||||||
/// </summary>
|
|
||||||
public class IndexedEntry
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
File = file;
|
||||||
/// MurMur3 hash of this file
|
}
|
||||||
/// </summary>
|
|
||||||
public string Hash;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Path in the archive to this file
|
|
||||||
/// </summary>
|
|
||||||
public string Path;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Size of the file (uncompressed)
|
|
||||||
/// </summary>
|
|
||||||
public long Size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class IndexedArchiveEntry : IndexedEntry
|
|
||||||
{
|
|
||||||
public string[] HashPath;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
@ -84,7 +83,9 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
public async Task<bool> Download(AbsolutePath destination)
|
public async Task<bool> Download(AbsolutePath destination)
|
||||||
{
|
{
|
||||||
destination.Parent.CreateDirectory();
|
destination.Parent.CreateDirectory();
|
||||||
return await Download(new Archive {Name = (string)destination.FileName}, destination);
|
// ToDo
|
||||||
|
// Is this null override needed? Why is state allowed to be null here?
|
||||||
|
return await Download(new Archive(state: null!) {Name = (string)destination.FileName}, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -8,7 +8,6 @@ using System.Web;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,17 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
private readonly string _encryptedKeyName;
|
private readonly string _encryptedKeyName;
|
||||||
private readonly string _cookieDomain;
|
private readonly string _cookieDomain;
|
||||||
private readonly string _cookieName;
|
private readonly string _cookieName;
|
||||||
internal Common.Http.Client AuthedClient;
|
// ToDo
|
||||||
|
// Remove null assignment. Either add nullability to type, or figure way to prepare it safely
|
||||||
|
public Common.Http.Client AuthedClient { get; private set; } = null!;
|
||||||
|
|
||||||
|
public ReactiveCommand<Unit, Unit> TriggerLogin { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
||||||
|
public IObservable<bool> IsLoggedIn => Utils.HaveEncryptedJsonObservable(_encryptedKeyName);
|
||||||
|
public abstract string SiteName { get; }
|
||||||
|
public virtual IObservable<string>? MetaInfo { get; }
|
||||||
|
public abstract Uri SiteURL { get; }
|
||||||
|
public virtual Uri? IconUri { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets up all the login facilites needed for a INeedsLogin downloader based on having the user log
|
/// Sets up all the login facilites needed for a INeedsLogin downloader based on having the user log
|
||||||
@ -49,14 +59,6 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
canExecute: IsLoggedIn.ObserveOnGuiThread());
|
canExecute: IsLoggedIn.ObserveOnGuiThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> TriggerLogin { get; }
|
|
||||||
public ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
|
||||||
public IObservable<bool> IsLoggedIn => Utils.HaveEncryptedJsonObservable(_encryptedKeyName);
|
|
||||||
public abstract string SiteName { get; }
|
|
||||||
public virtual IObservable<string> MetaInfo { get; }
|
|
||||||
public abstract Uri SiteURL { get; }
|
|
||||||
public virtual Uri IconUri { get; }
|
|
||||||
|
|
||||||
protected virtual async Task WhileWaiting(IWebDriver browser)
|
protected virtual async Task WhileWaiting(IWebDriver browser)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -120,7 +122,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
Downloader = downloader;
|
Downloader = downloader;
|
||||||
}
|
}
|
||||||
public override string ShortDescription => $"Getting {Downloader.SiteName} Login";
|
public override string ShortDescription => $"Getting {Downloader.SiteName} Login";
|
||||||
public override string ExtendedDescription { get; }
|
public override string ExtendedDescription { get; } = string.Empty;
|
||||||
|
|
||||||
private readonly TaskCompletionSource<Helpers.Cookie[]> _source = new TaskCompletionSource<Helpers.Cookie[]>();
|
private readonly TaskCompletionSource<Helpers.Cookie[]> _source = new TaskCompletionSource<Helpers.Cookie[]>();
|
||||||
public Task<Helpers.Cookie[]> Task => _source.Task;
|
public Task<Helpers.Cookie[]> Task => _source.Task;
|
||||||
|
@ -24,7 +24,6 @@ using Wabbajack.Lib.Validation;
|
|||||||
using File = Alphaleonis.Win32.Filesystem.File;
|
using File = Alphaleonis.Win32.Filesystem.File;
|
||||||
using Game = Wabbajack.Common.Game;
|
using Game = Wabbajack.Common.Game;
|
||||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
IndexedDownloaders = Downloaders.ToDictionary(d => d.GetType());
|
IndexedDownloaders = Downloaders.ToDictionary(d => d.GetType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<AbstractDownloadState> Infer(Uri uri)
|
public static async Task<AbstractDownloadState?> Infer(Uri uri)
|
||||||
{
|
{
|
||||||
foreach (var inf in Inferencers)
|
foreach (var inf in Inferencers)
|
||||||
{
|
{
|
||||||
@ -74,7 +74,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ini"></param>
|
/// <param name="ini"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static AbstractDownloadState ResolveArchive(string url)
|
public static AbstractDownloadState? ResolveArchive(string url)
|
||||||
{
|
{
|
||||||
return Downloaders.OfType<IUrlDownloader>().Select(d => d.GetDownloaderState(url)).FirstOrDefault(result => result != null);
|
return Downloaders.OfType<IUrlDownloader>().Select(d => d.GetDownloaderState(url)).FirstOrDefault(result => result != null);
|
||||||
}
|
}
|
||||||
@ -112,10 +112,9 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
var patchName = $"{archive.Hash.ToHex()}_{upgrade.Hash.ToHex()}";
|
var patchName = $"{archive.Hash.ToHex()}_{upgrade.Hash.ToHex()}";
|
||||||
var patchPath = destination.Parent.Combine("_Patch_" + patchName);
|
var patchPath = destination.Parent.Combine("_Patch_" + patchName);
|
||||||
|
|
||||||
var patchState = new Archive
|
var patchState = new Archive(new HTTPDownloader.State($"https://wabbajackcdn.b-cdn.net/updates/{patchName}"))
|
||||||
{
|
{
|
||||||
Name = patchName,
|
Name = patchName,
|
||||||
State = new HTTPDownloader.State($"https://wabbajackcdn.b-cdn.net/updates/{patchName}")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var patchResult = await Download(patchState, patchPath);
|
var patchResult = await Download(patchState, patchPath);
|
||||||
|
@ -4,7 +4,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
{
|
{
|
||||||
public static class DownloaderUtils
|
public static class DownloaderUtils
|
||||||
{
|
{
|
||||||
public static Uri GetDirectURL(dynamic meta)
|
public static Uri? GetDirectURL(dynamic? meta)
|
||||||
{
|
{
|
||||||
var url = meta?.General?.directURL;
|
var url = meta?.General?.directURL;
|
||||||
if (url == null) return null;
|
if (url == null) return null;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ using Wabbajack.Common;
|
|||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
using Game = Wabbajack.Common.Game;
|
using Game = Wabbajack.Common.Game;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using Wabbajack.Common;
|
|||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
using Wabbajack.Lib.Exceptions;
|
using Wabbajack.Lib.Exceptions;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,6 @@ using Wabbajack.Common;
|
|||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
using Wabbajack.Lib.Exceptions;
|
using Wabbajack.Lib.Exceptions;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
@ -12,7 +11,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
||||||
IObservable<bool> IsLoggedIn { get; }
|
IObservable<bool> IsLoggedIn { get; }
|
||||||
string SiteName { get; }
|
string SiteName { get; }
|
||||||
IObservable<string> MetaInfo { get; }
|
IObservable<string>? MetaInfo { get; }
|
||||||
Uri SiteURL { get; }
|
Uri SiteURL { get; }
|
||||||
Uri? IconUri { get; }
|
Uri? IconUri { get; }
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
{
|
{
|
||||||
public interface IUrlDownloader : IDownloader
|
public interface IUrlDownloader : IDownloader
|
||||||
{
|
{
|
||||||
AbstractDownloadState GetDownloaderState(string url);
|
AbstractDownloadState? GetDownloaderState(string url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ using Newtonsoft.Json;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
using Wabbajack.Lib.WebAutomation;
|
using Wabbajack.Lib.WebAutomation;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,6 @@ using Newtonsoft.Json;
|
|||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ using Wabbajack.Common;
|
|||||||
using Wabbajack.Common.IO;
|
using Wabbajack.Common.IO;
|
||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
using Wabbajack.Lib.WebAutomation;
|
using Wabbajack.Lib.WebAutomation;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ using Newtonsoft.Json;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,6 @@ using Wabbajack.Common.StatusFeed.Errors;
|
|||||||
using Wabbajack.Lib.NexusApi;
|
using Wabbajack.Lib.NexusApi;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
using Game = Wabbajack.Common.Game;
|
using Game = Wabbajack.Common.Game;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -14,20 +14,21 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
{
|
{
|
||||||
public class SteamWorkshopDownloader : IUrlDownloader
|
public class SteamWorkshopDownloader : IUrlDownloader
|
||||||
{
|
{
|
||||||
private SteamWorkshopItem _item;
|
public async Task<AbstractDownloadState?> GetDownloaderState(dynamic archiveINI, bool quickMode)
|
||||||
|
|
||||||
public async Task<AbstractDownloadState> GetDownloaderState(dynamic archiveINI, bool quickMode)
|
|
||||||
{
|
{
|
||||||
var id = archiveINI?.General?.itemID;
|
var id = archiveINI?.General?.itemID;
|
||||||
var steamID = archiveINI?.General?.steamID;
|
var steamID = archiveINI?.General?.steamID;
|
||||||
var size = archiveINI?.General?.itemSize;
|
var size = archiveINI?.General?.itemSize;
|
||||||
_item = new SteamWorkshopItem
|
if (steamID == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Steam workshop item had no steam ID.");
|
||||||
|
}
|
||||||
|
var item = new SteamWorkshopItem(GameRegistry.GetBySteamID(int.Parse(steamID)))
|
||||||
{
|
{
|
||||||
ItemID = id != null ? int.Parse(id) : 0,
|
ItemID = id != null ? int.Parse(id) : 0,
|
||||||
Size = size != null ? int.Parse(size) : 0,
|
Size = size != null ? int.Parse(size) : 0,
|
||||||
Game = steamID != null ? GameRegistry.GetBySteamID(int.Parse(steamID)) : null
|
|
||||||
};
|
};
|
||||||
return new State {Item = _item};
|
return new State(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Prepare()
|
public async Task Prepare()
|
||||||
@ -41,8 +42,14 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
|
|
||||||
public class State : AbstractDownloadState
|
public class State : AbstractDownloadState
|
||||||
{
|
{
|
||||||
public SteamWorkshopItem Item { get; set; }
|
public SteamWorkshopItem Item { get; }
|
||||||
public override object[] PrimaryKey { get => new object[] {Item.Game, Item.ItemID}; }
|
|
||||||
|
public override object[] PrimaryKey => new object[] { Item.Game, Item.ItemID };
|
||||||
|
|
||||||
|
public State(SteamWorkshopItem item)
|
||||||
|
{
|
||||||
|
Item = item;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool IsWhitelisted(ServerWhitelist whitelist)
|
public override bool IsWhitelisted(ServerWhitelist whitelist)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders.UrlDownloaders
|
namespace Wabbajack.Lib.Downloaders.UrlDownloaders
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders.UrlDownloaders
|
namespace Wabbajack.Lib.Downloaders.UrlDownloaders
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using YoutubeExplode;
|
using YoutubeExplode;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders.UrlDownloaders
|
namespace Wabbajack.Lib.Downloaders.UrlDownloaders
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,6 @@ using YoutubeExplode.Exceptions;
|
|||||||
using YoutubeExplode.Models.MediaStreams;
|
using YoutubeExplode.Models.MediaStreams;
|
||||||
using File = Alphaleonis.Win32.Filesystem.File;
|
using File = Alphaleonis.Win32.Filesystem.File;
|
||||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,5 @@ namespace Wabbajack.Lib.Exceptions
|
|||||||
Code = code;
|
Code = code;
|
||||||
Reason = reason;
|
Reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ namespace Wabbajack.Lib.FileUploader
|
|||||||
{
|
{
|
||||||
public static IObservable<bool> HaveAuthorAPIKey => Utils.HaveEncryptedJsonObservable(Consts.AuthorAPIKeyFile);
|
public static IObservable<bool> HaveAuthorAPIKey => Utils.HaveEncryptedJsonObservable(Consts.AuthorAPIKeyFile);
|
||||||
|
|
||||||
public static string ApiKeyOverride = null;
|
public static string? ApiKeyOverride = null;
|
||||||
|
|
||||||
public static async Task<string> GetAPIKey(string apiKey = null)
|
public static async Task<string> GetAPIKey(string? apiKey = null)
|
||||||
{
|
{
|
||||||
if (ApiKeyOverride != null) return ApiKeyOverride;
|
if (ApiKeyOverride != null) return ApiKeyOverride;
|
||||||
return apiKey ?? (await Consts.LocalAppDataPath.Combine(Consts.AuthorAPIKeyFile).ReadAllTextAsync()).Trim();
|
return apiKey ?? (await Consts.LocalAppDataPath.Combine(Consts.AuthorAPIKeyFile).ReadAllTextAsync()).Trim();
|
||||||
@ -32,7 +32,7 @@ namespace Wabbajack.Lib.FileUploader
|
|||||||
public static Uri UploadURL => new Uri($"{Consts.WabbajackBuildServerUri}upload_file");
|
public static Uri UploadURL => new Uri($"{Consts.WabbajackBuildServerUri}upload_file");
|
||||||
public static long BLOCK_SIZE = (long)1024 * 1024 * 2;
|
public static long BLOCK_SIZE = (long)1024 * 1024 * 2;
|
||||||
public static int MAX_CONNECTIONS = 8;
|
public static int MAX_CONNECTIONS = 8;
|
||||||
public static Task<string> UploadFile(AbsolutePath filename, Action<double> progressFn, string apikey=null)
|
public static Task<string> UploadFile(AbsolutePath filename, Action<double> progressFn, string? apikey = null)
|
||||||
{
|
{
|
||||||
var tcs = new TaskCompletionSource<string>();
|
var tcs = new TaskCompletionSource<string>();
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
@ -123,7 +123,7 @@ namespace Wabbajack.Lib.FileUploader
|
|||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<Common.Http.Client> GetAuthorizedClient(string apiKey=null)
|
public static async Task<Common.Http.Client> GetAuthorizedClient(string? apiKey = null)
|
||||||
{
|
{
|
||||||
var client = new Common.Http.Client();
|
var client = new Common.Http.Client();
|
||||||
client.Headers.Add(("X-API-KEY", await GetAPIKey(apiKey)));
|
client.Headers.Add(("X-API-KEY", await GetAPIKey(apiKey)));
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
|
@ -78,10 +78,10 @@ namespace Wabbajack.Lib.LibCefHelpers
|
|||||||
[JsonName("HttpCookie")]
|
[JsonName("HttpCookie")]
|
||||||
public class Cookie
|
public class Cookie
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Value { get; set; }
|
public string Value { get; set; } = string.Empty;
|
||||||
public string Domain { get; set; }
|
public string Domain { get; set; } = string.Empty;
|
||||||
public string Path { get; set; }
|
public string Path { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
|
@ -20,7 +20,6 @@ using File = Alphaleonis.Win32.Filesystem.File;
|
|||||||
using FileInfo = Alphaleonis.Win32.Filesystem.FileInfo;
|
using FileInfo = Alphaleonis.Win32.Filesystem.FileInfo;
|
||||||
using Game = Wabbajack.Common.Game;
|
using Game = Wabbajack.Common.Game;
|
||||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
@ -175,9 +174,8 @@ namespace Wabbajack.Lib
|
|||||||
|
|
||||||
IndexedArchives = (await MO2DownloadsFolder.EnumerateFiles()
|
IndexedArchives = (await MO2DownloadsFolder.EnumerateFiles()
|
||||||
.Where(f => f.WithExtension(Consts.MetaFileExtension).Exists)
|
.Where(f => f.WithExtension(Consts.MetaFileExtension).Exists)
|
||||||
.PMap(Queue, async f => new IndexedArchive
|
.PMap(Queue, async f => new IndexedArchive(VFS.Index.ByRootPath[f])
|
||||||
{
|
{
|
||||||
File = VFS.Index.ByRootPath[f],
|
|
||||||
Name = (string)f.FileName,
|
Name = (string)f.FileName,
|
||||||
IniData = f.WithExtension(Consts.MetaFileExtension).LoadIniFile(),
|
IniData = f.WithExtension(Consts.MetaFileExtension).LoadIniFile(),
|
||||||
Meta = await f.WithExtension(Consts.MetaFileExtension).ReadAllTextAsync()
|
Meta = await f.WithExtension(Consts.MetaFileExtension).ReadAllTextAsync()
|
||||||
|
@ -21,7 +21,6 @@ using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
|||||||
using File = Alphaleonis.Win32.Filesystem.File;
|
using File = Alphaleonis.Win32.Filesystem.File;
|
||||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||||
using SectionData = Wabbajack.Common.SectionData;
|
using SectionData = Wabbajack.Common.SectionData;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
@ -332,6 +331,10 @@ namespace Wabbajack.Lib
|
|||||||
|
|
||||||
private void SetScreenSizeInPrefs()
|
private void SetScreenSizeInPrefs()
|
||||||
{
|
{
|
||||||
|
if (SystemParameters == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("System Parameters was null. Cannot set screen size prefs");
|
||||||
|
}
|
||||||
var config = new IniParserConfiguration {AllowDuplicateKeys = true, AllowDuplicateSections = true};
|
var config = new IniParserConfiguration {AllowDuplicateKeys = true, AllowDuplicateSections = true};
|
||||||
foreach (var file in OutputFolder.Combine("profiles").EnumerateFiles()
|
foreach (var file in OutputFolder.Combine("profiles").EnumerateFiles()
|
||||||
.Where(f => ((string)f.FileName).EndsWith("refs.ini")))
|
.Where(f => ((string)f.FileName).EndsWith("refs.ini")))
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.Serialization.Json;
|
using Wabbajack.Common.Serialization.Json;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
@ -42,12 +41,11 @@ namespace Wabbajack.Lib
|
|||||||
InstallSize = modlist.InstallSize;
|
InstallSize = modlist.InstallSize;
|
||||||
|
|
||||||
// meta is being omitted due to it being useless and not very space friendly
|
// meta is being omitted due to it being useless and not very space friendly
|
||||||
Archives = modlist.Archives.Select(a => new Archive
|
Archives = modlist.Archives.Select(a => new Archive(a.State)
|
||||||
{
|
{
|
||||||
Hash = a.Hash,
|
Hash = a.Hash,
|
||||||
Name = a.Name,
|
Name = a.Name,
|
||||||
Size = a.Size,
|
Size = a.Size,
|
||||||
State = a.State
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,13 @@ namespace Wabbajack.Lib.ModListRegistry
|
|||||||
public class ModlistMetadata
|
public class ModlistMetadata
|
||||||
{
|
{
|
||||||
[JsonProperty("title")]
|
[JsonProperty("title")]
|
||||||
public string Title { get; set; }
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("description")]
|
[JsonProperty("description")]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("author")]
|
[JsonProperty("author")]
|
||||||
public string Author { get; set; }
|
public string Author { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("game")]
|
[JsonProperty("game")]
|
||||||
public Game Game { get; set; }
|
public Game Game { get; set; }
|
||||||
@ -33,7 +33,7 @@ namespace Wabbajack.Lib.ModListRegistry
|
|||||||
public LinksObject Links { get; set; } = new LinksObject();
|
public LinksObject Links { get; set; } = new LinksObject();
|
||||||
|
|
||||||
[JsonProperty("download_metadata")]
|
[JsonProperty("download_metadata")]
|
||||||
public DownloadMetadata DownloadMetadata { get; set; }
|
public DownloadMetadata? DownloadMetadata { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public ModListSummary ValidationSummary { get; set; } = new ModListSummary();
|
public ModListSummary ValidationSummary { get; set; } = new ModListSummary();
|
||||||
@ -42,22 +42,18 @@ namespace Wabbajack.Lib.ModListRegistry
|
|||||||
public class LinksObject
|
public class LinksObject
|
||||||
{
|
{
|
||||||
[JsonProperty("image")]
|
[JsonProperty("image")]
|
||||||
public string ImageUri { get; set; }
|
public string ImageUri { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("readme")]
|
[JsonProperty("readme")]
|
||||||
public string Readme { get; set; }
|
public string Readme { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("download")]
|
[JsonProperty("download")]
|
||||||
public string Download { get; set; }
|
public string Download { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("machineURL")]
|
[JsonProperty("machineURL")]
|
||||||
public string MachineURL { get; set; }
|
public string MachineURL { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static async Task<List<ModlistMetadata>> LoadFromGithub()
|
public static async Task<List<ModlistMetadata>> LoadFromGithub()
|
||||||
{
|
{
|
||||||
var client = new Common.Http.Client();
|
var client = new Common.Http.Client();
|
||||||
@ -103,17 +99,16 @@ namespace Wabbajack.Lib.ModListRegistry
|
|||||||
public long SizeOfArchives { get; set; }
|
public long SizeOfArchives { get; set; }
|
||||||
public long NumberOfInstalledFiles { get; set; }
|
public long NumberOfInstalledFiles { get; set; }
|
||||||
public long SizeOfInstalledFiles { get; set; }
|
public long SizeOfInstalledFiles { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonName("ModListSummary")]
|
[JsonName("ModListSummary")]
|
||||||
public class ModListSummary
|
public class ModListSummary
|
||||||
{
|
{
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("machineURL")]
|
[JsonProperty("machineURL")]
|
||||||
public string MachineURL { get; set; }
|
public string MachineURL { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("checked")]
|
[JsonProperty("checked")]
|
||||||
public DateTime Checked { get; set; }
|
public DateTime Checked { get; set; }
|
||||||
|
@ -4,57 +4,57 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
{
|
{
|
||||||
public class UserStatus
|
public class UserStatus
|
||||||
{
|
{
|
||||||
public string email;
|
public string email = string.Empty;
|
||||||
public bool is_premium;
|
public bool is_premium;
|
||||||
public bool is_supporter;
|
public bool is_supporter;
|
||||||
public string key;
|
public string key = string.Empty;
|
||||||
public string name;
|
public string name = string.Empty;
|
||||||
public string profile_url;
|
public string profile_url = string.Empty;
|
||||||
public string user_id;
|
public string user_id = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NexusFileInfo
|
public class NexusFileInfo
|
||||||
{
|
{
|
||||||
public long category_id { get; set; }
|
public long category_id { get; set; }
|
||||||
public string category_name { get; set; }
|
public string category_name { get; set; } = string.Empty;
|
||||||
public string changelog_html { get; set; }
|
public string changelog_html { get; set; } = string.Empty;
|
||||||
public string description { get; set; }
|
public string description { get; set; } = string.Empty;
|
||||||
public string external_virus_scan_url { get; set; }
|
public string external_virus_scan_url { get; set; } = string.Empty;
|
||||||
public long file_id { get; set; }
|
public long file_id { get; set; }
|
||||||
public string file_name { get; set; }
|
public string file_name { get; set; } = string.Empty;
|
||||||
public bool is_primary { get; set; }
|
public bool is_primary { get; set; }
|
||||||
public string mod_version { get; set; }
|
public string mod_version { get; set; } = string.Empty;
|
||||||
public string name { get; set; }
|
public string name { get; set; } = string.Empty;
|
||||||
public long size { get; set; }
|
public long size { get; set; }
|
||||||
public long size_kb { get; set; }
|
public long size_kb { get; set; }
|
||||||
public DateTime uploaded_time { get; set; }
|
public DateTime uploaded_time { get; set; }
|
||||||
public long uploaded_timestamp { get; set; }
|
public long uploaded_timestamp { get; set; }
|
||||||
public string version { get; set; }
|
public string version { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ModInfo
|
public class ModInfo
|
||||||
{
|
{
|
||||||
public uint _internal_version { get; set; }
|
public uint _internal_version { get; set; }
|
||||||
public string game_name { get; set; }
|
public string game_name { get; set; } = string.Empty;
|
||||||
public string mod_id { get; set; }
|
public string mod_id { get; set; } = string.Empty;
|
||||||
public string name { get; set; }
|
public string name { get; set; } = string.Empty;
|
||||||
public string summary { get; set; }
|
public string summary { get; set; } = string.Empty;
|
||||||
public string author { get; set; }
|
public string author { get; set; } = string.Empty;
|
||||||
public string uploaded_by { get; set; }
|
public string uploaded_by { get; set; } = string.Empty;
|
||||||
public string uploaded_users_profile_url { get; set; }
|
public string uploaded_users_profile_url { get; set; } = string.Empty;
|
||||||
public string picture_url { get; set; }
|
public string picture_url { get; set; } = string.Empty;
|
||||||
public bool contains_adult_content { get; set; }
|
public bool contains_adult_content { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MD5Response
|
public class MD5Response
|
||||||
{
|
{
|
||||||
public ModInfo mod;
|
public ModInfo? mod;
|
||||||
public NexusFileInfo file_details;
|
public NexusFileInfo? file_details;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EndorsementResponse
|
public class EndorsementResponse
|
||||||
{
|
{
|
||||||
public string message;
|
public string message = string.Empty;
|
||||||
public string status;
|
public string status = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,11 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
|
|
||||||
#region Authentication
|
#region Authentication
|
||||||
|
|
||||||
public string ApiKey { get; }
|
public string? ApiKey { get; }
|
||||||
|
|
||||||
public bool IsAuthenticated => ApiKey != null;
|
public bool IsAuthenticated => ApiKey != null;
|
||||||
|
|
||||||
private Task<UserStatus> _userStatus;
|
private Task<UserStatus>? _userStatus;
|
||||||
|
|
||||||
public Task<UserStatus> UserStatus
|
public Task<UserStatus> UserStatus
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -214,7 +213,7 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private NexusApiClient(string apiKey = null)
|
private NexusApiClient(string? apiKey = null)
|
||||||
{
|
{
|
||||||
ApiKey = apiKey;
|
ApiKey = apiKey;
|
||||||
|
|
||||||
@ -230,9 +229,9 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
Directory.CreateDirectory(Consts.NexusCacheDirectory);
|
Directory.CreateDirectory(Consts.NexusCacheDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<NexusApiClient> Get(string apiKey = null)
|
public static async Task<NexusApiClient> Get(string? apiKey = null)
|
||||||
{
|
{
|
||||||
apiKey = apiKey ?? await GetApiKey();
|
apiKey ??= await GetApiKey();
|
||||||
return new NexusApiClient(apiKey);
|
return new NexusApiClient(apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,9 +315,10 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetModFilesResponse
|
public class GetModFilesResponse
|
||||||
{
|
{
|
||||||
public List<NexusFileInfo> files { get; set; }
|
public List<NexusFileInfo> files { get; set; } = new List<NexusFileInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetModFilesResponse> GetModFiles(Game game, long modid)
|
public async Task<GetModFilesResponse> GetModFiles(Game game, long modid)
|
||||||
@ -344,18 +344,18 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
|
|
||||||
private class DownloadLink
|
private class DownloadLink
|
||||||
{
|
{
|
||||||
public string URI { get; set; }
|
public string URI { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MethodInfo CacheMethod { get; set; }
|
private static string? _localCacheDir;
|
||||||
|
|
||||||
private static string _localCacheDir;
|
|
||||||
public static string LocalCacheDir
|
public static string LocalCacheDir
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_localCacheDir == null)
|
if (_localCacheDir == null)
|
||||||
_localCacheDir = Environment.GetEnvironmentVariable("NEXUSCACHEDIR");
|
_localCacheDir = Environment.GetEnvironmentVariable("NEXUSCACHEDIR");
|
||||||
|
if (_localCacheDir == null)
|
||||||
|
throw new ArgumentNullException($"Enviornment variable could not be located: NEXUSCACHEDIR");
|
||||||
return _localCacheDir;
|
return _localCacheDir;
|
||||||
}
|
}
|
||||||
set => _localCacheDir = value;
|
set => _localCacheDir = value;
|
||||||
|
@ -18,16 +18,11 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static string FixupSummary(string argSummary)
|
public static string FixupSummary(string argSummary)
|
||||||
{
|
|
||||||
if (argSummary != null)
|
|
||||||
{
|
{
|
||||||
return argSummary.Replace("'", "'")
|
return argSummary.Replace("'", "'")
|
||||||
.Replace("<br/>", "\n\n")
|
.Replace("<br/>", "\n\n")
|
||||||
.Replace("<br />", "\n\n")
|
.Replace("<br />", "\n\n")
|
||||||
.Replace("!", "!");
|
.Replace("!", "!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return argSummary;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
public class RequestNexusAuthorization : AUserIntervention
|
public class RequestNexusAuthorization : AUserIntervention
|
||||||
{
|
{
|
||||||
public override string ShortDescription => "Getting User's Nexus API Key";
|
public override string ShortDescription => "Getting User's Nexus API Key";
|
||||||
public override string ExtendedDescription { get; }
|
public override string ExtendedDescription { get; } = string.Empty;
|
||||||
|
|
||||||
private readonly TaskCompletionSource<string> _source = new TaskCompletionSource<string>();
|
private readonly TaskCompletionSource<string> _source = new TaskCompletionSource<string>();
|
||||||
public Task<string> Task => _source.Task;
|
public Task<string> Task => _source.Task;
|
||||||
|
@ -10,7 +10,7 @@ namespace Wabbajack.Lib
|
|||||||
public class ConfirmUpdateOfExistingInstall : ConfirmationIntervention
|
public class ConfirmUpdateOfExistingInstall : ConfirmationIntervention
|
||||||
{
|
{
|
||||||
public AbsolutePath OutputFolder { get; set; }
|
public AbsolutePath OutputFolder { get; set; }
|
||||||
public string ModListName { get; set; }
|
public string ModListName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public override string ShortDescription { get; } = "Do you want to overwrite existing files?";
|
public override string ShortDescription { get; } = "Do you want to overwrite existing files?";
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ namespace Wabbajack.Lib
|
|||||||
public class ManuallyDownloadFile : AUserIntervention
|
public class ManuallyDownloadFile : AUserIntervention
|
||||||
{
|
{
|
||||||
public ManualDownloader.State State { get; }
|
public ManualDownloader.State State { get; }
|
||||||
public override string ShortDescription { get; }
|
public override string ShortDescription { get; } = string.Empty;
|
||||||
public override string ExtendedDescription { get; }
|
public override string ExtendedDescription { get; } = string.Empty;
|
||||||
|
|
||||||
private TaskCompletionSource<(Uri, Common.Http.Client)> _tcs = new TaskCompletionSource<(Uri, Common.Http.Client)>();
|
private TaskCompletionSource<(Uri, Common.Http.Client)> _tcs = new TaskCompletionSource<(Uri, Common.Http.Client)>();
|
||||||
public Task<(Uri, Common.Http.Client)> Task => _tcs.Task;
|
public Task<(Uri, Common.Http.Client)> Task => _tcs.Task;
|
||||||
|
@ -9,8 +9,8 @@ namespace Wabbajack.Lib
|
|||||||
public class ManuallyDownloadNexusFile : AUserIntervention
|
public class ManuallyDownloadNexusFile : AUserIntervention
|
||||||
{
|
{
|
||||||
public NexusDownloader.State State { get; }
|
public NexusDownloader.State State { get; }
|
||||||
public override string ShortDescription { get; }
|
public override string ShortDescription { get; } = string.Empty;
|
||||||
public override string ExtendedDescription { get; }
|
public override string ExtendedDescription { get; } = string.Empty;
|
||||||
|
|
||||||
private TaskCompletionSource<Uri> _tcs = new TaskCompletionSource<Uri>();
|
private TaskCompletionSource<Uri> _tcs = new TaskCompletionSource<Uri>();
|
||||||
public Task<Uri> Task => _tcs.Task;
|
public Task<Uri> Task => _tcs.Task;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
|
@ -10,33 +10,32 @@ namespace Wabbajack.Lib.Validation
|
|||||||
public bool? CanUseInOtherGames { get; set; }
|
public bool? CanUseInOtherGames { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Author
|
//public class Author
|
||||||
{
|
//{
|
||||||
public Permissions Permissions { get; set; }
|
// public Permissions Permissions { get; set; }
|
||||||
public Dictionary<string, Game> Games;
|
// public Dictionary<string, Game> Games;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public class Game
|
//public class Game
|
||||||
{
|
//{
|
||||||
public Permissions Permissions;
|
// public Permissions Permissions;
|
||||||
public Dictionary<string, Mod> Mods;
|
// public Dictionary<string, Mod> Mods;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public class Mod
|
//public class Mod
|
||||||
{
|
//{
|
||||||
public Permissions Permissions;
|
// public Permissions Permissions;
|
||||||
public Dictionary<string, File> Files;
|
// public Dictionary<string, File> Files;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public class File
|
|
||||||
{
|
|
||||||
public Permissions Permissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//public class File
|
||||||
|
//{
|
||||||
|
// public Permissions Permissions;
|
||||||
|
//}
|
||||||
|
|
||||||
public class ServerWhitelist
|
public class ServerWhitelist
|
||||||
{
|
{
|
||||||
public List<string> GoogleIDs;
|
public List<string> GoogleIDs = new List<string>();
|
||||||
public List<string> AllowedPrefixes;
|
public List<string> AllowedPrefixes = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,6 @@ using Wabbajack.Lib.NexusApi;
|
|||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
using File = Alphaleonis.Win32.Filesystem.File;
|
using File = Alphaleonis.Win32.Filesystem.File;
|
||||||
using Game = Wabbajack.Common.Game;
|
using Game = Wabbajack.Common.Game;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CefSharp.Common">
|
<PackageReference Include="CefSharp.Common">
|
||||||
|
@ -13,8 +13,8 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
{
|
{
|
||||||
public class CefSharpWrapper : IWebDriver
|
public class CefSharpWrapper : IWebDriver
|
||||||
{
|
{
|
||||||
private IWebBrowser _browser;
|
private readonly IWebBrowser _browser;
|
||||||
public Action<Uri> DownloadHandler { get; set; }
|
public Action<Uri>? DownloadHandler { get; set; }
|
||||||
public CefSharpWrapper(IWebBrowser browser)
|
public CefSharpWrapper(IWebBrowser browser)
|
||||||
{
|
{
|
||||||
_browser = browser;
|
_browser = browser;
|
||||||
@ -24,7 +24,7 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
{
|
{
|
||||||
var tcs = new TaskCompletionSource<bool>();
|
var tcs = new TaskCompletionSource<bool>();
|
||||||
|
|
||||||
EventHandler<LoadingStateChangedEventArgs> handler = null;
|
EventHandler<LoadingStateChangedEventArgs>? handler = null;
|
||||||
handler = (sender, e) =>
|
handler = (sender, e) =>
|
||||||
{
|
{
|
||||||
if (!e.IsLoading)
|
if (!e.IsLoading)
|
||||||
@ -68,7 +68,7 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
|
|
||||||
public class PopupBlocker : ILifeSpanHandler
|
public class PopupBlocker : ILifeSpanHandler
|
||||||
{
|
{
|
||||||
private CefSharpWrapper _wrapper;
|
private readonly CefSharpWrapper _wrapper;
|
||||||
|
|
||||||
public PopupBlocker(CefSharpWrapper cefSharpWrapper)
|
public PopupBlocker(CefSharpWrapper cefSharpWrapper)
|
||||||
{
|
{
|
||||||
@ -77,7 +77,7 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
|
|
||||||
public bool OnBeforePopup(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, string targetUrl,
|
public bool OnBeforePopup(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, string targetUrl,
|
||||||
string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures,
|
string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures,
|
||||||
IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser)
|
IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser? newBrowser)
|
||||||
{
|
{
|
||||||
// Block popups
|
// Block popups
|
||||||
newBrowser = null;
|
newBrowser = null;
|
||||||
@ -86,7 +86,6 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
|
|
||||||
public void OnAfterCreated(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
public void OnAfterCreated(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DoClose(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
public bool DoClose(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
||||||
@ -96,7 +95,6 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
|
|
||||||
public void OnBeforeClose(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
public void OnBeforeClose(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +110,7 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
||||||
IBeforeDownloadCallback callback)
|
IBeforeDownloadCallback callback)
|
||||||
{
|
{
|
||||||
_wrapper.DownloadHandler(new Uri(downloadItem.Url));
|
_wrapper.DownloadHandler?.Invoke(new Uri(downloadItem.Url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
||||||
|
@ -13,6 +13,6 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
Task NavigateTo(Uri uri);
|
Task NavigateTo(Uri uri);
|
||||||
Task<string> EvaluateJavaScript(string text);
|
Task<string> EvaluateJavaScript(string text);
|
||||||
Task<Helpers.Cookie[]> GetCookies(string domainPrefix);
|
Task<Helpers.Cookie[]> GetCookies(string domainPrefix);
|
||||||
public Action<Uri> DownloadHandler { get; set; }
|
public Action<Uri>? DownloadHandler { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,13 @@ namespace Wabbajack.Lib.WebAutomation
|
|||||||
return driver;
|
return driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Uri> NavigateTo(Uri uri)
|
public async Task<Uri?> NavigateTo(Uri uri)
|
||||||
{
|
{
|
||||||
await _driver.NavigateTo(uri);
|
await _driver.NavigateTo(uri);
|
||||||
return await GetLocation();
|
return await GetLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ValueTask<Uri> GetLocation()
|
public async ValueTask<Uri?> GetLocation()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,6 @@ using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
|||||||
using File = Alphaleonis.Win32.Filesystem.File;
|
using File = Alphaleonis.Win32.Filesystem.File;
|
||||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Wabbajack.Lib
|
namespace Wabbajack.Lib
|
||||||
{
|
{
|
||||||
@ -151,7 +150,7 @@ namespace Wabbajack.Lib
|
|||||||
return inline;
|
return inline;
|
||||||
}
|
}
|
||||||
var result = source.EvolveTo<MergedPatch>();
|
var result = source.EvolveTo<MergedPatch>();
|
||||||
result.Sources = merge.plugins.Select(f =>
|
result.Sources.SetTo(merge.plugins.Select(f =>
|
||||||
{
|
{
|
||||||
var origPath = (AbsolutePath)Path.Combine(f.dataFolder, f.filename);
|
var origPath = (AbsolutePath)Path.Combine(f.dataFolder, f.filename);
|
||||||
var paths = new[]
|
var paths = new[]
|
||||||
@ -172,10 +171,11 @@ namespace Wabbajack.Lib
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
hash = _compiler.VFS.Index.ByRootPath[absPath].Hash;
|
hash = _compiler.VFS.Index.ByRootPath[absPath].Hash;
|
||||||
} catch (KeyNotFoundException e)
|
}
|
||||||
|
catch (KeyNotFoundException e)
|
||||||
{
|
{
|
||||||
Utils.ErrorThrow(e, $"Could not find the key {absPath} in the VFS Index dictionary!");
|
Utils.Error(e, $"Could not find the key {absPath} in the VFS Index dictionary!");
|
||||||
return null;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SourcePatch
|
return new SourcePatch
|
||||||
@ -183,7 +183,7 @@ namespace Wabbajack.Lib
|
|||||||
RelativePath = absPath.RelativeTo(_mo2Compiler.MO2Folder),
|
RelativePath = absPath.RelativeTo(_mo2Compiler.MO2Folder),
|
||||||
Hash = hash
|
Hash = hash
|
||||||
};
|
};
|
||||||
}).ToList();
|
}));
|
||||||
|
|
||||||
var srcData = result.Sources.Select(f => _mo2Compiler.MO2Folder.Combine(f.RelativePath).ReadAllBytes())
|
var srcData = result.Sources.Select(f => _mo2Compiler.MO2Folder.Combine(f.RelativePath).ReadAllBytes())
|
||||||
.ConcatArrays();
|
.ConcatArrays();
|
||||||
|
@ -48,15 +48,15 @@ namespace Wabbajack.Test
|
|||||||
GameType = Game.Skyrim,
|
GameType = Game.Skyrim,
|
||||||
Archives = new List<Archive>
|
Archives = new List<Archive>
|
||||||
{
|
{
|
||||||
new Archive
|
new Archive(
|
||||||
{
|
new NexusDownloader.State
|
||||||
State = new NexusDownloader.State
|
|
||||||
{
|
{
|
||||||
Game = Game.Skyrim,
|
Game = Game.Skyrim,
|
||||||
Author = "bill",
|
Author = "bill",
|
||||||
ModID = 42,
|
ModID = 42,
|
||||||
FileID = 33,
|
FileID = 33,
|
||||||
},
|
})
|
||||||
|
{
|
||||||
Hash = Hash.FromLong(42)
|
Hash = Hash.FromLong(42)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -71,9 +71,8 @@ namespace Wabbajack.Test
|
|||||||
};
|
};
|
||||||
// Error due to file downloaded from 3rd party
|
// Error due to file downloaded from 3rd party
|
||||||
modlist.GameType = Game.Skyrim;
|
modlist.GameType = Game.Skyrim;
|
||||||
modlist.Archives[0] = new Archive()
|
modlist.Archives[0] = new Archive(new HTTPDownloader.State("https://somebadplace.com"))
|
||||||
{
|
{
|
||||||
State = new HTTPDownloader.State("https://somebadplace.com"),
|
|
||||||
Hash = Hash.FromLong(42)
|
Hash = Hash.FromLong(42)
|
||||||
};
|
};
|
||||||
var errors = await validate.Validate(modlist);
|
var errors = await validate.Validate(modlist);
|
||||||
@ -81,9 +80,8 @@ namespace Wabbajack.Test
|
|||||||
|
|
||||||
// Ok due to file downloaded from whitelisted 3rd party
|
// Ok due to file downloaded from whitelisted 3rd party
|
||||||
modlist.GameType = Game.Skyrim;
|
modlist.GameType = Game.Skyrim;
|
||||||
modlist.Archives[0] = new Archive
|
modlist.Archives[0] = new Archive(new HTTPDownloader.State("https://somegoodplace.com/baz.7z"))
|
||||||
{
|
{
|
||||||
State = new HTTPDownloader.State("https://somegoodplace.com/baz.7z"),
|
|
||||||
Hash = Hash.FromLong(42)
|
Hash = Hash.FromLong(42)
|
||||||
};
|
};
|
||||||
errors = await validate.Validate(modlist);
|
errors = await validate.Validate(modlist);
|
||||||
@ -92,9 +90,8 @@ namespace Wabbajack.Test
|
|||||||
|
|
||||||
// Error due to file downloaded from bad 3rd party
|
// Error due to file downloaded from bad 3rd party
|
||||||
modlist.GameType = Game.Skyrim;
|
modlist.GameType = Game.Skyrim;
|
||||||
modlist.Archives[0] = new Archive
|
modlist.Archives[0] = new Archive(new GoogleDriveDownloader.State("bleg"))
|
||||||
{
|
{
|
||||||
State = new GoogleDriveDownloader.State("bleg"),
|
|
||||||
Hash = Hash.FromLong(42)
|
Hash = Hash.FromLong(42)
|
||||||
};
|
};
|
||||||
errors = await validate.Validate(modlist);
|
errors = await validate.Validate(modlist);
|
||||||
@ -102,9 +99,8 @@ namespace Wabbajack.Test
|
|||||||
|
|
||||||
// Ok due to file downloaded from good google site
|
// Ok due to file downloaded from good google site
|
||||||
modlist.GameType = Game.Skyrim;
|
modlist.GameType = Game.Skyrim;
|
||||||
modlist.Archives[0] = new Archive
|
modlist.Archives[0] = new Archive(new GoogleDriveDownloader.State("googleDEADBEEF"))
|
||||||
{
|
{
|
||||||
State = new GoogleDriveDownloader.State("googleDEADBEEF"),
|
|
||||||
Hash = Hash.FromLong(42)
|
Hash = Hash.FromLong(42)
|
||||||
};
|
};
|
||||||
errors = await validate.Validate(modlist);
|
errors = await validate.Validate(modlist);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user