StringFromByteArray() public static method

public static StringFromByteArray ( byte arr ) : string
arr byte
return string
Esempio n. 1
0
        public static void SreachWord(RedisClient words)
        {
            Console.Write("Enter word for translation: ");
            string searchedWord = Console.ReadLine().ToLower();
            long   countWords   = words.HExists("words", Extensions.ToAsciiCharArray(searchedWord));

            if (countWords > 0)
            {
                var translation = words.HGet("words", Extensions.ToAsciiCharArray(searchedWord));
                Console.WriteLine("Word: {0}\nTranslation: {1}", searchedWord, Extensions.StringFromByteArray(translation));
            }
            else
            {
                Console.WriteLine("This word is not exist");
            }
        }
Esempio n. 2
0
        private static void ProcessUserCommand(RedisClient words)
        {
            string loweredInput = Console.ReadLine().ToLower();

            if (loweredInput == "a")
            {
                Utilities.SreachWord(words);
            }
            else if (loweredInput == "b")
            {
                byte[][] dictionary = words.HKeys("words");
                if (dictionary.GetLength(0) != 0)
                {
                    foreach (var wordAsArray in dictionary)
                    {
                        string word = Extensions.StringFromByteArray(wordAsArray);
                        Console.WriteLine(word);
                    }
                }
                else
                {
                    Console.WriteLine("There has no words in dictionary");
                }
            }
            else if (loweredInput == "c")
            {
                Utilities.EditWord(words);
            }
            else if (loweredInput == "d")
            {
                Utilities.RemoveWords(words);
            }
            else if (loweredInput == "e")
            {
                Utilities.AddWord(words);
            }
            else if (loweredInput == "x")
            {
                Environment.Exit(0);
            }
            else
            {
                Console.WriteLine("Wrong command");
            }
        }