示例#1
0
        // 异步上传接口
        public static void BeginUploadFile(byte[] fileBuffer, string fileName, string fileExtName, long fileSize, Action<FSUploadResultEntity, Exception> fileUploadCallback)
        {
            if (!bInit)
            {
                Exception ex1 = new Exception("FSManager.BeginUploadFile(): FSLibrary not initialized: please invoke FSManager.Initialize() first.");
                fileUploadCallback(null, ex1);
                return;
            }
            if (null == fileBuffer)
            {
                Exception ex2 = new Exception("FSManager.BeginUploadFile(): failed to upload file : file buffer is null.");
                fileUploadCallback(null, ex2);
                return;
            }

            FSUploadEntity entity = new FSUploadEntity();
            entity.FileBuffer = fileBuffer;
            entity.FileName = fileName;
            entity.FileExtName = fileExtName;
            entity.FileSize = fileSize;
            FSUploadTransaction uploadTrans = new FSUploadTransaction(entity);
            uploadTrans.BeginUpload(fileUploadCallback, 30000);
        }
示例#2
0
 public FSUploadTransaction(FSUploadEntity entity)
 {
     uploadEntity = entity;
 }