Example #1
0
		private void WriteDocumentManagementInstance(ADMFileWriter admWriter, List<OptionInfo> optionDefs, string subsectionName, string instanceName, RegistryTargetEnum localRegTarget)
		{
			// Document Management\<SubSectionName>\<InstanceName>
			string sectionName = string.Format("Document Management\\{0}\\{1}", subsectionName, instanceName);
			string keyname = Utils.GetOptionKeyName(sectionName, string.Empty, this._osPlatform, localRegTarget);

			admWriter.StartCategory(instanceName);

			foreach (OptionInfo optDef in optionDefs)
			{
				admWriter.StartPolicy(optDef.DisplayText);
				admWriter.StartKeyName(keyname);

				OptionDataTypeEnum optionDataType = (OptionDataTypeEnum) Enum.Parse(typeof(OptionDataTypeEnum), optDef.DataType);

				admWriter.AddPart(optDef.DisplayText, optionDataType, optDef.Name, string.Empty);
				admWriter.EndPolicy();
			}

			admWriter.EndCategory();
		}
Example #2
0
		private void GenerateADMEntries(ADMFileWriter admWriter, RegistryTargetEnum localRegTarget)
		{
			var categoryGroups = from opt in _options
								 orderby opt.DisplayText
								 group opt by opt.CategoryRef into optGrp
								 orderby optGrp.Key
								 select new { CategoryName = optGrp.Key, Options = optGrp };


			admWriter.StartWorkshareCategory();

			foreach (var oCat in categoryGroups)
			{
				admWriter.StartCategory(oCat.CategoryName);
				var subCategoryGroups = from opt in oCat.Options
									 orderby opt.DisplayText
									 group opt by opt.CategoryRef into optGrp
									 orderby optGrp.Key
									 select new { SubCategoryName = optGrp.Key, Options = optGrp };

				foreach (var oSubCat in subCategoryGroups)
				{
					admWriter.StartCategory(oSubCat.SubCategoryName);
					foreach (var opt in oSubCat.Options)
					{
						if ((localRegTarget == RegistryTargetEnum.HKLM && opt.ReadLocalMachine == "false") ||
							 (localRegTarget == RegistryTargetEnum.HKCU && opt.ReadCurrentUser == "false"))
						{
							continue;
						}

						admWriter.StartPolicy(opt.DisplayText);
						admWriter.StartKeyName(Utils.GetOptionKeyName(opt.CategoryRef, opt.SubCategoryRef, this._osPlatform, localRegTarget));

						OptionDataTypeEnum optionDataType = (OptionDataTypeEnum) Enum.Parse(typeof(OptionDataTypeEnum), opt.DataType);

						admWriter.AddPart(opt.DisplayText, optionDataType, opt.Name, opt.DefaultValue, opt.ValueRange);
						admWriter.EndPolicy();
					}
					admWriter.EndCategory();	//	SubCategory
				}

				if (localRegTarget == RegistryTargetEnum.HKLM)
				{
					var hklmOptions = from opt in oCat.Options
					                  where (opt.ReadLocalMachine != "false") && (opt.ReadCurrentUser == "true")
									  select opt;

					admWriter.StartCategory("IgnoredUserOverrides");
					foreach (var opt in hklmOptions)
					{
						admWriter.StartPolicy(opt.DisplayText);
						admWriter.StartKeyName(Utils.GetIgnoreHKCUValueKeyName(this._osPlatform));
						admWriter.AddPart(opt.DisplayText, OptionDataTypeEnum.Boolean, opt.Name, "false");
						admWriter.EndPolicy();
					}
					admWriter.EndCategory(); // IgnoredUserOverrides
				}
				admWriter.EndCategory();	//	Category
			}

			GenerateOptionGroupTemplates(admWriter, localRegTarget);

			admWriter.EndWorkshareCategory();
		}