-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#74642 Refactored and changed root only for mobile
- Loading branch information
Showing
11 changed files
with
151 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.AnyMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public sealed partial class IsolatedStorageFile : IsolatedStorage, IDisposable | ||
{ | ||
private string GetIsolatesStorageRoot() | ||
{ | ||
return Helper.GetRootDirectory(Scope); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
.../System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.NonMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Text; | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public sealed partial class IsolatedStorageFile : IsolatedStorage, IDisposable | ||
{ | ||
private string GetIsolatesStorageRoot() | ||
{ | ||
StringBuilder root = new StringBuilder(Helper.GetRootDirectory(Scope)); | ||
root.Append(SeparatorExternal); | ||
root.Append(IdentityHash); | ||
|
||
return root.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...braries/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/TestHelper.AnyMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Reflection; | ||
using System.Collections.Generic; | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public static partial class TestHelper | ||
{ | ||
static TestHelper() | ||
{ | ||
s_rootDirectoryProperty = typeof(IsolatedStorageFile).GetProperty("RootDirectory", BindingFlags.NonPublic | BindingFlags.Instance); | ||
|
||
s_roots = new List<string>(); | ||
|
||
string hash; | ||
object identity; | ||
Helper.GetDefaultIdentityAndHash(out identity, out hash, '.'); | ||
|
||
string userRoot = Helper.GetDataDirectory(IsolatedStorageScope.User); | ||
string randomUserRoot = Helper.GetRandomDirectory(userRoot, IsolatedStorageScope.User); | ||
s_roots.Add(randomUserRoot); | ||
|
||
// Application scope doesn't go under a random dir | ||
s_roots.Add(userRoot); | ||
|
||
// https://github.com/dotnet/runtime/issues/2092 | ||
// https://github.com/dotnet/runtime/issues/21742 | ||
if (OperatingSystem.IsWindows() | ||
&& !PlatformDetection.IsInAppContainer) | ||
{ | ||
s_roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine)); | ||
} | ||
|
||
// We don't expose Roaming yet | ||
// Helper.GetDataDirectory(IsolatedStorageScope.Roaming); | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...braries/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/TestHelper.NonMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Reflection; | ||
using System.Collections.Generic; | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public static partial class TestHelper | ||
{ | ||
static TestHelper() | ||
{ | ||
s_rootDirectoryProperty = typeof(IsolatedStorageFile).GetProperty("RootDirectory", BindingFlags.NonPublic | BindingFlags.Instance); | ||
|
||
s_roots = new List<string>(); | ||
|
||
string hash; | ||
object identity; | ||
Helper.GetDefaultIdentityAndHash(out identity, out hash, '.'); | ||
|
||
string userRoot = Helper.GetDataDirectory(IsolatedStorageScope.User); | ||
string randomUserRoot = Helper.GetRandomDirectory(userRoot, IsolatedStorageScope.User); | ||
s_roots.Add(Path.Combine(randomUserRoot, hash)); | ||
s_roots.Add(randomUserRoot); | ||
|
||
// Application scope doesn't go under a random dir | ||
s_roots.Add(Path.Combine(userRoot, hash)); | ||
s_roots.Add(userRoot); | ||
|
||
// https://github.com/dotnet/runtime/issues/2092 | ||
// https://github.com/dotnet/runtime/issues/21742 | ||
if (OperatingSystem.IsWindows() | ||
&& !PlatformDetection.IsInAppContainer) | ||
{ | ||
s_roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine)); | ||
} | ||
|
||
// We don't expose Roaming yet | ||
// Helper.GetDataDirectory(IsolatedStorageScope.Roaming); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters