예제 #1
0
        public string[] Import()
        {
            EscapeMap = new Dictionary <uint, bool>();
            StructReader Reader = new StructReader(new MemoryStream(Script), false, Encoding.Unicode);
            uint         Count  = Reader.ReadUInt32() * 2;

            string[] Strings = new string[Count];
            for (uint i = 0; i < Count; i++)
            {
                TMDEntry Entry = new TMDEntry();
                Reader.ReadStruct(ref Entry);
                EscapeMap[i] = Entry.String.EndsWith("\0");
                if (EscapeMap[i])
                {
                    Entry.String = Entry.String.Substring(0, Entry.String.Length);
                }
                Strings[i] = Entry.String;
            }
            Reader.Close();
            return(Strings);
        }
예제 #2
0
        public byte[] Export(string[] Strs)
        {
            MemoryStream Out    = new MemoryStream();
            StructWriter Writer = new StructWriter(Out, false, Encoding.Unicode);

            Writer.Write((uint)Strs.LongLength / 2);
            for (uint i = 0; i < Strs.Length; i++)
            {
                string Str = Strs[i];
                if (EscapeMap[i])
                {
                    Str += '\0';
                }
                TMDEntry Entry = new TMDEntry()
                {
                    String = Str
                };
                Writer.WriteStruct(ref Entry);
            }
            Out.Position = 0;
            byte[] Output = Out.ToArray();
            Writer.Close();
            return(Output);
        }