ClrPlus.Scripting.MsBuild.Packaging.NugetPackage.GenerateSettingsXaml C# (CSharp) 메소드

GenerateSettingsXaml() 개인적인 메소드

private GenerateSettingsXaml ( ) : dynamic
리턴 dynamic
        private dynamic GenerateSettingsXaml()
        {
            if (!IsDefault) {
                return null;
            }
            dynamic xaml = null;

            foreach (var pivot in Pivots.Values.Where(pivot => !pivot.IsBuiltIn && pivot.UsedChoices.Any() )) {

                xaml = xaml ?? InitXaml();

                var defaultchoice = pivot.Choices.Keys.FirstOrDefault();

                // add the key
                var enumProperty = xaml.Rule.Add("EnumProperty");
                enumProperty.Attributes.Name = "{0}-{1}".format(pivot.Name, _pkgName);
                enumProperty.Attributes.DisplayName = pivot.Name;
                enumProperty.Attributes.Description = pivot.Description;
                enumProperty.Attributes.Category = _pkgName;

                // add the choices
                var used = pivot.Choices.Keys.First().SingleItemAsEnumerable().Union(pivot.UsedChoices).ToArray();

                foreach (var v in used) {
                    var enumValue = enumProperty.Add("EnumValue");
                    enumValue.Attributes.Name = (v == defaultchoice) ? "" : v; // store "" as the value for defaultchoice.
                    enumValue.Attributes.DisplayName = pivot.Descriptions[v];
                }
            }

            return xaml;
        }