示例#1
0
        public AzureSynchronizer(RemoteInfo ri, string container, SynchronizeDirection syncDirection)
        {
            disposed = false;
            string _containerName = container;

            //
            // Setup Store and Provider
            //
            CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentialsAccountAndKey(ri.accountName, ri.accountKey), true);
            AzureBlobStore      blobStore      = new AzureBlobStore(_containerName, storageAccount);

            Console.WriteLine("Successfully created/attached to container {0}.", _containerName);
            AzureBlobSyncProvider azureProvider = new AzureBlobSyncProvider(_containerName, blobStore);

            azureProvider.ApplyingChange += new EventHandler <ApplyingBlobEventArgs>(UploadingFile);

            orchestrator = new SyncOrchestrator();
            orchestrator.RemoteProvider = azureProvider;

            if (syncDirection == SynchronizeDirection.Upload)
            {
                orchestrator.Direction = SyncDirectionOrder.Upload;
            }
            else if (syncDirection == SynchronizeDirection.Download)
            {
                orchestrator.Direction = SyncDirectionOrder.Download;
            }
        }
示例#2
0
        public AzureSynchronizer(RemoteInfo ri, string container, SynchronizeDirection syncDirection)
        {
            disposed = false;
            string _containerName = container;

            //
            // Setup Store and Provider
            //
            CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentialsAccountAndKey(ri.accountName, ri.accountKey), true);
            AzureBlobStore blobStore = new AzureBlobStore(_containerName, storageAccount);
            Console.WriteLine("Successfully created/attached to container {0}.", _containerName);
            AzureBlobSyncProvider azureProvider = new AzureBlobSyncProvider(_containerName, blobStore);
            azureProvider.ApplyingChange += new EventHandler<ApplyingBlobEventArgs>(UploadingFile);

            orchestrator = new SyncOrchestrator();
            orchestrator.RemoteProvider = azureProvider;

            if (syncDirection == SynchronizeDirection.Upload)
                orchestrator.Direction = SyncDirectionOrder.Upload;
            else if (syncDirection == SynchronizeDirection.Download)
                orchestrator.Direction = SyncDirectionOrder.Download;
        }