public async Task<DocumentReference> Duplicate (IFileSystem fs)
{
var baseName = Name;
if (!baseName.EndsWith ("Copy", StringComparison.Ordinal)) {
baseName = baseName + " Copy";
}
var directory = Path.GetDirectoryName (File.Path);
LocalFileAccess local = null;
var contents = "";
try {
local = await File.BeginLocalAccess ();
var localPath = local.LocalPath;
contents = System.IO.File.ReadAllText (localPath);
} catch (Exception ex) {
Debug.WriteLine (ex);
}
if (local != null)
await local.End ();
var ext = Path.GetExtension (File.Path);
var dr = await New (directory, baseName, ext, fs, dctor, contents);
dr.IsNew = false;
return dr;
}