public void StartUpLoad(string fileName, string saveName, ref string fileProjectId)
        {
            EndPoint endpoint = new IPEndPoint(IPAddress.Parse("139.196.188.134"), 2021);

            upLoadEngine = new UpLoadClientEngine(_FileUploadingEvents);
            upLoadEngine.Init(endpoint, fileName, saveName);
            upLoadEngine.StartUpLoad(ref fileProjectId);
        }
Ejemplo n.º 2
0
 public override void ExecuteCommand(UpLoadClientEngine session, TransferCommandInfo commandInfo)
 {
     try
     {
         session.m_StopEvent.Set();
     }
     catch (Exception ex)
     {
         log4net.LogManager.GetLogger("DoData").Error(ex.Message);
     }
 }
Ejemplo n.º 3
0
        public override void ExecuteCommand(UpLoadClientEngine session, TransferCommandInfo commandInfo)
        {
            bool result = session.OnFileExist();

            if (result)
            {
                byte[] data = SerializeHelp.Serialize <UpLoadInfo>(session.UpLoadInfo);
                session.SendData(UpLoadOP.DoCover, data, 0, data.Length);
            }
            else
            {
                session.DoEnd();
            }
        }
Ejemplo n.º 4
0
 public override void ExecuteCommand(UpLoadClientEngine session, TransferCommandInfo commandInfo)
 {
     try
     {
         UpLoadInfo ServerConfigInfo = SerializeHelp.Deserialize <UpLoadInfo>(commandInfo.Data);
         long       CurrentPos       = ServerConfigInfo.TransferPos + ServerConfigInfo.TransferedLength;
         long       TransferedLength = ServerConfigInfo.TransferedLength;
         long       TransferLength   = ServerConfigInfo.TransferLength;
         session.m_fileStream.Position = CurrentPos;
         session.UpLoadInfo            = ServerConfigInfo;
         session.OnTransferStart();
         while (TransferedLength < TransferLength)
         {
             lock (session.lockobj)
             {
                 if (session == null)
                 {
                     return;
                 }
                 if (session.StatusCode == 1)
                 {
                     session.StatusCode = 2;
                     session.m_StopEvent.Set();
                     return;
                 }
                 int length = session.m_fileStream.Read(session.readBuffer, 0, session.PacketSize);
                 session.SendData(UpLoadOP.DoData, session.readBuffer, 0, length);
                 TransferedLength += length;
                 session.UpLoadInfo.TransferedLength = TransferedLength;
                 session.OnTransferStep(TransferLength, TransferedLength, length);
             }
         }
         session.SendData(UpLoadOP.DoEnd, new byte[] { 1 }, 0, 1);
         new Action(() =>
         {
             session.m_EndEvent.WaitOne(5000);
             session.DoEnd();
         }).BeginInvoke(null, null);
     }
     catch (Exception ex)
     {
         //Log.Error(ex.ToString());
         ex.ToString();
         //error to do;
     }
 }
 internal UpLoadReader(UpLoadClientEngine upLoadEngine)
 {
     this.UpLoadEngine     = upLoadEngine;
     this.m_BufferSegments = new ArraySegmentList();
 }