Ejemplo n.º 1
0
        public static HttpManager Initalize(HttpSettings httpSettings = null, bool dontDestroyOnLoad = true)
        {
            string name = typeof(HttpManager).FullName;

            if (GameObject.Find(name))
            {
                throw new Exception(name + " should not be Initialized more than once");
            }

            GameObject go = new GameObject(name);

            if (dontDestroyOnLoad)
            {
                DontDestroyOnLoad(go);
            }

            return(go.AddComponent <HttpManager>().Setup(httpSettings));
        }
Ejemplo n.º 2
0
        public HttpManager Setup(HttpSettings httpSettings = null)
        {
            this.settings = (httpSettings ?? new HttpSettings()).FillWithDefaults();

            string dataPath = string.Concat(settings.dataDirectory, "/", GetType().Namespace);

            Directory.CreateDirectory(dataPath);

            this.streamPool   = new StreamPool(settings);
            this.cookieJar    = new CookieJar(settings.fileHandler, dataPath);
            this.cacheHandler = new CacheHandler(settings.fileHandler, dataPath);
            this.messenger    = new Messenger(settings, streamPool, cacheHandler, cookieJar);

            this.ongoingRequests = new List <DispatchInfo>();
            this.pendingRequests = new Queue <DispatchInfo>();
            this.mainThreadQueue = new Queue <Action>();
            this.deltaTimer      = 0f;

            UserAgent.Build();

            return(this);
        }
Ejemplo n.º 3
0
 internal ResponseHandler(HttpSettings settings, CookieJar cookieJar, CacheHandler cacheHandler)
 {
     this.settings     = settings;
     this.cookieJar    = cookieJar;
     this.cacheHandler = cacheHandler;
 }