本文整理汇总了C#中FileReader.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# FileReader.ReadBytes方法的具体用法?C# FileReader.ReadBytes怎么用?C# FileReader.ReadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileReader
的用法示例。
在下文中一共展示了FileReader.ReadBytes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogoFile
public LogoFile(Stream stream)
{
reader = new FileReader(stream);
reader.ReadBytes(4);//skip Signature
reader.ReadBytes(4);//skip Version
guid = reader.ReadGB2312(32);
uid = (int)(reader.ReadUInt32());
int len = (int)(reader.ReadUInt32());
if (len > 0)
{
title = reader.ReadGB2312(len);
}
len = (int)(reader.ReadUInt32());
if (len > 0)
{
remark = reader.ReadGB2312(len);
}
date = reader.ReadGB2312(8);
rect = new RectangleF();
rect.X = reader.ReadSingle();
rect.Y = reader.ReadSingle();
rect.Width = reader.ReadSingle();
rect.Height = reader.ReadSingle();
len = (int)(reader.ReadUInt32());//SymbolBytes
if (len > 0)
{
reader.BaseStream.Seek(len, SeekOrigin.Current);//skip Symbols
}
len = (int)(reader.ReadUInt32());//TextBytes
if (len > 0)
{
reader.BaseStream.Seek(len, SeekOrigin.Current);//skip Texts
}
len = (int)(reader.ReadUInt32());//ThumbnailBytes
if (len > 0)
{
byte[] thumbnailBytes = new byte[len];
reader.ReadBytes(len).CopyTo(thumbnailBytes, 0);
thumbnail = new Thumbnail(thumbnailBytes,ThumbnailType.LogoThumbnail);
thumbnail.Save(HttpContext.Current.Server.MapPath("/flexLib/Thumbnails/Logos/" + guid + ".png"));
}
}
示例2: CardFace
public CardFace(byte[] bytes,FaceType type)
{
faceBytes = bytes;
faceType = type;
Stream stream = new MemoryStream(faceBytes);
FileReader reader = new FileReader(stream);
reader.ReadBytes(4);//skip Tag 'FACE'
bgColor = reader.ReadUInt32();
hasLogo = reader.ReadBoolean();
byte[] dataBytes;
byte[] readBytes;
int len;
if (hasLogo)
{
reader.ReadBytes(16);//skip LogoRect
logoDepth = reader.ReadUInt32();//LogoDepth
len = (int)(reader.ReadUInt32());//LogoMatrixBytes
if (len > 0)
{
logoMatrix = new Matrix(reader.ReadBytes(24));
}
len = (int)(reader.ReadUInt32());//LogoColorTransBytes
if (len > 0)
{
logoColorTrans = new ColorTransform(reader.ReadBytes(32));
}
}
len = (int)(reader.ReadUInt32());//SymbolBytes
if (len > 0)
{
symbols = new SymbolCollection(reader.ReadBytes(len));
}
len = (int)(reader.ReadUInt32());//TextBytes
if (len > 0)
{
texts = new TextCollection(reader.ReadBytes(len));
}
len = (int)(reader.ReadUInt32());//ThumbnailBytes
if (len > 0)
{
dataBytes=new byte[len];
readBytes = reader.ReadBytes(len);
readBytes.CopyTo(dataBytes,0);
thumbnail = new Thumbnail(dataBytes,ThumbnailType.CardThumbnail);
}
stream.Close();
reader.Close();
}
示例3: CardTempFile
public CardTempFile(Stream stream)
{
reader = new FileReader(stream);
int len = (int)(reader.ReadUInt32());
if (len > 0)
{
style = reader.ReadGB2312(len);
}
Stream cardFileStream = new MemoryStream(reader.ReadBytes((int)(stream.Length - len - 4)));
cardFile = new CardFile(cardFileStream);
}
示例4: CardFile
public CardFile(Stream stream)
{
reader = new FileReader(stream);
reader.ReadBytes(4);
reader.ReadBytes(4);
guid = reader.ReadGB2312(32);
uid = (int)(reader.ReadUInt32());
int len = (int)(reader.ReadUInt32());
if (len > 0)
{
name = reader.ReadGB2312(len);
}
width = reader.ReadUInt32();
height = reader.ReadUInt32();
byte[] faceBytes;
byte[] readBytes;
len = (int)(reader.ReadUInt32());//FrontFaceBytes
if (len > 0)
{
faceBytes = new byte[len];
readBytes = reader.ReadBytes(len);
readBytes.CopyTo(faceBytes, 0);
frontFace = new CardFace(faceBytes,FaceType.Front);
}
len = (int)(reader.ReadUInt32());//BackFaceBytes
if (len > 0)
{
hasBack = true;
faceBytes = new byte[len];
readBytes = reader.ReadBytes(len);
readBytes.CopyTo(faceBytes, 0);
backFace = new CardFace(faceBytes, FaceType.Back);
}
}
示例5: ReadHeader
private void ReadHeader(FileReader Reader)
{
Type = (IFFChunkTypes)Enum.Parse(typeof(IFFChunkTypes), Reader.ReadString(4).Replace("#", "").Replace("\0", ""));
Size = Reader.ReadUInt32();
ID = Reader.ReadUShort();
Reader.ReadUShort(); //Flags
Reader.ReadBytes(64); //Label
m_Data = Reader.ReadBytes((int)(Size - 76));
if (!Endian.IsBigEndian)
Array.Reverse(m_Data); //Data is Little Endian, so needs to be reversed.
}