Example #1
0
        public void Read(IoBuffer io, int version)
        {
            Type         = (TREEBoxType)io.ReadUInt16();
            Unknown      = io.ReadUInt16();
            Width        = io.ReadInt16();
            Height       = io.ReadInt16();
            X            = io.ReadInt16();
            Y            = io.ReadInt16();
            CommentSize  = io.ReadInt16();
            TruePointer  = io.ReadInt16();
            Special      = io.ReadInt16();
            FalsePointer = io.ReadInt32();
            Comment      = io.ReadNullTerminatedString();
            if (Comment.Length % 2 == 0)
            {
                io.ReadByte();                          //padding to 2 byte align
            }
            if (version > 0)
            {
                TrailingZero = io.ReadInt32();
            }

            if (!Enum.IsDefined(typeof(TREEBoxType), Type))
            {
                throw new Exception("Unexpected TREE box type: " + Type.ToString());
            }
            if (Special < -1 || Special > 0)
            {
                throw new Exception("Unexpected TREE special: " + Special);
            }
            if (Unknown != 0)
            {
                throw new Exception("Unexpected Unknown: " + Unknown);
            }
            if (TrailingZero != 0)
            {
                Console.WriteLine("Unexpected TrailingZero: " + TrailingZero);
            }
        }
Example #2
0
        public void SetPlacement(TREEBoxType type, PrimitiveBox target)
        {
            PlacingName.Visible = true;
            PlacingDesc.Visible = true;

            var tree = BHAVView.EditTargetTree;
            var box  = new TREEBox(tree);

            if (target != null)
            {
                box.TruePointer = target.TreeBox.InternalID;
            }
            box.Width  = 200;
            box.Height = 60;
            box.Type   = type;
            if (type == TREEBoxType.Label)
            {
                box.Comment = "Label " + (tree.Entries.Count(x => x.Type == TREEBoxType.Label) + 1);
            }
            Placement           = new PrimitiveBox(box, BHAVView);
            PlacingName.Caption = "Placing " + type.ToString();
            Placement.Parent    = this;
        }
Example #3
0
 public override string ToString()
 {
     return(Type.ToString() + " (" + TruePointer + ((FalsePointer == -1) ? "" : ("/" + FalsePointer)) + "): " + Comment);
 }