Beispiel #1
0
        public ChatLine[] ReadChatLog()
        {
            ChatLogStruct   cls   = Read();
            List <ChatLine> lines = new List <ChatLine>();

            for (int i = 0; i < cls.NumberOfLines; i++)
            {
                byte[] buffer;

                if (i == cls.NumberOfLines - 1)
                {
                    buffer = new byte[cls.FinalOffset - cls.NewChatLogOffsets[i]];
                }
                else
                {
                    buffer = new byte[cls.NewChatLogOffsets[i + 1] - cls.NewChatLogOffsets[i]];
                }
                MemTools.ReadProcessMemory(FFXi.Handle, (IntPtr)((int)cls.NewChatLogPtr + cls.NewChatLogOffsets[i]), buffer, buffer.Length, 0);

                string s = Encoding.GetEncoding("shift-jis").GetString(Encoding.ASCII.GetBytes(CleanLine(Encoding.ASCII.GetString(buffer))));

                string[] split = s.Split(',');

                string text = "";

                for (int x = 0; x < (split.Length - 21); x++)
                {
                    text += split[21 + x] + ",";
                }

                ChatLine cl = new ChatLine();
                cl.Text = text.TrimEnd('\0').Replace("ノ", "").Replace("", "").Replace("", "").Replace("梗", "[");


                int second = cl.Text.IndexOf(']') + 1;

                cl.Text = cl.Text.Substring(second);

                int first = cl.Text.LastIndexOf("1");
                if (first > 0)
                {
                    cl.Text = cl.Text.Remove(first, 1);
                }


                cl.Raw   = s;
                cl.Color = int.Parse(split[3], NumberStyles.HexNumber);
                cl.Count = int.Parse(split[5], NumberStyles.HexNumber);
                lines.Add(cl);
            }


            return(lines.ToArray());
        }
Beispiel #2
0
        private ChatLine[] TestRead()
        {
            ChatLogStruct   cls   = Read();
            List <ChatLine> lines = new List <ChatLine>();

            if (cls.OldChatLogPtr != IntPtr.Zero)
            {
                for (int i = 0; i < 49; i++)
                {
                    byte[] buffer;

                    buffer = new byte[cls.OldChatLogOffsets[i + 1] - cls.OldChatLogOffsets[i]];


                    MemTools.ReadProcessMemory(FFXi.Handle, (IntPtr)((int)cls.OldChatLogPtr + cls.OldChatLogOffsets[i]), buffer, buffer.Length, 0);

                    string s = Encoding.GetEncoding("shift-jis").GetString(buffer);

                    string[] split = s.Split(',');


                    ChatLine cl = new ChatLine();
                    cl.Text  = split[split.Length - 1].TrimEnd('\0');
                    cl.Color = int.Parse(split[3], NumberStyles.HexNumber);
                    lines.Add(cl);
                }
            }

            for (int i = 0; i < cls.NumberOfLines; i++)
            {
                byte[] buffer;

                if (i == cls.NumberOfLines - 1)
                {
                    buffer = new byte[cls.FinalOffset - cls.NewChatLogOffsets[i]];
                }
                else
                {
                    buffer = new byte[cls.NewChatLogOffsets[i + 1] - cls.NewChatLogOffsets[i]];
                }
                MemTools.ReadProcessMemory(FFXi.Handle, (IntPtr)((int)cls.NewChatLogPtr + cls.NewChatLogOffsets[i]), buffer, buffer.Length, 0);

                string s = Encoding.GetEncoding("shift-jis").GetString(buffer);

                string[] split = s.Split(',');

                string text = "";

                for (int x = 0; x < (split.Length - 21); x++)
                {
                    text += split[21 + x] + ",";
                }

                ChatLine cl = new ChatLine();
                cl.Text  = text.TrimEnd('\0').Replace("ノ", "").Replace("", "").Replace("", "");
                cl.Color = cl.Color = int.Parse(split[3], NumberStyles.HexNumber);
                lines.Add(cl);
            }


            return(lines.ToArray());
        }