public override void Remove()
{
// Deletes the current IsoFile's directory and the identity folder if possible.
// (e.g. @"C:\Users\jerem\AppData\Local\IsolatedStorage\10v31ho4.bo2\eeolfu22.f2w\Url.qgeirsoc3cznuklvq5xlalurh1m0unxl\AssemFiles\")
// This matches .NET Framework logic. We want to try and clean as well as possible without being more aggressive with the identity folders.
// (e.g. Url.qgeirsoc3cznuklvq5xlalurh1m0unxl, etc.) We don't want to inadvertently yank folders for a different scope under the same
// identity (at least no more so than NetFX).
try
{
Directory.Delete(RootDirectory, recursive: true);
}
catch
{
throw new IsolatedStorageException(SR.IsolatedStorage_DeleteDirectories);
}
Close();
string?parentDirectory = Path.GetDirectoryName(RootDirectory.TrimEnd(Path.DirectorySeparatorChar));
Debug.Assert(parentDirectory != null);
if (ContainsUnknownFiles(parentDirectory))
{
return;
}
try
{
Directory.Delete(parentDirectory, recursive: true);
}
catch
{
return;
}
// Domain paths are doubly nested
// @"C:\Users\jerem\AppData\Local\IsolatedStorage\10v31ho4.bo2\eeolfu22.f2w\Url.qgeirsoc3cznuklvq5xlalurh1m0unxl\Url.qgeirsoc3cznuklvq5xlalurh1m0unxl\Files\"
if (Helper.IsDomain(Scope))
{
parentDirectory = Path.GetDirectoryName(parentDirectory);
Debug.Assert(parentDirectory != null);
if (ContainsUnknownFiles(parentDirectory))
{
return;
}
try
{
Directory.Delete(parentDirectory, recursive: true);
}
catch
{
return;
}
}
}