public List<FunctionPage> GetApplicableFunctions(IHTMLElement element, AppSettings.CodeLanguages language) { List<FunctionPage> applicable = new List<FunctionPage>(); foreach (FunctionPage page in Functions) { if (page.IsApplicable(element, language)) { applicable.Add(page); } } if (applicable.Count==0) { // load the default page applicable.Add(GetPageFromTitle("Default")); } foreach (FunctionPage page in Functions) { if (page.ShowOnAll && page.Languages.Contains(language.ToString())) { applicable.Add(page); } } return applicable; }
public void GUIToObject(AppSettings settings) { settings.BaseIEName = txtMainBrowserName.Text; settings.PopupIEName = txtPopupBrowserName.Text; settings.CompilePath = txtCompilePath.Text; settings.TypingTime = Convert.ToDouble(numTypeTime.Value); settings.DOMHighlightColor = pnlDOMColor.BackColor; settings.ScriptWindowFont = lblSourceFont.Font; settings.WarnWhenUnsaved = chkWarnUnsaved.Checked; settings.HideDOSWindow = chkHideDOSWindow.Checked; if (rbCSharp.Checked) { settings.CodeLanguage = AppSettings.CodeLanguages.CSharp; } else if (rbVBNet.Checked) { settings.CodeLanguage = AppSettings.CodeLanguages.VBNet; } else if (rbPHP.Checked) { settings.CodeLanguage = AppSettings.CodeLanguages.PHP; } else if (rbPython.Checked) { settings.CodeLanguage = AppSettings.CodeLanguages.Python; } else if (rbPerl.Checked) { settings.CodeLanguage = AppSettings.CodeLanguages.Perl; } }
public bool IsApplicable(IHTMLElement element, AppSettings.CodeLanguages language) { if (element == null) { return false; } bool result = true; // check if this function page applies to this element for (int i = 0; i < nvAttributes.Count; i++) { string name = nvAttributes.Keys[i]; string[] arrValues = nvAttributes.GetValues(i); string value = arrValues.Length == 0 ? "" : arrValues[0]; if (name == "tagName") { if (element.tagName.ToLower() != value.ToLower()) { result = false; break; } } else { string strValue = element.getAttribute(name, 0) as string; if (strValue==null && value=="null") { continue; } if (strValue == null) { strValue = ""; } if (strValue.ToLower() != value.ToLower()) { result = false; break; } } } if (!this.Languages.Contains(language.ToString())) { result = false; } return result; }
public string GetSaveFilter(AppSettings.CodeLanguages language) { StringBuilder sbResult = new StringBuilder(); foreach (Template tfile in TemplateList) { if (language != tfile.CodeLanguage) { continue; } sbResult.Append("|"+tfile.Name+" ("+tfile.FileExtension+")|"); } sbResult.Insert(0,Properties.Resources.TestRecorderCodeType); return sbResult.ToString(); }
public List<Template> GetListForCompile(AppSettings.CodeLanguages language) { List<Template> resultlist = new List<Template>(); foreach (Template tfile in TemplateList) { if (language != tfile.CodeLanguage) { continue; } if (tfile.CanCompile) { resultlist.Add(tfile); } } return resultlist; }
public Template GetTemplateByIndex(AppSettings.CodeLanguages language, int Index) { List<Template> resultlist = new List<Template>(); foreach (Template tfile in TemplateList) { if (language != tfile.CodeLanguage) { continue; } resultlist.Add(tfile); } if (Index > resultlist.Count - 1) { return null; } return resultlist[Index]; }
public void ObjectToGUI(AppSettings settings) { txtMainBrowserName.Text = settings.BaseIEName; txtPopupBrowserName.Text = settings.PopupIEName; txtCompilePath.Text = settings.CompilePath; numTypeTime.Value = Convert.ToDecimal(settings.TypingTime); pnlDOMColor.BackColor = settings.DOMHighlightColor; lblSourceFont.Font = settings.ScriptWindowFont; chkWarnUnsaved.Checked = settings.WarnWhenUnsaved; chkHideDOSWindow.Checked = settings.HideDOSWindow; switch (settings.CodeLanguage) { case AppSettings.CodeLanguages.CSharp: rbCSharp.Checked = true; break; case AppSettings.CodeLanguages.VBNet: rbVBNet.Checked = true; break; case AppSettings.CodeLanguages.PHP: rbPHP.Checked = true; break; case AppSettings.CodeLanguages.Python: rbPython.Checked = true; break; case AppSettings.CodeLanguages.Perl: rbPerl.Checked = true; break; } }
// generic constructor public WatinScript() { settings = new AppSettings(System.IO.Path.Combine(AppDirectory, "settings.xml")); TemplateFiles = new Templates(AppDirectory+"\\Templates\\"); }