Esempio n. 1
0
                    private bool GetAllCommands(XmlNode tNode, BlackLight.Services.Modules.Help.Lists.CommandList TopList)
                    {
                        string tCmdName;
                        string tCmdValue = "";
                        string[] tCmdValues;
                        BlackLight.Services.Modules.Help.Lists.CommandList tCommands = new BlackLight.Services.Modules.Help.Lists.CommandList();
                        ServiceCommandResponse tCmd;
                        foreach (XmlNode tCommandNode in tNode)
                        {
                            if (tCommandNode.Attributes["name"] != null && tCommandNode.Attributes["name"].Value != "")
                            {
                                tCmdName = tCommandNode.Attributes["name"].Value;
                            }
                            else
                            {
                                MyBase.Core.SendLogMessage("Help", "GetAllCommands()", BlackLight.Services.Error.Errors.ERROR, "XML Data Corruption", "", "", "");
                                //MessageBox.Show("XML Data corruption");
                                return false;
                            }

                            if (tCommandNode["commands"] != null)
                            {
                                try
                                {
                                    GetAllCommands(tCommandNode["commands"], tCommands);
                                }
                                catch (Exception ex)
                                {
                                    MyBase.Core.SendLogMessage("Help", "GetAllCommands()", BlackLight.Services.Error.Errors.ERROR, "Exception", "", ex.Message, ex.StackTrace);
                                    //MessageBox.Show(ex.Message + " " + ex.StackTrace);
                                }
                            }
                            else
                            {
                                if (tCommandNode.InnerText != null&& tCommandNode.InnerText != "")
                                {
                                    tCmdValue = tCommandNode.InnerText.Trim();
                                }
                                else
                                {
                                    MyBase.Core.SendLogMessage("Help", "ModLoad", BlackLight.Services.Error.Errors.ERROR, "XML Data Corruption", "", "", "");
                                    //MessageBox.Show("XML Data corruption");
                                    return false;
                                }
                            }
                            tCmdValue = tCmdValue.Replace("  ", " ");
                            tCmdValue = tCmdValue.Replace("  ", " ");
                            tCmdValue = tCmdValue.Replace("`B", "");
                            tCmdValue = tCmdValue.Replace("`U", "");
                            tCmdValue = tCmdValue.Replace("\r\n", "\r");
                            tCmdValue = tCmdValue.Replace("\n", "\r");
                            tCmdValues = tCmdValue.Split('\r');
                            if (tCommands.Count == 0)
                            {
                                tCmd = new ServiceCommandResponse(tCmdName, tCmdValues, null);
                            }
                            else
                            {
                                tCmd = new ServiceCommandResponse(tCmdName, tCommands["help"].Value, tCommands);
                            }

                            TopList.Add(tCmd);
                        }
                        return true;
                    }