Esempio n. 1
0
File: Photo.cs Progetto: mitim/sps
 public static Photo Create(SkypeCargo data, Enlister own)
 {
     Photo p = new Photo(data.GetData(), data.FileName, own);
     p.CreateTime = data.CreateTime;
     p.UpdateTime = data.UpdateTime;
     p.AccessTime = data.AccessTime;
     p.CanSave = true;
     return p;
 }
Esempio n. 2
0
 private Task AsyncSend(Photo p)
 {
     log.Debug("Start send. :" + p.FileName);
     return Task.Run(() =>
     {
         SkypeCargo s = new SkypeCargo(p);
         WaitForInterval(State.SENDING);
         WritePacket(SEND);
         if (!OK.Equals(GetReply()))
         {
             ThrowAndIntervalize(new FileSendException(p.Path, Target));
         }
         var j = s.ConvertToJson();
         var len = j.Length;
         WritePacket(String.Format("{0}{1:D20}", SIZE, len));
         log.Debug("Send size:" + len + " times:" + len / PACKET_SIZE);
         if (!OK.Equals(GetReply()))
         {
             ThrowAndIntervalize(new FileSendException(p.Path, Target));
         }
         SendAllData(j, len);
         WritePacket(END);
         ConnectionState = State.INTERVAL;
     });
 }