mirror of https://github.com/ppy/osu
Removed generic parameter function
This commit is contained in:
parent
02bc429911
commit
34fb6ccdf5
|
@ -482,21 +482,22 @@ private void postMessage(TextBox textbox, bool newText)
|
|||
|
||||
if (postText[0] == '/')
|
||||
{
|
||||
string unhandeledParameters = postText.Substring(1);
|
||||
string commandKeyword = cutFirstParameter(ref unhandeledParameters);
|
||||
string[] parameters = postText.Substring(1).Split(new[] { ' ' }, 2);
|
||||
string command = parameters[0];
|
||||
string content = parameters.Length == 2 ? parameters[1] : string.Empty;
|
||||
|
||||
switch (commandKeyword)
|
||||
switch (command)
|
||||
{
|
||||
case "me":
|
||||
|
||||
if (string.IsNullOrWhiteSpace(unhandeledParameters))
|
||||
if (string.IsNullOrWhiteSpace(content))
|
||||
{
|
||||
currentChannel.AddNewMessages(new ErrorMessage("Usage: /me [action]"));
|
||||
return;
|
||||
}
|
||||
|
||||
isAction = true;
|
||||
postText = unhandeledParameters;
|
||||
postText = content;
|
||||
break;
|
||||
|
||||
case "help":
|
||||
|
@ -504,7 +505,7 @@ private void postMessage(TextBox textbox, bool newText)
|
|||
return;
|
||||
|
||||
default:
|
||||
currentChannel.AddNewMessages(new ErrorMessage($@"""/{commandKeyword}"" is not supported! For a list of supported commands see /help"));
|
||||
currentChannel.AddNewMessages(new ErrorMessage($@"""/{command}"" is not supported! For a list of supported commands see /help"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -528,13 +529,6 @@ private void postMessage(TextBox textbox, bool newText)
|
|||
api.Queue(req);
|
||||
}
|
||||
|
||||
private string cutFirstParameter(ref string parameters)
|
||||
{
|
||||
string result = parameters.Split(' ')[0];
|
||||
parameters = result.Length == parameters.Length ? "" : parameters.Substring(result.Length + 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void transformChatHeightTo(double newChatHeight, double duration = 0, Easing easing = Easing.None)
|
||||
{
|
||||
this.TransformTo(this.PopulateTransform(new TransformChatHeight(), newChatHeight, duration, easing));
|
||||
|
|
Loading…
Reference in New Issue