Exemplo n.º 1
0
        public DeviceConfiguration OverrideWith(DeviceConfiguration configuration)
        {
            var mergedConfig = new DeviceConfiguration(
                configuration.RootFileSystemVersionId ?? RootFileSystemVersionId,
                configuration.AgentVersionId ?? AgentVersionId,
                configuration.ApplicationVersionId ?? ApplicationVersionId,
                configuration.ConfigurationVersion ?? ConfigurationVersion);

            var mergedVariables = configuration.Variables.ToList();

            foreach (var variable in Variables)
            {
                if (!mergedVariables.Any(v => v.Name == variable.Name))
                {
                    mergedVariables.Add(variable);
                }
            }

            mergedConfig.SetVariables(mergedVariables.ToArray());
            return(mergedConfig);
        }