当前位置: 首页>>代码示例>>C#>>正文


C# AppDomainSetup.SetupDefaults方法代码示例

本文整理汇总了C#中System.AppDomainSetup.SetupDefaults方法的典型用法代码示例。如果您正苦于以下问题:C# AppDomainSetup.SetupDefaults方法的具体用法?C# AppDomainSetup.SetupDefaults怎么用?C# AppDomainSetup.SetupDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.AppDomainSetup的用法示例。


在下文中一共展示了AppDomainSetup.SetupDefaults方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupDomain

        [System.Security.SecurityCritical]  // auto-generated
        private void SetupDomain(bool allowRedirects, String path, String configFile, String[] propertyNames, String[] propertyValues)
        {
            // It is possible that we could have multiple threads initializing
            // the default domain. We will just take the winner of these two.
            // (eg. one thread doing a com call and another doing attach for IJW)
            lock (this) {
                if(_FusionStore == null) {
                    AppDomainSetup setup = new AppDomainSetup();
#if FEATURE_CORECLR
                    // always use internet permission set
                    setup.InternalSetApplicationTrust("Internet");
#endif // FEATURE_CORECLR
#if FEATURE_FUSION
                    setup.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
                    if(path != null)
                        setup.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] = path;
                    if(configFile != null)
                        setup.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] = configFile;

                    // Default fusion context starts with binding redirects turned off.
                    if (!allowRedirects)
                        setup.DisallowBindingRedirects = true;
#endif

#if !FEATURE_CORECLR
                    if (propertyNames != null) {
                        BCLDebug.Assert(propertyValues != null, "propertyValues != null");
                        BCLDebug.Assert(propertyNames.Length == propertyValues.Length, "propertyNames.Length == propertyValues.Length");

                        for (int i = 0; i < propertyNames.Length; ++i) {
                            if (String.Equals(propertyNames[i], "PARTIAL_TRUST_VISIBLE_ASSEMBLIES", StringComparison.Ordinal)) {
                                // The value of the PARTIAL_TRUST_VISIBLE_ASSEMBLIES property is a semicolon
                                // delimited list of assembly names to add to the
                                // PartialTrustVisibleAssemblies setting of the domain setup
                                if (propertyValues[i] != null) {
                                    if (propertyValues[i].Length > 0) {
                                        setup.PartialTrustVisibleAssemblies = propertyValues[i].Split(';');
                                    }
                                    else {
                                        setup.PartialTrustVisibleAssemblies = new string[0];
                                    }
                                }
                            }
                            else {
                                // In v4 we disallow anything but PARTIAL_TRUST_VISIBLE_ASSEMBLIES to come
                                // in via the default domain properties.  That restriction could be lifted
                                // in a future release, at which point this assert should be removed.
                                // 
                                // This should be kept in sync with the real externally facing filter code
                                // in CorHost2::SetPropertiesForDefaultAppDomain
                                BCLDebug.Assert(false, "Unexpected default domain property");
                            }
                        }
                    }
#endif // !FEATURE_CORECLR

#if FEATURE_APTCA
                    // Propigate the set of conditional APTCA assemblies that will be used in the default
                    // domain onto the domain itself and also into the VM
                    PartialTrustVisibleAssemblies = setup.PartialTrustVisibleAssemblies;
#endif // FEATURE_APTCA

                    SetupFusionStore(setup, null);
                }
            }
        }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:67,代码来源:AppDomain.cs

示例2: SetupFusionStore

        [System.Security.SecurityCritical]  // auto-generated
        private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo)
        {
            Contract.Requires(info != null);

#if FEATURE_FUSION
            if (oldInfo == null) {
                        
       // Create the application base and configuration file from the imagelocation
            // passed in or use the Win32 Image name.
            if(info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null ||
               info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null ) 
#else        
            if (info.ApplicationBase == null)
#endif                

            {
#if FEATURE_FUSION
                AppDomain defaultDomain = GetDefaultDomain();
                if (this == defaultDomain) {
                    // The default domain gets its defaults from the main process.
                    info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
                }
                else {
                    // Other domains get their defaults from the default domain. This way, a host process
                    // can use AppDomainManager to set up the defaults for every domain created in the process.
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null)
                        info.ConfigurationFile = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue];
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null)
                        info.ApplicationBase = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue];
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue] == null)
                        info.ApplicationName = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue];
                }
#else
                info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
#endif
                
            }

#if FEATURE_FUSION
            // If there is no relative path then check the
            // environment
            if(info.Value[(int) AppDomainSetup.LoaderInformation.PrivateBinPathValue] == null)
                info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable);

            // Add the developer path if it exists on this
            // machine.
            if(info.DeveloperPath == null)
                info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath();

            }
                        
            // Set up the fusion context
            IntPtr fusionContext = GetFusionContext();
            info.SetupFusionContext(fusionContext, oldInfo);

            // Set loader optimization policy
#else
#if FEATURE_VERSIONING
            nCreateContext();
#endif // FEATURE_VERSIONING
#endif // FEATURE_FUSION

#if FEATURE_LOADER_OPTIMIZATION
            if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization))
                UpdateLoaderOptimization(info.LoaderOptimization);
#endif                        



            // This must be the last action taken
            _FusionStore = info;
        }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:73,代码来源:AppDomain.cs

示例3: SetupFusionStore

        private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo)
        {
            Contract.Requires(info != null);

            if (info.ApplicationBase == null)
            {
                info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
            }

#if FEATURE_VERSIONING
            nCreateContext();
#endif // FEATURE_VERSIONING

#if FEATURE_LOADER_OPTIMIZATION
            if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization))
                UpdateLoaderOptimization(info.LoaderOptimization);
#endif
            // This must be the last action taken
            _FusionStore = info;
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:20,代码来源:AppDomain.cs

示例4: SetupDomain

		private void SetupDomain(bool allowRedirects, string path, string configFile, string[] propertyNames, string[] propertyValues)
		{
			bool flag = false;
			try
			{
				Monitor.Enter(this, ref flag);
				if (this._FusionStore == null)
				{
					AppDomainSetup appDomainSetup = new AppDomainSetup();
					appDomainSetup.SetupDefaults(RuntimeEnvironment.GetModuleFileName());
					if (path != null)
					{
						appDomainSetup.Value[0] = path;
					}
					if (configFile != null)
					{
						appDomainSetup.Value[1] = configFile;
					}
					if (!allowRedirects)
					{
						appDomainSetup.DisallowBindingRedirects = true;
					}
					if (propertyNames != null)
					{
						for (int i = 0; i < propertyNames.Length; i++)
						{
							if (string.Equals(propertyNames[i], "PARTIAL_TRUST_VISIBLE_ASSEMBLIES", StringComparison.Ordinal) && propertyValues[i] != null)
							{
								if (propertyValues[i].Length > 0)
								{
									appDomainSetup.PartialTrustVisibleAssemblies = propertyValues[i].Split(new char[]
									{
										';'
									});
								}
								else
								{
									appDomainSetup.PartialTrustVisibleAssemblies = new string[0];
								}
							}
						}
					}
					this.PartialTrustVisibleAssemblies = appDomainSetup.PartialTrustVisibleAssemblies;
					this.SetupFusionStore(appDomainSetup, null);
				}
			}
			finally
			{
				if (flag)
				{
					Monitor.Exit(this);
				}
			}
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:54,代码来源:AppDomain.cs

示例5: SetupFusionStore

		private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo)
		{
			if (oldInfo == null)
			{
				if (info.Value[0] == null || info.Value[1] == null)
				{
					AppDomain defaultDomain = AppDomain.GetDefaultDomain();
					if (this == defaultDomain)
					{
						info.SetupDefaults(RuntimeEnvironment.GetModuleFileName());
					}
					else
					{
						if (info.Value[1] == null)
						{
							info.ConfigurationFile = defaultDomain.FusionStore.Value[1];
						}
						if (info.Value[0] == null)
						{
							info.ApplicationBase = defaultDomain.FusionStore.Value[0];
						}
						if (info.Value[4] == null)
						{
							info.ApplicationName = defaultDomain.FusionStore.Value[4];
						}
					}
				}
				if (info.Value[5] == null)
				{
					info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable);
				}
				if (info.DeveloperPath == null)
				{
					info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath();
				}
			}
			IntPtr fusionContext = this.GetFusionContext();
			info.SetupFusionContext(fusionContext, oldInfo);
			if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization))
			{
				this.UpdateLoaderOptimization(info.LoaderOptimization);
			}
			this._FusionStore = info;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:44,代码来源:AppDomain.cs

示例6: SetupDomain

 private void SetupDomain(bool allowRedirects, string path, string configFile, string[] propertyNames, string[] propertyValues)
 {
     lock (this)
     {
         if (this._FusionStore == null)
         {
             AppDomainSetup info = new AppDomainSetup();
             info.SetupDefaults(RuntimeEnvironment.GetModuleFileName());
             if (path != null)
             {
                 info.Value[0] = path;
             }
             if (configFile != null)
             {
                 info.Value[1] = configFile;
             }
             if (!allowRedirects)
             {
                 info.DisallowBindingRedirects = true;
             }
             if (propertyNames != null)
             {
                 for (int i = 0; i < propertyNames.Length; i++)
                 {
                     if (string.Equals(propertyNames[i], "PARTIAL_TRUST_VISIBLE_ASSEMBLIES", StringComparison.Ordinal) && (propertyValues[i] != null))
                     {
                         if (propertyValues[i].Length > 0)
                         {
                             info.PartialTrustVisibleAssemblies = propertyValues[i].Split(new char[] { ';' });
                         }
                         else
                         {
                             info.PartialTrustVisibleAssemblies = new string[0];
                         }
                     }
                 }
             }
             this.PartialTrustVisibleAssemblies = info.PartialTrustVisibleAssemblies;
             this.SetupFusionStore(info, null);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:42,代码来源:AppDomain.cs


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