Пример #1
0
        public new static StorageFlagParam Decode(Stream stream)
        {
            IVideoInfo vi        = VideoInfo.Decode(stream);
            bool       isStartUp = PacketBase.ReadBool(stream);

            return(new StorageFlagParam(vi, isStartUp));
        }
Пример #2
0
        public static DownloadExpandPart Decode(MemoryStream ms)
        {
            Guid         guid = PacketBase.ReadGuid(ms);
            DownloadCode code = (DownloadCode)PacketBase.ReadInt(ms);
            Object       obj  = null;

            switch (code)
            {
            case DownloadCode.DownloadInfo:
                obj = DownloadInfoParam.Decode(ms);
                break;

            case DownloadCode.Name:
            case DownloadCode.Quality:
            case DownloadCode.ErrorInfo:
                obj = PacketBase.ReadString(ms);
                break;

            case DownloadCode.Size:
            case DownloadCode.Speed:
                obj = PacketBase.ReadLong(ms);
                break;

            case DownloadCode.IsLocalDownload:
                obj = PacketBase.ReadBool(ms);
                break;

            case DownloadCode.TimePeriodsAll:
            case DownloadCode.TimePeriodsCompleted:
                obj = TimePeriodPacket.DecodeArray(ms);
                break;

            case DownloadCode.Status:
                obj = (DownloadStatus)PacketBase.ReadInt(ms);
                break;

            case DownloadCode.UpdatedLastestTime:
                obj = PacketBase.ReadTime(ms);
                break;

            case DownloadCode.GoTop:
                obj = null;
                break;
            }
            return(new DownloadExpandPart(guid, code, obj));
        }
        public static DownloadInfoExpandPacket Decode(MemoryStream ms)
        {
            Guid          guid            = PacketBase.ReadGuid(ms);
            IDownloadInfo di              = DownloadInfoParam.Decode(ms);
            string        name            = PacketBase.ReadString(ms);
            string        quality         = PacketBase.ReadString(ms);
            long          size            = PacketBase.ReadLong(ms);
            bool          isLocalDownload = PacketBase.ReadBool(ms);

            TimePeriodPacket[] tps       = TimePeriodPacket.DecodeArray(ms);
            TimePeriodPacket[] tpsc      = TimePeriodPacket.DecodeArray(ms);
            DownloadStatus     status    = (DownloadStatus)PacketBase.ReadInt(ms);
            string             errorInfo = PacketBase.ReadString(ms);
            DateTime           time      = PacketBase.ReadTime(ms);
            long speed = PacketBase.ReadLong(ms);

            return(new DownloadInfoExpandPacket(guid, di, name, quality, size, isLocalDownload, tps, tpsc, status, errorInfo, time, speed));
        }