示例#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));
         }
     }
 }
示例#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);
         }
     }
 }
示例#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.");
 }