Achilles.Acme.Storage.Azure.AzureCloudStorageProvider.CopyFile C# (CSharp) Méthode

CopyFile() public méthode

Copy source blob to destination blob.
public CopyFile ( string sourcePath, string destPath ) : void
sourcePath string path to source file
destPath string path to destination file
Résultat void
        public override void CopyFile( string sourcePath, string destPath )
        {
            string sPath = sourcePath.ToAzurePath();
            string dPath = destPath.ToAzurePath();

            CloudBlockBlob sourceBlob = _container.GetBlockBlobReference( sourcePath.ToAzurePath() );
            CloudBlockBlob destBlob = _container.GetBlockBlobReference( destPath.ToAzurePath() );

            try
            {
                sourceBlob.FetchAttributes();
            }
            catch ( StorageException )
            {
            }

            try
            {
                destBlob.FetchAttributes();
            }
            catch ( StorageException )
            {
            }

            // Copy source blob to destination blob
            try
            {
                destBlob.StartCopyFromBlob( sourceBlob );
            }
            catch ( StorageException e )
            {
                Console.WriteLine( "Error code: " + e.Message );
            }
        }