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; }
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; }