mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 06:20:34 +00:00
Remove default config files
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -2,9 +2,12 @@
|
||||
## ArchiSteamFarm
|
||||
#################
|
||||
|
||||
# Ignore all config files
|
||||
# Ignore all files in config directory
|
||||
ArchiSteamFarm/config
|
||||
|
||||
# Except placeholder to include the folder
|
||||
!ArchiSteamFarm/config/.gitkeep
|
||||
|
||||
# Include default pre-defined config files
|
||||
!ArchiSteamFarm/config/ASF.json
|
||||
!ArchiSteamFarm/config/example.json
|
||||
|
||||
@@ -253,8 +253,6 @@ namespace ArchiSteamFarm {
|
||||
|
||||
switch (botName) {
|
||||
case SharedInfo.ASF:
|
||||
case "example":
|
||||
case "minimal":
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
@@ -586,7 +584,7 @@ namespace ArchiSteamFarm {
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(zipFile.Name) || zipFile.Name.Equals(SharedInfo.GlobalConfigFileName)) {
|
||||
if (string.IsNullOrEmpty(zipFile.Name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,13 +107,7 @@
|
||||
<None Update="UI.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config\ASF.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config\example.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config\minimal.json">
|
||||
<None Update="config\.gitkeep">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="..\ASF-ui\dist\**\*.*" Exclude="**\README.md">
|
||||
|
||||
@@ -861,7 +861,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
string databaseFilePath = botPath + SharedInfo.DatabaseExtension;
|
||||
|
||||
BotDatabase botDatabase = await BotDatabase.Load(databaseFilePath).ConfigureAwait(false);
|
||||
BotDatabase botDatabase = await BotDatabase.CreateOrLoad(databaseFilePath).ConfigureAwait(false);
|
||||
if (botDatabase == null) {
|
||||
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorDatabaseInvalid, databaseFilePath));
|
||||
return;
|
||||
|
||||
@@ -144,6 +144,34 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
internal static async Task<BotDatabase> CreateOrLoad(string filePath) {
|
||||
if (string.IsNullOrEmpty(filePath)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(filePath));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!File.Exists(filePath)) {
|
||||
return new BotDatabase(filePath);
|
||||
}
|
||||
|
||||
BotDatabase botDatabase;
|
||||
|
||||
try {
|
||||
botDatabase = JsonConvert.DeserializeObject<BotDatabase>(await RuntimeCompatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false));
|
||||
} catch (Exception e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (botDatabase == null) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botDatabase));
|
||||
return null;
|
||||
}
|
||||
|
||||
botDatabase.FilePath = filePath;
|
||||
return botDatabase;
|
||||
}
|
||||
|
||||
internal IReadOnlyCollection<ulong> GetBlacklistedFromTradesSteamIDs() => BlacklistedFromTradesSteamIDs;
|
||||
|
||||
internal (string Key, string Name) GetGameToRedeemInBackground() {
|
||||
@@ -186,34 +214,6 @@ namespace ArchiSteamFarm {
|
||||
return IdlingPriorityAppIDs.Contains(appID);
|
||||
}
|
||||
|
||||
internal static async Task<BotDatabase> Load(string filePath) {
|
||||
if (string.IsNullOrEmpty(filePath)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(filePath));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!File.Exists(filePath)) {
|
||||
return new BotDatabase(filePath);
|
||||
}
|
||||
|
||||
BotDatabase botDatabase;
|
||||
|
||||
try {
|
||||
botDatabase = JsonConvert.DeserializeObject<BotDatabase>(await RuntimeCompatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false));
|
||||
} catch (Exception e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (botDatabase == null) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botDatabase));
|
||||
return null;
|
||||
}
|
||||
|
||||
botDatabase.FilePath = filePath;
|
||||
return botDatabase;
|
||||
}
|
||||
|
||||
internal async Task MakeReadOnly() {
|
||||
if (ReadOnly) {
|
||||
return;
|
||||
|
||||
@@ -246,6 +246,12 @@ namespace ArchiSteamFarm {
|
||||
return Enum.IsDefined(typeof(EUpdateChannel), UpdateChannel) ? (true, null) : (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(UpdateChannel), UpdateChannel));
|
||||
}
|
||||
|
||||
internal static GlobalConfig Create() =>
|
||||
new GlobalConfig {
|
||||
ShouldSerializeEverything = false,
|
||||
ShouldSerializeSensitiveDetails = false
|
||||
};
|
||||
|
||||
internal static async Task<GlobalConfig> Load(string filePath) {
|
||||
if (string.IsNullOrEmpty(filePath)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(filePath));
|
||||
|
||||
@@ -69,16 +69,7 @@ namespace ArchiSteamFarm {
|
||||
PackagesRefreshSemaphore.Dispose();
|
||||
}
|
||||
|
||||
internal HashSet<uint> GetPackageIDs(uint appID) {
|
||||
if (appID == 0) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(appID));
|
||||
return null;
|
||||
}
|
||||
|
||||
return PackagesData.Where(package => package.Value.AppIDs?.Contains(appID) == true).Select(package => package.Key).ToHashSet();
|
||||
}
|
||||
|
||||
internal static async Task<GlobalDatabase> Load(string filePath) {
|
||||
internal static async Task<GlobalDatabase> CreateOrLoad(string filePath) {
|
||||
if (string.IsNullOrEmpty(filePath)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(filePath));
|
||||
return null;
|
||||
@@ -106,6 +97,15 @@ namespace ArchiSteamFarm {
|
||||
return globalDatabase;
|
||||
}
|
||||
|
||||
internal HashSet<uint> GetPackageIDs(uint appID) {
|
||||
if (appID == 0) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(appID));
|
||||
return null;
|
||||
}
|
||||
|
||||
return PackagesData.Where(package => package.Value.AppIDs?.Contains(appID) == true).Select(package => package.Key).ToHashSet();
|
||||
}
|
||||
|
||||
internal async Task RefreshPackages(Bot bot, IReadOnlyDictionary<uint, uint> packages) {
|
||||
if ((bot == null) || (packages == null) || (packages.Count == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(bot) + " || " + nameof(packages));
|
||||
|
||||
@@ -34,9 +34,8 @@ namespace ArchiSteamFarm.IPC {
|
||||
internal static class ArchiKestrel {
|
||||
private const string ConfigurationFile = nameof(IPC) + ".config";
|
||||
|
||||
internal static string WebsiteDirectory { get; private set; } = Path.Combine(SharedInfo.HomeDirectory, SharedInfo.WebsiteDirectory);
|
||||
|
||||
internal static HistoryTarget HistoryTarget { get; private set; }
|
||||
internal static string WebsiteDirectory { get; private set; } = Path.Combine(SharedInfo.HomeDirectory, SharedInfo.WebsiteDirectory);
|
||||
|
||||
private static IWebHost KestrelWebHost;
|
||||
|
||||
|
||||
@@ -239,12 +239,16 @@ namespace ArchiSteamFarm {
|
||||
private static async Task InitGlobalConfigAndLanguage() {
|
||||
string globalConfigFile = Path.Combine(SharedInfo.ConfigDirectory, SharedInfo.GlobalConfigFileName);
|
||||
|
||||
GlobalConfig = await GlobalConfig.Load(globalConfigFile).ConfigureAwait(false);
|
||||
if (GlobalConfig == null) {
|
||||
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorGlobalConfigNotLoaded, globalConfigFile));
|
||||
await Task.Delay(5 * 1000).ConfigureAwait(false);
|
||||
await Exit(1).ConfigureAwait(false);
|
||||
return;
|
||||
if (File.Exists(globalConfigFile)) {
|
||||
GlobalConfig = await GlobalConfig.Load(globalConfigFile).ConfigureAwait(false);
|
||||
if (GlobalConfig == null) {
|
||||
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorGlobalConfigNotLoaded, globalConfigFile));
|
||||
await Task.Delay(5 * 1000).ConfigureAwait(false);
|
||||
await Exit(1).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
GlobalConfig = GlobalConfig.Create();
|
||||
}
|
||||
|
||||
if (Debugging.IsUserDebugging) {
|
||||
@@ -312,7 +316,7 @@ namespace ArchiSteamFarm {
|
||||
await Task.Delay(5 * 1000).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
GlobalDatabase = await GlobalDatabase.Load(globalDatabaseFile).ConfigureAwait(false);
|
||||
GlobalDatabase = await GlobalDatabase.CreateOrLoad(globalDatabaseFile).ConfigureAwait(false);
|
||||
if (GlobalDatabase == null) {
|
||||
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorDatabaseInvalid, globalDatabaseFile));
|
||||
await Task.Delay(5 * 1000).ConfigureAwait(false);
|
||||
|
||||
0
ArchiSteamFarm/config/.gitkeep
Normal file
0
ArchiSteamFarm/config/.gitkeep
Normal file
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"AutoRestart": true,
|
||||
"Blacklist": [],
|
||||
"CommandPrefix": "!",
|
||||
"ConfirmationsLimiterDelay": 10,
|
||||
"ConnectionTimeout": 60,
|
||||
"CurrentCulture": null,
|
||||
"Debug": false,
|
||||
"FarmingDelay": 15,
|
||||
"GiftsLimiterDelay": 1,
|
||||
"Headless": false,
|
||||
"IdleFarmingPeriod": 8,
|
||||
"InventoryLimiterDelay": 3,
|
||||
"IPC": false,
|
||||
"IPCPassword": null,
|
||||
"LoginLimiterDelay": 10,
|
||||
"MaxFarmingTime": 10,
|
||||
"MaxTradeHoldDuration": 15,
|
||||
"OptimizationMode": 0,
|
||||
"Statistics": true,
|
||||
"SteamMessagePrefix": "/me ",
|
||||
"SteamOwnerID": 0,
|
||||
"SteamProtocols": 5,
|
||||
"UpdateChannel": 1,
|
||||
"UpdatePeriod": 24,
|
||||
"WebLimiterDelay": 200,
|
||||
"WebProxy": null,
|
||||
"WebProxyPassword": null,
|
||||
"WebProxyUsername": null
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"AcceptGifts": false,
|
||||
"AutoSteamSaleEvent": false,
|
||||
"BotBehaviour": 0,
|
||||
"CustomGamePlayedWhileFarming": null,
|
||||
"CustomGamePlayedWhileIdle": null,
|
||||
"Enabled": false,
|
||||
"FarmingOrders": [],
|
||||
"GamesPlayedWhileIdle": [],
|
||||
"HoursUntilCardDrops": 3,
|
||||
"IdlePriorityQueueOnly": false,
|
||||
"IdleRefundableGames": true,
|
||||
"LootableTypes": [
|
||||
1,
|
||||
3,
|
||||
5
|
||||
],
|
||||
"MatchableTypes": [
|
||||
5
|
||||
],
|
||||
"OnlineStatus": 1,
|
||||
"PasswordFormat": 0,
|
||||
"Paused": false,
|
||||
"RedeemingPreferences": 0,
|
||||
"SendOnFarmingFinished": false,
|
||||
"SendTradePeriod": 0,
|
||||
"ShutdownOnFarmingFinished": false,
|
||||
"SteamLogin": null,
|
||||
"SteamMasterClanID": 0,
|
||||
"SteamParentalCode": null,
|
||||
"SteamPassword": null,
|
||||
"SteamTradeToken": null,
|
||||
"SteamUserPermissions": {},
|
||||
"TradingPreferences": 0,
|
||||
"TransferableTypes": [
|
||||
1,
|
||||
3,
|
||||
5
|
||||
],
|
||||
"UseLoginKeys": true
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"Enabled": false,
|
||||
"SteamLogin": null,
|
||||
"SteamPassword": null
|
||||
}
|
||||
Reference in New Issue
Block a user