ResponseBase ProcessRequest(ChunkUploadRequest request)
        {
            UploadResponse resp = new UploadResponse();

            UploadProcessor proc = null;

            if (request.Token == Guid.Empty)
            {
                proc = new UploadProcessor();
            }
            else
            {
                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 = "chunk failed.";
            }

            return(resp);
        }
		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;
		}
        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);
        }
        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);
        }
		ResponseBase ProcessRequest(ChunkUploadRequest request)
		{
			UploadResponse resp = new UploadResponse();

			UploadProcessor proc = null;
			if (request.Token == Guid.Empty)
				proc = new UploadProcessor();
			else
				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 = "chunk failed.";
			}

			return resp;
		}
		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;
		}