private void PaintTab(TabPage tab) { tab.Controls.Clear(); tab.Controls.Add(new csExWB.cEXWB()); csExWB.cEXWB wb = tab.Controls[0] as csExWB.cEXWB; FunctionPage page = tab.Tag as FunctionPage; wb.Dock = DockStyle.Fill; wb.BeforeNavigate2 += new csExWB.BeforeNavigate2EventHandler(this.cEXWB1_BeforeNavigate2); string dirpath = "file:///" + wscript.AppDirectory.Replace("\\", "/") + "/Functions/"; page.PageSource = page.PageSource.Replace("%DIRPATH%/", dirpath); wb.LoadHtmlIntoBrowser(page.PageSource + "<div Id=Data style='display:none'>" + json + "</div>", dirpath); //wb.LoadHtmlIntoBrowser("page data"); for (int i = 0; i < page.scNotFoundAssemblies.Count; i++) { Button nfButton = new Button(); wb.Controls.Add(nfButton); nfButton.Height = 30; nfButton.Dock = DockStyle.Top; nfButton.TextAlign = ContentAlignment.MiddleLeft; nfButton.Text = string.Format("Cannot Find {0}", page.scNotFoundAssemblies[i]); nfButton.Tag = page.scNotFoundAssemblies[i]; nfButton.Click += new EventHandler(nfButton_Click); } }
void watcher_Created(object sender, System.IO.FileSystemEventArgs e) { // new function found FunctionPage page = new FunctionPage(e.FullPath); Functions.Add(page); }
public FunctionManager(string path) { if (!System.IO.Directory.Exists(path)) { return; } string[] arrFiles = Directory.GetFiles(path, "*.trf"); for (int i = 0; i < arrFiles.Length; i++) { FunctionPage page = new FunctionPage(arrFiles[i]); Functions.Add(page); } //WatchFileSystem(path); }
void nfButton_Click(object sender, EventArgs e) { string searchedfile = (sender as Button).Tag.ToString(); openFileDialog1.Title = string.Format(Properties.Resources.Find, Path.GetFileName(searchedfile)); openFileDialog1.FileName = Path.GetFileName(searchedfile); if (openFileDialog1.ShowDialog() == DialogResult.Cancel) { return; } if (Path.GetFileName(openFileDialog1.FileName.ToLower()) == Path.GetFileName(searchedfile.ToLower())) { FunctionPage page = (sender as Button).Parent.Tag as FunctionPage; page.ReplacePath(searchedfile, openFileDialog1.FileName); (sender as Button).Visible = false; } }
private void cEXWB1_BeforeNavigate2(object sender, csExWB.BeforeNavigate2EventArgs e) { if (e.postdata == null) { e.Cancel = true; return; } // get the using statements and code byte[] byteData = e.postdata as byte[]; string strPostData = System.Text.ASCIIEncoding.ASCII.GetString(byteData); strPostData = strPostData.Remove(strPostData.Length - 1); strPostData = strPostData.Replace("+", " "); string[] arrPostData = strPostData.Split("&".ToCharArray()); NameValueCollection nvcPost = new NameValueCollection(); for (int i = 0; i < arrPostData.Length; i++) { string[] pair = arrPostData[i].Split("=".ToCharArray()); string value = System.Uri.UnescapeDataString(pair[1]); nvcPost.Add(pair[0], value); } /* * // add using statements * string[] usings = nvcPost.GetValues("Using"); * if (usings != null) * { * for (int i = 0; i < usings.Length; i++) * { * wscript.FunctionUsing.Add(usings[i]); * } * } */ // find function page to know what assemblies to add string[] arrfunctionnames = nvcPost.GetValues("FunctionTitle"); if (arrfunctionnames != null) { FunctionPage page = wscript.fcnManager.GetPageFromTitle(arrfunctionnames[0]); if (page != null) { for (int i = 0; i < page.scAssemblies.Count; i++) { wscript.FunctionAssemblies.Add(page.scAssemblies[i]); } } } // add code, replacing %variable% with the find method string varprefix = wscript.DetermineFindMethod(browsername, currentelement, lbAttributes.CheckedItems); if (varprefix == "") { varprefix = wscript.DetermineFindMethod(browsername, currentelement); if (varprefix == "") { varprefix = Properties.Resources.UnknownItem; } } string[] code = nvcPost.GetValues("Code"); if (code != null) { for (int i = 0; i < code.Length; i++) { wscript.AddScriptLine(code[i].Replace("%variable%", varprefix)); } } this.Close(); e.Cancel = true; }