public Game(string server, int port, AuthInformation authInformation) { _connection = new Connection(server, port, authInformation); var factory = new InMemoryMessageHandlerFactory(); factory.Register(typeof(Status), new StatusHandler(this)); factory.Register(typeof(Notification), new NotificationHandler(this)); _dispatcher = new MessageDispatcher(factory); _connection.ReconnectAndAuthorize(); Task.Run(() => { while (true) { var message = MessageSerializer.Deserialize(_connection.Stream); lock (_lock) // Puts message handlers in queue. { _dispatcher.Dispatch(message); } } }); }
static AuthInformation() { Facebook = new AuthInformation() { Name = FACEBOOK, ClientId = "195056067600094", Scope = "email", AuthorizeUrl = "https://m.facebook.com/dialog/oauth", RedirectUrl = "https://www.facebook.com/connect/login_success.html", AccessTokenUrl = "https://m.facebook.com/dialog/oauth/token" }; }
/// <summary> /// Constructor for use if the keys and SIN were derived external to this library. /// </summary> /// <param name="ecKey">An elliptical curve key.</param> /// <param name="clientName">The label for this client.</param> /// <param name="envUrl">The target server URL.</param> public Bitpay(Key ecKey, Uri envUrl) { if (ecKey == null) { throw new ArgumentNullException(nameof(ecKey)); } if (envUrl == null) { throw new ArgumentNullException(nameof(envUrl)); } _Auth = new AuthInformation(ecKey); _baseUrl = envUrl; }