Exemple #1
0
        public static void test()
        {
            //getting the mnemonic with a custom wordlist (generated by overriding the Italian one)
            Wordlist wl = getItalianWordlist();

            int[]    arr = Enumerable.Range(0, wl.WordCount - 1).ToArray();
            String[] ewl = wl.GetWords(arr);
            ewl[0]  = "dry";
            ewl[1]  = "drive";
            ewl[2]  = "brown";
            ewl[3]  = "parade";
            ewl[4]  = "drastic";
            ewl[5]  = "shine";
            ewl[6]  = "embrace";
            ewl[7]  = "hard";
            ewl[8]  = "report";
            ewl[9]  = "loan";
            ewl[10] = "fold";
            ewl[11] = "iron";

            Wordlist wlCustom = new Wordlist(ewl, ' ', "custom");

            Mnemonic mnemo        = new Mnemonic("dry brown drive parade drastic shine embrace hard report loan fold iron", wlCustom);
            ExtKey   hdroot       = mnemo.DeriveExtKey();
            var      firstprivkey = hdroot.Derive(new KeyPath("m/0'/0/0"));
            var      firstpubKey  = firstprivkey.Neuter().PubKey;
            String   address      = firstpubKey.GetAddress(Network.Main).ToString();

            Console.WriteLine(address); // --> 1AE1LyUWpfb32dReDuGezvdMGXHiFnq4jH
        }
Exemple #2
0
        private void txtInput_KeyUp(object sender, KeyEventArgs e)
        {
            bool found  = false;
            var  border = (txtSuggestions.Parent as ScrollViewer).Parent as Border;

            string query = (sender as TextBox).Text;

            if (query.Length == 0)
            {
                // Clear
                txtSuggestions.Children.Clear();
                border.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                border.Visibility = System.Windows.Visibility.Visible;
            }

            // Clear the list
            txtSuggestions.Children.Clear();

            // Add the result
            var functions = new Functions();

            wordList = functions.SelectedLanguage(selectedLanguage);

            foreach (var obj in wordList.GetWords())
            {
                if (obj.ToLower().StartsWith(query.ToLower()))
                {
                    // The word starts with this... Autocomplete must work
                    addItem(obj);
                    found = true;
                }
            }

            if (!found)
            {
                txtSuggestions.Children.Add(new TextBlock()
                {
                    Text = "No words found."
                });
            }
        }