Fix missing file on loading settings/commonobjects
This commit is contained in:
parent
3d6657b483
commit
fa19d3da14
@ -53,6 +53,7 @@ public class CommonObjects
|
|||||||
|
|
||||||
public void ExportSettings()
|
public void ExportSettings()
|
||||||
{
|
{
|
||||||
|
TrangaSettings.SettingsJsonObject? settings = null;
|
||||||
if (File.Exists(settingsFilePath))
|
if (File.Exists(settingsFilePath))
|
||||||
{
|
{
|
||||||
bool inUse = true;
|
bool inUse = true;
|
||||||
@ -70,11 +71,17 @@ public class CommonObjects
|
|||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
string toRead = File.ReadAllText(settingsFilePath);
|
||||||
|
settings = JsonConvert.DeserializeObject<TrangaSettings.SettingsJsonObject>(toRead,
|
||||||
|
new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
Converters =
|
||||||
|
{
|
||||||
|
new NotificationManager.NotificationManagerJsonConverter(),
|
||||||
|
new LibraryManager.LibraryManagerJsonConverter()
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
string toRead = File.ReadAllText(settingsFilePath);
|
|
||||||
TrangaSettings.SettingsJsonObject? settings = JsonConvert.DeserializeObject<TrangaSettings.SettingsJsonObject>(toRead,
|
|
||||||
new JsonSerializerSettings { Converters = { new NotificationManager.NotificationManagerJsonConverter(), new LibraryManager.LibraryManagerJsonConverter() } });
|
|
||||||
settings = new TrangaSettings.SettingsJsonObject(settings?.ts, this);
|
settings = new TrangaSettings.SettingsJsonObject(settings?.ts, this);
|
||||||
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(settings));
|
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(settings));
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ public class TrangaSettings
|
|||||||
|
|
||||||
public void ExportSettings()
|
public void ExportSettings()
|
||||||
{
|
{
|
||||||
|
SettingsJsonObject? settings = null;
|
||||||
if (File.Exists(settingsFilePath))
|
if (File.Exists(settingsFilePath))
|
||||||
{
|
{
|
||||||
bool inUse = true;
|
bool inUse = true;
|
||||||
@ -54,11 +55,17 @@ public class TrangaSettings
|
|||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
string toRead = File.ReadAllText(settingsFilePath);
|
||||||
|
settings = JsonConvert.DeserializeObject<SettingsJsonObject>(toRead,
|
||||||
|
new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
Converters =
|
||||||
|
{
|
||||||
|
new NotificationManager.NotificationManagerJsonConverter(),
|
||||||
|
new LibraryManager.LibraryManagerJsonConverter()
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
string toRead = File.ReadAllText(settingsFilePath);
|
|
||||||
SettingsJsonObject? settings = JsonConvert.DeserializeObject<SettingsJsonObject>(toRead,
|
|
||||||
new JsonSerializerSettings { Converters = { new NotificationManager.NotificationManagerJsonConverter(), new LibraryManager.LibraryManagerJsonConverter() } });
|
|
||||||
settings = new SettingsJsonObject(this, settings?.co);
|
settings = new SettingsJsonObject(this, settings?.co);
|
||||||
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(settings));
|
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(settings));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user