public static UcbFacade GetInstance() { lock (typeof(UcbFacade)) { if (instance == null) { instance = new UcbFacade(); } } return(instance); }
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()); }