Ejemplo n.º 1
0
        public override byte[] Serialize()
        {
            List <byte> s = new List <byte>();

            // serialize SideName
            s.Add((byte)((SideName == null) ? 0 : 1));
            if (SideName != null)
            {
                List <byte> tmp63 = new List <byte>();
                tmp63.AddRange(BitConverter.GetBytes((uint)SideName.Count()));
                while (tmp63.Count > 0 && tmp63.Last() == 0)
                {
                    tmp63.RemoveAt(tmp63.Count - 1);
                }
                s.Add((byte)tmp63.Count);
                s.AddRange(tmp63);

                s.AddRange(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(SideName));
            }

            // serialize AgentName
            s.Add((byte)((AgentName == null) ? 0 : 1));
            if (AgentName != null)
            {
                List <byte> tmp64 = new List <byte>();
                tmp64.AddRange(BitConverter.GetBytes((uint)AgentName.Count()));
                while (tmp64.Count > 0 && tmp64.Last() == 0)
                {
                    tmp64.RemoveAt(tmp64.Count - 1);
                }
                s.Add((byte)tmp64.Count);
                s.AddRange(tmp64);

                s.AddRange(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(AgentName));
            }

            // serialize TeamNickname
            s.Add((byte)((TeamNickname == null) ? 0 : 1));
            if (TeamNickname != null)
            {
                List <byte> tmp65 = new List <byte>();
                tmp65.AddRange(BitConverter.GetBytes((uint)TeamNickname.Count()));
                while (tmp65.Count > 0 && tmp65.Last() == 0)
                {
                    tmp65.RemoveAt(tmp65.Count - 1);
                }
                s.Add((byte)tmp65.Count);
                s.AddRange(tmp65);

                s.AddRange(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(TeamNickname));
            }

            return(s.ToArray());
        }
Ejemplo n.º 2
0
        public override byte[] Serialize()
        {
            List <byte> s = new List <byte>();

            // serialize SideName
            s.Add((byte)((SideName == null) ? 0 : 1));
            if (SideName != null)
            {
                List <byte> tmp78 = new List <byte>();
                tmp78.AddRange(BitConverter.GetBytes((uint)SideName.Count()));
                while (tmp78.Count > 0 && tmp78.Last() == 0)
                {
                    tmp78.RemoveAt(tmp78.Count - 1);
                }
                s.Add((byte)tmp78.Count);
                s.AddRange(tmp78);

                s.AddRange(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(SideName));
            }

            // serialize AgentName
            s.Add((byte)((AgentName == null) ? 0 : 1));
            if (AgentName != null)
            {
                List <byte> tmp79 = new List <byte>();
                tmp79.AddRange(BitConverter.GetBytes((uint)AgentName.Count()));
                while (tmp79.Count > 0 && tmp79.Last() == 0)
                {
                    tmp79.RemoveAt(tmp79.Count - 1);
                }
                s.Add((byte)tmp79.Count);
                s.AddRange(tmp79);

                s.AddRange(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(AgentName));
            }

            return(s.ToArray());
        }