Example #1
0
        public override bool loadReader(EexBinaryReader reader)
        {
            CommandConfig cfg = ScriptConfig.Instance.getCommandConfig(id);

            if (cfg.useFieldIds())
            {
                if (cfg.FieldRepeat <= 1)
                {
                    for (int i = 0; i < fieldCount; i++)
                    {
                        values[i] = reader.readFieldObject(keys[i]);
                    }
                }
                else
                {
                    for (int i = 0; i < cfg.FieldRepeat; i++)
                    {
                        Object[] objs = new Object[fieldCount];
                        for (int j = 0; j < fieldCount; j++)
                        {
                            objs[j] = reader.readFieldObject(keys[j]);
                        }
                        arrayValues[i] = objs;
                    }
                }
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < fieldCount; i++)
                {
                    sb.Append("0x").Append(reader.readUShort().ToString("x2")).Append(",");
                    values[i] = reader.readFieldValue(cfg.FieldTypes[i]);
                }
                String sth = sb.ToString();
                Console.WriteLine(sth);
                MessageBox.Show(sth);
            }
            return(true);
        }
Example #2
0
        public void loadConfig(XmlNode node)
        {
            fieldTypes.Clear();
            addFieldMap(node, "type/UShort", FTUShort, "FTUShort");
            addFieldMap(node, "type/Integer", FTInteger, "FTInteger");
            addFieldMap(node, "type/Boolean", FTBool, "FTBool");
            addFieldMap(node, "type/String", FTString, "FTString");
            addFieldMap(node, "type/UShortArray", FTUShortArray, "FTUShortArray");

            commandInfos.Clear();
            XmlNodeList xnList = node.SelectNodes("commandList/command");

            foreach (XmlNode xn in xnList)
            {
                CommandConfig ci = new CommandConfig();
                ci.loadXmlNode(xn);
                if (commandInfos.ContainsKey(ci.Id))
                {
                    throw new ApplicationException(String.Format("CommandId:0x{0:x2} 重复", ci.Id));
                }
                commandInfos.Add(ci.Id, ci);
            }
        }
Example #3
0
        public String getNodeText()
        {
            CommandConfig cfg = ScriptConfig.Instance.getCommandConfig(id);

            return(String.Format("{0:x}:{1}", id, cfg.Name));
        }