예제 #1
0
파일: UcbFacade.cs 프로젝트: GLgele/CK-RPG
 public static UcbFacade GetInstance()
 {
     lock (typeof(UcbFacade))
     {
         if (instance == null)
         {
             instance = new UcbFacade();
         }
     }
     return(instance);
 }
예제 #2
0
        private void init(string projectId)
        {
            ucbFacade = new UcbFacade();
            // ucbFacade.setHost("http://localhost");
            ucbFacade.setHost("https://api.ccb.unity.cn");
            ucbFacade.setPort("443");

            CosInfo cosInfo = ucbFacade.GetCredential(projectId);

            sourceBucket = cosInfo.bucket;
            deltaBucket  = cosInfo.deltaBucket;
            cosConfig    = new CosXmlConfig.Builder()
                           .SetConnectionTimeoutMs(60000) //ms
                           .SetReadWriteTimeoutMs(40000)  //ms
                           .IsHttps(true)
                           .SetAppid(cosInfo.appId)
                           .SetRegion(cosInfo.region)
                           .SetDebugLog(true)
                           .Build();
            cosProvider = new UcbSessionQCloudCredentialProvider(cosInfo.secretId, cosInfo.secretKey,
                                                                 cosInfo.expireTime, cosInfo.token, projectId, ucbFacade);
            cosXml          = new CosXmlServer(cosConfig, cosProvider);
            transferManager = new TransferManager(cosXml, new TransferConfig());
        }