Пример #1
0
        private void WriteTextItem(BinaryData data, TextArrayItem item)
        {
            data.Position = item.ItemInfo.RomAddress;
            for (int i = 0, loopTo = Math.Min(item.Data.Length, item.ItemInfo.MaxLength) - 1; i <= loopTo; i++)
            {
                byte b = item.Data[i];
                data.WriteByte(b);
            }

            if (item.TextGroupInfo.Encoding == System.Text.Encoding.ASCII)
            {
                for (int i = (int)data.Position, loopTo1 = item.ItemInfo.RomAddress + item.ItemInfo.MaxLength; i <= loopTo1; i++)
                {
                    data.WriteByte(20);
                }
            }
        }
Пример #2
0
        private TextArrayItem GetTextItem(BinaryData data, TextArrayItemInfo info)
        {
            byte tempByte   = 0;
            var  byteBuffer = new List <byte>();
            bool ende       = false;

            data.Position = info.RomAddress;
            while (!ende)
            {
                tempByte = data.ReadByte();
                byteBuffer.Add(tempByte);
                if (byteBuffer.Count >= info.MaxLength || TextGroupInfo.Encoding == M64TextEncoding.M64Text && tempByte == 0xFF)
                {
                    ende = true;
                }
            }

            var newItem = new TextArrayItem(byteBuffer.ToArray(), TextGroupInfo, info);

            byteBuffer.Clear();
            return(newItem);
        }