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

            T[] a = new T[structuresToRead];
            for (int n = 0; n < structuresToRead; n++)
            {
                a[n] = s.Read(riffFile);
            }
            return(a);
        }