Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofCwalina committed Feb 14, 2018
1 parent 40249f4 commit 7a2bef3
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions samples/AzCopyCore/AzCopyCore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.CommandLine;
using System.Diagnostics;
using System.IO;
using System.IO.Pipelines;
using System.Threading.Tasks;

static class Program
Expand Down Expand Up @@ -66,15 +67,13 @@ static void TransferDirectoryToStorage(ReadOnlyMemory<char> localDirectory, Read
return;
}

ReadOnlyMemory<char> key = options.Get("/DestKey:");
byte[] keyBytes = key.Span.ComputeKeyBytes();

ReadOnlyMemory<char> storageFullPath = storageDirectory.Slice(7);
ReadOnlyMemory<char> storageFullPath = storageDirectory.Slice("http://".Length);
int pathStart = storageFullPath.Span.IndexOf('/');
ReadOnlyMemory<char> host = storageFullPath.Slice(0, pathStart);
ReadOnlyMemory<char> path = storageFullPath.Slice(pathStart + 1);
ReadOnlyMemory<char> account = storageFullPath.Slice(0, storageFullPath.Span.IndexOf('.'));

byte[] keyBytes = options["/DestKey:"].ComputeKeyBytes();
using (var client = new StorageClient(keyBytes, account, host))
{
client.Log = Log;
Expand All @@ -101,10 +100,7 @@ static void TransferStorageFileToDirectory(ReadOnlyMemory<char> storageFile, Rea
return;
}

ReadOnlyMemory<char> key = options.Get("/SourceKey:");
byte[] keyBytes = key.Span.ComputeKeyBytes();

ReadOnlyMemory<char> storageFullPath = storageFile.Slice(7);
ReadOnlyMemory<char> storageFullPath = storageFile.Slice("http://".Length);
int pathStart = storageFullPath.Span.IndexOf('/');
ReadOnlyMemory<char> host = storageFullPath.Slice(0, pathStart);
ReadOnlyMemory<char> storagePath = storageFullPath.Slice(pathStart + 1);
Expand All @@ -117,6 +113,7 @@ static void TransferStorageFileToDirectory(ReadOnlyMemory<char> storageFile, Rea
Directory.CreateDirectory(directory);
}

byte[] keyBytes = options["/SourceKey:"].ComputeKeyBytes();
string destinationPath = directory + "\\" + new string(file.Span);
using (var client = new StorageClient(keyBytes, account, host))
{
Expand Down

0 comments on commit 7a2bef3

Please sign in to comment.