wabbajack/Wabbajack.Common/Consts.cs

155 lines
8.0 KiB
C#
Raw Normal View History

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;
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
{
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/#!";
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();
// 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();
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
public static string WABBAJACK_INCLUDE = "WABBAJACK_INCLUDE";
2019-09-04 20:49:13 +00:00
public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE";
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
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||--}";
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||--}";
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",
"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
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";
public static string UnlistedModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/unlisted_modlists.json";
public static string ModlistSummaryURL = "http://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 =
$"{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
public static RelativePath MetaIni = new RelativePath("meta.ini");
2020-03-31 22:05:36 +00:00
public static Extension IniExtension = new Extension(".ini");
2019-10-14 21:04:12 +00:00
2020-03-25 12:47:25 +00:00
public static Extension HashFileExtension = new Extension(".xxHash");
public static Extension MetaFileExtension = new Extension(".meta");
2020-04-09 22:36:07 +00:00
public const string ModListExtensionString = ".wabbajack";
public static Extension ModListExtension = new Extension(ModListExtensionString);
2020-03-25 12:47:25 +00:00
public static AbsolutePath LocalAppDataPath => new AbsolutePath(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";
public static string WabbajackCacheLocation = "http://build.wabbajack.org/nexus_api_cache/";
public static string WabbajackCacheHostname = "build.wabbajack.org";
2020-03-30 20:38:46 +00:00
public static Uri WabbajackBuildServerUri = new Uri("https://build.wabbajack.org");
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-03-25 12:47:25 +00:00
public static AbsolutePath PatchCacheFolder => LocalAppDataPath.Combine("patch_cache");
public static int MaxConnectionsPerServer = 4;
2020-02-20 10:45:38 +00:00
2020-03-29 03:29:27 +00:00
public static AbsolutePath LogsFolder => ((RelativePath)"logs").RelativeToEntryPoint();
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;
2020-03-25 12:47:25 +00:00
public static Extension BSA = new Extension(".BSA");
2020-03-25 22:30:43 +00:00
public static Extension MOHIDDEN = new Extension(".mohidden");
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;
public static string CompressedBodyHeader = "x-compressed-body";
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";
public static string AuthorAPIKeyFile = "author-api-key.txt";
2020-04-23 10:38:43 +00:00
public static Uri WabbajackOrg = new Uri("https://www.wabbajack.org/");
2020-05-09 22:16:16 +00:00
public static long UPLOADED_FILE_BLOCK_SIZE = (long)1024 * 1024 * 2;
2020-05-20 03:55:12 +00:00
public static Uri WabbajackMirror = new Uri("https://wabbajack-mirror.b-cdn.net");
2020-05-09 22:16:16 +00:00
2019-07-21 04:40:54 +00:00
}
}