SharpTune.RomMod.Blob.TryGetUInt16 C# (CSharp) 메소드

TryGetUInt16() 공개 메소드

Try to get a unsigned short from the blob at the given offset. If successful, incrmenet offset
public TryGetUInt16 ( UInt16 &result, int &offset ) : bool
result System.UInt16
offset int
리턴 bool
        public bool TryGetUInt16(ref UInt16 result, ref int offset)
        {
            if (this.Content.Count < offset + 2)
            {
                return false;
            }

            result = 0;
            byte temp = 0;
            if (!this.TryGetByte(ref temp, ref offset))
            {
                return false;
            }

            result |= temp;
            if (!this.TryGetByte(ref temp, ref offset))
            {
                return false;
            }

            result <<= 8;
            result |= temp;

            return true;
        }

Usage Example

예제 #1
0
파일: Lut.cs 프로젝트: segapsh2/SharpTune
 /// <summary>
 /// TODO: do 2d tables have grad/offs??
 /// </summary>
 /// <param name="blob"></param>
 /// <param name="address"></param>
 public Lut2D(string name,Blob blob, uint address)
 {
     Name = name;
     int addr = (int)(address - (uint)blob.StartAddress);
     blob.TryGetUInt16(ref cols, ref addr);
     addr += 2;
     blob.TryGetUInt32(ref colsAddress, ref addr);
     blob.TryGetUInt32(ref dataAddress, ref addr);
 }
All Usage Examples Of SharpTune.RomMod.Blob::TryGetUInt16