本文整理汇总了C#中File.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# File.ReadBytes方法的具体用法?C# File.ReadBytes怎么用?C# File.ReadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File.ReadBytes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SoundFileSubHeader
public SoundFileSubHeader(File file)
{
if (file == null) throw new ArgumentNullException("file");
Byte[] data = file.ReadBytes(16);
if (data.Length != 16) throw new ArgumentException("File is not long enough", "file");
m_nextoffset = BitConverter.ToInt32(data, 0);
m_length = BitConverter.ToInt32(data, 4);
m_id = new SoundId(BitConverter.ToInt32(data, 8), BitConverter.ToInt32(data, 12));
}
示例2: FontFileHeader
public FontFileHeader(File file)
{
if (file == null) throw new ArgumentNullException("file");
Byte[] data = file.ReadBytes(24);
if (data.Length != 24) throw new ArgumentException("File is not long enough", "file");
m_signature = System.Text.Encoding.Default.GetString(data, 0, 11);
m_unknown = BitConverter.ToInt32(data, 12);
m_imageoffset = BitConverter.ToInt32(data, 16);
m_imagesize = BitConverter.ToInt32(data, 20);
}
示例3: SoundFileHeader
public SoundFileHeader(File file)
{
if (file == null) throw new ArgumentNullException("file");
Byte[] data = file.ReadBytes(24);
if (data.Length != 24) throw new ArgumentException("File is not long enough", "file");
m_signature = System.Text.Encoding.Default.GetString(data, 0, 11);
m_version = BitConverter.ToInt32(data, 12);
m_numberofsounds = BitConverter.ToInt32(data, 16);
m_subheaderoffset = BitConverter.ToInt32(data, 20);
}
示例4: SpriteFileSubHeader
public SpriteFileSubHeader(File file)
{
if (file == null) throw new ArgumentNullException("file");
Byte[] data = file.ReadBytes(19);
if (data.Length != 19) throw new ArgumentException("File is not long enough", "file");
m_nextoffset = BitConverter.ToInt32(data, 0);
m_imagesize = BitConverter.ToInt32(data, 4);
m_axis = new Point(BitConverter.ToInt16(data, 8), BitConverter.ToInt16(data, 10));
m_id = new SpriteId(BitConverter.ToInt16(data, 12), BitConverter.ToInt16(data, 14));
m_sharedindex = BitConverter.ToInt16(data, 16);
m_copylastpalette = data[18] > 0;
}
示例5: SpriteFileHeader
public SpriteFileHeader(File file)
{
if (file == null) throw new ArgumentNullException("file");
Byte[] data = file.ReadBytes(33);
if (data.Length != 33) throw new ArgumentException("File is not long enough", "file");
m_signature = System.Text.Encoding.Default.GetString(data, 0, 11);
m_version = new Drawing.SpriteFileVersion(data[12], data[13], data[14], data[15]);
m_numberofgroups = BitConverter.ToInt32(data, 16);
m_numberofimages = BitConverter.ToInt32(data, 20);
m_subheaderoffset = BitConverter.ToInt32(data, 24);
m_subheadersize = BitConverter.ToInt32(data, 28);
m_sharedpalette = data[32] > 0;
}
示例6: PcxFileHeader
public PcxFileHeader(File file)
{
if(file == null) throw new ArgumentNullException("file");
Byte[] data = file.ReadBytes(HeaderSize);
if (data.Length != HeaderSize) throw new ArgumentException("File is not long enough", "file");
m_manufacturer = data[0];
m_version = data[1];
m_encoding = data[2];
m_bitsperpixel = data[3];
m_xmin = BitConverter.ToInt16(data, 4);
m_ymin = BitConverter.ToInt16(data, 6);
m_xmax = BitConverter.ToInt16(data, 8);
m_ymax = BitConverter.ToInt16(data, 10);
m_horizontalDPI = BitConverter.ToInt16(data, 12);
m_verticalDPI = BitConverter.ToInt16(data, 14);
m_colorplanes = data[65];
m_bytesperline = BitConverter.ToInt16(data, 66);
m_palettetype = BitConverter.ToInt16(data, 68);
}