コード例 #1
0
        public UploadResponse ContinueUpload(ChunkUploadRequest request)
        {
            UploadResponse resp = new UploadResponse();

            try
            {
                UploadProcessor proc = new UploadProcessor(request.Token);
                if (proc.ProcessChunk(request.Chunk, request.Hash))
                {
                    resp.Status = Enums.ResponsStatus.Success;
                    resp.Token  = proc.Token;
                }
                else
                {
                    resp.Status  = Enums.ResponsStatus.Fail;
                    resp.Message = "failed chunk send.";
                }
            }
            catch (Exception ex)
            {
                resp.Status  = Enums.ResponsStatus.Fail;
                resp.Message = ex.Message;
            }
            return(resp);
        }
コード例 #2
0
		public UploadResponse BeginUpload(ChunkUploadRequest request)
		{
			UploadResponse resp = new UploadResponse();
			try
			{
				//you could validate credentials here. 
				//request.Credentials

				UploadProcessor proc = new UploadProcessor(); //sets up destination and initializes the file. 

				if (proc.ProcessChunk(request.Chunk, request.Hash))
				{
					resp.Token = proc.Token;
					resp.Status = Enums.ResponsStatus.Success; //continue uploading. 
				}
				else
				{
					resp.Status = Enums.ResponsStatus.Fail;
					resp.Message = "Couldn't handle chunk.";
				}
			}
			catch (Exception ex)
			{
				resp.Status = Enums.ResponsStatus.Fail;
				resp.Message = ex.Message;
			}
			return resp;
		}
コード例 #3
0
        public UploadResponse BeginUpload(ChunkUploadRequest request)
        {
            UploadResponse resp = new UploadResponse();

            try
            {
                //you could validate credentials here.
                //request.Credentials

                UploadProcessor proc = new UploadProcessor();                 //sets up destination and initializes the file.

                if (proc.ProcessChunk(request.Chunk, request.Hash))
                {
                    resp.Token  = proc.Token;
                    resp.Status = Enums.ResponsStatus.Success;                     //continue uploading.
                }
                else
                {
                    resp.Status  = Enums.ResponsStatus.Fail;
                    resp.Message = "Couldn't handle chunk.";
                }
            }
            catch (Exception ex)
            {
                resp.Status  = Enums.ResponsStatus.Fail;
                resp.Message = ex.Message;
            }
            return(resp);
        }
コード例 #4
0
		public UploadResponse ContinueUpload(ChunkUploadRequest request)
		{
			UploadResponse resp = new UploadResponse();
			try
			{
				UploadProcessor proc = new UploadProcessor(request.Token);
				if (proc.ProcessChunk(request.Chunk, request.Hash))
				{
					resp.Status = Enums.ResponsStatus.Success;
					resp.Token = proc.Token;
				}
				else
				{
					resp.Status = Enums.ResponsStatus.Fail;
					resp.Message = "failed chunk send.";
				}
			}
			catch (Exception ex)
			{
				resp.Status = Enums.ResponsStatus.Fail;
				resp.Message = ex.Message;
			}
			return resp;
		}