public entity(string uri, Form1 host) : base(uri, host) { this.Host = host; this.Runtime = new Spider.Scripting.LuaInterpreter(this); this.Preprocessor = new Spider.Preprocessor.LuaMako(this); entifyScheme = new EntifyScheme(this); var fragments = uri.Split(':'); var app = fragments[1]; this.uri = uri; try { Program.settings.UserStyleSheetEnabled = true; Program.settings.UserStyleSheetLocation = "resources/resources/css/" + Properties.Settings.Default.Theme + ".css"; webView = new CefSharp.WinForms.WebView("about:blank", Program.settings); CefSharp.CEF.RegisterScheme("entify", new EntifySchemeHandlerFactory(this, entifyScheme)); webView.PropertyChanged += webView_PropertyChanged; #if(false) template = LoadLocalResource("entify://" + app + "/index.html"); #endif webView.Dock = DockStyle.Fill; webViewIsReady = true; this.Controls.Add(webView); } catch (Exception e) { } }
public String LoadLocalResource(string uri) { EntifyScheme es = new EntifyScheme(this); System.IO.Stream stream = new System.IO.MemoryStream(); String mimeType = ""; es.LoadResource(uri, ref mimeType, ref stream); String str = new StreamReader(stream).ReadToEnd(); stream.Close(); return str; }
public EntifySchemeHandlerFactory(ISpiderView spiderView, EntifyScheme entifyScheme) { this.SpiderView = spiderView; this.EntifyScheme = entifyScheme; }