Exemplo n.º 1
0
 private Server()
 {
     this.Pubnub = new Pubnub(PubKey, SubKey, SecretKey)
     {
         SessionUUID = Uuid
     };
     this.Pubnub.Subscribe <string>(Channel, this.HandleMessage, DefaultCallback, ErrorCallback);
     //this.pubnub.Presence<string>(this.channel, this.handlePresence, this.defaultCallback);
     Console.WriteLine("Server created.");
     this.db = Database.getInstance();
 }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            List <int> l = new List <int>();

            l.Add(3);
            l.Add(10);
            l.Add(1);
            l.Add(20);
            l.Sort((a, b) => {
                if (a == 20)
                {
                    return(1);
                }
                return(b - a);
            });
            Console.WriteLine(l);
            Server.Init();
            Console.WriteLine("Commands: cleardb, decktest, handtest, quit");
            string input;

            do
            {
                input = Console.ReadLine();
                //Console.Beep(r.Next(37, 20000), 300);
                switch (input)
                {
                case "cleardb":
                    Console.WriteLine(Database.getInstance().clear() + " rows deleted.");
                    break;

                case "decktest":
                    //int diff;
                    //for (int i = 0; i < 100; i++) {
                    //    diff = DeckTest();
                    //}
                    Console.WriteLine(DeckTest());
                    break;

                case "handtest":
                    HandTest();
                    break;

                case "gametest":
                    TestGame();
                    break;
                }
            } while (input != null && (input.Length == 0 || !"quit".StartsWith(input)));
        }