public static WalletData ReadBlobToWalletData(string _walletName) { //Read from bin //TODO: Move deserialization to FileBinIO to avoid duplicating code on multiple objects byte[] BlobData = FileBinIO.ReadBin(AppDomain.CurrentDomain.BaseDirectory + @"bin\\WalletData\\" + _walletName + ".bin"); MemoryStream memorystreamd = new MemoryStream(BlobData); BinaryFormatter bfd = new BinaryFormatter(); WalletData deserializedBlock = bfd.Deserialize(memorystreamd) as WalletData; memorystreamd.Close(); return(deserializedBlock); }
public static Preference ReadBlobToPreferences() { //TODO: Move deserialization to FileBinIO to avoid duplicating code on multiple objects if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"bin\\WalletData\\Pref.bin")) { //Return empty object return(new Preference()); } byte[] BlobData = FileBinIO.ReadBin(AppDomain.CurrentDomain.BaseDirectory + @"bin\\WalletData\\Pref.bin"); MemoryStream memorystreamd = new MemoryStream(BlobData); BinaryFormatter bfd = new BinaryFormatter(); Preference prefData = bfd.Deserialize(memorystreamd) as Preference; memorystreamd.Close(); return(prefData); }