TryParseData() 공개 정적인 메소드

public static TryParseData ( string text, HexDataKind dataKind, bool isBigEndian ) : byte[]
text string
dataKind HexDataKind
isBigEndian bool
리턴 byte[]
예제 #1
0
        public override bool IsSearchDataValid(HexDataKind dataKind, string searchString, bool matchCase, bool isBigEndian)
        {
            if (searchString == string.Empty)
            {
                return(false);
            }

            switch (dataKind)
            {
            case HexDataKind.Bytes:
                return(hexSearchServiceProvider.IsValidByteSearchString(searchString));

            case HexDataKind.Utf8String:
            case HexDataKind.Utf16String:
                return(true);

            case HexDataKind.Byte:
            case HexDataKind.SByte:
            case HexDataKind.Int16:
            case HexDataKind.UInt16:
            case HexDataKind.Int32:
            case HexDataKind.UInt32:
            case HexDataKind.Int64:
            case HexDataKind.UInt64:
            case HexDataKind.Single:
            case HexDataKind.Double:
                return(DataParser.TryParseData(searchString, dataKind, isBigEndian) != null);

            default:
                throw new InvalidOperationException();
            }
        }
예제 #2
0
        public override HexSearchService TryCreateHexSearchService(HexDataKind dataKind, string searchString, bool matchCase, bool isBigEndian)
        {
            if (searchString == string.Empty)
            {
                return(null);
            }

            byte[] data;
            switch (dataKind)
            {
            case HexDataKind.Bytes:
                if (!hexSearchServiceProvider.IsValidByteSearchString(searchString))
                {
                    return(null);
                }
                return(hexSearchServiceProvider.CreateByteSearchService(searchString));

            case HexDataKind.Utf8String:
                return(hexSearchServiceProvider.CreateUtf8StringSearchService(searchString, matchCase));

            case HexDataKind.Utf16String:
                return(hexSearchServiceProvider.CreateUtf16StringSearchService(searchString, matchCase, isBigEndian));

            case HexDataKind.Byte:
            case HexDataKind.SByte:
            case HexDataKind.Int16:
            case HexDataKind.UInt16:
            case HexDataKind.Int32:
            case HexDataKind.UInt32:
            case HexDataKind.Int64:
            case HexDataKind.UInt64:
            case HexDataKind.Single:
            case HexDataKind.Double:
                data = DataParser.TryParseData(searchString, dataKind, isBigEndian);
                if (data == null)
                {
                    return(null);
                }
                return(hexSearchServiceProvider.CreateByteSearchService(data));

            default:
                throw new InvalidOperationException();
            }
        }