public HistoryAnswerPackage(byte[] bytes)
        {
            List <byte[]> listParsed = PackageCreator.Parse(bytes);

            this.IdReceiver = PackageCreator.Encoding.GetString(listParsed[0]);
            this.IdAuthor   = PackageCreator.Encoding.GetString(listParsed[1]);

            // TODO Создание конструкторов для HistoryAnswerPackage

            this.RawData = bytes;
        }
示例#2
0
        public VoicePackage(byte[] bytes)
        {
            List <byte[]> listParsed = PackageCreator.Parse(bytes);

            this.IdReceiver = PackageCreator.Encoding.GetString(listParsed[0]);
            this.IdAuthor   = PackageCreator.Encoding.GetString(listParsed[1]);
            this.Time       = PackageCreator.ParseTime(listParsed[2]);
            this.Content    = listParsed[3];

            this.RawData = bytes;
        }
        public HistoryAnswerPackage(byte[] bytes)
        {
            List <byte[]> listParsed = PackageCreator.Parse(bytes);

            this.IdReceiver = PackageCreator.Encoding.GetString(listParsed[0]);
            this.IdAuthor   = PackageCreator.Encoding.GetString(listParsed[1]);
            this.Messages   = PackageCreator.Encoding.GetString(listParsed[2])
                              .Split(separatorMessages)
                              .Select(str =>
            {
                string[] parsed = str.Split(separatorTypeContent);
                return(new Tuple <MessageType, string>((MessageType)int.Parse(parsed[0]), parsed[1]));
            }).ToList();

            this.RawData = bytes;
        }