本文整理汇总了C#中ArcView.Read方法的典型用法代码示例。如果您正苦于以下问题:C# ArcView.Read方法的具体用法?C# ArcView.Read怎么用?C# ArcView.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArcView
的用法示例。
在下文中一共展示了ArcView.Read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadEncrypted
private static int ReadEncrypted(ArcView.Frame view, Camellia enc, long offset, byte[] buffer, int index, int length)
{
int offset_pad = (int)offset & 0xF;
int aligned_len = (offset_pad + length + 0xF) & ~0xF;
byte[] aligned_buf;
int block = 0;
if (aligned_len == length)
{
aligned_buf = buffer;
block = index;
}
else
{
aligned_buf = new byte[aligned_len];
}
int read = view.Read (offset - offset_pad, aligned_buf, block, (uint)aligned_len);
if (read < offset_pad)
return 0;
for (int block_count = aligned_len / 0x10; block_count > 0; --block_count)
{
enc.DecryptBlock (offset, aligned_buf, block);
block += 0x10;
offset += 0x10;
}
if (aligned_buf != buffer)
Buffer.BlockCopy (aligned_buf, offset_pad, buffer, index, length);
return Math.Min (length, read-offset_pad);
}
示例2: ReadBlock
static byte[] ReadBlock(ArcView.Frame view, INekoEncryption enc, long offset, out int length)
{
uint hash = view.ReadUInt32 (offset);
length = view.ReadInt32 (offset+4);
// parity check
// if (CalcParity (((NekoEncryption32bit)enc).Parity, (uint)length) != hash)
// throw new InvalidFormatException();
int aligned_size = (length+7) & ~7;
byte[] buffer = new byte[aligned_size];
length = view.Read (offset+8, buffer, 0, (uint)length);
if (0 != hash)
{
enc.Decrypt (hash, buffer, 0, aligned_size);
}
return buffer;
}