コード例 #1
0
        private bool LoadFile(byte[] Bytes)
        {
            originalFile = Bytes;

            Header       = new LuxPainEvtHeader();
            Header.Magic = BitConverter.ToUInt32(Bytes, 0x00);
            if (Header.Magic != 0x31304353)
            {
                return(false);
            }
            Header.Unknown1            = BitConverter.ToUInt32(Bytes, 0x04);
            Header.Unknown2            = BitConverter.ToUInt32(Bytes, 0x08);
            Header.Unknown3            = BitConverter.ToUInt32(Bytes, 0x0C);
            Header.TextOffsetsLocation = BitConverter.ToUInt32(Bytes, 0x10);
            Header.TextLocation        = BitConverter.ToUInt32(Bytes, 0x14);

            UInt32 PredictedTextAmount = (Header.TextLocation - Header.TextOffsetsLocation) / 2;

            TextEntries = new List <LuxPainEvtText>((int)PredictedTextAmount);

            for (UInt32 loc = Header.TextOffsetsLocation; loc < Header.TextLocation; loc += 2)
            {
                LuxPainEvtText txt = new LuxPainEvtText();
                txt.OffsetLocation = loc;
                txt.Offset         = BitConverter.ToUInt16(Bytes, (int)loc);

                txt.Text = LuxPainUtil.GetTextLuxPain((int)(Header.TextLocation + (txt.Offset * 2)), Bytes);

                TextEntries.Add(txt);
            }

            //foreach (LuxPainEvtText t in TextEntries)
            //{
            //    Console.WriteLine(t.Text);
            //}

            return(true);
        }
コード例 #2
0
        internal byte[] CreateTextBlock(int Size)
        {
            UInt32 TextLocationRelative = Header.TextLocation - Header.TextOffsetsLocation;

            Byte[] bytes = new Byte[Size];

            TextEntries.Sort();

            UInt16 CurrentTextOffset = 0;

            foreach (LuxPainEvtText t in TextEntries)
            {
                byte[] CurrentTextOffsetBytes = BitConverter.GetBytes((UInt16)(CurrentTextOffset));
                CurrentTextOffsetBytes.CopyTo(bytes, t.OffsetLocation - Header.TextOffsetsLocation);

                byte[] text = LuxPainUtil.BackConvertLuxPainText(t.Text);
                text.CopyTo(bytes, TextLocationRelative);

                TextLocationRelative += (uint)text.Length;
                CurrentTextOffset    += (ushort)(text.Length / 2);
            }

            return(bytes.Take((int)TextLocationRelative).ToArray());
        }
コード例 #3
0
 internal void FormatForEditing()
 {
     Text = LuxPainUtil.FormatForEditing(Text);
     return;
 }