protected override async Task OnSave(Uri resourceUri, StorageContent content, CancellationToken cancellationToken)
{
SaveCount++;
TraceMethod("SAVE", resourceUri);
string name = GetName(resourceUri);
string path = Path.Trim('\\') + '\\';
string[] t = name.Split('/');
name = t[t.Length - 1];
if (t.Length > 1)
{
for (int i = 0; i < t.Length - 1; i++)
{
string folder = t[i];
if (folder != string.Empty)
{
if (!(new DirectoryInfo(path + folder)).Exists)
{
DirectoryInfo directoryInfo = new DirectoryInfo(path);
directoryInfo.CreateSubdirectory(folder);
}
path = path + folder + '\\';
}
}
}
using (FileStream stream = File.Create(path + name))
{
await content.GetContentStream().CopyToAsync(stream,4096, cancellationToken);
}
}