/// <summary> /// Set whether or not to write headers. /// </summary> public OptionsBuilder WithWriteHeader(WriteHeader writeHeader) { if (!Enum.IsDefined(Types.WriteHeader, writeHeader)) { Throw.ArgumentException($"Unexpected {nameof(Cesil.WriteHeader)} value: {writeHeader}", nameof(writeHeader)); } return(WithWriteHeaderInternal(writeHeader)); }
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(); } } }
// sometimes we want to skip validation in tests internal OptionsBuilder WithWriteHeaderInternal(WriteHeader w) { WriteHeader = w; return(this); }