Example #1
0
 public T GetDataAsStructure <T>(StructureBuilder <T> s)
 {
     this.riffFile.BaseStream.Position = this.dataOffset;
     if ((long)s.Length != (long)((ulong)this.chunkSize))
     {
         throw new InvalidDataException(string.Format("Chunk size is: {0} so can't read structure of: {1}", this.chunkSize, s.Length));
     }
     return(s.Read(this.riffFile));
 }
Example #2
0
        public T[] GetDataAsStructureArray <T>(StructureBuilder <T> s)
        {
            this.riffFile.BaseStream.Position = this.dataOffset;
            if ((ulong)this.chunkSize % (ulong)((long)s.Length) != 0uL)
            {
                throw new InvalidDataException(string.Format("Chunk size is: {0} not a multiple of structure size: {1}", this.chunkSize, s.Length));
            }
            int num = (int)((ulong)this.chunkSize / (ulong)((long)s.Length));

            T[] array = new T[num];
            for (int i = 0; i < num; i++)
            {
                array[i] = s.Read(this.riffFile);
            }
            return(array);
        }