Example #1
0
        public static bool IsValid_(Hexalyzer.IAccessor <byte> data, long offset)
        {
            if (offset + 4 > data.Count)
            {
                return(false);
            }

            long len = T.SystemType.FromData <int>(data, offset);
            long ofs = offset + 4;

            if (len < 0)
            {
                len = -len;
                if (ofs + (len * 2) <= data.Count)
                {
                    return(H.Analyzers.IsWideString(data, ofs, len));
                }
            }
            else if (len >= 0)
            {
                if (ofs + len <= data.Count)
                {
                    if (len == 0)
                    {
                        return(true);
                    }
                    return(H.Analyzers.IsAsciiString(data, ofs, len));
                }
            }

            return(false);
        }
Example #2
0
        public static bool IsValid_(Hexalyzer.IAccessor <byte> data, long offset)
        {
            if (!FString.IsValid_(data, offset))
            {
                return(false);
            }
            long len = LengthOf_(data, offset);

            return(len > 0);
        }
Example #3
0
        public static long LengthOf_(Hexalyzer.IAccessor <byte> data, long offset)
        {
            long len = FString.LengthOf_(data, offset);

            if (len > 0)
            {
                len += 4;                // uint:Hash
            }
            if (offset + len > data.Count)
            {
                len = -1;
            }
            return(len);
        }
Example #4
0
        public static IDatatype FromData_(Hexalyzer.IAccessor <byte> data, long offset)
        {
            if (offset + (4 * 4) > data.Count)
            {
                return(null);
            }

            uint[] value = new uint[4];
            value[0] = T.SystemType.FromData <uint>(data, offset + 0);
            value[1] = T.SystemType.FromData <uint>(data, offset + 4);
            value[2] = T.SystemType.FromData <uint>(data, offset + 8);
            value[3] = T.SystemType.FromData <uint>(data, offset + 12);

            return(new FGuid(value));
        }
Example #5
0
        public static IDatatype FromData_(Hexalyzer.IAccessor <byte> data, long offset)
        {
            FString str = FString.FromData_(data, offset) as FString;

            if (str == null)
            {
                return(null);
            }

            offset += FString.LengthOf_(data, offset);
            if (offset + 4 > data.Count)
            {
                return(null);
            }

            uint hash = T.SystemType.FromData <uint>(data, offset);

            return(new FStringWithHash(str, hash));
        }
Example #6
0
        public static IDatatype FromData_(Hexalyzer.IAccessor <byte> data, long offset)
        {
            if (offset + 4 > data.Count)
            {
                return(null);
            }

            int  len = T.SystemType.FromData <int>(data, offset);
            long ofs = offset + 4;

            if (len < 0)
            {
                len = -len;
                T.WideString wstr = T.WideString.FromData_(data, ofs, len);
                if (wstr != null)
                {
                    return(new FString(wstr));
                }
            }
            else if (len >= 0)
            {
                T.AsciiString astr;
                if (len == 0)
                {
                    astr = new T.AsciiString("");
                }
                else
                {
                    astr = T.AsciiString.FromData_(data, ofs, len);
                }
                if (astr != null)
                {
                    return(new FString(astr));
                }
            }

            return(null);
        }
Example #7
0
        public static long LengthOf_(Hexalyzer.IAccessor <byte> data, long offset)
        {
            long len = T.SystemType.FromData <int>(data, offset);

            //if (len == 0)
            //	return -1;

            if (len < 0)
            {
                len = (-len * 2) + 4;
            }
            else
            {
                len += 4;
            }

            if (offset + len > data.Count)
            {
                len = -1;
            }

            return(len);
        }
Example #8
0
 public override bool IsValid(Hexalyzer.IAccessor <byte> data, long offset)
 {
     return(IsValid_(data, offset));
 }
Example #9
0
 public override IDatatype FromData(Hexalyzer.IAccessor <byte> data, long offset)
 {
     return(FromData_(data, offset));
 }
Example #10
0
 public static long LengthOf_(Hexalyzer.IAccessor <byte> data, long offset)
 {
     return(4 * 4);
 }
Example #11
0
 public override long LengthOf(Hexalyzer.IAccessor <byte> data, long offset)
 {
     return(LengthOf_(data, offset));
 }
Example #12
0
 public static bool IsValid_(Hexalyzer.IAccessor <byte> data, long offset)
 {
     return(offset + (4 * 4) <= data.Count);
 }