private static UbbParser GetUbbParser(ParserType type) { switch (type) { case ParserType.Full: if (fullParser == null) { fullParser = new UbbParser(CreateHandlers( "ALIGN", "B", "U", "I", "S", "FONT", "COLOR", "EMAIL", "IMG" , "FLASH", "WMA", "MP3", "WMV", "SIZE", "RM", "QQ", "TABLE", "URL" , "SUB", "SUP", "BGCOLOR", "INDENT", "LIST", "MSN", "QUOTE", "BR" )); } return(fullParser); case ParserType.Normal: if (normalParser == null) { normalParser = new UbbParser(CreateHandlers("B", "I", "U", "SIZE", "IMG", "COLOR", "S", "BGCOLOR", "URL", "FONT", "EMAIL", "FLASH")); } return(normalParser); case ParserType.Simple: if (simpleParser == null) { simpleParser = new UbbParser(CreateHandlers("B", "I", "U", "SIZE", "IMG", "COLOR", "S", "BGCOLOR")); } return(simpleParser); } return(new UbbParser()); }
private string FormatItemName(string itemName) { UbbParser ubbParser = new UbbParser(); ubbParser.AddTagHandler(new IMG()); return(ubbParser.UbbToHtml(itemName)); }
/// <summary> /// 自定义要解析的标签 /// </summary> /// <param name="text"></param> /// <param name="tags"></param> /// <returns></returns> public static string ConvertUbbToHtml(string text, string[] tags) { List <UbbTagHandler> handlers = CreateHandlers(tags); UbbParser parser = new UbbParser(handlers); return(parser.UbbToHtml(text)); }