GetLegalItemID() public static method

public static GetLegalItemID ( int itemID ) : ushort
itemID int
return ushort
Beispiel #1
0
        public static unsafe bool IsValidStatic(int index)
        {
            index  = SecondArt.GetLegalItemID(index);
            index += 0x4000;

            if (m_Cache[index] != null)
            {
                return(true);
            }

            int    length, extra;
            Stream stream = m_FileIndex.Seek(index, out length, out extra);

            if (stream == null)
            {
                return(false);
            }

            if (Validbuffer == null)
            {
                Validbuffer = new byte[4];
            }
            stream.Seek(4, SeekOrigin.Current);
            stream.Read(Validbuffer, 0, 4);
            fixed(byte *b = Validbuffer)
            {
                short *dat = (short *)b;

                if (*dat++ <= 0 || *dat <= 0)
                {
                    return(false);
                }
                return(true);
            }
        }
Beispiel #2
0
        public static Bitmap GetStatic(int index)
        {
            index  = SecondArt.GetLegalItemID(index);
            index += 0x4000;

            if (m_Cache[index] != null)
            {
                return(m_Cache[index]);
            }

            int    length, extra;
            Stream stream = m_FileIndex.Seek(index, out length, out extra);

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

            if (Files.CacheData)
            {
                return(m_Cache[index] = LoadStatic(stream, length));
            }
            else
            {
                return(LoadStatic(stream, length));
            }
        }
Beispiel #3
0
        public static byte[] GetRawStatic(int index)
        {
            index  = SecondArt.GetLegalItemID(index);
            index += 0x4000;

            int    length, extra;
            Stream stream = m_FileIndex.Seek(index, out length, out extra);

            if (stream == null)
            {
                return(null);
            }
            byte[] buffer = new byte[length];
            stream.Read(buffer, 0, length);
            return(buffer);
        }