Example #1
0
        public static void LoadMnemonicFromFile(out Mnemonic mnemonic)
        {
            mnemonic = null;
            bool   shouldContinue = true;
            string fullTxtPath;
            string mnemonicAsStringInput = string.Empty;

            Console.WriteLine("IMPORTANT!The mnemonic phrases will be readed as they are in the file. If you make\n changes of the mnemonic phrase the recovery will fail");
            do
            {
                Console.WriteLine("\nPlease provide full file path to the .txt mnemonic file");
                fullTxtPath = Console.ReadLine();
                if (CommonWalletHelper.CheckFilePath(fullTxtPath) && Path.GetExtension(fullTxtPath) == ".txt")
                {
                    shouldContinue = false;
                    using (StreamReader reader = new StreamReader(fullTxtPath))
                    {
                        mnemonicAsStringInput = reader.ReadToEnd();
                        mnemonic = new Mnemonic(mnemonicAsStringInput);
                    }
                }
            }while (shouldContinue);
        }