예제 #1
0
파일: Program.cs 프로젝트: zilveer/BitPoker
        private static String AddTableToAPI(UInt64 sb, UInt64 bb)
        {
            Console.WriteLine("Adds a table to mock api under carols address");

            Models.Contracts.Table table = new Models.Contracts.Table(2, 10)
            {
                SmallBlind    = sb,
                BigBlind      = bb,
                HashAlgorithm = "SHA256"
            };

            Models.Messages.AddTableRequest message = new Models.Messages.AddTableRequest();

            //message.BitcoinAddress = carol.ToString();
            //message.Signature = alice_secret.PrivateKey.SignMessage(message.Id.ToString());

            IRequest request = new Models.Messages.RPCRequest()
            {
                Method = "AddTableRequest"
            };

            request.Params = message;

            String        json           = JsonConvert.SerializeObject(message);
            StringContent requestContent = new StringContent(json, Encoding.UTF8, "application/json");
            String        url            = String.Format("{0}tables", API_URL);

            String response = Post(requestContent, url);

            return(response);
        }
예제 #2
0
파일: Program.cs 프로젝트: zilveer/BitPoker
        /// <summary>
        /// Console for test code
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            Console.WriteLine("{0} This is a console client for bitpoker, making REST or JSON RPC calls to the host", DateTime.UtcNow);

            Server server = new Server();

            server.MessageEvent += Server_MessageEvent;

            Int16 restPort = 8080; ///for rest
            Int16 tcpPort  = 5555;

            if (args == null || args.Length < 1)
            {
                Log(String.Format("tcp://127.0.0.1:{0}", tcpPort));
                args = new string[] { carol.ToString(), String.Format("tcp://127.0.0.1:{0}", tcpPort) };
            }

            Log("Starting tcp server");
            Task task = new Task(() => server.Listen(args[0]));

            task.Start();
            Log("TCP server running");

            String baseUrl = String.Format("http://*****:*****@"C:\Users\lucas.cullen\Source\Repos\bitpoker\headsupcolddeck.txt");

            Mnemonic mnemo = new Mnemonic("test", Wordlist.English);

            var key = mnemo.DeriveExtKey();
            var x   = key.PrivateKey;

            var s = x.GetBitcoinSecret(Network.Main);
            var b = s.GetAddress();


            Console.WriteLine(b);
            Console.ReadKey();

            IDeck deck = new FiftyTwoCardDeck();

            deck.Shuffle(null);

            DumpToDisk(deck.Cards, "deck.txt");
        }