2019-07-21 04:40:54 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2020-03-23 12:57:18 +00:00
|
|
|
|
using System.Linq;
|
2019-07-23 04:27:26 +00:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Runtime.InteropServices;
|
2020-04-16 15:16:49 +00:00
|
|
|
|
using System.Text.RegularExpressions;
|
2019-12-12 13:41:06 +00:00
|
|
|
|
using Alphaleonis.Win32.Filesystem;
|
2019-12-26 16:47:10 +00:00
|
|
|
|
using Wabbajack.Common.IO;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Common
|
|
|
|
|
{
|
|
|
|
|
public static class Consts
|
|
|
|
|
{
|
2021-07-04 22:33:26 +00:00
|
|
|
|
public static Version? CurrentMinimumWabbajackVersion = new("2.2.2.0");
|
|
|
|
|
public static Version MaximumUnsupportedWindowsVersion = new("10.0.18363.0");
|
2019-10-03 03:23:11 +00:00
|
|
|
|
public static bool TestMode { get; set; } = false;
|
|
|
|
|
|
2020-03-25 22:30:43 +00:00
|
|
|
|
public static RelativePath GameFolderFilesDir = (RelativePath)"Game Folder Files";
|
|
|
|
|
public static RelativePath ManualGameFilesDir = (RelativePath)"Manual Game Files";
|
|
|
|
|
public static RelativePath LOOTFolderFilesDir = (RelativePath)"LOOT Config Files";
|
|
|
|
|
public static RelativePath BSACreationDir = (RelativePath)"TEMP_BSA_FILES";
|
2019-10-20 11:26:42 +00:00
|
|
|
|
|
2020-03-29 03:29:27 +00:00
|
|
|
|
public static AbsolutePath ModListDownloadFolder => "downloaded_mod_lists".RelativeTo(AbsolutePath.EntryPoint);
|
2019-10-20 11:26:42 +00:00
|
|
|
|
|
2019-09-26 04:14:15 +00:00
|
|
|
|
public static string MegaPrefix = "https://mega.nz/#!";
|
2020-04-27 18:49:22 +00:00
|
|
|
|
public static string MegaFilePrefix = "https://mega.nz/file/";
|
2019-07-23 04:27:26 +00:00
|
|
|
|
|
2020-04-09 22:36:07 +00:00
|
|
|
|
public static readonly HashSet<Extension> SupportedArchives = new[]{".zip", ".rar", ".7z", ".7zip", ".fomod", ".omod", ".exe", ".dat", ".gz", ".tar"}
|
2020-03-23 12:57:18 +00:00
|
|
|
|
.Select(s => new Extension(s)).ToHashSet();
|
2019-12-15 11:27:16 +00:00
|
|
|
|
|
|
|
|
|
// HashSet with archive extensions that need to be tested before extraction
|
2020-03-23 12:57:18 +00:00
|
|
|
|
public static HashSet<Extension> TestArchivesBeforeExtraction = new []{".dat"}.Select(s => new Extension(s)).ToHashSet();
|
2019-09-24 15:51:47 +00:00
|
|
|
|
|
2020-03-23 12:57:18 +00:00
|
|
|
|
public static readonly HashSet<Extension> SupportedBSAs = new[] {".bsa", ".ba2"}
|
|
|
|
|
.Select(s => new Extension(s)).ToHashSet();
|
2019-07-24 04:31:08 +00:00
|
|
|
|
|
2020-03-25 12:47:25 +00:00
|
|
|
|
public static HashSet<Extension> ConfigFileExtensions = new[]{".json", ".ini", ".yml", ".xml"}.Select(s => new Extension(s)).ToHashSet();
|
|
|
|
|
public static HashSet<Extension> ESPFileExtensions = new []{ ".esp", ".esm", ".esl"}.Select(s => new Extension(s)).ToHashSet();
|
|
|
|
|
public static HashSet<Extension> AssetFileExtensions = new[] {".dds", ".tga", ".nif", ".psc", ".pex"}.Select(s => new Extension(s)).ToHashSet();
|
2020-03-23 12:57:18 +00:00
|
|
|
|
|
|
|
|
|
public static readonly Extension EXE = new Extension(".exe");
|
|
|
|
|
public static readonly Extension OMOD = new Extension(".omod");
|
2020-03-25 12:47:25 +00:00
|
|
|
|
public static readonly Extension ESM = new Extension(".esm");
|
|
|
|
|
public static readonly Extension ESP = new Extension(".esp");
|
2019-09-02 22:36:57 +00:00
|
|
|
|
|
2019-08-11 22:57:32 +00:00
|
|
|
|
public static string WABBAJACK_INCLUDE = "WABBAJACK_INCLUDE";
|
2019-09-04 20:49:13 +00:00
|
|
|
|
public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE";
|
2020-08-10 17:18:16 +00:00
|
|
|
|
public static string WABBAJACK_ALWAYS_DISABLE = "WABBAJACK_ALWAYS_DISABLE";
|
2019-09-20 22:49:32 +00:00
|
|
|
|
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
|
2021-02-12 16:57:37 +00:00
|
|
|
|
public static string WABBAJACK_IGNORE = "WABBAJACK_IGNORE";
|
2021-03-14 19:53:16 +00:00
|
|
|
|
public static string WABBAJACK_NOMATCH_INCLUDE_FILES = "WABBAJACK_NOMATCH_INCLUDE_FILES.txt";
|
|
|
|
|
public static string WABBAJACK_IGNORE_FILES = "WABBAJACK_IGNORE_FILES.txt";
|
2021-03-14 12:41:31 +00:00
|
|
|
|
public static string WABBAJACK_INCLUDE_SAVES = "WABBAJACK_INCLUDE_SAVES";
|
2019-08-11 22:57:32 +00:00
|
|
|
|
|
2019-08-24 23:20:54 +00:00
|
|
|
|
public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}";
|
|
|
|
|
public static string GAME_PATH_MAGIC_DOUBLE_BACK = "{--||GAME_PATH_MAGIC_DOUBLE_BACK||--}";
|
|
|
|
|
public static string GAME_PATH_MAGIC_FORWARD = "{--||GAME_PATH_MAGIC_FORWARD||--}";
|
|
|
|
|
|
|
|
|
|
public static string MO2_PATH_MAGIC_BACK = "{--||MO2_PATH_MAGIC_BACK||--}";
|
|
|
|
|
public static string MO2_PATH_MAGIC_DOUBLE_BACK = "{--||MO2_PATH_MAGIC_DOUBLE_BACK||--}";
|
|
|
|
|
public static string MO2_PATH_MAGIC_FORWARD = "{--||MO2_PATH_MAGIC_FORWARD||--}";
|
|
|
|
|
|
2019-09-03 22:12:39 +00:00
|
|
|
|
public static string DOWNLOAD_PATH_MAGIC_BACK = "{--||DOWNLOAD_PATH_MAGIC_BACK||--}";
|
|
|
|
|
public static string DOWNLOAD_PATH_MAGIC_DOUBLE_BACK = "{--||DOWNLOAD_PATH_MAGIC_DOUBLE_BACK||--}";
|
|
|
|
|
public static string DOWNLOAD_PATH_MAGIC_FORWARD = "{--||DOWNLOAD_PATH_MAGIC_FORWARD||--}";
|
2021-03-11 15:00:26 +00:00
|
|
|
|
|
|
|
|
|
public static Uri GITHUB_REPO_RELEASES = new Uri("https://api.github.com/repos/wabbajack-tools/wabbajack/releases");
|
2019-09-03 22:12:39 +00:00
|
|
|
|
|
2019-08-24 23:20:54 +00:00
|
|
|
|
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public static string AppName = "Wabbajack";
|
2019-08-25 03:46:32 +00:00
|
|
|
|
|
2020-03-25 12:47:25 +00:00
|
|
|
|
public static HashSet<RelativePath> GameESMs = new []
|
2019-10-19 10:59:43 +00:00
|
|
|
|
{
|
|
|
|
|
// Skyrim LE/SE
|
|
|
|
|
"Skyrim.esm",
|
|
|
|
|
"Update.esm",
|
|
|
|
|
"Dawnguard.esm",
|
|
|
|
|
"HearthFires.esm",
|
|
|
|
|
"Dragonborn.esm",
|
|
|
|
|
|
|
|
|
|
// Fallout 4
|
|
|
|
|
"DLCRobot.esm",
|
|
|
|
|
"DLCworkshop01.esm",
|
|
|
|
|
"DLCCoast.esm",
|
2019-11-04 17:57:19 +00:00
|
|
|
|
"DLCworkshop02.esm",
|
|
|
|
|
"DLCworkshop03.esm",
|
2019-10-19 10:59:43 +00:00
|
|
|
|
"DLCNukaWorld.esm",
|
|
|
|
|
"DLCUltraHighResolution.esm"
|
|
|
|
|
|
2020-03-25 12:47:25 +00:00
|
|
|
|
}.Select(s => (RelativePath)s).ToHashSet();
|
2019-09-14 04:35:42 +00:00
|
|
|
|
|
2019-09-29 22:21:18 +00:00
|
|
|
|
public static string ServerWhitelistURL = "https://raw.githubusercontent.com/wabbajack-tools/opt-out-lists/master/ServerWhitelist.yml";
|
2019-10-20 19:30:39 +00:00
|
|
|
|
public static string ModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/modlists.json";
|
2020-11-19 22:56:30 +00:00
|
|
|
|
public static string UtilityModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/utility_modlists.json";
|
2020-07-16 21:17:37 +00:00
|
|
|
|
public static string UnlistedModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/unlisted_modlists.json";
|
2021-05-17 23:20:03 +00:00
|
|
|
|
public static string ModlistSummaryURL = "https://build.wabbajack.org/lists/status.json";
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public static string UserAgent
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var platformType = Environment.Is64BitOperatingSystem ? "x64" : "x86";
|
|
|
|
|
var headerString =
|
2019-10-12 21:37:16 +00:00
|
|
|
|
$"{AppName}/{Assembly.GetEntryAssembly()?.GetName()?.Version ?? new Version(0, 1)} ({Environment.OSVersion.VersionString}; {platformType}) {RuntimeInformation.FrameworkDescription}";
|
2019-09-14 04:35:42 +00:00
|
|
|
|
return headerString;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-25 12:47:25 +00:00
|
|
|
|
|
2021-06-27 20:35:11 +00:00
|
|
|
|
public static RelativePath MetaIni = new("meta.ini");
|
|
|
|
|
public static Extension IniExtension = new(".ini");
|
2019-10-14 21:04:12 +00:00
|
|
|
|
|
2021-06-27 20:35:11 +00:00
|
|
|
|
public static Extension HashFileExtension = new(".xxHash");
|
|
|
|
|
public static Extension MetaFileExtension = new(".meta");
|
2020-04-09 22:36:07 +00:00
|
|
|
|
public const string ModListExtensionString = ".wabbajack";
|
2021-06-27 20:35:11 +00:00
|
|
|
|
public static Extension ModListExtension = new(ModListExtensionString);
|
|
|
|
|
public static AbsolutePath LocalAppDataPath => new(Path.Combine(KnownFolders.LocalAppData.Path, "Wabbajack"));
|
2020-07-10 11:55:53 +00:00
|
|
|
|
public static AbsolutePath FaviconCacheFolderPath => LocalAppDataPath.Combine("favicons");
|
2020-01-04 02:49:08 +00:00
|
|
|
|
public static string MetricsKeyHeader => "x-metrics-key";
|
2019-11-20 00:15:46 +00:00
|
|
|
|
|
2019-11-05 05:08:47 +00:00
|
|
|
|
public static string WabbajackCacheLocation = "http://build.wabbajack.org/nexus_api_cache/";
|
2020-01-02 00:11:13 +00:00
|
|
|
|
|
2020-01-01 16:19:06 +00:00
|
|
|
|
public static string WabbajackCacheHostname = "build.wabbajack.org";
|
2021-05-17 22:37:01 +00:00
|
|
|
|
|
|
|
|
|
// Direct IP to the CDN
|
2021-05-17 23:20:03 +00:00
|
|
|
|
public static string NetworkWorkaroundHost = "51.81.80.6";
|
2021-05-17 22:37:01 +00:00
|
|
|
|
public static bool UseNetworkWorkaroundMode = false;
|
|
|
|
|
|
2020-03-30 20:38:46 +00:00
|
|
|
|
public static Uri WabbajackBuildServerUri = new Uri("https://build.wabbajack.org");
|
2020-01-02 00:11:13 +00:00
|
|
|
|
public static int WabbajackCachePort = 80;
|
2020-01-03 23:02:48 +00:00
|
|
|
|
public static int MaxHTTPRetries = 4;
|
2020-03-25 22:30:43 +00:00
|
|
|
|
public static RelativePath MO2ModFolderName = (RelativePath)"mods";
|
2020-08-07 13:22:48 +00:00
|
|
|
|
public static RelativePath MO2ProfilesFolderName = (RelativePath)"profiles";
|
2020-02-08 00:56:22 +00:00
|
|
|
|
|
2020-03-25 12:47:25 +00:00
|
|
|
|
public static AbsolutePath PatchCacheFolder => LocalAppDataPath.Combine("patch_cache");
|
2020-02-14 13:30:58 +00:00
|
|
|
|
public static int MaxConnectionsPerServer = 4;
|
2020-02-20 10:45:38 +00:00
|
|
|
|
|
2021-03-19 05:04:27 +00:00
|
|
|
|
public static AbsolutePath LogsFolder { get; set; } = ((RelativePath)"logs").RelativeToEntryPoint();
|
2020-03-29 03:29:27 +00:00
|
|
|
|
public static AbsolutePath EntryPoint => (AbsolutePath)(Assembly.GetEntryAssembly()?.Location ?? (string)((RelativePath)"Unknown").RelativeToWorkingDirectory());
|
|
|
|
|
public static AbsolutePath LogFile => LogsFolder.Combine(EntryPoint.FileNameWithoutExtension + ".current.log");
|
2020-02-20 10:45:38 +00:00
|
|
|
|
public static int MaxOldLogs = 50;
|
2021-06-27 20:35:11 +00:00
|
|
|
|
public static Extension BSA = new(".BSA");
|
|
|
|
|
public static Extension MOHIDDEN = new(".mohidden");
|
2020-03-04 10:56:35 +00:00
|
|
|
|
|
2020-03-25 12:47:25 +00:00
|
|
|
|
public static AbsolutePath SettingsFile => LocalAppDataPath.Combine("settings.json");
|
2020-03-25 22:30:43 +00:00
|
|
|
|
public static RelativePath SettingsIni = (RelativePath)"settings.ini";
|
2020-04-21 13:42:32 +00:00
|
|
|
|
public static byte SettingsVersion => 2;
|
2020-12-31 06:44:42 +00:00
|
|
|
|
public static TimeSpan MaxVerifyTime => TimeSpan.FromMinutes(10);
|
2021-03-19 22:37:58 +00:00
|
|
|
|
public static Extension ModlistMetadataExtension = new(".modlist_metadata");
|
|
|
|
|
|
2021-02-06 16:43:11 +00:00
|
|
|
|
public static readonly string WabbajackAuthoredFilesPrefix = "https://wabbajack.b-cdn.net/";
|
2020-12-31 06:44:42 +00:00
|
|
|
|
|
2020-10-19 22:16:35 +00:00
|
|
|
|
public static RelativePath NativeSettingsJson = (RelativePath)"native_compiler_settings.json";
|
|
|
|
|
|
2020-09-09 12:51:38 +00:00
|
|
|
|
public static bool IsServer = false;
|
|
|
|
|
|
2020-07-16 21:17:37 +00:00
|
|
|
|
public static string CompressedBodyHeader = "x-compressed-body";
|
|
|
|
|
|
2020-05-29 22:51:41 +00:00
|
|
|
|
public static AbsolutePath CefCacheLocation = @"CEF".RelativeTo(LocalAppDataPath);
|
|
|
|
|
|
2020-04-04 22:06:14 +00:00
|
|
|
|
public static Extension SeqExtension = new Extension(".seq");
|
|
|
|
|
|
|
|
|
|
public static RelativePath SettingsJson = (RelativePath)"settings.json";
|
|
|
|
|
|
2020-04-03 20:19:10 +00:00
|
|
|
|
public static Extension TempExtension = new Extension(".temp");
|
|
|
|
|
|
2020-03-28 20:42:45 +00:00
|
|
|
|
public static Extension OctoSig = new Extension(".octo_sig");
|
|
|
|
|
|
2020-03-25 22:30:43 +00:00
|
|
|
|
public static RelativePath ModListTxt = (RelativePath)"modlist.txt";
|
2020-03-27 03:33:24 +00:00
|
|
|
|
public static RelativePath ModOrganizer2Exe = (RelativePath)"ModOrganizer.exe";
|
|
|
|
|
public static RelativePath ModOrganizer2Ini = (RelativePath)"ModOrganizer.ini";
|
2021-07-17 05:32:37 +00:00
|
|
|
|
public static readonly string AuthorAPIKeyFile = "author-api-key.txt";
|
2020-04-23 10:38:43 +00:00
|
|
|
|
|
2021-07-17 05:32:37 +00:00
|
|
|
|
public static readonly Uri WabbajackOrg = new Uri("https://www.wabbajack.org/");
|
2020-05-09 22:16:16 +00:00
|
|
|
|
|
2021-07-17 05:32:37 +00:00
|
|
|
|
public static readonly long UploadedFileBlockSize = (long)1024 * 1024 * 2;
|
2020-05-09 22:16:16 +00:00
|
|
|
|
|
2021-07-17 05:32:37 +00:00
|
|
|
|
public static readonly HashSet<Extension> TextureExtensions = new() {new Extension(".dds"), new Extension(".tga")};
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
2019-11-04 17:57:19 +00:00
|
|
|
|
}
|