Example #1
0
            protected override void WriteNodes(FileWriter writer, IEnumerator enumerator)
            {
                // first write all TEXR header + data
                var texrOffsets   = new List <Offset[]>();
                var texrPositions = new List <int>();
                var last          = !enumerator.MoveNext();

                while (!last)
                {
                    int pos = (int)writer.Position;
                    texrPositions.Add(pos);
                    IEFTBNode node    = (IEFTBNode)enumerator.Current;
                    Offset[]  offsets = node.WriteNode(writer);
                    texrOffsets.Add(offsets);
                    last = !enumerator.MoveNext();
                    offsets[Header.OffsetType.Sibling].Satisfy(last ? (int)Header.NULL_OFFSET : (int)writer.Position - pos);
                }

                // then write all their GX2B children
                enumerator.Reset();
                last = !enumerator.MoveNext();
                int i = 0;

                while (!last)
                {
                    int pos = (int)writer.Position;
                    texrOffsets[i][Header.OffsetType.Children].Satisfy(pos - texrPositions[i]);
                    IEFTBNode node    = (IEFTBNode)enumerator.Current;
                    Offset[]  offsets = ((TEXR)node).WriteGX2B(writer);
                    last = !enumerator.MoveNext();
                    offsets[Header.OffsetType.Sibling].Satisfy(last ? (int)Header.NULL_OFFSET : (int)writer.Position - pos);
                    ++i;
                }
            }
Example #2
0
            protected virtual void WriteNodes(FileWriter writer, IEnumerator enumerator)
            {
                var last = !enumerator.MoveNext();

                while (!last)
                {
                    int       pos     = (int)writer.Position;
                    IEFTBNode node    = (IEFTBNode)enumerator.Current;
                    Offset[]  offsets = node.WriteNode(writer);
                    last = !enumerator.MoveNext();
                    offsets[Header.OffsetType.Sibling].Satisfy(last ? (int)Header.NULL_OFFSET : (int)writer.Position - pos);
                }
            }