Better whitespace changes
This commit is contained in:
parent
28d8c145b5
commit
6b1e193c90
20
imm/FSM.cs
20
imm/FSM.cs
@ -12,7 +12,7 @@ public abstract record class FsmContextBase<TSelf> : io.Recorded<TSelf>
|
||||
where TSelf : FsmContextBase<TSelf>
|
||||
{
|
||||
// Required for 'with' expressions.
|
||||
protected FsmContextBase(io.Recorded<TSelf> original) : base(original) { }
|
||||
protected FsmContextBase( io.Recorded<TSelf> original ) : base( original ) { }
|
||||
protected FsmContextBase() { }
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ public abstract record class FsmStateBase<TSelf, TCtx> : io.Recorded<TSelf>
|
||||
/// <summary>
|
||||
/// Called when entering this state.
|
||||
/// </summary>
|
||||
public virtual (TCtx Context, TSelf State) OnEnter(TCtx context, FsmStateBase<TSelf, TCtx> oldState)
|
||||
public virtual (TCtx Context, TSelf State) OnEnter( TCtx context, FsmStateBase<TSelf, TCtx> oldState )
|
||||
{
|
||||
return (context, (TSelf)this);
|
||||
}
|
||||
@ -37,13 +37,13 @@ public abstract record class FsmStateBase<TSelf, TCtx> : io.Recorded<TSelf>
|
||||
/// <summary>
|
||||
/// Called when exiting this state.
|
||||
/// </summary>
|
||||
public virtual (TCtx Context, TSelf State) OnExit(TCtx context, FsmStateBase<TSelf, TCtx> newState)
|
||||
public virtual (TCtx Context, TSelf State) OnExit( TCtx context, FsmStateBase<TSelf, TCtx> newState )
|
||||
{
|
||||
return (context, (TSelf)this);
|
||||
}
|
||||
|
||||
// Required for 'with' expressions.
|
||||
protected FsmStateBase(io.Recorded<TSelf> original) : base(original) { }
|
||||
protected FsmStateBase( io.Recorded<TSelf> original ) : base( original ) { }
|
||||
protected FsmStateBase() { }
|
||||
}
|
||||
|
||||
@ -62,14 +62,14 @@ public abstract record class FsmBase<TSelf, TState, TCtx> : io.Recorded<TSelf>
|
||||
public TCtx Context { get; init; }
|
||||
public TState State { get; init; }
|
||||
|
||||
protected FsmBase(TCtx initialContext, TState initialState)
|
||||
protected FsmBase( TCtx initialContext, TState initialState )
|
||||
{
|
||||
Context = initialContext;
|
||||
State = initialState;
|
||||
}
|
||||
|
||||
// Required for 'with' expressions.
|
||||
protected FsmBase(io.Recorded<TSelf> original) : base(original)
|
||||
protected FsmBase( io.Recorded<TSelf> original ) : base( original )
|
||||
{
|
||||
var o = original as FsmBase<TSelf, TState, TCtx>;
|
||||
Context = o!.Context;
|
||||
@ -86,12 +86,12 @@ public abstract record class FsmBase<TSelf, TState, TCtx> : io.Recorded<TSelf>
|
||||
[CallerMemberName] string memberName = "",
|
||||
[CallerFilePath] string filePath = "",
|
||||
[CallerLineNumber] int lineNumber = 0,
|
||||
[CallerArgumentExpression("newState")] string expression = "")
|
||||
[CallerArgumentExpression( "newState" )] string expression = "" )
|
||||
{
|
||||
Console.WriteLine($"[FSM] Transition: {State.GetType().Name} -> {newState.GetType().Name}. Reason: {reason}");
|
||||
Console.WriteLine( $"[FSM] Transition: {State.GetType().Name} -> {newState.GetType().Name}. Reason: {reason}" );
|
||||
|
||||
var (ctxAfterExit, stateAfterExit) = State.OnExit(Context, newState);
|
||||
var (ctxAfterEnter, stateAfterEnter) = newState.OnEnter(ctxAfterExit, stateAfterExit);
|
||||
var (ctxAfterExit, stateAfterExit) = State.OnExit( Context, newState );
|
||||
var (ctxAfterEnter, stateAfterEnter) = newState.OnEnter( ctxAfterExit, stateAfterExit );
|
||||
|
||||
// Since 'this' is at least 'io.Recorded<TSelf>', we can call the
|
||||
// detailed 'Process'. If 'this' is actually 'Timed<TSelf>', C#'s
|
||||
|
||||
40
imm/List.cs
40
imm/List.cs
@ -19,7 +19,7 @@ public record class List<T> : Timed<List<T>>, IImmutableList<T>
|
||||
|
||||
public List() { }
|
||||
// Required for 'with' expressions to work with the base class hierarchy
|
||||
protected List(Timed<List<T>> original) : base(original) { }
|
||||
protected List( Timed<List<T>> original ) : base( original ) { }
|
||||
|
||||
// Helper to apply changes using the Process method
|
||||
private List<T> Change(
|
||||
@ -29,37 +29,37 @@ public record class List<T> : Timed<List<T>>, IImmutableList<T>
|
||||
[CallerLineNumber] int dbgLine = -1,
|
||||
[CallerArgumentExpression( "listChange" )] string reason = "" )
|
||||
{
|
||||
var newValues = listChange(Values);
|
||||
return ReferenceEquals(Values, newValues)
|
||||
var newValues = listChange( Values );
|
||||
return ReferenceEquals( Values, newValues )
|
||||
? this
|
||||
: Process(l => l with { Values = newValues }, reason, dbgMethod, dbgPath, dbgLine, reason);
|
||||
: Process( l => l with { Values = newValues }, reason, dbgMethod, dbgPath, dbgLine, reason );
|
||||
}
|
||||
|
||||
// --- IImmutableList<T> implementation using the Change helper ---
|
||||
public T this[int index] => Values[index];
|
||||
public int Count => Values.Count;
|
||||
|
||||
public List<T> Add(T value, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1) => Change(v => v.Add(value), dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> AddRange(IEnumerable<T> items, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1) => Change(v => v.AddRange(items), dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> Clear([CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1) => Change(v => v.Clear(), dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> Add( T value, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.Add( value ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> AddRange( IEnumerable<T> items, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.AddRange( items ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> Clear( [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.Clear(), dbgMethod, dbgPath, dbgLine );
|
||||
#region IImmutableList Implementati, dbgMethod, dbgPath, dbgLineon
|
||||
public List<T> Insert( int index, T element, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.Insert( index, element ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> InsertRange( int index, IEnumerable<T> items, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.InsertRange( index, items ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> Remove( T value, IEqualityComparer<T>? equalityComparer, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.Remove( value, equalityComparer ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> Remove( T value, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Remove( value, EqualityComparer<T>.Default , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> RemoveAll( Predicate<T> match, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.RemoveAll( match ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> RemoveAt( int index, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.RemoveAt( index ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> RemoveRange( int index, int count, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.RemoveRange( index, count ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> RemoveRange( IEnumerable<T> items, IEqualityComparer<T>? equalityComparer, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.RemoveRange( items, equalityComparer ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> Replace( T oldValue, T newValue, IEqualityComparer<T>? equalityComparer, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.Replace( oldValue, newValue, equalityComparer ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> SetItem( int index, T value, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.SetItem( index, value ) , dbgMethod, dbgPath, dbgLine);
|
||||
public List<T> Insert( int index, T element, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.Insert( index, element ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> InsertRange( int index, IEnumerable<T> items, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.InsertRange( index, items ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> Remove( T value, IEqualityComparer<T>? equalityComparer, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.Remove( value, equalityComparer ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> Remove( T value, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Remove( value, EqualityComparer<T>.Default, dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> RemoveAll( Predicate<T> match, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.RemoveAll( match ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> RemoveAt( int index, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.RemoveAt( index ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> RemoveRange( int index, int count, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.RemoveRange( index, count ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> RemoveRange( IEnumerable<T> items, IEqualityComparer<T>? equalityComparer, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.RemoveRange( items, equalityComparer ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> Replace( T oldValue, T newValue, IEqualityComparer<T>? equalityComparer, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.Replace( oldValue, newValue, equalityComparer ), dbgMethod, dbgPath, dbgLine );
|
||||
public List<T> SetItem( int index, T value, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => Change( v => v.SetItem( index, value ), dbgMethod, dbgPath, dbgLine );
|
||||
|
||||
|
||||
|
||||
public int IndexOf( T item, int index, int count, IEqualityComparer<T>? equalityComparer ) => Values.IndexOf( item, index, count, equalityComparer ?? EqualityComparer<T>.Default );
|
||||
public int LastIndexOf( T item, int index, int count, IEqualityComparer<T>? equalityComparer) => Values.LastIndexOf( item, index, count, equalityComparer ?? EqualityComparer<T>.Default );
|
||||
public int LastIndexOf( T item, int index, int count, IEqualityComparer<T>? equalityComparer ) => Values.LastIndexOf( item, index, count, equalityComparer ?? EqualityComparer<T>.Default );
|
||||
|
||||
public int IndexOf( T item, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => IndexOf( item, 0, Count, EqualityComparer<T>.Default);
|
||||
public int IndexOf( T item, [CallerMemberName] string dbgMethod = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1 ) => IndexOf( item, 0, Count, EqualityComparer<T>.Default );
|
||||
|
||||
|
||||
IImmutableList<T> IImmutableList<T>.Clear() => Clear();
|
||||
@ -78,5 +78,5 @@ public record class List<T> : Timed<List<T>>, IImmutableList<T>
|
||||
|
||||
// --- Standard Interfaces ---
|
||||
public IEnumerator<T> GetEnumerator() => Values.GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)Values).GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => ( (IEnumerable)Values ).GetEnumerator();
|
||||
}
|
||||
|
||||
@ -261,7 +261,8 @@ public record class Recorded<T> : Versioned<T> where T : Recorded<T>
|
||||
if( ReferenceEquals( current, next ) )
|
||||
return current;
|
||||
|
||||
var newMeta = current.Meta with {
|
||||
var newMeta = current.Meta with
|
||||
{
|
||||
Version = current.Meta.Version + 1,
|
||||
Reason = reason,
|
||||
MemberName = dbgName,
|
||||
|
||||
@ -186,7 +186,8 @@ namespace lib
|
||||
|
||||
doc.Load( reader );
|
||||
|
||||
if( doc.DocumentElement == null ) return null;
|
||||
if( doc.DocumentElement == null )
|
||||
return null;
|
||||
|
||||
if( t == null )
|
||||
return Deserialize( doc.DocumentElement );
|
||||
@ -256,7 +257,8 @@ namespace lib
|
||||
{
|
||||
TypeCode typeCode = Type.GetTypeCode( type );
|
||||
|
||||
if( _cfg.VerboseLogging ) log.info( $"{type.FriendlyName()}.{name} {existing} {mi?.Name}" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"{type.FriendlyName()}.{name} {existing} {mi?.Name}" );
|
||||
|
||||
if( typeCode != TypeCode.Object )
|
||||
{
|
||||
@ -276,7 +278,8 @@ namespace lib
|
||||
|
||||
if( obj is ser.I_Serialize iser )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"" );
|
||||
obj = iser.OnDeserialize( null );
|
||||
}
|
||||
|
||||
@ -314,7 +317,8 @@ namespace lib
|
||||
|
||||
private object DeserializeConcrete( XmlElement elem, MemberInfo mi, string name, Type type )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"" );
|
||||
|
||||
string val = "";
|
||||
|
||||
@ -398,7 +402,8 @@ namespace lib
|
||||
|
||||
private object HydrateObject( XmlElement elem, MemberInfo mi, Type finalType, object obj )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"" );
|
||||
|
||||
if( obj is IList )
|
||||
{
|
||||
@ -488,9 +493,10 @@ namespace lib
|
||||
|
||||
private object HydrateObjectOfNarrowType( XmlElement elem, MemberInfo mi, Type narrowType, object obj )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"" );
|
||||
|
||||
var isImm = typeof(io.Obj).IsAssignableFrom( narrowType );
|
||||
var isImm = typeof( io.Obj ).IsAssignableFrom( narrowType );
|
||||
|
||||
XmlNodeList allChildren = elem.ChildNodes;
|
||||
|
||||
@ -642,7 +648,7 @@ namespace lib
|
||||
}
|
||||
}
|
||||
|
||||
if(!isImm)
|
||||
if( !isImm )
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
@ -686,7 +692,8 @@ namespace lib
|
||||
|
||||
int refInt = refString.Length > 0 ? Convert.ToInt32( refString ) : -1;
|
||||
|
||||
if( _cfg.VerboseLogging ) log.info( $"{finalType?.FriendlyName()}({type?.FriendlyName()}) refInt {refInt} exitingObj = {obj?.ToString()}" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"{finalType?.FriendlyName()}({type?.FriendlyName()}) refInt {refInt} exitingObj = {obj?.ToString()}" );
|
||||
|
||||
obj = createObject( elem, finalType, refInt, obj );
|
||||
|
||||
@ -695,7 +702,8 @@ namespace lib
|
||||
|
||||
private object DeserializeList( XmlElement elem, MemberInfo mi, Type type, IList list )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"" );
|
||||
|
||||
XmlNodeList arrNodeList = elem.ChildNodes;
|
||||
|
||||
@ -731,7 +739,8 @@ namespace lib
|
||||
typeElem = typeof( KeyValuePair<,> ).MakeGenericType( type.GenericTypeArguments );
|
||||
}
|
||||
|
||||
if( _cfg.VerboseLogging ) log.info( $"DserCol {type.GetType().FriendlyName()} {typeElem.Name} into reflT {mi.ReflectedType.FriendlyName()} declT {mi.DeclaringType.FriendlyName()} {mi.Name}" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"DserCol {type.GetType().FriendlyName()} {typeElem.Name} into reflT {mi.ReflectedType.FriendlyName()} declT {mi.DeclaringType.FriendlyName()} {mi.Name}" );
|
||||
|
||||
string refString = elem.GetAttribute( "ref" );
|
||||
int refInt = refString.Length > 0 ? Convert.ToInt32( refString ) : -1;
|
||||
@ -776,7 +785,8 @@ namespace lib
|
||||
|
||||
var typeGen = Type.MakeGenericSignatureType( type );
|
||||
|
||||
if( _cfg.VerboseLogging ) log.info( $"TypeGen: {typeGen.FriendlyName()}" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"TypeGen: {typeGen.FriendlyName()}" );
|
||||
|
||||
if( type == typeof( ImmutableArray<> ).MakeGenericType( typeElem ) )
|
||||
{
|
||||
@ -833,7 +843,8 @@ namespace lib
|
||||
|
||||
private object DeserializeArray( XmlElement elem, MemberInfo mi, Type type )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"" );
|
||||
|
||||
Type typeElem = type.GetElementType();
|
||||
|
||||
@ -883,7 +894,8 @@ namespace lib
|
||||
|
||||
if( _cfg.datastructure == Datastructure.Graph && refInt > 0 && m_alreadySerialized.ContainsKey( refInt ) )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"Reuse object" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"Reuse object" );
|
||||
return m_alreadySerialized[refInt];
|
||||
}
|
||||
|
||||
@ -893,7 +905,8 @@ namespace lib
|
||||
|
||||
if( isProxy )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"use Proxy" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"use Proxy" );
|
||||
object obj = null;
|
||||
|
||||
var tryType = type;
|
||||
@ -937,7 +950,8 @@ namespace lib
|
||||
|
||||
if( isSubclass )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"Using existing obj {existingObj?.ToString()}" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"Using existing obj {existingObj?.ToString()}" );
|
||||
return existingObj;
|
||||
}
|
||||
|
||||
@ -953,12 +967,14 @@ namespace lib
|
||||
|
||||
try
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"For {type.FriendlyName()} check for constructors" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"For {type.FriendlyName()} check for constructors" );
|
||||
|
||||
var cons = type.GetConstructor( Type.EmptyTypes );
|
||||
if( cons != null)
|
||||
if( cons != null )
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"Activator.CreateInstance" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"Activator.CreateInstance" );
|
||||
obj = Activator.CreateInstance( type );
|
||||
}
|
||||
else
|
||||
@ -967,15 +983,18 @@ namespace lib
|
||||
obj = System.Runtime.Serialization.FormatterServices.GetUninitializedObject( type );
|
||||
}
|
||||
|
||||
if( _cfg.VerboseLogging ) log.info( $"Got obj {obj?.ToString()}" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"Got obj {obj?.ToString()}" );
|
||||
}
|
||||
catch( Exception )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( _cfg.VerboseLogging ) log.info( $"GetUninitializedObject" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"GetUninitializedObject" );
|
||||
obj = System.Runtime.Serialization.FormatterServices.GetUninitializedObject( type );
|
||||
if( _cfg.VerboseLogging ) log.info( $"Got obj {obj?.ToString()}" );
|
||||
if( _cfg.VerboseLogging )
|
||||
log.info( $"Got obj {obj?.ToString()}" );
|
||||
}
|
||||
catch( Exception exInner )
|
||||
{
|
||||
@ -1290,7 +1309,7 @@ namespace lib
|
||||
HashSet<string> whitelistFields, whitelistProps;
|
||||
GetFilters( _cfg.TypesDefault, mi, narrowType, out filterFields, out filterProps, out doImpls, out doFields, out doProps, out whitelistFields, out whitelistProps );
|
||||
|
||||
var isImm = typeof(io.Obj).IsAssignableFrom( narrowType );
|
||||
var isImm = typeof( io.Obj ).IsAssignableFrom( narrowType );
|
||||
|
||||
if( doFields || doImpls )
|
||||
{
|
||||
@ -1323,8 +1342,10 @@ namespace lib
|
||||
|
||||
if( isImm )
|
||||
{
|
||||
if( name == "MetaStorage" ) continue;
|
||||
if( name == "Fn" ) continue;
|
||||
if( name == "MetaStorage" )
|
||||
continue;
|
||||
if( name == "Fn" )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !doAtt.Any() && FilterField( filterFields, doImpls, whitelistFields, childFi as MemberInfo, name ) )
|
||||
@ -1365,8 +1386,10 @@ namespace lib
|
||||
|
||||
if( isImm )
|
||||
{
|
||||
if( name == "MetaStorage" ) continue;
|
||||
if( name == "Fn" ) continue;
|
||||
if( name == "MetaStorage" )
|
||||
continue;
|
||||
if( name == "Fn" )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( FilterField( filterProps, doImpls, whitelistProps, childPi as MemberInfo, name ) )
|
||||
@ -1413,8 +1436,10 @@ namespace lib
|
||||
Type type = root.GetType();
|
||||
|
||||
Type typeOfMember = typeof( object );
|
||||
if( mi is FieldInfo fi ) typeOfMember = fi.FieldType;
|
||||
if( mi is PropertyInfo pi ) typeOfMember = pi.PropertyType;
|
||||
if( mi is FieldInfo fi )
|
||||
typeOfMember = fi.FieldType;
|
||||
if( mi is PropertyInfo pi )
|
||||
typeOfMember = pi.PropertyType;
|
||||
if( typeOfMember != type )
|
||||
{
|
||||
log.info( $"SerArr {typeOfMember.FriendlyName()} {mi?.Name} != {type.FriendlyName()}" );
|
||||
|
||||
@ -181,7 +181,7 @@ static public class log
|
||||
}
|
||||
|
||||
|
||||
#region LogEvent
|
||||
#region LogEvent
|
||||
|
||||
public struct LogEvent
|
||||
{
|
||||
@ -256,7 +256,7 @@ static public class log
|
||||
ImmutableInterlocked.AddOrUpdate( ref s_logEPforCat, cat, ep, ( k, v ) => ep );
|
||||
}
|
||||
|
||||
#endregion // LogEvent
|
||||
#endregion // LogEvent
|
||||
|
||||
static public void shutdown()
|
||||
{
|
||||
@ -396,32 +396,32 @@ static public class log
|
||||
}
|
||||
|
||||
[StackTraceHidden]
|
||||
static public void info( string msg, string cat = "",SourceLoc? loc = null,
|
||||
static public void info( string msg, string cat = "", SourceLoc? loc = null,
|
||||
[CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
{
|
||||
logBase( msg, LogType.Info, dbgPath, dbgLine, dbgMethod, cat, dbgExp, loc );
|
||||
}
|
||||
|
||||
[StackTraceHidden]
|
||||
static public void debug( string msg, string cat = "",SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
static public void debug( string msg, string cat = "", SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
{
|
||||
logBase( msg, LogType.Debug, dbgPath, dbgLine, dbgMethod, cat, dbgExp, loc );
|
||||
}
|
||||
|
||||
[StackTraceHidden]
|
||||
static public void trace( string msg, string cat = "",SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
static public void trace( string msg, string cat = "", SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
{
|
||||
logBase( msg, LogType.Trace, dbgPath, dbgLine, dbgMethod, cat, dbgExp, loc );
|
||||
}
|
||||
|
||||
[StackTraceHidden]
|
||||
static public void warn( string msg, string cat = "",SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
static public void warn( string msg, string cat = "", SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
{
|
||||
logBase( msg, LogType.Warn, dbgPath, dbgLine, dbgMethod, cat, dbgExp, loc );
|
||||
}
|
||||
|
||||
[StackTraceHidden]
|
||||
static public void high( string msg, string cat = "",SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
static public void high( string msg, string cat = "", SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
{
|
||||
logBase( msg, LogType.High, dbgPath, dbgLine, dbgMethod, cat, dbgExp, loc );
|
||||
}
|
||||
@ -456,12 +456,12 @@ static public class log
|
||||
|
||||
|
||||
[StackTraceHidden]
|
||||
static public void fatal( string msg, string cat = "",SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
static public void fatal( string msg, string cat = "", SourceLoc? loc = null, [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "", [CallerArgumentExpression( "msg" )] string dbgExp = "" )
|
||||
{
|
||||
logBase( msg, LogType.Fatal, dbgPath, dbgLine, dbgMethod, cat, dbgExp, loc );
|
||||
}
|
||||
|
||||
//new LogEvent( LogType.Raw, $"", "", 0, "", "lib.time", "", null )
|
||||
//new LogEvent( LogType.Raw, $"", "", 0, "", "lib.time", "", null )
|
||||
|
||||
#endregion
|
||||
|
||||
@ -546,14 +546,14 @@ static public class log
|
||||
}
|
||||
|
||||
|
||||
static public LogEvent logCreateEvent( string msg, LogType type = LogType.Debug, string dbgPath = "", int dbgLine = -1, string dbgMethod = "", string cat = "unk", string exp = "",SourceLoc? loc = null )
|
||||
static public LogEvent logCreateEvent( string msg, LogType type = LogType.Debug, string dbgPath = "", int dbgLine = -1, string dbgMethod = "", string cat = "unk", string exp = "", SourceLoc? loc = null )
|
||||
{
|
||||
LogEvent evt = new LogEvent( type, msg, dbgPath, dbgLine, dbgMethod, cat, exp, loc );
|
||||
return evt;
|
||||
}
|
||||
|
||||
[StackTraceHidden]
|
||||
static public void logBase( string msg, LogType type = LogType.Debug, string dbgPath = "", int dbgLine = -1, string dbgMethod = "", string cat = "unk", string exp = "",SourceLoc? loc = null )
|
||||
static public void logBase( string msg, LogType type = LogType.Debug, string dbgPath = "", int dbgLine = -1, string dbgMethod = "", string cat = "unk", string exp = "", SourceLoc? loc = null )
|
||||
{
|
||||
var evt = logCreateEvent( msg, type, dbgPath, dbgLine, dbgMethod, cat, exp );
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ public class Ref<T> : Ref where T : class, new()
|
||||
// Let's assume you'll add saving logic here.
|
||||
// Mgr.Save(value, path); // Example: Needs implementation
|
||||
|
||||
var immMeta = (value as io.Obj)?.Meta;
|
||||
var immMeta = ( value as io.Obj )?.Meta;
|
||||
|
||||
|
||||
|
||||
@ -433,7 +433,7 @@ public static class Mgr
|
||||
var loadedObject = loaderHolder.Load( filename, reason, dbgName, dbgPath, dbgLine );
|
||||
if( loadedObject is T value )
|
||||
{
|
||||
var meta = (value as io.Obj)?.Meta;
|
||||
var meta = ( value as io.Obj )?.Meta;
|
||||
|
||||
// If it's an immutable object, record its loading.
|
||||
if( value is io.Obj imm )
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.002.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user