示例#1
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Name = binaryReader.ReadString32();
     this.CombatStatusDecayOptions = ((CombatStatusDecayOptionsEnum)(binaryReader.ReadInt16()));
     this.fieldpad          = binaryReader.ReadBytes(2);
     this.Attitude          = ((AttitudeEnum)(binaryReader.ReadInt16()));
     this.fieldpad0         = binaryReader.ReadBytes(2);
     this.EngageAttitude    = ((EngageAttitudeEnum)(binaryReader.ReadByte()));
     this.EvasionAttitude   = ((EvasionAttitudeEnum)(binaryReader.ReadByte()));
     this.CoverAttitude     = ((CoverAttitudeEnum)(binaryReader.ReadByte()));
     this.SearchAttitude    = ((SearchAttitudeEnum)(binaryReader.ReadByte()));
     this.PresearchAttitude = ((PresearchAttitudeEnum)(binaryReader.ReadByte()));
     this.RetreatAttitude   = ((RetreatAttitudeEnum)(binaryReader.ReadByte()));
     this.ChargeAttitude    = ((ChargeAttitudeEnum)(binaryReader.ReadByte()));
     this.ReadyAttitude     = ((ReadyAttitudeEnum)(binaryReader.ReadByte()));
     this.IdleAttitude      = ((IdleAttitudeEnum)(binaryReader.ReadByte()));
     this.WeaponAttitude    = ((WeaponAttitudeEnum)(binaryReader.ReadByte()));
     this.SwarmAttitude     = ((SwarmAttitudeEnum)(binaryReader.ReadByte()));
     this.fieldpad1         = binaryReader.ReadBytes(1);
     this.StyleStyleControl = ((StyleControl)(binaryReader.ReadInt32()));
     this.StyleBehaviors1   = ((Behaviors1)(binaryReader.ReadInt32()));
     this.StyleBehaviors2   = ((Behaviors2)(binaryReader.ReadInt32()));
     this.StyleBehaviors3   = ((Behaviors3)(binaryReader.ReadInt32()));
     this.StyleBehaviors4   = ((Behaviors4)(binaryReader.ReadInt32()));
     this.StyleBehaviors5   = ((Behaviors5)(binaryReader.ReadInt32()));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(4));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(32));
     return(pointerQueue);
 }
        public void Should_WriteStyleControl()
        {
            var control = new StyleControl(new StyleControlOptions {
                MapStyles          = new[] { MapStyle.Blank, MapStyle.GrayscaleDark },
                Style              = ControlStyle.Auto,
                StyleControlLayout = StyleControlLayout.Icons
            }, ControlPosition.BottomLeft);

            var expectedJson = "{"
                               + "\"id\":\"" + control.Id + "\""
                               + ",\"type\":\"" + control.Type + "\""
                               + ",\"position\":\"" + control.Position.ToString() + "\""
                               + ",\"options\":{"
                               + "\"mapStyles\":[\"" + control.Options.MapStyles.First().ToString() + "\",\"" + control.Options.MapStyles.ElementAt(1).ToString() + "\"]"
                               + ",\"style\":\"" + control.Options.Style.ToString() + "\""
                               + ",\"styleControlLayout\":\"" + control.Options.StyleControlLayout.ToString() + "\""
                               + "}"
                               + "}";

            TestAndAssertWrite(control, expectedJson);
        }