/// <summary>
        /// Объединение настроек
        /// </summary>        
        public static PathVariable Merge(PathVariable vars1, PathVariable vars2)
        {
            if (vars1 == null) return vars2;
            if (vars2 == null) return vars1;

            vars1.Supports.AddRange(vars2.Supports);
            vars1.ToolPalettePaths.AddRange(vars2.ToolPalettePaths);
            return vars1;
        }
示例#2
0
        /// <summary>
        /// Объединение настроек
        /// </summary>
        public static PathVariable Merge(PathVariable vars1, PathVariable vars2)
        {
            if (vars1 == null)
            {
                return(vars2);
            }
            if (vars2 == null)
            {
                return(vars1);
            }

            vars1.Supports.AddRange(vars2.Supports);
            vars1.ToolPalettePaths.AddRange(vars2.ToolPalettePaths);
            return(vars1);
        }
        /// <summary>
        /// Объединение настроек групп в одну общую
        /// </summary>
        /// <param name="sgfs">Группы настроек разных разделов</param>
        public static SettingsGroupFile Merge(List <SettingsGroupFile> sgfs)
        {
            if (sgfs == null || sgfs.Count == 0)
            {
                return(null);
            }
            if (sgfs.Count == 1)
            {
                return(sgfs[0]);
            }

            var f = sgfs[0];

            foreach (var item in sgfs.Skip(1))
            {
                if (item.FlexBricsSetup)
                {
                    f.FlexBricsSetup  = true;
                    f.FlexBricsFolder = item.FlexBricsFolder;
                }
                f.PathVariables = PathVariable.Merge(f.PathVariables, item.PathVariables);

                if (f.SystemVariables == null)
                {
                    f.SystemVariables = item.SystemVariables;
                }
                else
                {
                    if (item.SystemVariables != null && item.SystemVariables.Any())
                    {
                        f.SystemVariables.AddRange(item.SystemVariables);
                    }
                }
            }
            return(f);
        }