Updates to SharpLib
This commit is contained in:
parent
26716c6648
commit
2844950af3
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,7 +1,3 @@
|
||||
###################################
|
||||
# Git ignore file for Molyjam2012 #
|
||||
###################################
|
||||
|
||||
#Folders
|
||||
Library/
|
||||
Temp/
|
||||
@ -12,6 +8,7 @@ Release/
|
||||
run/
|
||||
bin/
|
||||
obj/
|
||||
.vs/
|
||||
|
||||
#Project/User Preference Files
|
||||
*.pidb
|
||||
|
||||
10
Helpers.cs
10
Helpers.cs
@ -147,28 +147,28 @@ namespace lib
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.error( String.Format( $"No attributes in node while loading file {filename}" ) );
|
||||
log.error( String.Format( $"No attributes in node while loading file {filename}" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.error( String.Format( $"Incorrect key {node.Name} found while loading file {filename}" ) );
|
||||
log.error( String.Format( $"Incorrect key {node.Name} found while loading file {filename}" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( keyMI == null )
|
||||
Log.error( String.Format( $"Key type conversion not found for type {keyType}" ) );
|
||||
log.error( String.Format( $"Key type conversion not found for type {keyType}" ) );
|
||||
|
||||
if( valMI == null )
|
||||
Log.error( String.Format( $"Val type conversion not found for type {valType}" ) );
|
||||
log.error( String.Format( $"Val type conversion not found for type {valType}" ) );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.error( String.Format( $"No dictionary element found while loading file {filename}" ) );
|
||||
log.error( String.Format( $"No dictionary element found while loading file {filename}" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
<Folder Include="reflect\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
// THE SOFTWARE.
|
||||
#pragma warning disable SA1405 // Debug.Assert must provide message text
|
||||
using att;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@ -88,12 +89,12 @@ namespace lib
|
||||
{
|
||||
if( !Directory.Exists( path ) )
|
||||
{
|
||||
lib.Log.info( $"Creating directory {path}" );
|
||||
log.info( $"Creating directory {path}" );
|
||||
Directory.CreateDirectory( path );
|
||||
}
|
||||
else
|
||||
{
|
||||
lib.Log.debug( $"{path} already exists." );
|
||||
log.debug( $"{path} already exists." );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ namespace lib
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
Log.error( $"Exception while creating config {t.ToString()}, Msg {e.Message}" );
|
||||
log.error( $"Exception while creating config {t.ToString()}, Msg {e.Message}" );
|
||||
}
|
||||
|
||||
//cfg.SetFilename( filename );
|
||||
@ -120,7 +120,7 @@ namespace lib
|
||||
|
||||
lib.Util.checkAndAddDirectory( dirName );
|
||||
|
||||
lib.Log.info( $"Writing out template config of type {t?.Name} in {templateFile}" );
|
||||
log.info( $"Writing out template config of type {t?.Name} in {templateFile}" );
|
||||
|
||||
Config.save( cfg, templateFile );
|
||||
}
|
||||
|
||||
281
logging/Log.cs
281
logging/Log.cs
@ -8,38 +8,10 @@ using System.Collections.Immutable;
|
||||
using System.Reflection;
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
namespace lib
|
||||
static public class log
|
||||
{
|
||||
|
||||
|
||||
|
||||
[Flags]
|
||||
public enum LogTypeNew
|
||||
{
|
||||
Invalid = 0,
|
||||
|
||||
// Frequency
|
||||
FrequencyBase = 1,
|
||||
FrequencyBits = 2,
|
||||
FrequencyMask = ( ( 1 << FrequencyBits ) - 1 ) << FrequencyBase,
|
||||
|
||||
Detail = 0b01 << FrequencyBase,
|
||||
Normal = 0b10 << FrequencyBase,
|
||||
Overview = 0b11 << FrequencyBase,
|
||||
|
||||
// Type
|
||||
TypeBase = FrequencyBase + FrequencyBits,
|
||||
TypeBits = 3,
|
||||
TypeMask = ( ( 1 << TypeBits ) - 1 ) << TypeBase,
|
||||
|
||||
Startup = 0b001 << TypeBase,
|
||||
Running = 0b010 << TypeBase,
|
||||
Shutdown = 0b011 << TypeBase,
|
||||
Error = 0b101 << TypeBase,
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Flags]
|
||||
public enum LogType
|
||||
{
|
||||
@ -67,7 +39,7 @@ namespace lib
|
||||
|
||||
|
||||
|
||||
static ImmutableDictionary<string, string> m_shortname = ImmutableDictionary<string, string>.Empty;
|
||||
static ImmutableDictionary<int, string> s_shortname = ImmutableDictionary<int, string>.Empty;
|
||||
|
||||
|
||||
public LogEvent( LogType logType, string msg, string path, int line, string member, string cat, object obj )
|
||||
@ -76,7 +48,8 @@ namespace lib
|
||||
//Cache the automatic category names
|
||||
if( string.IsNullOrEmpty( cat ) )
|
||||
{
|
||||
if( m_shortname.TryGetValue( path, out var autoCat ) )
|
||||
var pathHash = path.GetHashCode();
|
||||
if( s_shortname.TryGetValue( pathHash, out var autoCat ) )
|
||||
{
|
||||
cat = autoCat;
|
||||
}
|
||||
@ -86,7 +59,7 @@ namespace lib
|
||||
|
||||
var lastDir = pathPieces[ pathPieces.Length - 2 ];
|
||||
|
||||
ImmutableInterlocked.AddOrUpdate( ref m_shortname, path, lastDir, ( key, value ) => { return lastDir; } );
|
||||
ImmutableInterlocked.AddOrUpdate( ref s_shortname, pathHash, lastDir, ( key, value ) => { return lastDir; } );
|
||||
|
||||
cat = lastDir;
|
||||
}
|
||||
@ -107,11 +80,9 @@ namespace lib
|
||||
|
||||
|
||||
|
||||
public class Log : TraceListener
|
||||
{
|
||||
static public void create( string filename )
|
||||
{
|
||||
s_log = new Log( filename );
|
||||
createLog( filename );
|
||||
}
|
||||
|
||||
|
||||
@ -121,25 +92,11 @@ namespace lib
|
||||
|
||||
var evt = CreateLogEvent( LogType.Info, msg, "System", null );
|
||||
|
||||
s_log.writeToAll( evt );
|
||||
writeToAll( evt );
|
||||
|
||||
s_log.stop();
|
||||
|
||||
s_log = null;
|
||||
stop();
|
||||
}
|
||||
|
||||
static public Log s_log;
|
||||
|
||||
/*
|
||||
static public Log log
|
||||
{
|
||||
get
|
||||
{
|
||||
return s_log;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
static LogEvent CreateLogEvent( LogType logType, string msg, string cat, object obj, [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
@ -154,59 +111,62 @@ namespace lib
|
||||
// Forwards.
|
||||
static public void fatal( string msg, string cat = "", object obj = null, [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
log( msg, LogType.Fatal, path, line, member, cat, obj );
|
||||
logBase( msg, LogType.Fatal, path, line, member, cat, obj );
|
||||
}
|
||||
|
||||
static public void error( string msg, string cat = "", object obj = null, [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
log( msg, LogType.Error, path, line, member, cat, obj );
|
||||
logBase( msg, LogType.Error, path, line, member, cat, obj );
|
||||
}
|
||||
|
||||
static public void warn( string msg, string cat = "", object obj = null, [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
log( msg, LogType.Warn, path, line, member, cat, obj );
|
||||
logBase( msg, LogType.Warn, path, line, member, cat, obj );
|
||||
}
|
||||
|
||||
static public void info( string msg, string cat = "", object obj = null, [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
log( msg, LogType.Info, path, line, member, cat, obj );
|
||||
logBase( msg, LogType.Info, path, line, member, cat, obj );
|
||||
}
|
||||
|
||||
static public void high( string msg, string cat = "", object obj = null, [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
log( msg, LogType.High, path, line, member, cat, obj );
|
||||
logBase( msg, LogType.High, path, line, member, cat, obj );
|
||||
}
|
||||
|
||||
static public void debug( string msg, string cat = "", object obj = null, [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
log( msg, LogType.Debug, path, line, member, cat, obj );
|
||||
logBase( msg, LogType.Debug, path, line, member, cat, obj );
|
||||
}
|
||||
|
||||
static public void trace( string msg, string cat = "", object obj = null, [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
log( msg, LogType.Trace, path, line, member, cat, obj );
|
||||
logBase( msg, LogType.Trace, path, line, member, cat, obj );
|
||||
}
|
||||
|
||||
static public void log( string msg, LogType type = LogType.Debug, string path = "", int line = -1, string member = "", string cat = "unk", object obj = null )
|
||||
static object s_lock = new object();
|
||||
|
||||
static public void logBase( string msg, LogType type = LogType.Debug, string path = "", int line = -1, string member = "", string cat = "unk", object obj = null )
|
||||
{
|
||||
// @@@@@ TODO Get rid of this lock.
|
||||
var evt = new LogEvent( type, msg, path, line, member, cat, obj );
|
||||
|
||||
lock( s_log )
|
||||
lock( s_lock )
|
||||
{
|
||||
s_log.writeToAll( evt );
|
||||
writeToAll( evt );
|
||||
}
|
||||
}
|
||||
|
||||
static public void logProps( object obj, string header, LogType type = LogType.Debug, string cat = "", string prefix = "" )
|
||||
static public void logProps( object obj, string header, LogType type = LogType.Debug, string cat = "", string prefix = "", [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" )
|
||||
{
|
||||
var list = scr.GetAllProperties( obj.GetType() );
|
||||
var list = refl.GetAllProperties( obj.GetType() );
|
||||
|
||||
lock( s_log )
|
||||
lock( s_lock )
|
||||
{
|
||||
var evt = CreateLogEvent( type, header, cat, obj );
|
||||
var evt = new LogEvent( type, header, path, line, member, cat, obj );
|
||||
//var evt = CreateLogEvent( type, header, cat, obj );
|
||||
|
||||
s_log.writeToAll( evt );
|
||||
writeToAll( evt );
|
||||
|
||||
foreach( var pi in list )
|
||||
{
|
||||
@ -214,11 +174,11 @@ namespace lib
|
||||
{
|
||||
var v = pi.GetValue( obj );
|
||||
|
||||
log( $"{prefix}{pi.Name} = {v}", type, cat );
|
||||
logBase( $"{prefix}{pi.Name} = {v}", type, path, line, member, cat );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
log( $"Exception processing {pi.Name} {ex.Message}", LogType.Error, "log" );
|
||||
logBase( $"Exception processing {pi.Name} {ex.Message}", LogType.Error, "log" );
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,25 +191,30 @@ namespace lib
|
||||
|
||||
if( !value.Equals( notExpectedValue ) )
|
||||
{
|
||||
lib.Log.info( $"Properly got {value}{trueString}" );
|
||||
log.info( $"Properly got {value}{trueString}" );
|
||||
}
|
||||
else
|
||||
{
|
||||
lib.Log.warn( $"Got {notExpectedValue} instead of {value}{falseString}" );
|
||||
log.warn( $"Got {notExpectedValue} instead of {value}{falseString}" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Log( string filename )
|
||||
static private void createLog( string filename )
|
||||
{
|
||||
//TODO: Fix this so itll work without a directory.
|
||||
Directory.CreateDirectory( Path.GetDirectoryName( filename ) );
|
||||
|
||||
m_stream = new FileStream( filename, FileMode.Append, FileAccess.Write );
|
||||
m_writer = new StreamWriter( m_stream );
|
||||
string dir = Path.GetDirectoryName( filename );
|
||||
|
||||
m_errorStream = new FileStream( filename + ".error", FileMode.Append, FileAccess.Write );
|
||||
m_errorWriter = new StreamWriter( m_errorStream );
|
||||
if( dir.Length > 0 )
|
||||
{
|
||||
Directory.CreateDirectory( dir );
|
||||
}
|
||||
|
||||
s_stream = new FileStream( filename, FileMode.Append, FileAccess.Write );
|
||||
s_writer = new StreamWriter( s_stream );
|
||||
|
||||
s_errorStream = new FileStream( filename + ".error", FileMode.Append, FileAccess.Write );
|
||||
s_errorWriter = new StreamWriter( s_errorStream );
|
||||
|
||||
//Debug.Listeners.Add( this );
|
||||
|
||||
@ -260,59 +225,31 @@ namespace lib
|
||||
writeToAll( evt );
|
||||
}
|
||||
|
||||
public override void Write( string msg )
|
||||
{
|
||||
/*
|
||||
static public override void Write( string msg ) {
|
||||
WriteLine( msg );
|
||||
}
|
||||
|
||||
public override void WriteLine( string msg )
|
||||
{
|
||||
static public override void WriteLine( string msg ) {
|
||||
error( msg );
|
||||
//base.WriteLine( msg );
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
m_writer.Close();
|
||||
m_stream.Close();
|
||||
|
||||
m_errorWriter.Close();
|
||||
m_errorStream.Close();
|
||||
}
|
||||
|
||||
public void addDelegate( Log_delegate cb )
|
||||
{
|
||||
m_delegates.Add( cb );
|
||||
}
|
||||
|
||||
/*
|
||||
private void writeFileAndLine( StackTrace st )
|
||||
{
|
||||
StackFrame frame = st.GetFrame( 1 );
|
||||
|
||||
string srcFile = frame.GetFileName();
|
||||
string srcLine = frame.GetFileLineNumber().Tostring();
|
||||
|
||||
Console.WriteLine( $"{srcFile} ({srcLine}):" );
|
||||
}
|
||||
|
||||
private void writeStack( StackTrace st )
|
||||
{
|
||||
for( int i=0; i<st.FrameCount; ++i )
|
||||
{
|
||||
StackFrame frame = st.GetFrame( i );
|
||||
|
||||
string srcFile = frame.GetFileName();
|
||||
string srcLine = frame.GetFileLineNumber().Tostring();
|
||||
|
||||
if( srcFile != null )
|
||||
{
|
||||
Console.WriteLine( $"{srcFile} ({srcLine})" );
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static void stop()
|
||||
{
|
||||
s_writer.Close();
|
||||
s_stream.Close();
|
||||
|
||||
s_errorWriter.Close();
|
||||
s_errorStream.Close();
|
||||
}
|
||||
|
||||
static public void addDelegate( Log_delegate cb )
|
||||
{
|
||||
s_delegates.Add( cb );
|
||||
}
|
||||
|
||||
public static char getSymbol( LogType type )
|
||||
{
|
||||
switch( type )
|
||||
@ -336,7 +273,7 @@ namespace lib
|
||||
}
|
||||
}
|
||||
|
||||
private void writeToAll( LogEvent evt )
|
||||
static private void writeToAll( LogEvent evt )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -352,24 +289,16 @@ namespace lib
|
||||
//Console.WriteLine( finalMsg );
|
||||
//Console.Out.Write( finalMsg );
|
||||
|
||||
/*
|
||||
foreach( var l_obj in Debug.Listeners )
|
||||
{
|
||||
var l = l_obj as TraceListener;
|
||||
if( l != null && l != this )
|
||||
{
|
||||
l.WriteLine( finalMsg );
|
||||
}
|
||||
}
|
||||
*/
|
||||
s_writer.WriteLine( finalLine );
|
||||
|
||||
m_writer.WriteLine( finalLine );
|
||||
Console.WriteLine( finalLine );
|
||||
|
||||
m_writer.Flush();
|
||||
Debug.WriteLine( finalLine );
|
||||
|
||||
foreach( Log_delegate cb in m_delegates )
|
||||
s_writer.Flush();
|
||||
|
||||
foreach( Log_delegate cb in s_delegates )
|
||||
{
|
||||
//lock( cb )
|
||||
{
|
||||
cb( evt );
|
||||
}
|
||||
@ -378,71 +307,29 @@ namespace lib
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
//oops.
|
||||
//int dummy = 0;
|
||||
Console.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Console.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Console.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Console.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Console.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Console.WriteLine( $"Exception {ex}" );
|
||||
|
||||
Debug.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Debug.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Debug.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Debug.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Debug.WriteLine( "EXCEPTION DURING LOGGING" );
|
||||
Debug.WriteLine( $"Exception {ex}" );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private void error_i( string msg, object obj )
|
||||
{
|
||||
//var t = Task.Run( () => {
|
||||
StackTrace st = new StackTrace( true );
|
||||
private static Stream s_stream;
|
||||
private static StreamWriter s_writer;
|
||||
|
||||
writeStack( st );
|
||||
private static Stream s_errorStream;
|
||||
private static StreamWriter s_errorWriter;
|
||||
|
||||
string msgPrint = msg;
|
||||
|
||||
if( args.Length > 0 )
|
||||
{
|
||||
msgPrint = string.Format( msg, args );
|
||||
}
|
||||
|
||||
writeToAll( "error", "log", msgPrint );
|
||||
//} );
|
||||
}
|
||||
private void warn_i( string msg, object obj )
|
||||
{
|
||||
//var t = Task.Run( () => {
|
||||
StackTrace st = new StackTrace( true );
|
||||
|
||||
writeStack( st );
|
||||
|
||||
string msgPrint = msg;
|
||||
|
||||
if( args.Length > 0 )
|
||||
{
|
||||
msgPrint = string.Format( msg, args );
|
||||
}
|
||||
|
||||
writeToAll( "warn", "log", msgPrint );
|
||||
//});
|
||||
}
|
||||
private void info_i( string msg, object obj )
|
||||
{
|
||||
//var t = Task.Run( () => {
|
||||
StackTrace st = new StackTrace( true );
|
||||
|
||||
string msgPrint = msg;
|
||||
|
||||
if( args.Length > 0 )
|
||||
{
|
||||
msgPrint = string.Format( msg, args );
|
||||
}
|
||||
|
||||
writeToAll( "info", "log", msgPrint );
|
||||
//} );
|
||||
}
|
||||
*/
|
||||
|
||||
private Stream m_stream;
|
||||
private StreamWriter m_writer;
|
||||
|
||||
private Stream m_errorStream;
|
||||
private StreamWriter m_errorWriter;
|
||||
|
||||
private ArrayList m_delegates = new ArrayList();
|
||||
}
|
||||
private static ArrayList s_delegates = new ArrayList();
|
||||
|
||||
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ namespace lib
|
||||
}
|
||||
catch( System.Xml.XmlException ex )
|
||||
{
|
||||
lib.Log.error( $"Outer Exception {ex.Message}" );
|
||||
log.error( $"Outer Exception {ex.Message}" );
|
||||
}
|
||||
|
||||
return obj;
|
||||
@ -92,8 +92,8 @@ namespace lib
|
||||
formatter.Serialize( ms, obj );
|
||||
|
||||
//var str = System.Text.Encoding.Default.GetString( mm_buffer, 0, (int)ms.Position );
|
||||
//lib.Log.info( $"Sent data {str} of length {ms.Position}" );
|
||||
//lib.Log.info( $"Sent {obj}" );
|
||||
//log.info( $"Sent data {str} of length {ms.Position}" );
|
||||
//log.info( $"Sent {obj}" );
|
||||
|
||||
byte[] byteSize = BitConverter.GetBytes( (uint)ms.Position );
|
||||
m_streamNet.Write( byteSize, 0, 4 );
|
||||
@ -103,7 +103,7 @@ namespace lib
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
lib.Log.warn( $"Exception sending obj {obj} of {e}" );
|
||||
log.warn( $"Exception sending obj {obj} of {e}" );
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
static public class scr
|
||||
static public class refl
|
||||
{
|
||||
|
||||
public class PredEnumerator
|
||||
@ -247,10 +247,10 @@ namespace res
|
||||
if( wr.TryGetTarget( out var v ) )
|
||||
return v;
|
||||
|
||||
lib.Log.info( $"{filename} was in cache, but its been dropped, reloading." );
|
||||
log.info( $"{filename} was in cache, but its been dropped, reloading." );
|
||||
}
|
||||
|
||||
lib.Log.warn( $"Block Loading {filename}." );
|
||||
log.warn( $"Block Loading {filename}." );
|
||||
|
||||
var newV = actualLoad<T>( filename );
|
||||
|
||||
@ -268,7 +268,7 @@ namespace res
|
||||
if( wr.TryGetTarget( out var v ) )
|
||||
return v;
|
||||
|
||||
lib.Log.error( $"{filename} was in cache, but its been dropped, reloading." );
|
||||
log.error( $"{filename} was in cache, but its been dropped, reloading." );
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,19 +291,19 @@ namespace res
|
||||
//Done loading
|
||||
if( !ImmutableInterlocked.TryRemove( ref s_loading, filename, out var oldEvt ) )
|
||||
{
|
||||
lib.Log.error( $"Error removing loading event for {filename}" );
|
||||
log.error( $"Error removing loading event for {filename}" );
|
||||
}
|
||||
|
||||
if( alreadyAdded )
|
||||
{
|
||||
lib.Log.error( $"Key {filename} already existed, though it shouldnt." );
|
||||
log.error( $"Key {filename} already existed, though it shouldnt." );
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
else
|
||||
{
|
||||
lib.Log.error( $"Loader could not be found for type {typeof( T )}" );
|
||||
log.error( $"Loader could not be found for type {typeof( T )}" );
|
||||
|
||||
return ResCache<T>.s_default;
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ namespace lib
|
||||
}
|
||||
else //More than 1.
|
||||
{
|
||||
//Log.error( "Too many fields named the same thing" );
|
||||
//log.error( "Too many fields named the same thing" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ namespace lib
|
||||
|
||||
String childType = node.GetAttribute("t");
|
||||
|
||||
name = scr.TypeToIdentifier( name );
|
||||
name = refl.TypeToIdentifier( name );
|
||||
|
||||
XmlElement childElem = getNamedChild(allChildren, name);
|
||||
|
||||
@ -343,7 +343,7 @@ namespace lib
|
||||
{
|
||||
String name = serMember.Name;
|
||||
|
||||
name = scr.TypeToIdentifier( name );
|
||||
name = refl.TypeToIdentifier( name );
|
||||
|
||||
XmlElement childElem = getNamedChild( allChildren, name );
|
||||
|
||||
@ -355,7 +355,7 @@ namespace lib
|
||||
{
|
||||
XmlNodeList allChildren = elem.ChildNodes;
|
||||
|
||||
var fields = scr.GetAllFields( type );
|
||||
var fields = refl.GetAllFields(type);
|
||||
|
||||
//MemberInfo[] miArr = FormatterServices.GetSerializableMembers( type, Context );
|
||||
|
||||
@ -364,7 +364,7 @@ namespace lib
|
||||
|
||||
String name = childFi.Name;
|
||||
|
||||
name = scr.TypeToIdentifier( name );
|
||||
name = refl.TypeToIdentifier( name );
|
||||
|
||||
XmlElement childElem = getNamedChild(allChildren, name);
|
||||
|
||||
@ -472,14 +472,14 @@ namespace lib
|
||||
}
|
||||
catch( Exception exInner )
|
||||
{
|
||||
lib.Log.error( $"Got exception {exInner.Message} trying to make an uninitialized object" );
|
||||
log.error( $"Got exception {exInner.Message} trying to make an uninitialized object" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( obj == null )
|
||||
{
|
||||
lib.Log.warn( $"Could not create object of type {type.Name}" );
|
||||
log.warn( $"Could not create object of type {type.Name}" );
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -660,7 +660,7 @@ namespace lib
|
||||
{
|
||||
String name = serMember.Name;
|
||||
|
||||
name = scr.TypeToIdentifier( name );
|
||||
name = refl.TypeToIdentifier( name );
|
||||
|
||||
Serialize( writer, serMember.Value, name, true );
|
||||
}
|
||||
@ -672,7 +672,7 @@ namespace lib
|
||||
else
|
||||
//*/
|
||||
{
|
||||
var fields = scr.GetAllFields( type );
|
||||
var fields = refl.GetAllFields(type);
|
||||
|
||||
//MemberInfo[] miArr = FormatterServices.GetSerializableMembers( type, Context );
|
||||
|
||||
@ -688,7 +688,7 @@ namespace lib
|
||||
|
||||
String name = childFi.Name;
|
||||
|
||||
name = scr.TypeToIdentifier( name );
|
||||
name = refl.TypeToIdentifier( name );
|
||||
|
||||
Serialize( writer, childFi.GetValue( root ), name, false );
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user