[Aaru.Settings] Reformat and cleanup.

This commit is contained in:
2023-10-03 23:37:25 +01:00
parent 68c16e78fc
commit 4b7fe8a837

View File

@@ -126,6 +126,7 @@ public static class Settings
/// <summary>Local database path</summary>
public static string LocalDbPath { get; private set; }
/// <summary>Main database path</summary>
public static string MainDbPath { get; private set; }
@@ -136,7 +137,7 @@ public static class Settings
PlatformID ptId = DetectOS.GetRealPlatformID();
string homePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
LocalDbPath = "local.db";
string oldMainDbPath = "master.db";
var oldMainDbPath = "master.db";
MainDbPath = "main.db";
try
@@ -322,6 +323,7 @@ public static class Settings
var stats = (NSDictionary)obj;
if(stats != null)
{
Current.Stats = new StatsSettings
{
ShareStats = stats.TryGetValue("ShareStats", out NSObject obj2) &&
@@ -345,11 +347,13 @@ public static class Settings
((NSNumber)obj2).ToBool()
};
}
}
else
Current.Stats = null;
Current.GdprCompliance = parsedPreferences.TryGetValue("GdprCompliance", out obj)
? (ulong)((NSNumber)obj).ToLong() : 0;
? (ulong)((NSNumber)obj).ToLong()
: 0;
prefsFs.Close();
}
@@ -397,6 +401,7 @@ public static class Settings
stats = Convert.ToBoolean(dicKey.GetValue("Statistics"));
if(stats)
{
Current.Stats = new StatsSettings
{
ShareStats = Convert.ToBoolean(dicKey.GetValue("ShareStats")),
@@ -410,6 +415,7 @@ public static class Settings
MediaStats = Convert.ToBoolean(dicKey.GetValue("MediaStats")),
VerifyStats = Convert.ToBoolean(dicKey.GetValue("VerifyStats"))
};
}
SaveSettings();
@@ -434,6 +440,7 @@ public static class Settings
stats = Convert.ToBoolean(key.GetValue("Statistics"));
if(stats)
{
Current.Stats = new StatsSettings
{
ShareStats = Convert.ToBoolean(key.GetValue("ShareStats")),
@@ -448,6 +455,7 @@ public static class Settings
VerifyStats = Convert.ToBoolean(key.GetValue("VerifyStats"))
};
}
}
break;
#endif
@@ -542,54 +550,26 @@ public static class Settings
{
var root = new NSDictionary
{
{
"SaveReportsGlobally", Current.SaveReportsGlobally
},
{
"ShareReports", Current.ShareReports
},
{
"GdprCompliance", Current.GdprCompliance
},
{
"EnableDecryption", Current.EnableDecryption
}
{ "SaveReportsGlobally", Current.SaveReportsGlobally },
{ "ShareReports", Current.ShareReports },
{ "GdprCompliance", Current.GdprCompliance },
{ "EnableDecryption", Current.EnableDecryption }
};
if(Current.Stats != null)
{
var stats = new NSDictionary
{
{
"ShareStats", Current.Stats.ShareStats
},
{
"CommandStats", Current.Stats.CommandStats
},
{
"DeviceStats", Current.Stats.DeviceStats
},
{
"FilesystemStats", Current.Stats.FilesystemStats
},
{
"FilterStats", Current.Stats.FilterStats
},
{
"MediaImageStats", Current.Stats.MediaImageStats
},
{
"MediaScanStats", Current.Stats.MediaScanStats
},
{
"PartitionStats", Current.Stats.PartitionStats
},
{
"MediaStats", Current.Stats.MediaStats
},
{
"VerifyStats", Current.Stats.VerifyStats
}
{ "ShareStats", Current.Stats.ShareStats },
{ "CommandStats", Current.Stats.CommandStats },
{ "DeviceStats", Current.Stats.DeviceStats },
{ "FilesystemStats", Current.Stats.FilesystemStats },
{ "FilterStats", Current.Stats.FilterStats },
{ "MediaImageStats", Current.Stats.MediaImageStats },
{ "MediaScanStats", Current.Stats.MediaScanStats },
{ "PartitionStats", Current.Stats.PartitionStats },
{ "MediaStats", Current.Stats.MediaStats },
{ "VerifyStats", Current.Stats.VerifyStats }
};
root.Add("Stats", stats);