Пример #1
0
 public override void Write(BinaryWriter file)
 {
     base.Write(file);
     file.WriteVLQInt32(Trees.array.Count);
     if (Trees.Any())
     {
         foreach (var t in Trees.array)
         {
             var currtreetype = (CArray)t;
             ((CHandle)currtreetype.array[0]).Write(file);      //The type of the tree
             file.WriteVLQInt32(currtreetype.array.Count - 1);
             for (int i = 1; i < currtreetype.array.Count; i++) //Start from 1 since the 0th elementh is the type
             {
                 currtreetype.array[i].Write(file);
             }
         }
     }
     file.WriteVLQInt32(Grasses.Count());
     if (Grasses.Any())
     {
         foreach (var t in Grasses.array)
         {
             var currtreetype = (CArray)t;
             ((CHandle)currtreetype.array[0]).Write(file);      //The type of the Grass
             file.WriteVLQInt32(currtreetype.array.Count - 1);
             for (int i = 1; i < currtreetype.array.Count; i++) //Start from 1 since the 0th elementh is the type
             {
                 currtreetype.array[i].Write(file);
             }
         }
     }
 }
Пример #2
0
        public override void Write(BinaryWriter file)
        {
            throw new NotImplementedException();//TODO
            base.Write(file);
            var count = new CDynamicInt(cr2w);

            count.val = Trees.Count();
            foreach (var current in Trees.array)
            {
                /*
                 * treetype.Read(file, 4);
                 * currenttreebundle.Name = treetype.Handle;
                 * currentTrees.AddVariable(treetype);
                 * treecount.Read(file, 1);
                 * for (int i = 0; i < treecount.val; i++)
                 * {
                 *  CTree tree = new CTree(cr2w);
                 *  tree.Read(file, 29);
                 *  currentTrees.AddVariable(tree);
                 * }
                 * currenttreebundle.AddVariable(currentTrees);
                 * Trees.AddVariable(currenttreebundle);*/
            }
            file.Write(0x80); //END
        }