예제 #1
0
		private static bool SaveCleanADMFile(string filePath, MainViewModel viewmodel, OSPlatformEnum osPlatform = OSPlatformEnum.x86, RegistryTargetEnum registryTarget = RegistryTargetEnum.HKCU)
		{
			// Get UIOptionRootType from View Model
			UIOptionRootType defaultXMLOptionRoot = OptionMapper.DefaultXmlToOptionModel();
			UIOptionRootType rootOptions = OptionMapper.DefaultXmlToOptionModel();
			OptionMapper.UIModelToOptionModel(rootOptions, viewmodel, true, false);

			MakeOptionRootsMutuallyExclusive(defaultXMLOptionRoot, rootOptions);

			// Save UIOptionRootType

			using (IVisitor dirtyVisitor = new ADMVisitor(filePath, osPlatform, registryTarget, false, (x) => true))
			{
				rootOptions.Accept(dirtyVisitor);
			}

			using (IVisitor visitor = new ADMVisitor(filePath, osPlatform, registryTarget, true, (x) => (x != "Internal" && x != "InstanceTemplate")))
			{
				defaultXMLOptionRoot.Accept(visitor);
			}

			return true;
		}
예제 #2
0
		private static bool SaveADMFile(string filePath, MainViewModel viewmodel, OSPlatformEnum osPlatform = OSPlatformEnum.x86, RegistryTargetEnum registryTarget = RegistryTargetEnum.HKCU)
		{
			// Get UIOptionRootType from View Model
			UIOptionRootType rootOptions = OptionMapper.DefaultXmlToOptionModel();
			OptionMapper.UIModelToOptionModel(rootOptions, viewmodel, true, true);

			// Save UIOptionRootType

			using (IVisitor dirtyVisitor = new ADMVisitor(filePath, osPlatform, registryTarget, false))
			{
				rootOptions.Accept(dirtyVisitor);
			}

			return true;
		}