Пример #1
0
        /* Save the wallet data to the filename and password previously
         * specified when loading the wallet */
        public void Save()
        {
            FileEncrypter <WalletBackend> fileEncrypter
                = new JSONWalletEncrypter();

            fileEncrypter.Save(filename, password, this);
        }
Пример #2
0
        /* Load a wallet from the given filename with the given password,
         * returning either the wallet, or an error */
        public static IEither <Error, WalletBackend> Load(string filename,
                                                          string password)
        {
            FileEncrypter <WalletBackend> fileEncrypter
                = new JSONWalletEncrypter();

            return(fileEncrypter.Load(filename, password).Fmap(

                       /* Loading filename / password from file is dumb. The filename
                        * can for sure change - the password maybe could? */
                       wallet => {
                wallet.filename = filename;
                wallet.password = password;
                return Either.Right <Error, WalletBackend>(wallet);
            }
                       ));
        }