mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Aaru.Settings] Reformat and cleanup.
This commit is contained in:
@@ -126,6 +126,7 @@ public static class Settings
|
|||||||
|
|
||||||
/// <summary>Local database path</summary>
|
/// <summary>Local database path</summary>
|
||||||
public static string LocalDbPath { get; private set; }
|
public static string LocalDbPath { get; private set; }
|
||||||
|
|
||||||
/// <summary>Main database path</summary>
|
/// <summary>Main database path</summary>
|
||||||
public static string MainDbPath { get; private set; }
|
public static string MainDbPath { get; private set; }
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ public static class Settings
|
|||||||
PlatformID ptId = DetectOS.GetRealPlatformID();
|
PlatformID ptId = DetectOS.GetRealPlatformID();
|
||||||
string homePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
string homePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
LocalDbPath = "local.db";
|
LocalDbPath = "local.db";
|
||||||
string oldMainDbPath = "master.db";
|
var oldMainDbPath = "master.db";
|
||||||
MainDbPath = "main.db";
|
MainDbPath = "main.db";
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -322,6 +323,7 @@ public static class Settings
|
|||||||
var stats = (NSDictionary)obj;
|
var stats = (NSDictionary)obj;
|
||||||
|
|
||||||
if(stats != null)
|
if(stats != null)
|
||||||
|
{
|
||||||
Current.Stats = new StatsSettings
|
Current.Stats = new StatsSettings
|
||||||
{
|
{
|
||||||
ShareStats = stats.TryGetValue("ShareStats", out NSObject obj2) &&
|
ShareStats = stats.TryGetValue("ShareStats", out NSObject obj2) &&
|
||||||
@@ -345,11 +347,13 @@ public static class Settings
|
|||||||
((NSNumber)obj2).ToBool()
|
((NSNumber)obj2).ToBool()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Current.Stats = null;
|
Current.Stats = null;
|
||||||
|
|
||||||
Current.GdprCompliance = parsedPreferences.TryGetValue("GdprCompliance", out obj)
|
Current.GdprCompliance = parsedPreferences.TryGetValue("GdprCompliance", out obj)
|
||||||
? (ulong)((NSNumber)obj).ToLong() : 0;
|
? (ulong)((NSNumber)obj).ToLong()
|
||||||
|
: 0;
|
||||||
|
|
||||||
prefsFs.Close();
|
prefsFs.Close();
|
||||||
}
|
}
|
||||||
@@ -397,6 +401,7 @@ public static class Settings
|
|||||||
stats = Convert.ToBoolean(dicKey.GetValue("Statistics"));
|
stats = Convert.ToBoolean(dicKey.GetValue("Statistics"));
|
||||||
|
|
||||||
if(stats)
|
if(stats)
|
||||||
|
{
|
||||||
Current.Stats = new StatsSettings
|
Current.Stats = new StatsSettings
|
||||||
{
|
{
|
||||||
ShareStats = Convert.ToBoolean(dicKey.GetValue("ShareStats")),
|
ShareStats = Convert.ToBoolean(dicKey.GetValue("ShareStats")),
|
||||||
@@ -410,6 +415,7 @@ public static class Settings
|
|||||||
MediaStats = Convert.ToBoolean(dicKey.GetValue("MediaStats")),
|
MediaStats = Convert.ToBoolean(dicKey.GetValue("MediaStats")),
|
||||||
VerifyStats = Convert.ToBoolean(dicKey.GetValue("VerifyStats"))
|
VerifyStats = Convert.ToBoolean(dicKey.GetValue("VerifyStats"))
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
|
||||||
@@ -434,6 +440,7 @@ public static class Settings
|
|||||||
stats = Convert.ToBoolean(key.GetValue("Statistics"));
|
stats = Convert.ToBoolean(key.GetValue("Statistics"));
|
||||||
|
|
||||||
if(stats)
|
if(stats)
|
||||||
|
{
|
||||||
Current.Stats = new StatsSettings
|
Current.Stats = new StatsSettings
|
||||||
{
|
{
|
||||||
ShareStats = Convert.ToBoolean(key.GetValue("ShareStats")),
|
ShareStats = Convert.ToBoolean(key.GetValue("ShareStats")),
|
||||||
@@ -448,6 +455,7 @@ public static class Settings
|
|||||||
VerifyStats = Convert.ToBoolean(key.GetValue("VerifyStats"))
|
VerifyStats = Convert.ToBoolean(key.GetValue("VerifyStats"))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -542,54 +550,26 @@ public static class Settings
|
|||||||
{
|
{
|
||||||
var root = new NSDictionary
|
var root = new NSDictionary
|
||||||
{
|
{
|
||||||
{
|
{ "SaveReportsGlobally", Current.SaveReportsGlobally },
|
||||||
"SaveReportsGlobally", Current.SaveReportsGlobally
|
{ "ShareReports", Current.ShareReports },
|
||||||
},
|
{ "GdprCompliance", Current.GdprCompliance },
|
||||||
{
|
{ "EnableDecryption", Current.EnableDecryption }
|
||||||
"ShareReports", Current.ShareReports
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"GdprCompliance", Current.GdprCompliance
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"EnableDecryption", Current.EnableDecryption
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if(Current.Stats != null)
|
if(Current.Stats != null)
|
||||||
{
|
{
|
||||||
var stats = new NSDictionary
|
var stats = new NSDictionary
|
||||||
{
|
{
|
||||||
{
|
{ "ShareStats", Current.Stats.ShareStats },
|
||||||
"ShareStats", Current.Stats.ShareStats
|
{ "CommandStats", Current.Stats.CommandStats },
|
||||||
},
|
{ "DeviceStats", Current.Stats.DeviceStats },
|
||||||
{
|
{ "FilesystemStats", Current.Stats.FilesystemStats },
|
||||||
"CommandStats", Current.Stats.CommandStats
|
{ "FilterStats", Current.Stats.FilterStats },
|
||||||
},
|
{ "MediaImageStats", Current.Stats.MediaImageStats },
|
||||||
{
|
{ "MediaScanStats", Current.Stats.MediaScanStats },
|
||||||
"DeviceStats", Current.Stats.DeviceStats
|
{ "PartitionStats", Current.Stats.PartitionStats },
|
||||||
},
|
{ "MediaStats", Current.Stats.MediaStats },
|
||||||
{
|
{ "VerifyStats", Current.Stats.VerifyStats }
|
||||||
"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);
|
root.Add("Stats", stats);
|
||||||
|
|||||||
Reference in New Issue
Block a user