GetRootDirectory() static private méthode

The full root directory is the relevant special folder from Environment.GetFolderPath() plus "IsolatedStorage" and a set of random directory names if not roaming. Examples: User: @"C:\Users\jerem\AppData\Local\IsolatedStorage\10v31ho4.bo2\eeolfu22.f2w\" User|Roaming: @"C:\Users\jerem\AppData\Roaming\IsolatedStorage\" Machine: @"C:\ProgramData\IsolatedStorage\nin03cyc.wr0\o3j0urs3.0sn\" Identity for the current store gets tacked on after this.
static private GetRootDirectory ( IsolatedStorageScope scope ) : string
scope IsolatedStorageScope
Résultat string
        // https://github.com/dotnet/corefx/issues/10935
        // Evidence isn't currently available
        // public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, Evidence domainEvidence, Type domainEvidenceType, Evidence assemblyEvidence, Type assemblyEvidenceType) { return default(IsolatedStorageFile); }

        private void Initialize(IsolatedStorageScope scope)
        {
            // InitStore will set up the IdentityHash
            InitStore(scope, null, null);

            StringBuilder sb = new StringBuilder(Helper.GetRootDirectory(scope));

            sb.Append(SeparatorExternal);
            sb.Append(IdentityHash);
            sb.Append(SeparatorExternal);

            if (Helper.IsApplication(scope))
            {
                sb.Append(s_appFiles);
            }
            else if (Helper.IsDomain(scope))
            {
                sb.Append(s_files);
            }
            else
            {
                sb.Append(s_assemFiles);
            }
            sb.Append(SeparatorExternal);

            _rootDirectory = sb.ToString();
            Helper.CreateDirectory(_rootDirectory, scope);
        }
Exemple #2
0
        // Data file notes
        // ===============

        // "identity.dat" is the serialized identity object, such as StrongName or Url. It is used to
        // enumerate stores, which we currently do not support.
        //
        // private const string IDFile = "identity.dat";

        // "info.dat" is used to track disk space usage (against quota). The accounting file for Silverlight
        // stores is "appInfo.dat". .NET Core is always in full trust so we can safely ignore these.
        //
        // private const string InfoFile = "info.dat";
        // private const string AppInfoFile = "appInfo.dat";

        internal IsolatedStorageFile(IsolatedStorageScope scope)
        {
            // Evidence isn't currently available: https://github.com/dotnet/runtime/issues/18208
            // public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, Evidence domainEvidence, Type domainEvidenceType, Evidence assemblyEvidence, Type assemblyEvidenceType) { return default(IsolatedStorageFile); }

            // InitStore will set up the IdentityHash
            InitStore(scope, null, null);

            StringBuilder sb = new StringBuilder(Helper.GetRootDirectory(scope));

            sb.Append(SeparatorExternal);
            sb.Append(IdentityHash);
            sb.Append(SeparatorExternal);

            if (Helper.IsApplication(scope))
            {
                sb.Append(s_appFiles);
            }
            else if (Helper.IsDomain(scope))
            {
                sb.Append(s_files);
            }
            else
            {
                sb.Append(s_assemFiles);
            }
            sb.Append(SeparatorExternal);

            _rootDirectory = sb.ToString();
            Helper.CreateDirectory(_rootDirectory, scope);
        }
Exemple #3
0
        public static void Remove(IsolatedStorageScope scope)
        {
            // The static Remove() deletes ALL IsoStores for the given scope
            VerifyGlobalScope(scope);

            string root = Helper.GetRootDirectory(scope);

            try
            {
                Directory.Delete(root, recursive: true);
                Directory.CreateDirectory(root);
            }
            catch
            {
                throw new IsolatedStorageException(SR.IsolatedStorage_DeleteDirectories);
            }
        }
        // https://github.com/dotnet/corefx/issues/10935
        // Evidence isn't currently available
        // public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, Evidence domainEvidence, Type domainEvidenceType, Evidence assemblyEvidence, Type assemblyEvidenceType) { return default(IsolatedStorageFile); }

        private void Initialize(IsolatedStorageScope scope)
        {
            InitStore(scope, null, null);
            _rootDirectoryForScope = Helper.GetRootDirectory(scope);
            _rootDirectory         = Path.Combine(_rootDirectoryForScope, IdentityHash);
        }