Put more things into datafolder
MODIFY
MagicalCryptoWallet.Backend/Config.cs
MagicalCryptoWallet.Backend/Config.cs
@@ -49,7 +49,7 @@ namespace MagicalCryptoWallet.Backend
if (!File.Exists(path))
{
- Logger.LogInfo<Config>($"Config file did not exist. Created at path: `{path}`.");
+ Logger.LogInfo<Config>($"{nameof(Config)} file did not exist. Created at path: `{path}`.");
}
else
{

MODIFY
MagicalCryptoWallet.Tests/SharedFixture.cs
MagicalCryptoWallet.Tests/SharedFixture.cs
@@ -28,7 +28,7 @@ namespace MagicalCryptoWallet.Tests
Logger.SetMinimumLevel(LogLevel.Info);
Logger.SetModes(LogMode.Debug, LogMode.Console, LogMode.File);
- Logger.SetFilePath("TestLogs.txt");
+ Logger.SetFilePath(Path.Combine(DataDir, "Logs.txt"));
}
public void Dispose()

MODIFY
MagicalCryptoWallet.Tests/WalletTests.cs
MagicalCryptoWallet.Tests/WalletTests.cs
@@ -24,7 +24,7 @@ namespace MagicalCryptoWallet.Tests
{
var manager = KeyManager.CreateNew(out Mnemonic mnemonic, "password");
var dataFolder = Path.Combine(SharedFixture.DataDir, nameof(BasicWalletTestAsync));
- using (var wallet = new WalletService(dataFolder, Network.TestNet, manager))
+ using (var wallet = new WalletService(dataFolder, Network.Main, manager))
{
wallet.Start();
await Task.Delay(1000);

MODIFY
MagicalCryptoWallet/Services/WalletService.cs
MagicalCryptoWallet/Services/WalletService.cs
@@ -51,9 +51,11 @@ namespace MagicalCryptoWallet.Services
try
{
AddressManager = AddressManager.LoadPeerFile(AddressManagerFilePath);
+ Logger.LogInfo<WalletService>($"Loaded {nameof(AddressManager)} from `{AddressManagerFilePath}`.");
}
- catch (Exception ex) // ToDo: find out what the specific exception that is thrown and catch that
+ catch (FileNotFoundException ex)
{
+ Logger.LogInfo<WalletService>($"{nameof(AddressManager)} did not exist. Created at `{AddressManagerFilePath}`.");
Logger.LogTrace<WalletService>(ex);
AddressManager = new AddressManager();
}
@@ -92,6 +94,8 @@ namespace MagicalCryptoWallet.Services
{
try
{
+ AddressManager.SavePeerFile(AddressManagerFilePath, Network);
+ Logger.LogInfo<WalletService>($"Saved {nameof(AddressManager)} to `{AddressManagerFilePath}`.");
Nodes?.Dispose();
}
catch (Exception ex)

Put more things into datafolder