Beispiel #1
0
        public static void DeleteChannel(Profile profile, string channelID)
        {
            String token = Token.LiveDeleteToken(profile.accessKey,
                profile.secretKey,
                channelID,
                Const.TokenTimeoutSec);

            DeleteChannel(token);
        }
Beispiel #2
0
        public static LiveChannelInfo CreateChannel(Profile profile, FileType fileType, string channelName)
        {
            String token = Token.LiveCreateToken(profile.accessKey,
                profile.secretKey,
                fileType,
                channelName,
                Const.TokenTimeoutSec);

            return CreateChannel(token);
        }
Beispiel #3
0
        public static FileInfo QueryFile(Profile profile, Baofeng.Cloud.ServiceType serviceType,
                String fileName, String fileKey)
        {
            String token = Token.CreateQueryToken(profile.accessKey,
                profile.secretKey,
                serviceType,
                fileName,
                fileKey
                );

            return QueryFile(token);
        }
Beispiel #4
0
        public static void DeleteFile(Profile profile, Baofeng.Cloud.ServiceType serviceType,
             String fileName, String fileKey, String callbackUrl)
        {
            String token = Token.CreateDeleteToken(profile.accessKey,
             profile.secretKey,
             serviceType,
             fileName,
             fileKey,
             Const.TokenTimeoutSec,
             callbackUrl);

             DeleteFile(token);
        }
Beispiel #5
0
        public static void UpdateFile(Profile profile, Baofeng.Cloud.ServiceType serviceType,
                String fileName, String fileKey, FileType fileType)
        {
            String token = Token.CreateUpdateToken(profile.accessKey,
                profile.secretKey,
                serviceType,
                fileType,
                fileName,
                fileKey
                );

            UpdateFile(token);
        }
Beispiel #6
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);
        }
Beispiel #7
0
        public static String GetSwfPlayUrl(Profile profile, String fileName, String fileKey, Int64 timeoutSec, String url, FileType fileType, String swfUrl)
        {
            String fid = "";
            foreach (var line in url.Split('&'))
            {
                var kv = line.Split('=');
                if (kv[0] == "fid")
                    fid = kv[1];
            }

            if (fid.Length == 0)
                throw new CloudException(99, "fid not found in url!");

            string playToken = Token.CreatePlayTokenByFid(profile.accessKey, profile.secretKey, fid, timeoutSec);

            string encodeUrl = HttpUtility.UrlEncode(url);

            String playUrl = swfUrl.Length > 0 ? swfUrl : Const.SwfUrl + "?vk=" + encodeUrl;

            if(fileType == FileType.Private)
                playUrl += "&tk=" + HttpUtility.UrlEncode(playToken);

            return playUrl;
        }
Beispiel #8
0
 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);
 }
Beispiel #9
0
 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);
 }
Beispiel #10
0
        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;
            }
        }