private void BuildEditorForm(CaseInvariantNameValueCollection attributes = null) { plhEditor.Controls.Clear(); if (string.IsNullOrEmpty(MacroAlias)) return; var macro = Macro.GetByAlias(MacroAlias); foreach (var property in macro.Properties) { try { var type = Type.GetType(property.Type.Assembly + "." + property.Type.Type + "," + property.Type.Assembly); var control = Activator.CreateInstance(type) as Control; if (control != null && control is IMacroGuiRendering) { control.ID = property.Alias; if (attributes != null) { var propertyValue = attributes["umb_" + property.Alias]; if (propertyValue != null) { propertyValue = HttpUtility.UrlDecode(propertyValue.Replace(@"\r", "\r").Replace(@"\n", "\n").Replace("\\\"", "\"")); if (propertyValue != "") type.GetProperty("Value").SetValue(control, Convert.ChangeType(propertyValue, type.GetProperty("Value").PropertyType), null); } } var panel = new PropertyPanel { Text = property.Name }; panel.Controls.Add(control); //this._scriptOnLoad = this._scriptOnLoad + "\t\tregisterAlias('" + control.ID + "');\n"; plhEditor.Controls.Add(panel); _dataFields.Add(control); } else { Trace.Warn("umbEditContent", "Type doesn't exist or is not umbraco.interfaces.DataFieldI ('" + property.Type.Assembly + "." + property.Type.Type + "')"); } } catch (Exception exception) { Trace.Warn("umbEditContent", "Error creating type '" + property.Type.Assembly + "." + property.Type.Type + "'", exception); } } }
protected HtmlElement() { _attributes = new CaseInvariantNameValueCollection(); ChildElements = new List<HtmlElement>(); }
private void DoExtractContent(CrawlData crawlData) { var text = _indexStrips.Aggregate(crawlData.OriginalContent, (current, strip) => StripText(current, strip.Key, strip.Value)); var html = new HtmlDocument(text); crawlData.Title = html.FindTagsByName("title").Select(t => t.InnerText).FirstOrDefault(); var metaData = new CaseInvariantNameValueCollection(); foreach (var keyValue in html.FindTagsByName("meta").Select(GetKeyValue).Where(keyValue => keyValue.HasValue)) { if (metaData.HasKey(keyValue.Value.Key)) throw new ApplicationException("Duplicate meta tags:" + keyValue.Value.Key); metaData.Append(keyValue.Value.Key, keyValue.Value.Value); } crawlData.MetaData = metaData.ToDictionary(); crawlData.FilteredContent = html.ExtractContent(); }