Exemple #1
0
        /// <summary>
        /// 获取响应结果
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="contentStr"></param>
        /// <returns></returns>
        protected T GetRespResult <T>(string contentStr) where T : WxPayBaseResp, new()
        {
            XmlDocument resultXml = null;
            var         dics      = XmlDicHelper.ChangXmlToDir(contentStr, ref resultXml);

            T t = new T {
                RespXml = resultXml
            };

            t.FromResContent(dics);

            if (dics.ContainsKey("sign"))
            {
                var encryptStr = string.Join("&", dics.Select(d =>
                {
                    if (d.Key != "sign" && !string.IsNullOrEmpty(d.Value))
                    {
                        return(string.Concat(d.Key, "=", d.Value));
                    }
                    return(string.Empty);
                }));
                var signStr = GetSign(encryptStr);

                if (signStr != t.sign)
                {
                    t.Ret     = (int)ResultTypes.ParaNotMeet;
                    t.Message = "返回的结果签名(sign)不匹配";
                }
            }
            return(t);
        }
        public override void LoadItems()
        {
            base.LoadItems();
            int         index = this.UseUserDic ? 1 : 0;
            XmlDocument doc   = XmlDicHelper.EnhanceMenusDic[index];

            if (doc?.DocumentElement == null)
            {
                return;
            }
            foreach (XmlNode xn in doc.DocumentElement.ChildNodes)
            {
                try
                {
                    Image  image = null;
                    string text  = null;
                    string path  = xn.SelectSingleNode("RegPath")?.InnerText;
                    foreach (XmlElement textXE in xn.SelectNodes("Text"))
                    {
                        if (XmlDicHelper.JudgeCulture(textXE))
                        {
                            text = ResourceString.GetDirectString(textXE.GetAttribute("Value"));
                        }
                    }
                    if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(text))
                    {
                        continue;
                    }
                    if (!string.IsNullOrEmpty(this.ScenePath) && !path.Equals(this.ScenePath, StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }

                    string iconLocation = xn.SelectSingleNode("Icon")?.InnerText;
                    using (Icon icon = ResourceIcon.GetIcon(iconLocation))
                    {
                        image = icon?.ToBitmap();
                        image = image ?? AppImage.NotFound;
                    }
                    FoldGroupItem groupItem = new FoldGroupItem(path, ObjectPath.PathType.Registry)
                    {
                        Image = image,
                        Text  = text
                    };
                    this.AddItem(groupItem);
                    XmlNode shellXN   = xn.SelectSingleNode("Shell");
                    XmlNode shellExXN = xn.SelectSingleNode("ShellEx");
                    if (shellXN != null)
                    {
                        LoadShellItems(shellXN, groupItem);
                    }
                    if (shellExXN != null)
                    {
                        LoadShellExItems(shellExXN, groupItem);
                    }
                    groupItem.SetVisibleWithSubItemCount();
                }
                catch { continue; }
            }
        }
Exemple #3
0
 private void RefreshApp()
 {
     this.Cursor = Cursors.WaitCursor;
     ObjectPath.FilePathDic.Clear();
     AppConfig.ReloadConfig();
     GuidInfo.ReloadDics();
     XmlDicHelper.ReloadDics();
     this.SwitchItem();
     this.Cursor = Cursors.Default;
 }
Exemple #4
0
        /// <summary>
        /// 获取响应结果
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="contentStr"></param>
        /// <returns></returns>
        protected T GetRespResult <T>(string contentStr) where T : WxPayBaseResp, new()
        {
            XmlDocument resultXml = null;
            var         dics      = XmlDicHelper.ChangXmlToDir(contentStr, ref resultXml);

            var t = new T {
                RespXml = resultXml
            };

            t.FromResContent(dics);

            if (dics.ContainsKey("sign"))
            {
                var sb    = new StringBuilder();
                var first = true;

                foreach (var d in dics.Where(d => d.Key != "sign" && !string.IsNullOrEmpty(d.Value)))
                {
                    if (first)
                    {
                        first = false;
                        sb.AppendFormat("{0}={1}", d.Key, d.Value);
                    }
                    else
                    {
                        sb.AppendFormat("&{0}={1}", d.Key, d.Value);
                    }
                }


                var encryptStr = sb.ToString();

                var signStr = GetSign(encryptStr);

                if (signStr != t.sign)
                {
                    t.ret     = (int)ResultTypes.ParaError;
                    t.message = "返回的结果签名(sign)不匹配";
                }
            }

            if (t.return_code.ToUpper() != "SUCCESS")
            {
                //通信结果处理,这个微信做的其实没意义,脱裤子放屁
                t.ret     = -1;
                t.message = t.return_msg;
            }
            else if (!t.IsSuccess())
            {
                //  请求数据结果处理
                t.message = GetErrMsg(t.err_code?.ToUpper());
            }

            return(t);
        }
 private void LoadShellExItems(XmlNode shellExXN, FoldGroupItem groupItem)
 {
     foreach (XmlNode itemXN in shellExXN.SelectNodes("Item"))
     {
         if (!XmlDicHelper.FileExists(itemXN))
         {
             continue;
         }
         if (!XmlDicHelper.JudgeCulture(itemXN))
         {
             continue;
         }
         if (!XmlDicHelper.JudgeOSVersion(itemXN))
         {
             continue;
         }
         if (!GuidEx.TryParse(itemXN.SelectSingleNode("Guid")?.InnerText, out Guid guid))
         {
             continue;
         }
         EnhanceShellExItem item = new EnhanceShellExItem
         {
             FoldGroupItem  = groupItem,
             ShellExPath    = $@"{groupItem.GroupPath}\ShellEx",
             Image          = ResourceIcon.GetIcon(itemXN.SelectSingleNode("Icon")?.InnerText)?.ToBitmap() ?? AppImage.SystemFile,
             DefaultKeyName = itemXN.SelectSingleNode("KeyName")?.InnerText,
             Guid           = guid
         };
         foreach (XmlNode textXE in itemXN.SelectNodes("Text"))
         {
             if (XmlDicHelper.JudgeCulture(textXE))
             {
                 item.Text = ResourceString.GetDirectString(textXE.InnerText);
             }
         }
         if (item.Text.IsNullOrWhiteSpace())
         {
             item.Text = GuidInfo.GetText(guid);
         }
         if (item.DefaultKeyName.IsNullOrWhiteSpace())
         {
             item.DefaultKeyName = guid.ToString("B");
         }
         string tip = "";
         foreach (XmlElement tipXE in itemXN.SelectNodes("Tip"))
         {
             if (XmlDicHelper.JudgeCulture(tipXE))
             {
                 tip = tipXE.GetAttribute("Text");
             }
         }
         ToolTipBox.SetToolTip(item.ChkVisible, tip);
         this.AddItem(item);
     }
 }
Exemple #6
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     if (SingleInstance.IsRunning())
     {
         return;
     }
     AppString.LoadStrings();
     Updater.PeriodicUpdate();
     XmlDicHelper.ReloadDics();
     Application.Run(new MainForm());
 }
        private static string CreateCommandFile(XmlNode xe)
        {
            string path = string.Empty;

            if (xe == null)
            {
                return(path);
            }
            foreach (XmlElement cfXE in xe.SelectNodes("CreateFile"))
            {
                if (!XmlDicHelper.FileExists(cfXE))
                {
                    continue;
                }
                if (!XmlDicHelper.JudgeCulture(cfXE))
                {
                    continue;
                }
                if (!XmlDicHelper.JudgeOSVersion(cfXE))
                {
                    continue;
                }
                string fileName  = cfXE.GetAttribute("FileName");
                string content   = cfXE.GetAttribute("Content");
                string extension = Path.GetExtension(fileName).ToLower();
                string filePath  = $@"{AppConfig.ProgramsDir}\{fileName}";
                if (path == string.Empty)
                {
                    path = filePath;
                }
                Encoding encoding;
                switch (extension)
                {
                case ".bat":
                case ".cmd":
                    encoding = Encoding.Default;
                    break;

                default:
                    encoding = Encoding.Unicode;
                    break;
                }
                File.Delete(filePath);
                File.WriteAllText(filePath, content, encoding);
            }
            return(path);
        }
        private static void WriteSubKeysValue(XmlNode keyXN, string regPath)
        {
            if (keyXN == null)
            {
                return;
            }
            if (!XmlDicHelper.FileExists(keyXN))
            {
                return;
            }
            if (!XmlDicHelper.JudgeCulture(keyXN))
            {
                return;
            }
            if (!XmlDicHelper.JudgeOSVersion(keyXN))
            {
                return;
            }
            string defaultValue = ((XmlElement)keyXN).GetAttribute("Default");

            if (!defaultValue.IsNullOrWhiteSpace())
            {
                defaultValue = Environment.ExpandEnvironmentVariables(defaultValue);
                Registry.SetValue(regPath, "", defaultValue);
            }
            else if (keyXN.Name == "Command")
            {
                //按照规则Command节点无默认值则创建文件
                WriteCommandValue(keyXN, regPath);
            }
            WriteAttributesValue(keyXN.SelectSingleNode("Value"), regPath);

            XmlNode subKeyXN = keyXN.SelectSingleNode("SubKey");

            if (subKeyXN != null)
            {
                foreach (XmlNode xn in subKeyXN.ChildNodes)
                {
                    if (xn is XmlComment)
                    {
                        continue;
                    }
                    WriteSubKeysValue(xn, $@"{regPath}\{xn.Name}");
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// 获取响应结果
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="contentStr"></param>
        /// <returns></returns>
        protected T GetRespResult <T>(string contentStr) where T : WxPayBaseResp, new()
        {
            XmlDocument resultXml = null;
            var         dics      = XmlDicHelper.ChangXmlToDir(contentStr, ref resultXml);

            T t = new T {
                RespXml = resultXml
            };

            t.FromResContent(dics);

            if (dics.ContainsKey("sign"))
            {
                dics.Remove("sign");
                var encryptStr = string.Join("&", dics.Select(d =>
                {
                    if (!string.IsNullOrEmpty(d.Value))
                    {
                        return(string.Concat(d.Key, "=", d.Value));
                    }
                    return(string.Empty);
                }));
                var signStr = GetSign(encryptStr);

                if (signStr != t.sign)
                {
                    t.Ret     = (int)ResultTypes.ParaNotMeet;
                    t.Message = "返回的结果签名(sign)不匹配";
                }
            }

            if (t.return_code.ToUpper() != "SUCCESS")
            {
                //通信结果处理,这个其实没意义,脱裤子放屁
                t.Ret     = 0;
                t.Message = t.return_msg;
            }
            else if (!t.IsSuccess)
            {
                //  请求数据结果处理
                t.Message = GetErrMsg(t.err_code?.ToUpper());
            }

            return(t);
        }
        public override void LoadItems()
        {
            base.LoadItems();
            int         index = this.UseUserDic ? 1 : 0;
            XmlDocument doc   = XmlDicHelper.DetailedEditDic[index];

            if (doc?.DocumentElement == null)
            {
                return;
            }
            foreach (XmlNode groupXN in doc.DocumentElement.ChildNodes)
            {
                try
                {
                    List <Guid> guids    = new List <Guid>();
                    XmlNodeList guidList = groupXN.SelectNodes("Guid");
                    foreach (XmlNode guidXN in guidList)
                    {
                        if (!GuidEx.TryParse(guidXN.InnerText, out Guid guid))
                        {
                            continue;
                        }
                        if (!File.Exists(GuidInfo.GetFilePath(guid)))
                        {
                            continue;
                        }
                        if (this.GroupGuid != Guid.Empty && this.GroupGuid != guid)
                        {
                            continue;
                        }
                        guids.Add(guid);
                    }
                    if (guidList.Count > 0 && guids.Count == 0)
                    {
                        continue;
                    }

                    FoldGroupItem       groupItem;
                    bool                isIniGroup = groupXN.SelectSingleNode("IsIniGroup") != null;
                    string              attribute  = isIniGroup ? "FilePath" : "RegPath";
                    ObjectPath.PathType pathType   = isIniGroup ? ObjectPath.PathType.File : ObjectPath.PathType.Registry;
                    groupItem = new FoldGroupItem(groupXN.SelectSingleNode(attribute)?.InnerText, pathType);
                    foreach (XmlElement textXE in groupXN.SelectNodes("Text"))
                    {
                        if (XmlDicHelper.JudgeCulture(textXE))
                        {
                            groupItem.Text = ResourceString.GetDirectString(textXE.GetAttribute("Value"));
                        }
                    }
                    if (guids.Count > 0)
                    {
                        groupItem.Tag = guids;
                        if (groupItem.Text.IsNullOrWhiteSpace())
                        {
                            groupItem.Text = GuidInfo.GetText(guids[0]);
                        }
                        groupItem.Image = GuidInfo.GetImage(guids[0]);
                        string filePath  = GuidInfo.GetFilePath(guids[0]);
                        string clsidPath = GuidInfo.GetClsidPath(guids[0]);
                        if (filePath != null || clsidPath != null)
                        {
                            groupItem.ContextMenuStrip.Items.Add(new ToolStripSeparator());
                        }
                        if (filePath != null)
                        {
                            ToolStripMenuItem tsi = new ToolStripMenuItem(AppString.Menu.FileLocation);
                            tsi.Click += (sender, e) => ExternalProgram.JumpExplorer(filePath, AppConfig.OpenMoreExplorer);
                            groupItem.ContextMenuStrip.Items.Add(tsi);
                        }
                        if (clsidPath != null)
                        {
                            ToolStripMenuItem tsi = new ToolStripMenuItem(AppString.Menu.ClsidLocation);
                            tsi.Click += (sender, e) => ExternalProgram.JumpRegEdit(clsidPath, null, AppConfig.OpenMoreRegedit);
                            groupItem.ContextMenuStrip.Items.Add(tsi);
                        }
                    }
                    XmlNode iconXN = groupXN.SelectSingleNode("Icon");
                    using (Icon icon = ResourceIcon.GetIcon(iconXN?.InnerText))
                    {
                        if (icon != null)
                        {
                            groupItem.Image = icon.ToBitmap();
                        }
                    }
                    this.AddItem(groupItem);

                    string GetRuleFullRegPath(string regPath)
                    {
                        if (string.IsNullOrEmpty(regPath))
                        {
                            regPath = groupItem.GroupPath;
                        }
                        else if (regPath.StartsWith("\\"))
                        {
                            regPath = groupItem.GroupPath + regPath;
                        }
                        return(regPath);
                    };

                    foreach (XmlElement itemXE in groupXN.SelectNodes("Item"))
                    {
                        try
                        {
                            if (!XmlDicHelper.JudgeOSVersion(itemXE))
                            {
                                continue;
                            }
                            RuleItem ruleItem;
                            ItemInfo info = new ItemInfo();
                            foreach (XmlElement textXE in itemXE.SelectNodes("Text"))
                            {
                                if (XmlDicHelper.JudgeCulture(textXE))
                                {
                                    info.Text = ResourceString.GetDirectString(textXE.GetAttribute("Value"));
                                }
                            }
                            foreach (XmlElement tipXE in itemXE.SelectNodes("Tip"))
                            {
                                if (XmlDicHelper.JudgeCulture(tipXE))
                                {
                                    info.Tip = ResourceString.GetDirectString(tipXE.GetAttribute("Value"));
                                }
                            }
                            info.RestartExplorer = itemXE.SelectSingleNode("RestartExplorer") != null;

                            int defaultValue = 0, maxValue = 0, minValue = 0;
                            if (itemXE.SelectSingleNode("IsNumberItem") != null)
                            {
                                XmlElement ruleXE = (XmlElement)itemXE.SelectSingleNode("Rule");
                                defaultValue = ruleXE.HasAttribute("Default") ? Convert.ToInt32(ruleXE.GetAttribute("Default")) : 0;
                                maxValue     = ruleXE.HasAttribute("Max") ? Convert.ToInt32(ruleXE.GetAttribute("Max")) : int.MaxValue;
                                minValue     = ruleXE.HasAttribute("Min") ? Convert.ToInt32(ruleXE.GetAttribute("Min")) : int.MinValue;
                            }

                            if (isIniGroup)
                            {
                                XmlElement ruleXE  = (XmlElement)itemXE.SelectSingleNode("Rule");
                                string     iniPath = ruleXE.GetAttribute("FilePath");
                                if (iniPath.IsNullOrWhiteSpace())
                                {
                                    iniPath = groupItem.GroupPath;
                                }
                                string section = ruleXE.GetAttribute("Section");
                                string keyName = ruleXE.GetAttribute("KeyName");
                                if (itemXE.SelectSingleNode("IsNumberItem") != null)
                                {
                                    var rule = new NumberIniRuleItem.IniRule
                                    {
                                        IniPath      = iniPath,
                                        Section      = section,
                                        KeyName      = keyName,
                                        DefaultValue = defaultValue,
                                        MaxValue     = maxValue,
                                        MinValue     = maxValue
                                    };
                                    ruleItem = new NumberIniRuleItem(rule, info);
                                }
                                else if (itemXE.SelectSingleNode("IsStringItem") != null)
                                {
                                    var rule = new StringIniRuleItem.IniRule
                                    {
                                        IniPath  = iniPath,
                                        Secation = section,
                                        KeyName  = keyName
                                    };
                                    ruleItem = new StringIniRuleItem(rule, info);
                                }
                                else
                                {
                                    var rule = new VisbleIniRuleItem.IniRule
                                    {
                                        IniPath      = iniPath,
                                        Section      = section,
                                        KeyName      = keyName,
                                        TurnOnValue  = ruleXE.HasAttribute("On") ? ruleXE.GetAttribute("On") : null,
                                        TurnOffValue = ruleXE.HasAttribute("Off") ? ruleXE.GetAttribute("Off") : null,
                                    };
                                    ruleItem = new VisbleIniRuleItem(rule, info);
                                }
                            }
                            else
                            {
                                if (itemXE.SelectSingleNode("IsNumberItem") != null)
                                {
                                    XmlElement ruleXE = (XmlElement)itemXE.SelectSingleNode("Rule");
                                    var        rule   = new NumberRegRuleItem.RegRule
                                    {
                                        RegPath      = GetRuleFullRegPath(ruleXE.GetAttribute("RegPath")),
                                        ValueName    = ruleXE.GetAttribute("ValueName"),
                                        ValueKind    = XmlDicHelper.GetValueKind(ruleXE.GetAttribute("ValueKind"), RegistryValueKind.DWord),
                                        DefaultValue = defaultValue,
                                        MaxValue     = maxValue,
                                        MinValue     = minValue
                                    };
                                    ruleItem = new NumberRegRuleItem(rule, info);
                                }
                                else if (itemXE.SelectSingleNode("IsStringItem") != null)
                                {
                                    XmlElement ruleXE = (XmlElement)itemXE.SelectSingleNode("Rule");
                                    var        rule   = new StringRegRuleItem.RegRule
                                    {
                                        RegPath   = GetRuleFullRegPath(ruleXE.GetAttribute("RegPath")),
                                        ValueName = ruleXE.GetAttribute("ValueName"),
                                    };
                                    ruleItem = new StringRegRuleItem(rule, info);
                                }
                                else
                                {
                                    XmlNodeList ruleXNList = itemXE.SelectNodes("Rule");
                                    var         rules      = new VisibleRegRuleItem.RegRule[ruleXNList.Count];
                                    for (int i = 0; i < ruleXNList.Count; i++)
                                    {
                                        XmlElement ruleXE = (XmlElement)ruleXNList[i];
                                        rules[i] = new VisibleRegRuleItem.RegRule
                                        {
                                            RegPath   = GetRuleFullRegPath(ruleXE.GetAttribute("RegPath")),
                                            ValueName = ruleXE.GetAttribute("ValueName"),
                                            ValueKind = XmlDicHelper.GetValueKind(ruleXE.GetAttribute("ValueKind"), RegistryValueKind.DWord)
                                        };
                                        string turnOn  = ruleXE.HasAttribute("On") ? ruleXE.GetAttribute("On") : null;
                                        string turnOff = ruleXE.HasAttribute("Off") ? ruleXE.GetAttribute("Off") : null;
                                        switch (rules[i].ValueKind)
                                        {
                                        case RegistryValueKind.Binary:
                                            rules[i].TurnOnValue = turnOn != null?XmlDicHelper.ConvertToBinary(turnOn) : null;

                                            rules[i].TurnOffValue = turnOff != null?XmlDicHelper.ConvertToBinary(turnOff) : null;

                                            break;

                                        case RegistryValueKind.DWord:
                                            if (turnOn == null)
                                            {
                                                rules[i].TurnOnValue = null;
                                            }
                                            else
                                            {
                                                rules[i].TurnOnValue = Convert.ToInt32(turnOn);
                                            }
                                            if (turnOff == null)
                                            {
                                                rules[i].TurnOffValue = null;
                                            }
                                            else
                                            {
                                                rules[i].TurnOffValue = Convert.ToInt32(turnOff);
                                            }
                                            break;

                                        default:
                                            rules[i].TurnOnValue  = turnOn;
                                            rules[i].TurnOffValue = turnOff;
                                            break;
                                        }
                                    }
                                    ruleItem = new VisibleRegRuleItem(rules, info);
                                }
                            }
                            this.AddItem(ruleItem);
                            ruleItem.FoldGroupItem = groupItem;
                            ruleItem.HasImage      = ruleItem.Image != null;
                            ruleItem.Indent();
                        }
                        catch { continue; }
                    }
                    groupItem.SetVisibleWithSubItemCount();
                }
                catch { continue; }
            }
        }
        private static void WriteAttributesValue(XmlNode valueXN, string regPath)
        {
            if (valueXN == null)
            {
                return;
            }
            if (!XmlDicHelper.FileExists(valueXN))
            {
                return;
            }
            if (!XmlDicHelper.JudgeCulture(valueXN))
            {
                return;
            }
            if (!XmlDicHelper.JudgeOSVersion(valueXN))
            {
                return;
            }
            using (RegistryKey key = RegistryEx.GetRegistryKey(regPath, true, true))
            {
                foreach (XmlNode xn in valueXN.ChildNodes)
                {
                    if (xn is XmlComment)
                    {
                        continue;
                    }
                    if (!XmlDicHelper.FileExists(xn))
                    {
                        continue;
                    }
                    if (!XmlDicHelper.JudgeCulture(xn))
                    {
                        continue;
                    }
                    if (!XmlDicHelper.JudgeOSVersion(xn))
                    {
                        continue;
                    }
                    foreach (XmlAttribute xa in xn.Attributes)
                    {
                        switch (xn.Name)
                        {
                        case "REG_SZ":
                            key.SetValue(xa.Name, Environment.ExpandEnvironmentVariables(xa.Value), RegistryValueKind.String);
                            break;

                        case "REG_EXPAND_SZ":
                            key.SetValue(xa.Name, xa.Value, RegistryValueKind.ExpandString);
                            break;

                        case "REG_BINARY":
                            key.SetValue(xa.Name, XmlDicHelper.ConvertToBinary(xa.Value), RegistryValueKind.Binary);
                            break;

                        case "REG_DWORD":
                            int num = xa.Value.ToLower().StartsWith("0x") ? 16 : 10;
                            key.SetValue(xa.Name, Convert.ToInt32(xa.Value, num), RegistryValueKind.DWord);
                            break;
                        }
                    }
                }
            }
        }
 private void LoadShellItems(XmlNode shellXN, FoldGroupItem groupItem)
 {
     foreach (XmlElement itemXE in shellXN.SelectNodes("Item"))
     {
         if (!XmlDicHelper.FileExists(itemXE))
         {
             continue;
         }
         if (!XmlDicHelper.JudgeCulture(itemXE))
         {
             continue;
         }
         if (!XmlDicHelper.JudgeOSVersion(itemXE))
         {
             continue;
         }
         string keyName = itemXE.GetAttribute("KeyName");
         if (keyName.IsNullOrWhiteSpace())
         {
             continue;
         }
         EnhanceShellItem item = new EnhanceShellItem()
         {
             RegPath       = $@"{groupItem.GroupPath}\shell\{keyName}",
             FoldGroupItem = groupItem,
             ItemXE        = itemXE
         };
         foreach (XmlElement szXE in itemXE.SelectNodes("Value/REG_SZ"))
         {
             if (!XmlDicHelper.JudgeCulture(szXE))
             {
                 continue;
             }
             if (szXE.HasAttribute("MUIVerb"))
             {
                 item.Text = ResourceString.GetDirectString(szXE.GetAttribute("MUIVerb"));
             }
             if (szXE.HasAttribute("Icon"))
             {
                 item.Image = ResourceIcon.GetIcon(szXE.GetAttribute("Icon"))?.ToBitmap();
             }
             else if (szXE.HasAttribute("HasLUAShield"))
             {
                 item.Image = AppImage.Shield;
             }
         }
         if (item.Image == null)
         {
             XmlElement cmdXE = (XmlElement)itemXE.SelectSingleNode("SubKey/Command");
             if (cmdXE != null)
             {
                 Icon icon = null;
                 if (cmdXE.HasAttribute("Default"))
                 {
                     string filePath = ObjectPath.ExtractFilePath(cmdXE.GetAttribute("Default"));
                     icon = ResourceIcon.GetIcon(filePath);
                 }
                 else
                 {
                     XmlNode fileXE = cmdXE.SelectSingleNode("FileName");
                     if (fileXE != null)
                     {
                         string filePath = ObjectPath.ExtractFilePath(fileXE.InnerText);
                         icon = ResourceIcon.GetIcon(filePath);
                     }
                 }
                 item.Image = icon?.ToBitmap();
                 icon?.Dispose();
             }
         }
         if (item.Image == null)
         {
             item.Image = AppImage.NotFound;
         }
         if (item.Text.IsNullOrWhiteSpace())
         {
             item.Text = keyName;
         }
         string tip = "";
         foreach (XmlElement tipXE in itemXE.SelectNodes("Tip"))
         {
             if (XmlDicHelper.JudgeCulture(tipXE))
             {
                 tip = tipXE.GetAttribute("Value");
             }
         }
         if (itemXE.GetElementsByTagName("CreateFile").Count > 0)
         {
             if (!tip.IsNullOrWhiteSpace())
             {
                 tip += "\n";
             }
             tip += AppString.Tip.CommandFiles;
         }
         ToolTipBox.SetToolTip(item.ChkVisible, tip);
         this.AddItem(item);
     }
 }