Fixes string interpolation

This commit is contained in:
Kamron Batman 2018-09-14 13:07:43 -07:00
parent 42d0b6271f
commit 7d3a0ca265
233 changed files with 758 additions and 690 deletions

View file

@ -31,7 +31,7 @@ namespace Server.RemoteAdmin
string outStr;
if ( m_NewLine )
{
outStr = String.Format( "[{0}]: {1}", DateTime.UtcNow.ToString( DateFormat ), str );
outStr = $"[{DateTime.UtcNow.ToString(DateFormat)}]: {str}";
m_NewLine = false;
}
else
@ -50,7 +50,7 @@ namespace Server.RemoteAdmin
if ( m_NewLine )
{
string outStr;
outStr = String.Format( "[{0}]: {1}", DateTime.UtcNow.ToString( DateFormat ), ch );
outStr = $"[{DateTime.UtcNow.ToString(DateFormat)}]: {ch}";
m_ConsoleData.Append( outStr );
SendToAll( outStr );
@ -70,9 +70,9 @@ namespace Server.RemoteAdmin
{
string outStr;
if ( m_NewLine )
outStr = String.Format( "[{0}]: {1}{2}", DateTime.UtcNow.ToString( DateFormat ), line, Console.Out.NewLine );
outStr = $"[{DateTime.UtcNow.ToString(DateFormat)}]: {line}{Console.Out.NewLine}";
else
outStr = String.Format( "{0}{1}", line, Console.Out.NewLine );
outStr = $"{line}{Console.Out.NewLine}";
m_ConsoleData.Append( outStr );
RoughTrimConsoleData();
@ -126,7 +126,8 @@ namespace Server.RemoteAdmin
}
else if ( cmd == 0xFF )
{
string statStr = String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K, Ver={6}", Misc.ServerList.ServerName, (int)(DateTime.UtcNow - Items.Clock.ServerStart).TotalHours, NetState.Instances.Count, World.Items.Count, World.Mobiles.Count, (int)(GC.GetTotalMemory( false ) / 1024), ProtocolVersion );
string statStr =
$", Name={Misc.ServerList.ServerName}, Age={(int) (DateTime.UtcNow - Items.Clock.ServerStart).TotalHours}, Clients={NetState.Instances.Count}, Items={World.Items.Count}, Chars={World.Mobiles.Count}, Mem={(int) (GC.GetTotalMemory(false) / 1024)}K, Ver={ProtocolVersion}";
state.Send( new UOGInfo( statStr ) );
state.Dispose();
}

View file

@ -225,7 +225,8 @@ namespace Server.RemoteAdmin
{
string changes = string.Empty;
if ( UpdatedPass ) changes += " Password Changed.";
if ( oldAcessLevel != a.AccessLevel ) changes = string.Format( "{0} Access level changed from {1} to {2}.", changes, oldAcessLevel, a.AccessLevel );
if ( oldAcessLevel != a.AccessLevel ) changes =
$"{changes} Access level changed from {oldAcessLevel} to {a.AccessLevel}.";
if ( oldbanned != a.Banned ) changes += a.Banned ? " Banned." : " Unbanned.";
RemoteAdminLogging.WriteLine( state, "Updated account {0}:{1}", a.Username, changes );
}

View file

@ -89,7 +89,7 @@ namespace Server.RemoteAdmin
Commands.CommandLogging.AppendPath( ref path, LogBaseDirectory );
Commands.CommandLogging.AppendPath( ref path, LogSubDirectory );
Commands.CommandLogging.AppendPath( ref path, accesslevel );
path = Path.Combine( path, String.Format( "{0}.log", name ) );
path = Path.Combine( path, $"{name}.log");
using ( StreamWriter sw = new StreamWriter( path, true ) )
sw.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, statestr, text );