Beispiel #1
0
        public bool Open(PTP.PTP PTP)
        {
            OpenFileName = Path.GetFileNameWithoutExtension(Path.GetFullPath(PTP.OpenFileName)) + ".BMD";
            CharList CharList = PTP.NewCharList;

            name.Clear();
            msg.Clear();
            foreach (var a in PTP.names)
            {
                name.Add(new Names(a.Index, a.NewName.GetTextBaseList(CharList).GetByteArray().ToArray()));
            }

            foreach (var a in PTP.msg)
            {
                int          Index          = a.Index;
                string       Name           = a.Name;
                MSGs.MsgType Type           = a.Type == "MSG" ? MSGs.MsgType.MSG : MSGs.MsgType.SEL;
                int          CharacterIndex = a.CharacterIndex;

                List <byte> Msg = new List <byte>();
                foreach (var b in a.Strings)
                {
                    foreach (var c in b.Prefix)
                    {
                        Msg.AddRange(c.Array.ToArray());
                    }

                    Msg.AddRange(b.NewString.GetTextBaseList(CharList).GetByteArray().ToArray());

                    foreach (var c in b.Postfix)
                    {
                        Msg.AddRange(c.Array.ToArray());
                    }
                }
                byte[] MsgBytes = Msg.ToArray();

                msg.Add(new MSGs(Index, Name, Type, CharacterIndex, MsgBytes.ToArray()));
            }

            return(true);
        }
Beispiel #2
0
        public bool Open(PTP PTP, Encoding New)
        {
            Name.Clear();
            Msg.Clear();
            foreach (var a in PTP.names)
            {
                Name.Add(new Names(a.Index, a.NewName.GetTextBaseList(New).GetByteArray().ToArray()));
            }

            foreach (var a in PTP.msg)
            {
                int          Index          = a.Index;
                string       Name           = a.Name;
                MSGs.MsgType Type           = a.Type == "MSG" ? MSGs.MsgType.MSG : MSGs.MsgType.SEL;
                int          CharacterIndex = a.CharacterIndex;

                byte[] MsgBytes = a.GetNew(New);

                Msg.Add(new MSGs(Index, Name, Type, CharacterIndex, MsgBytes.ToArray()));
            }

            return(true);
        }