public static void UpdateWalletFile(WalletModel newWallet) { string path = newWallet.FileLocation; string recoveryPath = newWallet.FileRecover; if (File.Exists(path) && File.Exists(recoveryPath)) { // set wallet files to normal for editing/updating purposes File.SetAttributes(recoveryPath, FileAttributes.Normal); File.SetAttributes(path, FileAttributes.Normal); FileTools.EncryptWallet(newWallet, newWallet.PassHash, path); FileTools.EncryptWallet(newWallet, newWallet.RecoveryPhraseHash, recoveryPath); // reapply defensive settings FileDefense(path); FileDefense(recoveryPath, true); } else { // Wallet Files did not update...Wallet Files do not exist at specified location string message = TextTools.RetrieveStringFromResource("Error_A300"); Messenger.Default.Send <string>(message, "OpenSimpleDialogView"); } }
public static void WalletLockPrompt(string file) { if (File.Exists(file)) { Messenger.Default.Send <string>(file, "OpenPasswordPrompt"); } else { string message = TextTools.RetrieveStringFromResource("Error_A400"); Messenger.Default.Send <string>("", "CloseWallet"); Messenger.Default.Send <string>(message, "OpenSimpleDialogView"); } }
public static void Status() { string url = "http://google.com"; try { WebRequests.GET(url); } catch { string message = TextTools.RetrieveStringFromResource("Error_N100"); Messenger.Default.Send <string>(message, "OpenSimpleDialogView"); } }
public static string GetActionString(TxAction action) { if (action == TxAction.Sent) { return(TextTools.RetrieveStringFromResource("Sent")); } else if (action == TxAction.Received) { return(TextTools.RetrieveStringFromResource("Received")); } else { return("NA"); } }
public static bool SaveNewWallet(WalletModel newWallet) { string path = newWallet.FileLocation; string recoveryPath = newWallet.FileRecover; if (File.Exists(path) && File.Exists(recoveryPath)) { string message = TextTools.RetrieveStringFromResource("Error_A200") .Replace("*path*", path) .Replace("*recoverypath*", recoveryPath); Messenger.Default.Send <string>(message, "OpenSimpleDialogView"); return(false); } else if (File.Exists(path)) { string existingWalletName = TextTools.DecodeWalletName(path); string message = TextTools.RetrieveStringFromResource("Error_A201") .Replace("*name*", existingWalletName) .Replace("*path*", path); Messenger.Default.Send <string>(message, "OpenSimpleDialogView"); return(false); } else if (File.Exists(recoveryPath)) { string existingWalletName = TextTools.DecodeWalletName(recoveryPath); string message = TextTools.RetrieveStringFromResource("Error_A202") .Replace("*name*", existingWalletName) .Replace("*recoverypath*", recoveryPath); Messenger.Default.Send <string>(message, "OpenSimpleDialogView"); return(false); } FileTools.EncryptWallet(newWallet, newWallet.PassHash, path); FileTools.EncryptWallet(newWallet, newWallet.RecoveryPhraseHash, recoveryPath); string addmanPath = Path.Combine(App.WalletsDir, newWallet.Name, "addrman.dat"); new AddressManager().SavePeerFile(addmanPath, newWallet.NetworkChoice); // Make Wallet File Encrypted and ReadOnly // Make Recovery File Hidden and Readonly FileDefense(path); FileDefense(recoveryPath, true); return(true); }
public static string GetStateString(TxState state) { if (state == TxState.Confirmed) { return(TextTools.RetrieveStringFromResource("Confirmed")); } else if (state == TxState.Awaiting) { return(TextTools.RetrieveStringFromResource("Awaiting")); } else if (state == TxState.Unconfirmed) { return(TextTools.RetrieveStringFromResource("Unconfirmed")); } else { return("NA"); } }