Beispiel #1
0
        public void TestRecordArrayNode()
        {
            List <EsfNode> records = new List <EsfNode>();

            for (int i = 0; i < 5; i++)
            {
                RecordEntryNode entry = new RecordEntryNode(codec)
                {
                    Name  = "test - " + i,
                    Value = createSomeNodes()
                };
                records.Add(entry);
            }
            RecordArrayNode array = new RecordArrayNode(codec, (byte)EsfType.RECORD_BLOCK)
            {
                Name  = "test",
                Value = records
            };

            VerifyEncodeDecode(array, false);
        }
Beispiel #2
0
        private static bool ChangePersonality(ParentNode equipmentSlotsBlock, ParentNode ceoPoolBlock,
                                              String personality1, String personality2, String personality3, String personality4, String personality5,
                                              String personality6, String personality7)
        {
            var equipmentSlotsBlockName = equipmentSlotsBlock.AllNodes[0].ToString();

            if (equipmentSlotsBlockName != CeoCategory.personality)
            {
                return(false);
            }
            var equipmentCategoryManager = equipmentSlotsBlock.Children[0];
            var equipmentSlotsBlockSlots = equipmentCategoryManager.Children[0];

            var ceoPoolBlockName = ceoPoolBlock.AllNodes[0].ToString();

            if (ceoPoolBlockName != CeoCategory.personality)
            {
                return(false);
            }
            var ceoPool = ceoPoolBlock.Children[0];
            //RecordArrayNode
            var ceoMapBlocks = ceoPool.Children[0];
            //RecordEntryNode
            RecordEntryNode c0 = ceoMapBlocks.Children[0] as RecordEntryNode;

            if (c0 == null)
            {
                return(false);
            }
            if (personality4 != null)
            {
                var c3 = c0.CreateCopy() as RecordEntryNode;
                if (c3?.AllNodes[0] == null)
                {
                    return(false);
                }
                var c3Name = c3.AllNodes[0] as StringNode;
                c3Name.Value = personality4;
                var c3CeoBlocks = c3.AllNodes[1] as RecordArrayNode;
                var c3Code      = c3CeoBlocks.Children[0].AllNodes[0] as OptimizedUIntNode; //12 15 14
                c3Code.Value = (CeoMapNameKey[personality4].AllNodes[0] as OptimizedUIntNode).Value;
                ceoMapBlocks.Value.Insert(3, c3);
                var e3Code =
                    equipmentSlotsBlockSlots.Children[3].Children[0].AllNodes[0] as OptimizedUIntNode; //14 15 16
                e3Code.Value = (CeoMapNameKey[personality4].AllNodes[5] as OptimizedUIntNode).Value;
            }


            // 特性1
            var a = equipmentSlotsBlockSlots.Children[0].Children[0].AllNodes[0].ToString();
            // 特性2
            var b = equipmentSlotsBlockSlots.Children[1].Children[0].AllNodes[0].ToString();
            // 特性3
            var c = equipmentSlotsBlockSlots.Children[2].Children[0].AllNodes[0].ToString();

//            // 特性4
//            var d = equipmentSlotsBlockSlots.Children[3].Children[0].AllNodes[0].ToString();
//            // 特性5
//            var e = equipmentSlotsBlockSlots.Children[4].Children[0].AllNodes[0].ToString();
//            // 特性6
//            var f = equipmentSlotsBlockSlots.Children[5].Children[0].AllNodes[0].ToString();
//            // 特性7
//            var g = equipmentSlotsBlockSlots.Children[6].Children[0].AllNodes[0].ToString();
            if (CeoMapEquipmentCodeKey.ContainsKey(a))
            {
                Debug.WriteLine("{0}  {1}", a, CeoMapEquipmentCodeKey[a]);
            }
            if (CeoMapEquipmentCodeKey.ContainsKey(b))
            {
                Debug.WriteLine("{0}  {1}", b, CeoMapEquipmentCodeKey[b]);
            }
            if (CeoMapEquipmentCodeKey.ContainsKey(c))
            {
                Debug.WriteLine("{0}  {1}", c, CeoMapEquipmentCodeKey[c]);
            }
//            if (CeoMapEquipmentCodeKey.ContainsKey(d)) Debug.WriteLine("{0}  {1}", d, CeoMapEquipmentCodeKey[d]);
//            if (CeoMapEquipmentCodeKey.ContainsKey(e)) Debug.WriteLine("{0}  {1}", e, CeoMapEquipmentCodeKey[e]);
//            if (CeoMapEquipmentCodeKey.ContainsKey(f)) Debug.WriteLine("{0}  {1}", f, CeoMapEquipmentCodeKey[f]);
//            if (CeoMapEquipmentCodeKey.ContainsKey(g)) Debug.WriteLine("{0}  {1}", g, CeoMapEquipmentCodeKey[g]);
            Debug.WriteLine("-----------------------------");
//            var map = CeoMapNameKey;
//            String codeHeavenHonest = map["3k_ytr_ceo_trait_personality_heaven_honest"];
//            Debug.WriteLine("{0}  {1}", codeHeavenHonest, CeoMapCodeKey[codeHeavenHonest]);

            return(true);
        }