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


C# RegistryHive.ToString方法代码示例

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


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

示例1: GetHiveKey

 /// <summary>
 /// Returns the key for a given registry hive.
 /// </summary>
 /// <param name="hive">The registry hive to return the key for.</param>
 /// <returns>
 /// The key for a given registry hive.
 /// </returns>
 protected RegistryKey GetHiveKey(RegistryHive hive)
 {
     switch (hive)
     {
         case RegistryHive.LocalMachine:
             return Registry.LocalMachine;
         case RegistryHive.Users:
             return Registry.Users;
         case RegistryHive.CurrentUser:
             return Registry.CurrentUser;
         case RegistryHive.ClassesRoot:
             return Registry.ClassesRoot;
         default:
             Log(Level.Verbose, "Registry not found for {0}.", hive.ToString());
             return null;
     }
 }
开发者ID:vardars,项目名称:ci-factory,代码行数:24,代码来源:WriteRegistryTask.cs

示例2: GetHiveName

		static string GetHiveName (RegistryHive hive)
		{
			switch (hive) {
			case RegistryHive.ClassesRoot:
				return "HKEY_CLASSES_ROOT";
			case RegistryHive.CurrentConfig:
				return "HKEY_CURRENT_CONFIG";
			case RegistryHive.CurrentUser:
				return "HKEY_CURRENT_USER";
			case RegistryHive.DynData:
				return "HKEY_DYN_DATA";
			case RegistryHive.LocalMachine:
				return "HKEY_LOCAL_MACHINE";
			case RegistryHive.PerformanceData:
				return "HKEY_PERFORMANCE_DATA";
			case RegistryHive.Users:
				return "HKEY_USERS";
			}

			throw new NotImplementedException (string.Format (
				"Registry hive '{0}' is not implemented.", hive.ToString ()));
		}
开发者ID:runefs,项目名称:Marvin,代码行数:22,代码来源:RegistryKey.cs

示例3: OpenRegKey

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Open the registry key. If the key doesn't exist it will be created.
		/// </summary>
		/// <param name="key">Registry sub key</param>
		/// <param name="hive">Registry hive</param>
		/// <returns>registry key</returns>
		/// ------------------------------------------------------------------------------------
		protected RegistryKey OpenRegKey(string key, RegistryHive hive)
		{
			Log(Level.Verbose, "Opening {0}:{1}", hive.ToString(), key);
			RegistryKey returnkey = GetHiveKey(hive).CreateSubKey(key);
			if(returnkey != null)
			{
				return returnkey;
			}
			throw new BuildException(String.Format(CultureInfo.InvariantCulture,
				"Registry Path Not Found! - key='{0}';hive='{1}';", key, hive));
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:19,代码来源:WriteRegistryTask.cs

示例4: GetRegistryKeyEffectiveRights

 /// <summary>
 /// Returns the ACL Access Mask for a user on registry key.
 /// </summary>
 /// <param name="targetInfo">The target info object. For Windows Authentication, the credentials must be null or empty.</param>
 /// <param name="hive">The hive of registry key.</param>
 /// <param name="registryKey">The path of registry key without hive value.</param>
 /// <param name="userSID">The unique user security identifier.</param>
 /// <returns>Access Mask as unassigned integer.</returns>
 public virtual uint GetRegistryKeyEffectiveRights(
     TargetInfo targetInfo, RegistryHive hive, string registryKey, string userSID)
 {
     IntPtr token = LogOn(targetInfo);
     var person = WindowsIdentity.Impersonate(token);
     
     var result = this.GetUserDaclForRegistryKeyOnTarget(
         targetInfo, hive.ToString(), registryKey, userSID);
     
     person.Undo();
     return result;
 }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:20,代码来源:AccessControlListProvider.cs

示例5: LookupRegKey

 /// <summary>
 /// Returns the hive for a given key.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="registries"></param>
 /// <returns>
 /// The hive for a given key.
 /// </returns>
 protected RegistryKey LookupRegKey(string key, RegistryHive[] registries) {
     foreach (RegistryHive hive in registries) {
         Log(Level.Verbose, "Opening {0}:{1}.", hive.ToString(), key);
         RegistryKey returnkey = GetHiveKey(hive).OpenSubKey(key, false);
         if (returnkey != null) {
             return returnkey;
         }
     }
     throw new BuildException(string.Format(CultureInfo.InvariantCulture, 
         "Registry Path Not Found! - key='{0}';hive='{1}';", key, 
         registries.ToString()));
 }
开发者ID:smaclell,项目名称:NAnt,代码行数:20,代码来源:ReadRegistryTask.cs

示例6: GetHiveKey

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Returns the registry key that corresponds to the passed in hive
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected RegistryKey GetHiveKey(RegistryHive hive)
		{
			switch (hive)
			{
				case RegistryHive.LocalMachine:
					return Registry.LocalMachine;
				case RegistryHive.Users:
					return Registry.Users;
				case RegistryHive.CurrentUser:
					return Registry.CurrentUser;
				case RegistryHive.ClassesRoot:
					return Registry.ClassesRoot;
				default:
					Log.LogWarning("WriteRegistry: registry not found for hive='{0}'.", hive.ToString());
					return null;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:22,代码来源:WriteRegistry.cs

示例7: OpenRegKey

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Open the registry key. If the key doesn't exist it will be created.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected RegistryKey OpenRegKey(string key, RegistryHive hive)
		{
			Log.LogMessage(MessageImportance.Low, "Opening {0}:{1}", hive.ToString(), key);
			return GetHiveKey(hive).CreateSubKey(key);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:10,代码来源:WriteRegistry.cs


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