Exemplo n.º 1
0
 public static byte[] ReadBytes(string filePath, int offset, int length)
 {
     using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
     {
         Sanity.Requires(fs.Length >= offset + length, "File length error.");
         fs.Seek(offset, SeekOrigin.Begin);
         using (BinaryReader br = new BinaryReader(fs))
         {
             return(br.ReadBytes(length));
         }
     }
 }
Exemplo n.º 2
0
 public static void WriteBytes(string filePath, byte[] bytes, int offset)
 {
     using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Write))
     {
         Sanity.Requires(fs.Length > offset + bytes.Length, "File length error.");
         fs.Seek(offset, SeekOrigin.Begin);
         using (BinaryWriter br = new BinaryWriter(fs))
         {
             br.Write(bytes);
         }
     }
 }
Exemplo n.º 3
0
 private void ParseSchema()
 {
     Sanity.Requires(Schema.ColumnCount == Schema.ColumnNames.Length, "Schema name count mismatches.");
     Sanity.Requires(Schema.ColumnCount == Schema.ColumnTypes.Length, "Schema type count mismatches.");
 }