ReadInt64() публичный статический Метод

public static ReadInt64 ( System.Int64 address, int handle = -1 ) : System.Int64
address System.Int64
handle int
Результат System.Int64
Пример #1
0
        public static string ReadChatMessage(Int32 address)
        {
            byte[] chat_message = ReadBytes(address, 40);
            // system or written message?
            int messageType = BitConverter.ToInt32(chat_message, 0);
            int timeAddress = BitConverter.ToInt32(chat_message, 4);
            // get the timestamp of the message
            long     utctimestamp = MemoryReader.ReadInt64(timeAddress + 8);
            DateTime time;

            if (!UnixTimeStampToDateTime(utctimestamp, out time))
            {
                return(null);
            }
            string timestamp = String.Format("{0:00}:{1:00} ", time.Hour, time.Minute);

            if (messageType == 0)
            {
                // system message, no speaker
                string qstring = ReadQString(BitConverter.ToInt32(chat_message, 8));
                if (qstring != null && qstring.Length > 5)
                {
                    return(timestamp + qstring);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                // npc or player message
                string message = ReadQString(BitConverter.ToInt32(chat_message, 8));
                string speaker = ReadQString(BitConverter.ToInt32(chat_message, 16));
                if (message == null || speaker == null)
                {
                    return(null);
                }
                if (messageType == 1)
                {
                    // npc, no level
                    return(timestamp + String.Format("{0}: {1}", speaker, message));
                }
                else if (messageType == 2)
                {
                    // player, add level information
                    short level = BitConverter.ToInt16(chat_message, 20);
                    return(timestamp + String.Format("{0} [{1}]: {2}", speaker, level, message));
                }
            }
            return(null);
        }
Пример #2
0
        public long GetValue()
        {
            switch (bytes)
            {
            case 1:
                return(MemoryReader.ReadInt8(GetAddress()));

            case 2:
                return(MemoryReader.ReadInt16(GetAddress()));

            case 4:
                return(MemoryReader.ReadInt32(GetAddress()));

            case 8:
                return(MemoryReader.ReadInt64(GetAddress()));
            }
            return(-1);
        }