コード例 #1
0
ファイル: Upload.cs プロジェクト: baofengcloud/csharp-sdk
        protected static AsyncUploadHandle UploadFileInternal(Profile profile, Baofeng.Cloud.ServiceType serviceType,
                                                              Baofeng.Cloud.FileType fileType, String localFilePath, String fileName, String fileKey, String callbackUrl, bool isAsync)
        {
            Int64 fileSize = new System.IO.FileInfo(localFilePath).Length;

            String token = Token.CreateUploadToken(profile.accessKey,
                                                   profile.secretKey,
                                                   serviceType,
                                                   fileType,
                                                   UploadType.Full,
                                                   fileName,
                                                   fileKey,
                                                   fileSize,
                                                   Const.TokenTimeoutSec,
                                                   callbackUrl
                                                   );

            if (isAsync)
            {
                return(UploadFileAsync(token, localFilePath));
            }
            else
            {
                UploadFile(token, localFilePath);
                return(null);
            }
        }
コード例 #2
0
        public void UploadFileAsync(Profile profile, Baofeng.Cloud.ServiceType serviceType,
                                    Baofeng.Cloud.FileType fileType, String localFilePath, String fileName, String fileKey, String callbackUrl)
        {
            Int64 fileSize = new System.IO.FileInfo(localFilePath).Length;

            String token = Token.CreateUploadToken(profile.accessKey,
                                                   profile.secretKey,
                                                   serviceType,
                                                   fileType,
                                                   UploadType.Partial,
                                                   fileName,
                                                   fileKey,
                                                   fileSize,
                                                   Const.TokenTimeoutSec,
                                                   callbackUrl
                                                   );

            UploadFileAsync(token, localFilePath, fileSize);
        }
コード例 #3
0
ファイル: Upload.cs プロジェクト: baofengcloud/csharp-sdk
 public static void UploadFile(Profile profile, Baofeng.Cloud.ServiceType serviceType,
                               Baofeng.Cloud.FileType fileType, String localFilePath, String fileName, String fileKey, String callbackUrl)
 {
     UploadFileInternal(profile, serviceType, fileType, localFilePath, fileName, fileKey, callbackUrl, false);
 }
コード例 #4
0
ファイル: Upload.cs プロジェクト: baofengcloud/csharp-sdk
 public static AsyncUploadHandle UploadFileAsync(Profile profile, Baofeng.Cloud.ServiceType serviceType,
                                                 Baofeng.Cloud.FileType fileType, String localFilePath, String fileName, String fileKey, String callbackUrl)
 {
     return(UploadFileInternal(profile, serviceType, fileType, localFilePath, fileName, fileKey, callbackUrl, true));
 }