FSO.Files.Formats.IFF.IffChunk.Write C# (CSharp) Méthode

Write() public méthode

Attempts to write this chunk to a stream (presumably an IFF or PIFF)
public Write ( IffFile iff, Stream stream ) : bool
iff IffFile
stream Stream
Résultat bool
        public virtual bool Write(IffFile iff, Stream stream)
        {
            return false;
        }

Usage Example

Exemple #1
0
        public void WriteChunk(IoWriter io,IffChunk c)
        {
            var typeString = CHUNK_TYPES.FirstOrDefault(x => x.Value == c.GetType()).Key;

            io.WriteCString((typeString == null) ? c.ChunkType : typeString,4);

            byte[] data;
            using (var cstr = new MemoryStream())
            {
                if (c.Write(this,cstr))
                {
                    data = cstr.ToArray();
                }
                else
                {
                    data = c.OriginalData;
                }
            }

            //todo: exporting PIFF as IFF SHOULD NOT DO THIS
            c.OriginalData = data; //if we revert, it is to the last save.
            c.RuntimeInfo  = ChunkRuntimeState.Normal;

            io.WriteUInt32((uint)data.Length + 76);
            io.WriteUInt16(c.ChunkID);
            io.WriteUInt16(c.ChunkFlags);
            io.WriteCString(c.ChunkLabel,64);
            io.WriteBytes(data);
        }
All Usage Examples Of FSO.Files.Formats.IFF.IffChunk::Write