Add default for xmlformatter
This commit is contained in:
parent
a3e79e83b4
commit
d237c438c7
@ -102,6 +102,8 @@ namespace lib
|
|||||||
public Dictionary<string, List<string>> WLFields= new();
|
public Dictionary<string, List<string>> WLFields= new();
|
||||||
|
|
||||||
public Dictionary<Type, TypeProxy> TypeProxy = new();
|
public Dictionary<Type, TypeProxy> TypeProxy = new();
|
||||||
|
|
||||||
|
public Types TypesDefault = Types.Fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class XmlFormatter2: IFormatter
|
public class XmlFormatter2: IFormatter
|
||||||
@ -436,7 +438,7 @@ namespace lib
|
|||||||
|
|
||||||
bool filterFields, filterProps, doImpls, doFields, doProps;
|
bool filterFields, filterProps, doImpls, doFields, doProps;
|
||||||
HashSet<string> whitelistFields, whitelistProps;
|
HashSet<string> whitelistFields, whitelistProps;
|
||||||
GetFilters( mi, finalType, out filterFields, out filterProps, out doImpls, out doFields, out doProps, out whitelistFields, out whitelistProps );
|
GetFilters( m_cfg.TypesDefault, mi, finalType, out filterFields, out filterProps, out doImpls, out doFields, out doProps, out whitelistFields, out whitelistProps );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
List<MemberInfo> members = new();
|
List<MemberInfo> members = new();
|
||||||
@ -922,7 +924,7 @@ namespace lib
|
|||||||
{
|
{
|
||||||
bool filterFields, filterProps, doImpls, doFields, doProps;
|
bool filterFields, filterProps, doImpls, doFields, doProps;
|
||||||
HashSet<string> whitelistFields, whitelistProps;
|
HashSet<string> whitelistFields, whitelistProps;
|
||||||
GetFilters( mi, type, out filterFields, out filterProps, out doImpls, out doFields, out doProps, out whitelistFields, out whitelistProps );
|
GetFilters( m_cfg.TypesDefault, mi, type, out filterFields, out filterProps, out doImpls, out doFields, out doProps, out whitelistFields, out whitelistProps );
|
||||||
|
|
||||||
if( doFields || doImpls )
|
if( doFields || doImpls )
|
||||||
{
|
{
|
||||||
@ -976,7 +978,7 @@ namespace lib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GetFilters( MemberInfo mi, Type type, out bool filterFields, out bool filterProps, out bool doImpls, out bool doFields, out bool doProps, out HashSet<string> whitelistFields, out HashSet<string> whitelistProps )
|
private static void GetFilters( Types TypesDefault, MemberInfo mi, Type type, out bool filterFields, out bool filterProps, out bool doImpls, out bool doFields, out bool doProps, out HashSet<string> whitelistFields, out HashSet<string> whitelistProps )
|
||||||
{
|
{
|
||||||
var custWLFields = mi?.GetCustomAttribute<ChildFieldsAttribute>();
|
var custWLFields = mi?.GetCustomAttribute<ChildFieldsAttribute>();
|
||||||
var custWLProps = mi?.GetCustomAttribute<ChildPropsAttribute>();
|
var custWLProps = mi?.GetCustomAttribute<ChildPropsAttribute>();
|
||||||
@ -984,7 +986,7 @@ namespace lib
|
|||||||
filterFields = custWLFields != null;
|
filterFields = custWLFields != null;
|
||||||
filterProps = custWLProps != null;
|
filterProps = custWLProps != null;
|
||||||
|
|
||||||
var typesTodo = type.GetCustomAttribute<Ser>()?.Types ?? Types.None;
|
var typesTodo = type.GetCustomAttribute<Ser>()?.Types ?? TypesDefault;
|
||||||
|
|
||||||
doImpls = typesTodo.HasFlag( Types.Implied );
|
doImpls = typesTodo.HasFlag( Types.Implied );
|
||||||
doFields = filterFields || typesTodo.HasFlag( Types.Fields );
|
doFields = filterFields || typesTodo.HasFlag( Types.Fields );
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user