Save BotDeviceInfo to directory
This commit is contained in:
parent
20c633eed6
commit
a09d94fd01
|
@ -56,9 +56,17 @@ public sealed class LagrangeAppBuilder
|
|||
keystore = JsonSerializer.Deserialize<BotKeystore>(File.ReadAllText(keystorePath)) ?? new BotKeystore();
|
||||
}
|
||||
|
||||
var deviceInfo = !File.Exists(deviceInfoPath)
|
||||
? new BotDeviceInfo()
|
||||
: JsonSerializer.Deserialize<BotDeviceInfo>(File.ReadAllText(deviceInfoPath)) ?? new BotDeviceInfo();
|
||||
BotDeviceInfo deviceInfo;
|
||||
if (!File.Exists(deviceInfoPath))
|
||||
{
|
||||
deviceInfo = new BotDeviceInfo();
|
||||
string json = JsonSerializer.Serialize(deviceInfo);
|
||||
File.WriteAllText(deviceInfoPath, json);
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceInfo = JsonSerializer.Deserialize<BotDeviceInfo>(File.ReadAllText(deviceInfoPath)) ?? new BotDeviceInfo();
|
||||
}
|
||||
|
||||
Services.AddSingleton(BotFactory.Create(config, deviceInfo, keystore));
|
||||
|
||||
|
|
Loading…
Reference in New Issue