示例#1
0
        public static void ListAll(RedisClient client)
        {
            var keys = client.HKeys(wordHashStructure);
            var stringifiedKeys = new List<string>();
            foreach (var key in keys)
            {
                stringifiedKeys.Add(Extensions.StringFromByteArray(key));
            }

            foreach (var key in stringifiedKeys)
            {
                Console.WriteLine(key + " : " + Extensions.StringFromByteArray(client.HGet(wordHashStructure, key.ToAsciiCharArray())));
            }
        }
示例#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");
     }
 }