/// <summary> /// Replace slack markups <xxxx> by text /// </summary> /// <param name="content">String content to modify</param> /// <param name="textOnly">Replace by links (false) or text only (true)</param> /// <returns>Content updated</returns> protected string transformText(string content, bool textOnly) { MatchCollection mc = Regex.Matches(content, "<([^>]+)>"); if (mc.Count > 0) { foreach (Match m in mc) { if (m.Groups.Count > 1) { string tag = m.Groups[1].Value; if (Str.BeginWith(tag, "http")) //Eg. <http://www.sinequa.com> { content = Str.Replace(content, "<" + tag + ">", textOnly ? tag : "<a href=\"" + tag + "\">" + tag + "</a>"); } else if (Str.BeginWith(tag, "@")) //Eg. <@U7A9LH1GT> { string user = Str.RemoveBegin(tag, 1); if (users.ContainsKey(user)) { user = users[user].ValueStr("real_name"); } content = Str.Replace(content, "<" + tag + ">", user); } } } } return(content); }
/// <summary> /// Returns a value for a given custom property /// </summary> /// <param name="name">Property name</param> /// <returns>Value of the property</returns> public override string GetValue(string name) { //get the value of a custom property if (Str.BeginWith(name, "slack.channel.")) { return(channel.ValueStr(Str.ParseFromSep(name, "slack.channel."))); } //get the value of a custom property if (Str.BeginWith(name, "slack.file.")) { return(file.ValueStr(Str.ParseFromSep(name, "slack.file."))); } //get the value of standard property return(base.GetValue(name)); }
private void GetCursorIQLIQAAttribute() { if (_cursor.HasAttribute("internalquerylog")) { internalQueryLog = _cursor.GetAttribute("internalquerylog"); } //if (_cursor.HasAttribute("internalqueryanalysis")) internalQueryAnalysis = _cursor.GetAttribute("internalqueryanalysis"); foreach (string attributeName in _cursor.AttributesNames) { if (Str.BeginWith(attributeName, "internalqueryanalysis", false)) { if (!Str.IsEmpty(_cursor.GetAttribute(attributeName))) { dInternalQueryAnalysis.Add(attributeName, _cursor.GetAttribute(attributeName)); } } } }