Ejemplo n.º 1
0
 public bool TryGetBrowser(int browserIdentifier, out BrowserWrapper browserWrapper)
 {
     lock (browserMapLock)
     {
         return(browserMap.TryGetValue(browserIdentifier, out browserWrapper));
     }
 }
Ejemplo n.º 2
0
 public void RegisterBrowser(int browserIdentifier, BrowserWrapper browserWrapper)
 {
     lock (browserMapLock)
     {
         browserMap.Add(browserIdentifier, browserWrapper);
     }
 }
Ejemplo n.º 3
0
 public HTTPServer(int maxThreads, Dictionary <String, HTTPHandler.RequestHandler> routes,
                   BrowserWrapper browserWrapper)
 {
     mRoutes         = routes;
     mWorkers        = new Thread[maxThreads];
     mQueue          = new Queue <HttpListenerContext>();
     mStopEvent      = new ManualResetEvent(false);
     mReadyEvent     = new ManualResetEvent(false);
     mListener       = new HttpListener();
     mListenerThread = new Thread(HandleRequests);
     mBrowserWrapper = browserWrapper;
 }
Ejemplo n.º 4
0
        public static void PingHandler(HttpListenerRequest req, HttpListenerResponse res, BrowserWrapper browserWrapper)
        {
            RequestData requestData = GetRequestData(req);
            string      url         = requestData.data["url"];

            API.Instance.Log("change Url: {0}", url);

            var script = "document.location.href=\"" + url + "\";";

            browserWrapper.ExecuteJS(script);
            WriteSuccessJson(res);
        }
Ejemplo n.º 5
0
        public static void ChangeThemeHandler(HttpListenerRequest req, HttpListenerResponse res, BrowserWrapper browserWrapper)
        {
            RequestData requestData     = GetRequestData(req);
            string      url             = browserWrapper.BrowserConfig.BrowserSourceSettings.LoadUrl;
            int         index           = url.IndexOf("/filters/theme/");
            int         subStringLength = index + "/filters/theme/".Length;

            string changeUrl = url.Substring(0, subStringLength);

            string theme      = requestData.data["theme"];
            string appPkg     = requestData.data["appPkg"];
            string queryParam = requestData.data["queryParam"];

            changeUrl += appPkg + "/" + theme + "/index.html?" + queryParam;

            API.Instance.Log("change Url: {0}", changeUrl);

            var script = "document.location.href=\"" + changeUrl + "\";";

            browserWrapper.ExecuteJS(script);
            WriteSuccessJson(res);
        }
Ejemplo n.º 6
0
        public static void UpdateSettingsHandler(HttpListenerRequest req, HttpListenerResponse res, BrowserWrapper browserWrapper)
        {
            RequestData requestData = GetRequestData(req);

            API.Instance.Log("change Url: {0}", requestData.data["settings"].ToString());
            var script = ""
                         + "var clrBrowserSettingJSONObj = JSON.parse('" + requestData.data["settings"].ToString() + "');"
                         + "window.setconfig(clrBrowserSettingJSONObj);";

            //var script = "document.body.innerHTML='"+requestData.data["settings"].ToString().Replace("\"", "\\\"")+"';";
            browserWrapper.ExecuteJS(script);
            WriteSuccessJson(res);
            API.Instance.Log("done");
        }
 public void RegisterBrowser(int browserIdentifier, BrowserWrapper browserWrapper)
 {
     lock (browserMapLock)
     {
         browserMap.Add(browserIdentifier, browserWrapper);
     }
 }
 public bool TryGetBrowser(int browserIdentifier, out BrowserWrapper browserWrapper)
 {
     lock (browserMapLock)
     {
         return browserMap.TryGetValue(browserIdentifier, out browserWrapper);
     }
 }
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // remove any pending texture requests
                lock (pendingTextureLock)
                {
                    if (pendingTexture != null && pendingTexture.Texture != null)
                    {
                        pendingTexture.Texture.Dispose();
                    }
                    pendingTexture = null;
                }
                if (browser != null)
                {
                    browser.CloseBrowser(true);
                    browser = null;
                }
            }

            isDisposed = true;
        }
        public override void UpdateSettings()
        {
            browserConfig.Reload(configElement);

            // unscaled w/h
            Size.X = (float)browserConfig.BrowserSourceSettings.Width;
            Size.Y = (float)browserConfig.BrowserSourceSettings.Height;

            outputColor = 0xFFFFFF | (((uint)(browserConfig.BrowserSourceSettings.Opacity * 255) & 0xFF) << 24);

            if (browser != null)
            {
                browser.CloseBrowser(true);
                browser = null;
            }

            browser = new BrowserWrapper();
            browser.CreateBrowser(this, browserConfig);
        }