2019-02-16 17:34:17 +01:00
// _ _ _ ____ _ _____
2017-11-18 17:27:06 +01:00
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
2019-01-14 19:11:17 +01:00
// |
2020-02-01 23:33:35 +01:00
// Copyright 2015-2020 Łukasz "JustArchi" Domeradzki
2018-07-27 04:52:14 +02:00
// Contact: JustArchi@JustArchi.net
2019-01-14 19:11:17 +01:00
// |
2018-07-27 04:52:14 +02:00
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
2019-01-14 19:11:17 +01:00
// |
2018-07-27 04:52:14 +02:00
// http://www.apache.org/licenses/LICENSE-2.0
2019-01-14 19:11:17 +01:00
// |
2018-07-27 04:52:14 +02:00
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2016-06-27 02:07:27 +02:00
2016-08-02 06:04:44 +02:00
using System ;
2018-05-23 15:28:02 +02:00
using System.IO ;
2016-08-02 06:04:44 +02:00
using System.Reflection ;
2019-06-25 12:26:55 +02:00
using ArchiSteamFarm.Plugins ;
2019-01-10 23:44:32 +01:00
using JetBrains.Annotations ;
2016-08-02 06:04:44 +02:00
2016-06-27 02:07:27 +02:00
namespace ArchiSteamFarm {
internal static class SharedInfo {
2016-11-24 07:32:16 +01:00
internal const ulong ArchiSteamID = 76561198006963719 ;
2019-07-27 19:22:22 +02:00
internal const string ArchivalLogFile = "log.{#}.txt" ;
internal const string ArchivalLogsDirectory = "logs" ;
2017-12-29 03:40:44 +01:00
internal const string ASF = nameof ( ASF ) ;
2016-11-24 07:32:16 +01:00
internal const ulong ASFGroupSteamID = 103582791440160998 ;
2018-10-06 05:06:29 +02:00
internal const string AssemblyDocumentation = AssemblyName + ".xml" ;
2017-12-29 03:40:44 +01:00
internal const string AssemblyName = nameof ( ArchiSteamFarm ) ;
2016-08-02 06:04:44 +02:00
internal const string ConfigDirectory = "config" ;
2018-02-17 19:29:33 +01:00
internal const string DatabaseExtension = ".db" ;
2016-08-02 06:04:44 +02:00
internal const string DebugDirectory = "debug" ;
2019-04-24 10:49:37 +02:00
internal const string EnvironmentVariableCryptKey = ASF + "_CRYPTKEY" ;
2019-07-07 11:39:44 +02:00
internal const string EnvironmentVariablePath = ASF + "_PATH" ;
2019-12-08 00:26:41 +01:00
internal const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases" ;
2018-09-22 20:35:13 +02:00
internal const string GithubRepo = "JustArchiNET/" + AssemblyName ;
2019-08-01 21:21:43 +02:00
internal const string GlobalConfigFileName = ASF + JsonConfigExtension ;
2018-02-17 19:29:33 +01:00
internal const string GlobalDatabaseFileName = ASF + DatabaseExtension ;
2019-08-01 21:12:48 +02:00
internal const string IPCConfigExtension = ".config" ;
internal const string IPCConfigFile = nameof ( IPC ) + IPCConfigExtension ;
2019-08-01 21:21:43 +02:00
internal const string JsonConfigExtension = ".json" ;
2018-02-17 19:29:33 +01:00
internal const string KeysExtension = ".keys" ;
2018-03-08 10:53:11 +01:00
internal const string KeysUnusedExtension = ".unused" ;
internal const string KeysUsedExtension = ".used" ;
2018-11-28 03:13:38 +01:00
internal const string LicenseName = "Apache 2.0" ;
internal const string LicenseURL = "http://www.apache.org/licenses/LICENSE-2.0" ;
2016-11-24 07:32:16 +01:00
internal const string LogFile = "log.txt" ;
2018-02-17 19:29:33 +01:00
internal const string MobileAuthenticatorExtension = ".maFile" ;
2019-01-10 22:33:07 +01:00
internal const string PluginsDirectory = "plugins" ;
2018-07-28 05:17:52 +02:00
internal const string ProjectURL = "https://github.com/" + GithubRepo ;
2018-02-17 19:29:33 +01:00
internal const string SentryHashExtension = ".bin" ;
2016-12-19 04:45:30 +01:00
internal const string StatisticsServer = "asf.justarchi.net" ;
2018-02-11 11:11:38 +01:00
internal const string UlongCompatibilityStringPrefix = "s_" ;
2018-02-17 19:29:33 +01:00
internal const string UpdateDirectory = "_old" ;
2018-01-28 03:23:58 +01:00
internal const string WebsiteDirectory = "www" ;
2016-08-02 06:04:44 +02:00
2019-12-05 21:34:40 +01:00
internal static string HomeDirectory {
get {
2019-12-08 00:13:18 +01:00
if ( ! string . IsNullOrEmpty ( CachedHomeDirectory ) ) {
return CachedHomeDirectory ;
}
2019-12-16 20:14:49 +01:00
// We're aiming to handle two possible cases here, classic publish and single-file publish which is possible with OS-specific builds
// In order to achieve that, we have to guess the case above from the binary's name
// We can't just return our base directory since it could lead to the (wrong) temporary directory of extracted files in a single-publish scenario
// If the path goes to our own binary, the user is using OS-specific build, single-file or not, we'll use path to location of that binary then
// Otherwise, this path goes to some third-party binary, likely dotnet/mono, the user is using our generic build or other custom binary, we need to trust our base directory then
CachedHomeDirectory = Path . GetFileNameWithoutExtension ( OS . ProcessFileName ) = = AssemblyName ? Path . GetDirectoryName ( OS . ProcessFileName ) : AppContext . BaseDirectory ;
2019-12-08 00:13:18 +01:00
return CachedHomeDirectory ;
2019-12-05 21:34:40 +01:00
}
}
2019-01-10 23:44:32 +01:00
[NotNull]
2019-06-25 12:26:55 +02:00
internal static string ProgramIdentifier = > PublicIdentifier + " V" + Version + " (" + BuildInfo . Variant + "/" + ModuleVersion + " | " + OS . Variant + ")" ;
[NotNull]
internal static string PublicIdentifier = > AssemblyName + ( BuildInfo . IsCustomBuild ? "-custom" : PluginsCore . HasActivePluginsLoaded ? "-modded" : "" ) ;
2019-01-10 23:44:32 +01:00
2019-05-19 15:38:06 +02:00
[NotNull]
internal static Version Version = > Assembly . GetEntryAssembly ( ) ? . GetName ( ) . Version ? ? throw new ArgumentNullException ( nameof ( Version ) ) ;
2018-05-11 23:20:25 +02:00
2019-06-25 12:26:55 +02:00
private static Guid ModuleVersion = > Assembly . GetEntryAssembly ( ) ? . ManifestModule . ModuleVersionId ? ? throw new ArgumentNullException ( nameof ( ModuleVersion ) ) ;
2019-12-08 00:13:18 +01:00
private static string CachedHomeDirectory ;
2018-05-11 23:20:25 +02:00
internal static class BuildInfo {
#if ASF_VARIANT_DOCKER
2019-08-05 11:59:36 +02:00
internal static bool CanUpdate = > false ;
[NotNull]
internal static string Variant = > "docker" ;
2018-05-11 23:20:25 +02:00
#elif ASF_VARIANT_GENERIC
2019-08-05 11:59:36 +02:00
internal static bool CanUpdate = > true ;
[NotNull]
internal static string Variant = > "generic" ;
2018-06-03 07:51:20 +02:00
#elif ASF_VARIANT_GENERIC_NETF
2019-08-05 11:59:36 +02:00
internal static bool CanUpdate = > true ;
[NotNull]
internal static string Variant = > "generic-netf" ;
2018-05-11 23:20:25 +02:00
#elif ASF_VARIANT_LINUX_ARM
2019-08-05 11:59:36 +02:00
internal static bool CanUpdate = > true ;
[NotNull]
internal static string Variant = > "linux-arm" ;
2020-04-08 19:32:53 +02:00
#elif ASF_VARIANT_LINUX_ARM64
internal static bool CanUpdate = > true ;
[NotNull]
internal static string Variant = > "linux-arm64" ;
2018-05-11 23:20:25 +02:00
#elif ASF_VARIANT_LINUX_X64
2019-08-05 11:59:36 +02:00
internal static bool CanUpdate = > true ;
[NotNull]
internal static string Variant = > "linux-x64" ;
2018-05-11 23:20:25 +02:00
#elif ASF_VARIANT_OSX_X64
2019-08-05 11:59:36 +02:00
internal static bool CanUpdate = > true ;
[NotNull]
internal static string Variant = > "osx-x64" ;
2018-05-11 23:20:25 +02:00
#elif ASF_VARIANT_WIN_X64
2019-08-05 11:59:36 +02:00
internal static bool CanUpdate = > true ;
[NotNull]
internal static string Variant = > "win-x64" ;
2018-05-11 23:20:25 +02:00
#else
2019-08-05 11:59:36 +02:00
internal static bool CanUpdate = > false ;
[NotNull]
internal static string Variant = > SourceVariant ;
2018-05-11 23:20:25 +02:00
#endif
private const string SourceVariant = "source" ;
internal static bool IsCustomBuild = > Variant = = SourceVariant ;
}
2016-06-27 02:07:27 +02:00
}
2018-07-28 05:17:52 +02:00
}