private PhMenuNode GetTheNodeWithMatch(Match aMatch) { var newPhMenuNode = new PhMenuNode(); newPhMenuNode.Id = aMatch.Groups[1].Value; newPhMenuNode.Name = aMatch.Groups[2].Value; newPhMenuNode.Url = aMatch.Groups[3].Value; newPhMenuNode.Icon = aMatch.Groups[4].Value; return(newPhMenuNode); }
private PhMenuNode GetTheNodeWithMatch(Match aMatch) { var newPhMenuNode = new PhMenuNode(); newPhMenuNode.Id = aMatch.Groups[1].Value; newPhMenuNode.Name = Encoding.UTF8.GetString(Convert.FromBase64String(aMatch.Groups[2].Value)); newPhMenuNode.Url = aMatch.Groups[3].Value; newPhMenuNode.Icon = aMatch.Groups[4].Value; return(newPhMenuNode); }
private PhMenuNode GetNodeChilds(string menuFileContent, PhMenuNode parentNode) { var matchResults = Regex.Matches(menuFileContent, $@"{{id:(\d*), pId: {parentNode.Id}, name:'(.*)', url:'(.*)',.*icon:'(.*)'"); var phMenuNodes = new List <PhMenuNode>(); foreach (Match aMatchResult in matchResults) { var newPhMenuNode = GetTheNodeWithMatch(aMatchResult); GetNodeChilds(menuFileContent, newPhMenuNode); phMenuNodes.Add(newPhMenuNode); } parentNode.Childs = phMenuNodes; return(parentNode); }
private PhMenuNode GetNodeChilds(string menuFileContent, PhMenuNode parentNode, int deep) { var matchResults = Regex.Matches(menuFileContent, $@"{{id:(.*), pId:{parentNode.Id}, name:'(.*)', url:'(.*)',.*icon:'(.*)'"); var phMenuNodes = new List <PhMenuNode>(); foreach (Match aMatchResult in matchResults) { var newPhMenuNode = GetTheNodeWithMatch(aMatchResult); if (deep < 8) { if (parentNode.Name == null || !parentNode.Name.Contains("文件列表")) { GetNodeChilds(menuFileContent, newPhMenuNode, deep + 1); } } phMenuNodes.Add(newPhMenuNode); } parentNode.Childs = phMenuNodes; return(parentNode); }