• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IsolatedStorageScope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IsolatedStorageScope的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageScope类的具体用法?C# IsolatedStorageScope怎么用?C# IsolatedStorageScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IsolatedStorageScope类属于命名空间,在下文中一共展示了IsolatedStorageScope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetDataDirectory

        internal static string GetDataDirectory(IsolatedStorageScope scope)
        {
            // This is the relevant special folder for the given scope plus "IsolatedStorage".
            // It is meant to replicate the behavior of the VM ComIsolatedStorage::GetRootDir().

            string dataDirectory = null;

            if (IsMachine(scope))
            {
                dataDirectory = ApplicationData.Current.SharedLocalFolder.Path;
            }
            else
            {
                if (!IsRoaming(scope))
                {
                    dataDirectory = ApplicationData.Current.LocalFolder.Path;
                }
                else
                {
                    dataDirectory = ApplicationData.Current.RoamingFolder.Path;
                }
            }

            dataDirectory = Path.Combine(dataDirectory, IsolatedStorageDirectoryName);

            return dataDirectory;
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:27,代码来源:Helper.WinRT.cs


示例2: DomainIdentityIsSet

 public void DomainIdentityIsSet(IsolatedStorageScope scope)
 {
     TestStorage storage = new TestStorage(scope);
     Assert.NotNull(storage.AssemblyIdentity);
     Assert.NotNull(storage.DomainIdentity);
     Assert.Throws<InvalidOperationException>(() => storage.ApplicationIdentity);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:IdentityTests.cs


示例3: GetRootDirectory

        internal static string GetRootDirectory(IsolatedStorageScope scope)
        {
            // The full root directory is the relevant special folder from Environment.GetFolderPath() plus "IsolatedStorage"
            // and a set of random directory names if not roaming. The current identity gets tacked on after this.

            if (IsRoaming(scope))
            {
                if (string.IsNullOrEmpty(s_roamingUserRootDirectory))
                {
                    s_roamingUserRootDirectory = GetDataDirectory(scope);
                }
                return s_roamingUserRootDirectory;
            }

            if (IsMachine(scope))
            {
                if (string.IsNullOrEmpty(s_machineRootDirectory))
                {
                    s_machineRootDirectory = GetDataDirectory(scope);
                }
                return s_machineRootDirectory;
            }

            if (string.IsNullOrEmpty(s_userRootDirectory))
                s_userRootDirectory = GetDataDirectory(scope);

            return s_userRootDirectory;
        }
开发者ID:shmao,项目名称:corefx,代码行数:28,代码来源:Helper.cs


示例4: GetDataDirectory

        internal static string GetDataDirectory(IsolatedStorageScope scope)
        {
            // This is the relevant special folder for the given scope plus "IsolatedStorage".
            // It is meant to replicate the behavior of the VM ComIsolatedStorage::GetRootDir().

            // (note that Silverlight used "CoreIsolatedStorage" for a directory name and did not support machine scope)

            string dataDirectory = null;

            if (IsMachine(scope))
            {
                // SpecialFolder.CommonApplicationData -> C:\ProgramData
                dataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            }
            else if (IsRoaming(scope))
            {
                // SpecialFolder.ApplicationData -> C:\Users\Joe\AppData\Roaming
                dataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            }
            else
            {
                // SpecialFolder.LocalApplicationData -> C:\Users\Joe\AppData\Local
                dataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            }

            dataDirectory = Path.Combine(dataDirectory, IsolatedStorageDirectoryName);

            return dataDirectory;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:29,代码来源:Helper.Win32.Unix.cs


示例5: GetStore

    /*
    public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, System.Security.Policy.Evidence domainEvidence, Type domainEvidenceType, System.Security.Policy.Evidence assemblyEvidence, Type assemblyEvidenceType)
    {
      Contract.Requires(domainEvidence != null);
      Contract.Requires(assemblyEvidence != null);

      return default(IsolatedStorageFile);
    }
     */
    public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, object domainIdentity, object assemblyIdentity)
    {
      Contract.Requires(domainIdentity != null);
      Contract.Requires(assemblyIdentity != null);

      return default(IsolatedStorageFile);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:16,代码来源:System.IO.IsolatedStorage.IsolatedStorageFile.cs


示例6: GetRootDirectory

        /// <summary>
        /// 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.
        /// </summary>
        internal static string GetRootDirectory(IsolatedStorageScope scope)
        {
            if (IsRoaming(scope))
            {
                if (string.IsNullOrEmpty(s_roamingUserRootDirectory))
                {
                    s_roamingUserRootDirectory = GetDataDirectory(scope);
                }
                return s_roamingUserRootDirectory;
            }

            if (IsMachine(scope))
            {
                if (string.IsNullOrEmpty(s_machineRootDirectory))
                {
                    s_machineRootDirectory = GetRandomDirectory(GetDataDirectory(scope), scope);
                }
                return s_machineRootDirectory;
            }

            if (string.IsNullOrEmpty(s_userRootDirectory))
                s_userRootDirectory = GetRandomDirectory(GetDataDirectory(scope), scope);

            return s_userRootDirectory;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:37,代码来源:Helper.cs


示例7: GetRandomDirectory

        internal static string GetRandomDirectory(string rootDirectory, IsolatedStorageScope scope)
        {
            string randomDirectory = GetExistingRandomDirectory(rootDirectory);
            if (string.IsNullOrEmpty(randomDirectory))
            {
                using (Mutex m = CreateMutexNotOwned(rootDirectory))
                {
                    if (!m.WaitOne())
                    {
                        throw new IsolatedStorageException(SR.IsolatedStorage_Init);
                    }

                    try
                    {
                        randomDirectory = GetExistingRandomDirectory(rootDirectory);
                        if (string.IsNullOrEmpty(randomDirectory))
                        {
                            // Someone else hasn't created the directory before we took the lock
                            randomDirectory = Path.Combine(rootDirectory, Path.GetRandomFileName(), Path.GetRandomFileName());
                            CreateDirectory(randomDirectory, scope);
                        }
                    }
                    finally
                    {
                        m.ReleaseMutex();
                    }
                }
            }

            return randomDirectory;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:31,代码来源:Helper.cs


示例8: IsolatedStorageSettings

 public IsolatedStorageSettings(
     bool useIsolatedStore,
     IsolatedStorageScope isolationScope
     )
 {
     UseIsolatedStore = useIsolatedStore;
     _isolationScope = isolationScope;
 }
开发者ID:alienwaredream,项目名称:toolsdotnet,代码行数:8,代码来源:IsolatedStorageSettings.cs


示例9: IsolatedStorageFileEnumerator

 internal IsolatedStorageFileEnumerator(IsolatedStorageScope scope)
 {
     this.m_Scope = scope;
     this.m_fiop = IsolatedStorageFile.GetGlobalFileIOPerm(scope);
     this.m_rootDir = IsolatedStorageFile.GetRootDir(scope);
     this.m_fileEnum = new TwoLevelFileEnumerator(this.m_rootDir);
     this.Reset();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:IsolatedStorageFileEnumerator.cs


示例10: GetRandomDirectory

 public void GetRandomDirectory(IsolatedStorageScope scope)
 {
     using (var temp = new TempDirectory())
     {
         string randomDir = Helper.GetRandomDirectory(temp.Path, scope);
         Assert.True(Directory.Exists(randomDir));
     }
 }
开发者ID:kouvel,项目名称:corefx,代码行数:8,代码来源:HelperTests.cs


示例11: IsolatedStorageFileEnumerator

		public IsolatedStorageFileEnumerator (IsolatedStorageScope scope, string root)
		{
			_scope = scope;
			// skip application-isolated storages
			if (Directory.Exists (root))
				_storages = Directory.GetDirectories (root, "d.*");
			_pos = -1;
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:8,代码来源:IsolatedStorageFileEnumerator.cs


示例12: IsolatedStorageFile

	// Constructor.
	internal IsolatedStorageFile(IsolatedStorageScope scope,
								 String baseDirectory)
			{
				InitStore(scope, null, null);
				this.baseDirectory = baseDirectory;
				this.refCount = 1;
				this.closed = false;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:IsolatedStorageFile.cs


示例13: GetEnumerator

		private void GetEnumerator (IsolatedStorageScope scope)
		{
			IEnumerator e = IsolatedStorageFile.GetEnumerator (scope);
			int n = 0;
			while (e.MoveNext ())
			{
				IsolatedStorageFile isf = (IsolatedStorageFile)e.Current;
				CheckEnumerated (++n, scope, isf);
			}
		}
开发者ID:nkuln,项目名称:mono,代码行数:10,代码来源:IsolatedStorageFileTest.cs


示例14: CreateDirectory

        internal static void CreateDirectory(string path, IsolatedStorageScope scope)
        {
            if (Directory.Exists(path))
                return;

            DirectoryInfo info = Directory.CreateDirectory(path);

            if (IsMachine(scope) && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                // Need to emulate COMIsolatedStorage::CreateDirectoryWithDacl(), which gives the following rights:
                //
                //  World / Everyone (S-1-1-0 / SECURITY_WORLD_RID) -> (FILE_GENERIC_WRITE | FILE_GENERIC_READ) & (~WRITE_DAC)
                //  Creator Owner (S-1-3-0 / SECURITY_CREATOR_OWNER_RID) -> FILE_ALL_ACCESS
                //  Local Admins (S-1-5-32 / SECURITY_BUILTIN_DOMAIN_RID & DOMAIN_ALIAS_RID_ADMINS) -> FILE_ALL_ACCESS
                // 
                // When looking at rights through the GUI it looks like this:
                //
                //  "Everyone" -> Read, Write
                //  "Administrators" -> Full control
                //  "CREATOR OWNER" -> Full control
                //
                // With rights applying to "This folder, subfolders, and files". No inheritance from the parent folder.
                //
                // Note that trying to reset the rules for CREATOR OWNER leaves the current directory with the actual creator's SID.
                // (But applies CREATOR OWNER as expected for items and subdirectories.) Setting up front when creating the directory
                // doesn't exhibit this behavior, but as we can't currently do that we'll take the rough equivalent for now.

                DirectorySecurity security = new DirectorySecurity();

                // Don't inherit the existing rules
                security.SetAccessRuleProtection(isProtected: true, preserveInheritance: false);
                security.AddAccessRule(new FileSystemAccessRule(
                    identity: new SecurityIdentifier(WellKnownSidType.WorldSid, null),
                    fileSystemRights: FileSystemRights.Read | FileSystemRights.Write,
                    inheritanceFlags: InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
                    propagationFlags: PropagationFlags.None,
                    type: AccessControlType.Allow));

                security.AddAccessRule(new FileSystemAccessRule(
                    identity: new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null),
                    fileSystemRights: FileSystemRights.FullControl,
                    inheritanceFlags: InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
                    propagationFlags: PropagationFlags.None,
                    type: AccessControlType.Allow));

                security.AddAccessRule(new FileSystemAccessRule(
                    identity: new SecurityIdentifier(WellKnownSidType.CreatorOwnerSid, null),
                    fileSystemRights: FileSystemRights.FullControl,
                    inheritanceFlags: InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
                    propagationFlags: PropagationFlags.None,
                    type: AccessControlType.Allow));

                info.SetAccessControl(security);
            }
        }
开发者ID:kouvel,项目名称:corefx,代码行数:55,代码来源:Helper.Win32.Unix.cs


示例15: InitStore_InvalidScopes

 public void InitStore_InvalidScopes(IsolatedStorageScope scope)
 {
     try
     {
         s_verifyScopeMethod.Invoke(null, new object[] { scope });
     }
     catch (TargetInvocationException e)
     {
         Assert.IsType<ArgumentException>(e.InnerException);
     }
 }
开发者ID:Corillian,项目名称:corefx,代码行数:11,代码来源:GetStoreTests.cs


示例16: CheckEnumerated

		private void CheckEnumerated (int n, IsolatedStorageScope scope, IsolatedStorageFile isf)
		{
			string prefix = n.ToString () + " - " + scope.ToString () + " - ";
			Assert.IsNotNull (isf, prefix + "IsolatedStorageFile");
			Assert.IsTrue (((scope & isf.Scope) != 0), prefix + "Scope");

			if ((isf.Scope & IsolatedStorageScope.Assembly) != 0)
				Assert.IsNotNull (isf.AssemblyIdentity, prefix + "AssemblyIdentity");
			if ((isf.Scope & IsolatedStorageScope.Domain) != 0)
				Assert.IsNotNull (isf.DomainIdentity, prefix + "DomainIdentity");
			if ((isf.Scope & IsolatedStorageScope.Application) != 0)
				Assert.IsNotNull (isf.ApplicationIdentity, prefix + "ApplicationIdentity");
		}
开发者ID:hedehua,项目名称:mono,代码行数:13,代码来源:IsolatedStorageFileTest.cs


示例17: CreateDirectory

 internal static void CreateDirectory(string path, IsolatedStorageScope scope)
 {
     if (!IsMachine(scope))
     {
         Directory.CreateDirectory(path);
     }
     else
     {
         // TODO: https://github.com/dotnet/corefx/issues/11124
         // Machine scope, we need to ACL
         throw new NotImplementedException();
     }
 }
开发者ID:Corillian,项目名称:corefx,代码行数:13,代码来源:Helper.Win32.Unix.cs


示例18: GetEnumerator

		public static IEnumerator GetEnumerator (IsolatedStorageScope scope)
		{
			Demand (scope);

			switch (scope) {
			case IsolatedStorageScope.User:
			case IsolatedStorageScope.User | IsolatedStorageScope.Roaming:
			case IsolatedStorageScope.Machine:
				break;
			default:
				string msg = Locale.GetText ("Invalid scope, only User, User|Roaming and Machine are valid");
				throw new ArgumentException (msg);
			}

			return new IsolatedStorageFileEnumerator (scope, GetIsolatedStorageRoot (scope));
		}
开发者ID:nkuln,项目名称:mono,代码行数:16,代码来源:IsolatedStorageFile.cs


示例19: IsoStorageConfigurationSource

        /// <summary>
        /// Initializes a new instance of the <see cref="IsoStorageConfigurationSource"/> class.
        /// </summary>
        /// <param name="scope">
        /// The scope for the isolated storage file.
        /// </param>
        /// <param name="fileName">
        /// Name of the file.
        /// </param>
        /// <remarks>
        /// If you specify invalid scope for your application, you will get an <see cref="IsolatedStorageException"/>.
        /// </remarks>
        public IsoStorageConfigurationSource( IsolatedStorageScope scope, string fileName )
        {
            if ( scope == IsolatedStorageScope.None )
            {
                throw new ArgumentException( Text.InvalidStorageScope );
            }

            if ( string.IsNullOrEmpty( fileName ) )
            {
                throw new ArgumentNullException( "fileName" );
            }

            Scope = scope;
            _fileName = fileName;

            Load();
        }
开发者ID:chKarner,项目名称:innovatian.configuration,代码行数:29,代码来源:IsoStorageConfigurationSource.cs


示例20: Delete

 /// <summary>
 /// ɾ��ָ������Ĵ洢������
 /// </summary>
 /// <param name="fileName">��ɾ�����ļ�</param>
 /// <param name="scope">�����洢��Χ����</param>
 public static void Delete(string fileName, IsolatedStorageScope scope)
 {
     try
     {
         using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(scope, null, null))
         {
             if (!string.IsNullOrEmpty(fileName) && isoStore.GetFileNames(fileName).Length > 0)
             {
                 isoStore.DeleteFile(fileName);
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception("�޷��ڴ洢����ɾ���ļ�.", ex);
     }
 }
开发者ID:Andy-Yin,项目名称:MY_OA_RM,代码行数:22,代码来源:IsolatedStorageHelper.cs



注:本文中的IsolatedStorageScope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Isolation类代码示例发布时间:2022-05-24
下一篇:
C# IsExpression类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap