本文整理汇总了C#中DataReader.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# DataReader.ReadUInt32方法的具体用法?C# DataReader.ReadUInt32怎么用?C# DataReader.ReadUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataReader
的用法示例。
在下文中一共展示了DataReader.ReadUInt32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadFrom
public static DirectoryEntry ReadFrom(DataReader reader)
{
long startPos = reader.Position;
long length = reader.ReadInt64();
if (length == 0)
{
return null;
}
DirectoryEntry result = new DirectoryEntry();
result.Length = length;
result.Attributes = (FileAttributes)reader.ReadUInt32();
result.SecurityId = reader.ReadUInt32();
result.SubdirOffset = reader.ReadInt64();
reader.Skip(16);
result.CreationTime = reader.ReadInt64();
result.LastAccessTime = reader.ReadInt64();
result.LastWriteTime = reader.ReadInt64();
result.Hash = reader.ReadBytes(20);
reader.Skip(4);
result.ReparseTag = reader.ReadUInt32();
result.HardLink = reader.ReadUInt32();
result.StreamCount = reader.ReadUInt16();
int shortNameLength = reader.ReadUInt16();
int fileNameLength = reader.ReadUInt16();
if (fileNameLength > 0)
{
result.FileName = Encoding.Unicode.GetString(reader.ReadBytes(fileNameLength + 2)).TrimEnd('\0');
}
else
{
result.FileName = string.Empty;
}
if (shortNameLength > 0)
{
result.ShortName = Encoding.Unicode.GetString(reader.ReadBytes(shortNameLength + 2)).TrimEnd('\0');
}
else
{
result.ShortName = null;
}
if (startPos + length > reader.Position)
{
int toRead = (int)(startPos + length - reader.Position);
reader.Skip(toRead);
}
if (result.StreamCount > 0)
{
result.AlternateStreams = new Dictionary<string, AlternateStreamEntry>();
for (int i = 0; i < result.StreamCount; ++i)
{
AlternateStreamEntry stream = AlternateStreamEntry.ReadFrom(reader);
result.AlternateStreams.Add(stream.Name, stream);
}
}
return result;
}
示例2: ReadResourceRecord
private static DNSRRBase ReadResourceRecord(byte[] data, DataReader reader)
{
DNSRRBase rr = null;
string name = ReadString(data, reader);
DNSType type = (DNSType)reader.ReadUInt16(false);
DNSClass cls = (DNSClass)reader.ReadUInt16(false);
uint ttl = reader.ReadUInt32(false);
ushort rlen = reader.ReadUInt16(false);
byte[] rdata = reader.ReadBytes(rlen);
switch (type)
{
case DNSType.CNAME:
{
CNameDNSRR newRec = new CNameDNSRR(data, rdata);
rr = newRec;
}
break;
case DNSType.A:
{
ADNSRR aRec = new ADNSRR(rdata);
rr = aRec;
}
break;
case DNSType.AAAA:
{
AAAADNSRR aRec = new AAAADNSRR(rdata);
rr = aRec;
}
break;
case DNSType.PTR:
{
PTRDNSRR aRec = new PTRDNSRR(data, rdata);
rr = aRec;
}
break;
default:
{
UnknownDNSRR newRec = new UnknownDNSRR();
newRec.RData = rdata;
rr = newRec;
}
break;
}
rr.Name = name;
rr.Class = cls;
rr.Type = type;
rr.TimeToLive = ttl;
return rr;
}