using Api.Framework.SDK; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using 提取xml连接.Properties; namespace 提取xml连接 { public class Class1 : Plugin { public Class1() { this.Logo = Resources.Lark20210414_110119; this.Name = "xml提取地址"; this.Note = "xml提取地址"; } #region 自定义变量 public static Config Config; private MainForm mainForm = null; #endregion public override void Start() { Config = this.ReadConfig(); SDK.ReciveIMEvent += SDK_ReciveIMEvent; } #region 消息事件处理 private void SDK_ReciveIMEvent(object sender, ReciveIMEvent e) { try { if (e.Message.Trim().Contains("(?<链接>[\w\W]+?))|(?:(?<链接>[\w\W]+?)))", RegexOptions.IgnoreCase | RegexOptions.Multiline); if (reg.Success) { var strb = new StringBuilder(); strb.AppendLine($"用户:{e.NickName}({e.Username})"); strb.AppendLine($"提取:{reg.Groups["链接"].Value.Replace("", "")}"); strb.AppendLine($"时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); if (Config.usernames.Contains(e.Username)) { e.SendMessage(strb.ToString()); } else this.OnLog(strb.ToString()); } } } catch (Exception ex) { this.OnLog(ex.Message); } } #endregion public override void ShowForm() { try { if (mainForm == null || mainForm.IsDisposed) { mainForm = new MainForm(); mainForm.Show(); } mainForm.TopMost = true; mainForm.TopMost = false; } catch (Exception ex) { this.OnLog(ex.Message); } } public override void Stop() { try { if (mainForm != null) { mainForm.CloseForm(); mainForm = null; } } catch (Exception ex) { this.OnLog(ex.Message); } } } }