ToAsciiCharArray() public static method

public static ToAsciiCharArray ( this s ) : byte[]
s this
return byte[]
Esempio n. 1
0
        public static void RemoveWords(RedisClient words)
        {
            Console.Write("Enter word for remove: ");
            string deleteWord = Console.ReadLine().ToLower();
            long   countWords = words.HExists("words", Extensions.ToAsciiCharArray(deleteWord));

            if (countWords > 0)
            {
                words.HDel("words", Extensions.ToAsciiCharArray(deleteWord));
            }
            else
            {
                Console.WriteLine("This word is not exist");
            }
        }
Esempio n. 2
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. 3
0
        public static void EditWord(RedisClient words)
        {
            Console.Write("Enter word for edit: ");
            string editWord = Console.ReadLine().ToLower();

            Console.Write("Enter new translation: ");
            string translation = Console.ReadLine().ToLower();
            long   countWords  = words.HExists("words", Extensions.ToAsciiCharArray(editWord));

            if (countWords > 0)
            {
                words.HSet("words", Extensions.ToAsciiCharArray(editWord), Extensions.ToAsciiCharArray(translation));
            }
            else
            {
                Console.WriteLine("This word is not exist");
            }
        }
Esempio n. 4
0
        public static void AddWord(RedisClient words)
        {
            Console.Write("Enter word: ");
            string loweredWord = Console.ReadLine().ToLower();

            Console.Write("Enter translation: ");
            string loweredTranslation = Console.ReadLine().ToLower();

            long countWords = words.HExists("words", Extensions.ToAsciiCharArray(loweredWord));

            if (countWords > 0)
            {
                Console.WriteLine("This word already exist");
            }
            else
            {
                words.HSetNX("words", Extensions.ToAsciiCharArray(loweredWord), Extensions.ToAsciiCharArray(loweredTranslation));
            }
        }