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

@ -116,7 +116,7 @@ namespace Server.Commands.Generic
public override string ToString()
{
if ( m_Count > 1 )
return String.Format( "{0} ({1})", m_Message, m_Count );
return $"{m_Message} ({m_Count})";
return m_Message;
}

View file

@ -190,7 +190,7 @@ namespace Server.Commands.Generic
if ( list.Count == 1 )
AddResponse( "There is one matching object." );
else
AddResponse( String.Format( "There are {0} matching objects.", list.Count ) );
AddResponse($"There are {list.Count} matching objects.");
}
}
@ -255,7 +255,8 @@ namespace Server.Commands.Generic
else
AddResponse( "Open web browser request sent." );
mob.SendGump( new WarningGump( 1060637, 30720, String.Format( "A game master is requesting to open your web browser to the following URL:<br>{0}", url ), 0xFFC000, 320, 240, new WarningGumpCallback( OpenBrowser_Callback ), new object[]{ from, url, echo } ) );
mob.SendGump( new WarningGump( 1060637, 30720,
$"A game master is requesting to open your web browser to the following URL:<br>{url}", 0xFFC000, 320, 240, new WarningGumpCallback( OpenBrowser_Callback ), new object[]{ from, url, echo } ) );
}
}
else
@ -636,9 +637,9 @@ namespace Server.Commands.Generic
Type type = obj.GetType();
if ( type.DeclaringType == null )
AddResponse( String.Format( "The type of that object is {0}.", type.Name ) );
AddResponse($"The type of that object is {type.Name}.");
else
AddResponse( String.Format( "The type of that object is {0}.", type.FullName ) );
AddResponse($"The type of that object is {type.FullName}.");
}
}
}
@ -698,7 +699,7 @@ namespace Server.Commands.Generic
Commands = new[]{ command };
ObjectTypes = objects;
Usage = command;
Description = String.Format( "Sets the {0} property to {1}.", name, value );
Description = $"Sets the {name} property to {value}.";
}
public override void Execute( CommandEventArgs e, object obj )
@ -796,7 +797,8 @@ namespace Server.Commands.Generic
{
if ( list.Count > 1 )
{
e.Mobile.SendGump( new WarningGump( 1060637, 30720, String.Format( "You are about to delete {0} objects. This cannot be undone without a full server revert.<br><br>Continue?", list.Count ), 0xFFC000, 420, 280, new WarningGumpCallback( OnConfirmCallback ), new object[]{ e, list } ) );
e.Mobile.SendGump( new WarningGump( 1060637, 30720,
$"You are about to delete {list.Count} objects. This cannot be undone without a full server revert.<br><br>Continue?", 0xFFC000, 420, 280, new WarningGumpCallback( OnConfirmCallback ), new object[]{ e, list } ) );
AddResponse( "Awaiting confirmation..." );
}
else
@ -1043,7 +1045,7 @@ namespace Server.Commands.Generic
targ.Say( "I've been {0}!", m_Ban ? "banned" : "kicked" );
AddResponse( String.Format( "They have been {0}.", m_Ban ? "banned" : "kicked" ) );
AddResponse($"They have been {(m_Ban ? "banned" : "kicked")}.");
targState.Dispose();

View file

@ -95,7 +95,8 @@ namespace Server.Commands.Generic
#region Area targeting mode
public override void ExecuteList( CommandEventArgs e, ArrayList list )
{
e.Mobile.SendGump( new WarningGump( 1060637, 30720, String.Format( "You are about to insert {0} objects. This cannot be undone without a full server revert.<br><br>Continue?", list.Count ), 0xFFC000, 420, 280, new WarningGumpCallback( OnConfirmCallback ), new object[] { e, list, ( e.Length < 1 || !e.GetBoolean( 0 ) ) } ) );
e.Mobile.SendGump( new WarningGump( 1060637, 30720,
$"You are about to insert {list.Count} objects. This cannot be undone without a full server revert.<br><br>Continue?", 0xFFC000, 420, 280, new WarningGumpCallback( OnConfirmCallback ), new object[] { e, list, ( e.Length < 1 || !e.GetBoolean( 0 ) ) } ) );
AddResponse( "Awaiting confirmation..." );
}

View file

@ -85,7 +85,8 @@ namespace Server.Commands.Generic
else
AddEntryHeader( 20 );
AddEntryHtml( 40 + ( m_Columns.Length * 130 ) - 20 + ( ( m_Columns.Length - 2 ) * OffsetSize ), Center( String.Format( "Page {0} of {1}", m_Page+1, (m_List.Count + EntriesPerPage - 1) / EntriesPerPage ) ) );
AddEntryHtml( 40 + ( m_Columns.Length * 130 ) - 20 + ( ( m_Columns.Length - 2 ) * OffsetSize ), Center(
$"Page {m_Page + 1} of {(m_List.Count + EntriesPerPage - 1) / EntriesPerPage}") );
if ( (m_Page + 1) * EntriesPerPage < m_List.Count )
AddEntryButton( 20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight );
@ -297,7 +298,7 @@ namespace Server.Commands.Generic
private void InvokeCommand( string ip )
{
CommandSystem.Handle( m_From, String.Format( "{0}{1}", CommandSystem.Prefix, ip ) );
CommandSystem.Handle( m_From, $"{CommandSystem.Prefix}{ip}");
}
public override void OnResponse( NetState sender, RelayInfo info )
@ -338,7 +339,7 @@ namespace Server.Commands.Generic
case 4: // Go there
{
m_From.SendGump( new InterfaceItemGump( m_From, m_Columns, m_List, m_Page, m_Item ) );
InvokeCommand( String.Format( "Go {0}", m_Item.Serial.Value ) );
InvokeCommand($"Go {m_Item.Serial.Value}");
break;
}
case 5: // Move to target
@ -458,7 +459,7 @@ namespace Server.Commands.Generic
private void InvokeCommand( string ip )
{
CommandSystem.Handle( m_From, String.Format( "{0}{1}", CommandSystem.Prefix, ip ) );
CommandSystem.Handle( m_From, $"{CommandSystem.Prefix}{ip}");
}
public override void OnResponse( NetState sender, RelayInfo info )
@ -503,7 +504,7 @@ namespace Server.Commands.Generic
case 4: // Go there
{
m_From.SendGump( new InterfaceMobileGump( m_From, m_Columns, m_List, m_Page, m_Mobile ) );
InvokeCommand( String.Format( "Go {0}", m_Mobile.Serial.Value ) );
InvokeCommand($"Go {m_Mobile.Serial.Value}");
break;
}
case 5: // Bring them here

View file

@ -177,11 +177,7 @@ namespace Server.Commands.Generic
else
{
throw new InvalidOperationException(
String.Format(
"Unable to convert string \"{0}\" into type '{1}'.",
m_Value,
m_Type
)
$"Unable to convert string \"{m_Value}\" into type '{m_Type}'."
);
}
}

View file

@ -94,7 +94,7 @@ namespace Server.Commands.Generic
Type objectType = ScriptCompiler.FindTypeByName( args[offset + index], true );
if ( objectType == null )
throw new Exception( String.Format( "No type with that name ({0}) was found.", args[offset + index] ) );
throw new Exception($"No type with that name ({args[offset + index]}) was found.");
++index;
@ -231,7 +231,7 @@ namespace Server.Commands.Generic
}
if ( condition == null )
throw new InvalidOperationException( String.Format( "Unrecognized operator (\"{0}\").", oper ) );
throw new InvalidOperationException($"Unrecognized operator (\"{oper}\").");
current.Add( condition );
}