mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Apply batch fixing of built-in types using var
This commit is contained in:
@ -70,14 +70,14 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
foreach (Match m in regex.Matches(result.Text, startIndex))
|
||||
{
|
||||
var index = m.Index - captureOffset;
|
||||
int index = m.Index - captureOffset;
|
||||
|
||||
var displayText = string.Format(display,
|
||||
string? displayText = string.Format(display,
|
||||
m.Groups[0],
|
||||
m.Groups["text"].Value,
|
||||
m.Groups["url"].Value).Trim();
|
||||
|
||||
var linkText = string.Format(link,
|
||||
string linkText = string.Format(link,
|
||||
m.Groups[0],
|
||||
m.Groups["text"].Value,
|
||||
m.Groups["url"].Value).Trim();
|
||||
@ -109,9 +109,9 @@ namespace osu.Game.Online.Chat
|
||||
{
|
||||
foreach (Match m in regex.Matches(result.Text, startIndex))
|
||||
{
|
||||
var index = m.Index;
|
||||
var linkText = m.Groups["link"].Value;
|
||||
var indexLength = linkText.Length;
|
||||
int index = m.Index;
|
||||
string? linkText = m.Groups["link"].Value;
|
||||
int indexLength = linkText.Length;
|
||||
|
||||
var details = GetLinkDetails(linkText);
|
||||
var link = new Link(linkText, index, indexLength, details.Action, details.Argument);
|
||||
@ -126,7 +126,7 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
public static LinkDetails GetLinkDetails(string url)
|
||||
{
|
||||
var args = url.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||
string[]? args = url.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||
args[0] = args[0].TrimEnd(':');
|
||||
|
||||
switch (args[0])
|
||||
@ -136,7 +136,7 @@ namespace osu.Game.Online.Chat
|
||||
// length > 3 since all these links need another argument to work
|
||||
if (args.Length > 3 && args[1].EndsWith(websiteRootUrl, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var mainArg = args[3];
|
||||
string? mainArg = args[3];
|
||||
|
||||
switch (args[2])
|
||||
{
|
||||
@ -145,7 +145,7 @@ namespace osu.Game.Online.Chat
|
||||
case "beatmaps":
|
||||
{
|
||||
string trimmed = mainArg.Split('?').First();
|
||||
if (int.TryParse(trimmed, out var id))
|
||||
if (int.TryParse(trimmed, out int id))
|
||||
return new LinkDetails(LinkAction.OpenBeatmap, id.ToString());
|
||||
|
||||
break;
|
||||
@ -159,7 +159,7 @@ namespace osu.Game.Online.Chat
|
||||
// handle discussion links externally for now
|
||||
return new LinkDetails(LinkAction.External, url);
|
||||
|
||||
if (args.Length > 4 && int.TryParse(args[4], out var id))
|
||||
if (args.Length > 4 && int.TryParse(args[4], out int id))
|
||||
// https://osu.ppy.sh/beatmapsets/1154158#osu/2768184
|
||||
return new LinkDetails(LinkAction.OpenBeatmap, id.ToString());
|
||||
|
||||
@ -273,7 +273,7 @@ namespace osu.Game.Online.Chat
|
||||
// handle channels
|
||||
handleMatches(channel_regex, "{0}", "osu://chan/{0}", result, startIndex, LinkAction.OpenChannel);
|
||||
|
||||
var empty = "";
|
||||
string empty = "";
|
||||
while (space-- > 0)
|
||||
empty += "\0";
|
||||
|
||||
|
Reference in New Issue
Block a user