public MatchCollection Matches() { try { var matches = Reg.Matches(Input ?? string.Empty); for (int n = 0; n < matches.Count; n++) { var match = matches[n]; AddMatchData(match); } Result = string.Join(Environment.NewLine, matches.Cast <Match>().Select(m => m.Value)); return(matches); } catch (Exception ex) { Logger.Error("正则执行失败", ex); NotifyWin.Warn("执行失败:" + ex.Message); return(null); } }
public void LoadMainMenu() { try { #if DEBUG /* * var json = @" * [ * { * 'Id': 'iOffice10', * 'Header': 'iOffice10' * }, * { * 'Id': 'RevCleaner', * 'Parent': 'iOffice10', * 'Header': '补丁文件清理', * 'ClassName': 'RevCleanerCtrl' * }, * { * 'Id': 'MongoSync', * 'Parent': 'iOffice10', * 'Header': 'MongoDB同步', * 'ClassName': 'MongoSyncCtrl' * }, * { * 'Id': 'VersionFile', * 'Parent': 'iOffice10', * 'Header': '版本文件生成', * 'ClassName': 'VersionFileCtrl' * }, * { * 'Id': 'WebsiteMklink', * 'Parent': 'iOffice10', * 'Header': '站点文件映射', * 'ClassName': 'WebsiteMklinkCtrl' * }, * { * 'Id': 'ConfigManager', * 'Parent': 'iOffice10', * 'Header': '配置文件管理*', * 'ClassName': 'ConfigManagerCtrl' * }, * { * 'Id': 'ScriptManager', * 'Parent': 'iOffice10', * 'Header': '常用脚本管理*', * 'ClassName': 'ScriptManagerCtrl' * }, * { * 'Id': 'ChangesetGetter', * 'Header': '变更集抽取*', * 'ClassName': 'ChangesetGetterCtrl', * 'Visible': true * }, * { * 'Id': 'RegexNet', * 'Header': '正则表达式', * 'ClassName': 'RegexNetCtrl' * } * ] * "; * var nodes = JsonConvert.DeserializeObject<List<MenuNode>>(json);*/ var nodes = ReadSetting(nameof(MainMenu), new List <MenuNode>()); #else var nodes = ReadSetting(nameof(MainMenu), new List <MenuNode>()); #endif foreach (var item in nodes) { MainMenu.Add(item); } if (!MainMenu.Any()) { NotifyWin.Warn("主菜单无数据"); } else { StartOn = MainMenu.Where(m => m.StartOn).ToList(); } } catch (Exception ex) { Logger.Error("加载主菜单错误", ex); NotifyWin.Error("加载主菜单错误:" + ex.Message); } }
public static void NotifyError(string msg, string title = "错误") { DispatcherInvoke(() => { NotifyWin.Error(msg, title); }); }
public static void NotifyWarn(string msg, string title = "警告") { DispatcherInvoke(() => { NotifyWin.Warn(msg, title); }); }
public static void NotifyInfo(string msg, string title = "提示") { DispatcherInvoke(() => { NotifyWin.Info(msg, title); }); }