Exemplo n.º 1
0
 public WebRequest(string url)
 {
     // parse url
     url     = GetUrl(url);
     _url    = url;
     _uri    = new EB.Uri(url);
     _method = "GET";
 }
Exemplo n.º 2
0
        public static Network Create(string url)
        {
            var uri = new EB.Uri(url);

            System.Type type = null;
            if (_types.TryGetValue(uri.Scheme, out type))
            {
                return((Network)System.Activator.CreateInstance(type));
            }
            throw new System.Exception("Uknown network type: " + uri.Scheme);
        }
Exemplo n.º 3
0
        public WebRequest(string url, Hashtable headers)
        {
            // parse url
            url     = GetUrl(url);
            _url    = url;
            _uri    = new EB.Uri(url);
            _method = "GET";

            foreach (DictionaryEntry header in headers)
            {
                _requestHeaders[header.Key.ToString()] = header.Value.ToString();
            }
        }
Exemplo n.º 4
0
        // token for the websocket
        public WebSocketEndPoint(string endPoint, EndPointOptions options)  :
            base(MakeHttpEndpoint(endPoint), options)
        {
            _wsUrl  = new EB.Uri(endPoint);
            _socket = new Net.TalkWebSocket();
            _socket.ActivityTimeout = options.ActivityTimeout;
            _socket.OnError        += OnError;

            if (options.KeepAlive)
            {
                ConnectIfNeeded();
            }
        }
Exemplo n.º 5
0
        static StackObject *get_Host_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            EB.Uri instance_of_this_method = (EB.Uri) typeof(EB.Uri).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Host;

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemplo n.º 6
0
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @url = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = new EB.Uri(@url);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemplo n.º 7
0
        public MasterServer(object data)
        {
            EndPoint = Dot.String("endpoint", data, string.Empty);
            Token    = Dot.String("token", data, string.Empty);
            Name     = Dot.String("name", data, string.Empty);
            PingPort = Dot.Integer("pingPort", data, 0);
            Ping     = 0;         // unknown

            if (!string.IsNullOrEmpty(EndPoint))
            {
                Hostname = new EB.Uri(EndPoint).Host;
            }

            Games = new MasterServerGame[0];
        }
Exemplo n.º 8
0
        void OnGetPushToken(string error, Hashtable result)
        {
            var websocket = Dot.String("websocket", result, string.Empty);

            if (!string.IsNullOrEmpty(websocket))
            {
                _url  = new EB.Uri(websocket);
                State = SubSystemState.Connected;
                ConnectWebsocket();
            }
            else
            {
                State = SubSystemState.Error;
            }
        }
Exemplo n.º 9
0
        public override void Initialize(Config config)
        {
            _api      = new PushAPI(Hub.ApiEndPoint);
            _deffered = new Deferred(4);
            _url      = null;

#if UNITY_IPHONE
            UnityEngine.iOS.NotificationServices.ClearLocalNotifications();
            UnityEngine.iOS.NotificationServices.ClearRemoteNotifications();

            EB.Debug.Log("PushManager: registering for notification services");
            UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound);
#elif UNITY_ANDROID
#endif
        }
Exemplo n.º 10
0
        public WebRequest(string url, byte[] postData, Hashtable headers)
        {
            // parse url
            url     = GetUrl(url);
            _url    = url;
            _uri    = new EB.Uri(url);
            _method = "POST";

            foreach (DictionaryEntry header in headers)
            {
                _requestHeaders[header.Key.ToString()] = header.Value.ToString();
            }
            _requestHeaders["Content-Length"] = postData.Length.ToString();
            _body      = postData;
            _bytesSent = postData.LongLength;
        }
Exemplo n.º 11
0
        public Request(string url, bool isPost)
        {
            _url          = new EB.Uri(url);
            _isPost       = isPost;
            numRetries    = 0;
            suspendMethod = eSuspendMethod.Retry;

            _query = QueryString.Parse(_url.Query);
            if (isPost)
            {
                _data = Johny.HashtablePool.Claim();
            }
            else
            {
                _data = _query;
            }
        }
Exemplo n.º 12
0
        public Manager(Config config)
        {
            if (Enabled == true)
            {
                _config       = config;
                _rpcs         = Johny.HashtablePool.Claim();
                _deferred     = new EB.Deferred(8);
                _updateHandle = EB.Coroutines.SetUpdate(_deferred.Dispatch);

                // load certs
                //EB.Net.TcpClientFactory.LoadCertStore("Crypto/Certs");

                // make the signed request
                Hashtable data = Johny.HashtablePool.Claim();
                data["_id"]       = EB.Version.GetMACAddress();
                data["type"]      = Application.platform.ToString();
                data["game"]      = _config.game;
                data["last"]      = EB.Time.Now;
                data["algorithm"] = "hmac-sha1";
                var json = EB.JSON.Stringify(data);

                var key = SignedRequest.Stringify(Encoding.GetBytes(json), Hmac.Sha1(Encoding.GetBytes(_config.serverKey)));

                var url = _config.serverUrl + "?access_token=" + key;
                _wsUrl = new EB.Uri(url);
                Debug.Log("GameTalk Url: " + url);

                _socket          = new EB.Net.TalkWebSocket();
                _socket.OnError += this.OnError;
                _socket.OnRPC   += this.OnRPC;

                Bind(string.Empty, new RPC.Global());

                ConnectIfNeeded();
            }
        }