Exemplo n.º 1
0
 internal IXTypeSymbol FindType(string name)
 {
     if (Project != null)
     {
         var usings = Usings.ToList();
         return(Project.FindType(name, usings));
     }
     return(null);
 }
Exemplo n.º 2
0
        protected override void BeginProcessing()
        {
            base.BeginProcessing();

            Options = new XsdCodeGeneratorOptions
            {
                UseNullableTypes = UseNullable.ToBool() || All.ToBool(),
                HideUnderlyingNullableProperties = UseNullable.ToBool() || All.ToBool(),
                OutputNamespace      = Namespace,
                MixedContent         = MixedContent.ToBool(),
                ExcludeImportedTypes = ExcludeImports.ToBool() || All.ToBool(),
                ExcludeImportedTypesByNameAndNamespace = ExcludeImportsByName.ToBool(),
                Imports                 = Imports?.Select(GetPath).ToList() ?? new System.Collections.Generic.List <string>(),
                UsingNamespaces         = Usings?.ToList() ?? new System.Collections.Generic.List <string>(),
                Language                = Language,
                WriteFileHeader         = WriteHeader.ToBool(),
                PreserveOrder           = PreserveOrder.ToBool(),
                EnableDataBinding       = EnableDataBinding.ToBool(),
                UseLists                = UseLists.ToBool() || All.ToBool(),
                UseXLinq                = UseXlinq.ToBool(),
                AttributesToRemove      = new System.Collections.Generic.HashSet <string>(RemoveAttributes ?? Enumerable.Empty <string>()),
                EnumValueCapitalizer    = EnumCapitalizer ?? new NoneCapitalizer(),
                TypeNameCapitalizer     = TypeCapitalizer ?? new NoneCapitalizer(),
                PropertyNameCapitalizer = PropertyCapitalizer ?? new NoneCapitalizer(),
                ExcludeXmlTypes         = new System.Collections.Generic.HashSet <string>(ExcludeXmlTypes ?? Enumerable.Empty <string>()),
                AdditionalRootTypes     = new System.Collections.Generic.HashSet <string>(AdditionalRootTypes ?? Enumerable.Empty <string>()),
                AllTypesAreRoot         = AllTypesAreRoot.ToBool()
            };

            if (PclTarget)
            {
                Options.AttributesToRemove.Add("System.SerializableAttribute");
                Options.AttributesToRemove.Add("System.ComponentModel.DesignerCategoryAttribute");
            }

            if (StripDebugAttributes || All)
            {
                Options.AttributesToRemove.Add("System.Diagnostics.DebuggerStepThroughAttribute");
            }

            if (All)
            {
                if (Options.EnumValueCapitalizer is NoneCapitalizer)
                {
                    Options.EnumValueCapitalizer = new FirstCharacterCapitalizer();
                }
                if (Options.TypeNameCapitalizer is NoneCapitalizer)
                {
                    Options.TypeNameCapitalizer = new FirstCharacterCapitalizer();
                }
                if (Options.PropertyNameCapitalizer is NoneCapitalizer)
                {
                    Options.PropertyNameCapitalizer = new FirstCharacterCapitalizer();
                }
            }
        }