public Emoticon(string pattern, string url, int width, int height) { if (string.IsNullOrWhiteSpace(url)) { return; } if (!Re.IsMatch(pattern, @"\W")) { ExactWord = pattern; } else if (pattern != null) { Pattern = pattern; } Width = width; Height = height; Uri uri; if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri)) { HtmlCode = Html.CreateImageTag(url, width, height, String.IsNullOrWhiteSpace(ExactWord)?Pattern:ExactWord); Uri = uri; } }
public static bool DoesHaveAngleBracketsAsBoundary(string Input) { foreach (Regex Re in CompiledAngleBracketsRegex) { if (Re.IsMatch(Input)) { return(true); } } return(false); }
public static bool DoesHaveHtmlTags(string Input) { foreach (Regex Re in CompiledHtmlTagRegexes) { if (Re.IsMatch(Input)) { return(true); } } return(false); }
private FileStream GetFile(string path) { var fullPath = path; if (!Re.IsMatch(path, @"^.:\\.*$")) { fullPath = (webContentFolder + path.Replace("/", @"\")).Replace(@"\\", @"\"); } try { return(File.OpenRead(fullPath)); } catch { Log.WriteError("Web server is unable to read a file: {0}", fullPath); return(null); } }