Add backup mechanism and some collection cleanup.

This commit is contained in:
Ottermandias 2022-03-31 23:22:11 +02:00
parent d906e5aedf
commit c210a4f10a
5 changed files with 202 additions and 29 deletions

View file

@ -101,24 +101,25 @@ public partial class Mod
}
}
public static string SortOrderFile = Path.Combine( Dalamud.PluginInterface.GetPluginConfigDirectory(),
"sort_order.json" );
public Manager()
{
SetBaseDirectory( Config.ModDirectory, true );
// TODO
try
{
var data = JObject.Parse( File.ReadAllText( Path.Combine( Dalamud.PluginInterface.GetPluginConfigDirectory(),
"sort_order.json" ) ) );
TemporaryModSortOrder = data["Data"]?.ToObject<Dictionary<string, string>>() ?? new Dictionary<string, string>();
var data = JObject.Parse( File.ReadAllText( SortOrderFile ) );
TemporaryModSortOrder = data[ "Data" ]?.ToObject< Dictionary< string, string > >() ?? new Dictionary< string, string >();
}
catch
{
TemporaryModSortOrder = new Dictionary<string, string>();
TemporaryModSortOrder = new Dictionary< string, string >();
}
}
public Dictionary<string, string> TemporaryModSortOrder;
public Dictionary< string, string > TemporaryModSortOrder;
private bool SetSortOrderPath( Mod mod, string path )
{