Exemple #1
0
        public static new DownloadInfoParam Decode(Stream stream)
        {
            string sourceIp     = PacketBase.ReadString(stream);
            int    sourcePort   = PacketBase.ReadInt(stream);
            string downloadPath = PacketBase.ReadString(stream);
            var    param        = VideoBaseInfomParam.Decode(stream);

            return(new DownloadInfoParam(sourceIp, sourcePort, param, downloadPath));
        }
Exemple #2
0
 public static byte[] Encode(IDownloadInfo param)
 {
     using (MemoryStream ms = new MemoryStream())
     {
         PacketBase.WriteBytes(ms, param.SourceIp);
         PacketBase.WriteBytes(ms, param.SourcePort);
         PacketBase.WriteBytes(ms, param.DownloadPath);
         PacketBase.WriteBytes(ms, VideoBaseInfomParam.Encode(param as IVideoBaseInfom));
         return(ms.ToArray());
     }
 }
Exemple #3
0
 public DownloadInfoParam(string ip, int port, VideoBaseInfomParam baseInfo, string downPath)
     : this(ip, port, baseInfo.BeginTime, baseInfo.EndTime, baseInfo.VideoId, baseInfo.StreamId, downPath, baseInfo.VideoName)
 {
 }