本文整理汇总了C#中ILittleEndianInput类的典型用法代码示例。如果您正苦于以下问题:C# ILittleEndianInput类的具体用法?C# ILittleEndianInput怎么用?C# ILittleEndianInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILittleEndianInput类属于命名空间,在下文中一共展示了ILittleEndianInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadTokens
/**
* Reads <c>size</c> bytes of the input stream, to Create an array of <c>Ptg</c>s.
* Extra data (beyond <c>size</c>) may be Read if and <c>ArrayPtg</c>s are present.
*/
public static Ptg[] ReadTokens(int size, ILittleEndianInput in1)
{
ArrayList temp = new ArrayList(4 + size / 2);
int pos = 0;
bool hasArrayPtgs = false;
while (pos < size)
{
Ptg ptg = Ptg.CreatePtg(in1);
if (ptg is ArrayPtg.Initial)
{
hasArrayPtgs = true;
}
pos += ptg.Size;
temp.Add(ptg);
}
if (pos != size)
{
throw new Exception("Ptg array size mismatch");
}
if (hasArrayPtgs)
{
Ptg[] result = ToPtgArray(temp);
for (int i = 0; i < result.Length; i++)
{
if (result[i] is ArrayPtg.Initial)
{
result[i] = ((ArrayPtg.Initial)result[i]).FinishReading(in1);
}
}
return result;
}
return ToPtgArray(temp);
}
示例2: CreateSubRecord
public static SubRecord CreateSubRecord(ILittleEndianInput in1, CommonObjectType cmoOt)
{
int sid = in1.ReadUShort();
int secondUShort = in1.ReadUShort(); // Often (but not always) the datasize for the sub-record
switch (sid)
{
case CommonObjectDataSubRecord.sid:
return new CommonObjectDataSubRecord(in1, secondUShort);
case EmbeddedObjectRefSubRecord.sid:
return new EmbeddedObjectRefSubRecord(in1, secondUShort);
case GroupMarkerSubRecord.sid:
return new GroupMarkerSubRecord(in1, secondUShort);
case EndSubRecord.sid:
return new EndSubRecord(in1, secondUShort);
case NoteStructureSubRecord.sid:
return new NoteStructureSubRecord(in1, secondUShort);
case LbsDataSubRecord.sid:
return new LbsDataSubRecord(in1, secondUShort, (int)cmoOt);
case FtCblsSubRecord.sid:
return new FtCblsSubRecord(in1, secondUShort);
}
return new UnknownSubRecord(in1, sid, secondUShort);
}
示例3: EndSubRecord
/**
* Constructs a End record and Sets its fields appropriately.
*
* @param in the RecordInputstream to Read the record from
*/
public EndSubRecord(ILittleEndianInput in1, int size)
{
if ((size & 0xFF) != ENCODED_SIZE)
{ // mask out random crap in upper byte
throw new RecordFormatException("Unexpected size (" + size + ")");
}
}
示例4: FtCfSubRecord
public FtCfSubRecord(ILittleEndianInput in1, int size)
{
if (size != length)
{
throw new RecordFormatException("Unexpected size (" + size + ")");
}
flags = in1.ReadShort();
}
示例5: Parse
public static object[] Parse(ILittleEndianInput in1, int nValues)
{
object[] result = new Object[nValues];
for (int i = 0; i < result.Length; i++)
{
result[i]=ReadAConstantValue(in1);
}
return result;
}
示例6: NoteStructureSubRecord
/**
* Constructs a NoteStructureSubRecord and Sets its fields appropriately.
*
*/
public NoteStructureSubRecord(ILittleEndianInput in1, int size)
{
if (size != ENCODED_SIZE) {
throw new RecordFormatException("Unexpected size (" + size + ")");
}
//just grab the raw data
byte[] buf = new byte[size];
in1.ReadFully(buf);
reserved = buf;
}
示例7: ReadBoolean
private static Object ReadBoolean(ILittleEndianInput in1)
{
byte val = (byte)in1.ReadLong(); // 7 bytes 'not used'
switch (val)
{
case FALSE_ENCODING:
return false;
case TRUE_ENCODING:
return true;
}
// Don't tolerate Unusual bool encoded values (unless it becomes evident that they occur)
throw new Exception("unexpected bool encoding (" + val + ")");
}
示例8: StringPtg
/** Create a StringPtg from a stream */
public StringPtg(ILittleEndianInput in1)
{
int field_1_length = in1.ReadUByte();
field_2_options = (byte)in1.ReadByte();
_is16bitUnicode = (field_2_options & 0x01) != 0;
if (_is16bitUnicode)
{
field_3_string = StringUtil.ReadUnicodeLE(in1, field_1_length);
}
else
{
field_3_string = StringUtil.ReadCompressedUnicode(in1, field_1_length);
}
}
示例9: Biff8DecryptingStream
public Biff8DecryptingStream(Stream in1, int InitialOffSet, Biff8EncryptionKey key)
{
_rc4 = new Biff8RC4(InitialOffSet, key);
if (in1 is ILittleEndianInput)
{
// accessing directly is an optimisation
_le = (ILittleEndianInput)in1;
}
else
{
// less optimal, but should work OK just the same. Often occurs in junit tests.
_le = new LittleEndianInputStream(in1);
}
}
示例10: ScrollableObjectSubRecord
public ScrollableObjectSubRecord(ILittleEndianInput in1, int size)
{
if (size !=this.DataSize)
{
throw new RecordFormatException(string.Format(CultureInfo.CurrentCulture, "Expected size {0} but got ({1})", this.DataSize, size));
}
in1.ReadInt();
field_1_iVal=in1.ReadShort();
field_2_iMin=in1.ReadShort();
field_3_iMax=in1.ReadShort();
field_4_dInc=in1.ReadShort();
field_5_dPage=in1.ReadShort();
field_6_fHoriz = in1.ReadShort();
field_7_dxScroll = in1.ReadShort();
field_8_options = in1.ReadShort();
}
示例11: AttrPtg
public AttrPtg(ILittleEndianInput in1)
{
field_1_options =(byte)in1.ReadByte();
field_2_data = in1.ReadShort();
if (IsOptimizedChoose)
{
int nCases = field_2_data;
int[] jumpTable = new int[nCases];
for (int i = 0; i < jumpTable.Length; i++)
{
jumpTable[i] = in1.ReadUShort();
}
_jumpTable = jumpTable;
_chooseFuncOffset = in1.ReadUShort();
}
else
{
_jumpTable = null;
_chooseFuncOffset = -1;
}
}
示例12: ReadAConstantValue
private static object ReadAConstantValue(ILittleEndianInput in1)
{
byte grbit = (byte)in1.ReadByte();
switch (grbit)
{
case TYPE_EMPTY:
in1.ReadLong(); // 8 byte 'not used' field
return EMPTY_REPRESENTATION;
case TYPE_NUMBER:
return in1.ReadDouble();
case TYPE_STRING:
return StringUtil.ReadUnicodeString(in1);
case TYPE_BOOLEAN:
return ReadBoolean(in1);
case TYPE_ERROR_CODE:
int errCode = in1.ReadUShort();
// next 6 bytes are Unused
in1.ReadUShort();
in1.ReadInt();
return ErrorConstant.ValueOf(errCode);
}
throw new Exception("Unknown grbit value (" + grbit + ")");
}
示例13: MemAreaPtg
public MemAreaPtg(ILittleEndianInput in1)
{
field_1_reserved = in1.ReadInt();
field_2_subex_len = in1.ReadShort();
}
示例14: GUID
public GUID(ILittleEndianInput in1)
:this(in1.ReadInt(), in1.ReadUShort(), in1.ReadUShort(), in1.ReadLong())
{
}
示例15: NameXPtg
public NameXPtg(ILittleEndianInput in1)
:this(in1.ReadUShort(), in1.ReadUShort(), in1.ReadUShort())
{
}