Skip to content

Commit

Permalink
Merge pull request #2108 from andy840119/regular-clean-up-code
Browse files Browse the repository at this point in the history
Regular clean up code.
  • Loading branch information
andy840119 authored Aug 30, 2023
2 parents 2aa705e + 12742f4 commit 4a6ffdc
Show file tree
Hide file tree
Showing 46 changed files with 80 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public void SetUp() => Schedule(() =>
[Test]
public void ShowWithNoFetch()
{
AddStep(@"Show", () => markdownContainer.Show());
AddStep("Show", () => markdownContainer.Show());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public partial class TestSceneKaraokeChangeLogOverlay : OsuTestScene
[Test]
public void ShowWithNoFetch()
{
AddStep(@"Show", () => changelog.Show());
AddAssert(@"listing displayed", () => changelog.Current.Value == null);
AddStep("Show", () => changelog.Show());
AddAssert("listing displayed", () => changelog.Current.Value == null);
}

private partial class TestChangelogOverlay : KaraokeChangelogOverlay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public TestManageFontPreview()
private void load(GameHost host)
{
var resources = new KaraokeRuleset().CreateResourceStore();
var textureStore = new TextureStore(host.Renderer, host.CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(resources, @"Textures")));
var textureStore = new TextureStore(host.Renderer, host.CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(resources, "Textures")));
Dependencies.CacheAs(textureStore);

Add(new ManageFontPreview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void TestPopover()
Schedule(() =>
{
Child = popover;
Child?.Show();
Child.Show();
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke.Tests/VisualTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class VisualTestRunner
[STAThread]
public static int Main(string[] args)
{
using var host = Host.GetSuitableDesktopHost(@"karaoke-visual-test-runner", new HostOptions { BindIPC = true });
using var host = Host.GetSuitableDesktopHost("karaoke-visual-test-runner", new HostOptions { BindIPC = true });
host.Run(new KaraokeTestBrowser());

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class KaraokeLegacyBeatmapDecoder : LegacyBeatmapDecoder

public new static void Register()
{
AddDecoder<Beatmap>(@"karaoke file format v", m => new KaraokeLegacyBeatmapDecoder(Parsing.ParseInt(m.Split('v').Last())));
AddDecoder<Beatmap>("karaoke file format v", m => new KaraokeLegacyBeatmapDecoder(Parsing.ParseInt(m.Split('v').Last())));

// use this weird way to let all the fall-back beatmap(include karaoke beatmap) become karaoke beatmap.
SetFallbackDecoder<Beatmap>(() => new KaraokeLegacyBeatmapDecoder());
Expand Down
10 changes: 5 additions & 5 deletions osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public override IEnumerable<BeatmapStatistic> GetStatistics()
{
new()
{
Name = @"Singer",
Name = "Singer",
Content = singers.ToString(),
CreateIcon = () => new SpriteIcon { Icon = FontAwesome.Solid.User },
},
new()
{
Name = @"Lyric",
Name = "Lyric",
Content = lyrics.ToString(),
CreateIcon = () => new SpriteIcon { Icon = FontAwesome.Solid.AlignLeft },
},
Expand All @@ -59,7 +59,7 @@ public override IEnumerable<BeatmapStatistic> GetStatistics()
int notes = HitObjects.Count(s => s is Note { Display: true });
defaultStatistic.Add(new BeatmapStatistic
{
Name = @"Note",
Name = "Note",
Content = notes.ToString(),
CreateIcon = () => new SpriteIcon { Icon = FontAwesome.Solid.Music },
});
Expand All @@ -68,8 +68,8 @@ public override IEnumerable<BeatmapStatistic> GetStatistics()
{
defaultStatistic.Add(new BeatmapStatistic
{
Name = @"This beatmap is not scorable.",
Content = @"This beatmap is not scorable.",
Name = "This beatmap is not scorable.",
Content = "This beatmap is not scorable.",
CreateIcon = () => new SpriteIcon { Icon = FontAwesome.Solid.Times },
});
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/Bindables/BindableCultureInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public override void Parse(object? input)

protected override Bindable<CultureInfo?> CreateInstance() => new BindableCultureInfo();

public override string ToString(string format, IFormatProvider formatProvider)
public override string ToString(string? format, IFormatProvider? formatProvider)
=> Value != null ? CultureInfoUtils.GetSaveCultureInfoCode(Value) : string.Empty;
}
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/Bindables/BindableFontUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ public override void Parse(object input)
protected override Bindable<FontUsage> CreateInstance() => new BindableFontUsage();

// IDK why not being called in here while saving.
public override string ToString(string format, IFormatProvider formatProvider)
public override string ToString(string? format, IFormatProvider? formatProvider)
=> $"family={Value.Family} weight={Value.Weight} size={Value.Size} italics={Value.Italics} fixedWidth={Value.FixedWidth}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public OkPopupDialog(Action<bool>? okAction = null)
{
new PopupDialogOkButton
{
Text = @"OK",
Text = "OK",
Action = () => okAction?.Invoke(true),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void load(LargeTextureStore textures, IKaraokeBeatmapResourcesProvider k
}, true);

Texture getDefaultAvatar()
=> textures.Get(@"Online/avatar-guest");
=> textures.Get("Online/avatar-guest");
}

private ISinger? singer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public CircleCheckbox()
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
sampleChecked = audio.Samples.Get(@"UI/check-on");
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
sampleChecked = audio.Samples.Get("UI/check-on");
sampleUnchecked = audio.Samples.Get("UI/check-off");
}

private Color4 accentColour;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ private partial class TextPropertySearchTextBox : SearchTextBox

public TextPropertySearchTextBox()
{
PlaceholderText = @"Search...";
PlaceholderText = "Search...";
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private partial class LanguageSelectionSearchTextBox : SearchTextBox

public LanguageSelectionSearchTextBox()
{
PlaceholderText = @"type in keywords...";
PlaceholderText = "type in keywords...";
}
}

Expand Down
6 changes: 3 additions & 3 deletions osu.Game.Rulesets.Karaoke/IO/Stores/TtfGlyphStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Task LoadFontAsync() => fontLoadTask ??= Task.Factory.StartNew(() =>
{
Font font;

using (var s = Store.GetStream($@"{AssetName}"))
using (var s = Store.GetStream($"{AssetName}"))
{
var fonts = new FontCollection();
var fontFamily = fonts.Add(s);
Expand Down Expand Up @@ -131,15 +131,15 @@ public TextureUpload Get(string name)
{
if (fontMetrics == null) return null;

if (name.Length > 1 && !name.StartsWith($@"{FontName}/", StringComparison.Ordinal))
if (name.Length > 1 && !name.StartsWith($"{FontName}/", StringComparison.Ordinal))
return null;

return !HasGlyph(name.Last()) ? null : LoadCharacter(name.Last());
}

public virtual async Task<TextureUpload> GetAsync(string name, CancellationToken cancellationToken = default)
{
if (name.Length > 1 && !name.StartsWith($@"{FontName}/", StringComparison.Ordinal))
if (name.Length > 1 && !name.StartsWith($"{FontName}/", StringComparison.Ordinal))
return null;

await completionSource.Task.ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/Mods/KaraokeModHiddenNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Karaoke.Mods;

public class KaraokeModHiddenNote : ModHidden
{
public override LocalisableString Description => @"Notes fade out before you sing them!";
public override LocalisableString Description => "Notes fade out before you sing them!";
public override double ScoreMultiplier => 1.06;
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight<KaraokeHitObject>) };
public override IconUsage? Icon => KaraokeIcon.ModHiddenNote;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/Mods/KaraokeModSnow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void ApplyToHUD(HUDOverlay overlay)
Speed = 1,
WingAffection = 3,
SnowSize = 0.3f,
TexturePath = @"Mod/Snow/Snow",
TexturePath = "Mod/Snow/Snow",
Clock = new FramedClock(new StopwatchClock(true)),
RelativeSizeAxes = Axes.Both,
Depth = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected override void AddLinkText(string text, LinkInline linkInline)
var baseUri = new Uri(githubUrls[text]);

// Get hash tag with number
const string issue_regex = @"#(?<issue>[0-9]+)|@(?<username>[0-9A-z]+)";
const string issue_regex = "#(?<issue>[0-9]+)|@(?<username>[0-9A-z]+)";
var result = Regex.Matches(linkInline.Url, issue_regex, RegexOptions.IgnoreCase);

if (!result.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void load(AudioManager audio)
{
Header.Build.BindTo(Current);

sampleBack = audio.Samples.Get(@"UI/generic-select-soft");
sampleBack = audio.Samples.Get("UI/generic-select-soft");

Current.BindValueChanged(e =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private partial class LyricSelectionSearchTextBox : SearchTextBox

public LyricSelectionSearchTextBox()
{
PlaceholderText = @"type in keywords...";
PlaceholderText = "type in keywords...";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public DeleteLyricDialog(Action<bool> okAction)
{
new PopupDialogOkButton
{
Text = @"Yes. Go for it.",
Text = "Yes. Go for it.",
Action = () => okAction(true),
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!",
Text = "No! Abort mission!",
Action = () => okAction(false),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ private void initializeSettingsArea()
bool checkDuplicatedWithExistSettings(LyricEditorSettings lyricEditorSettings)
{
var type = lyricEditorSettings.GetType();
if (leftSideSettings.Children?.FirstOrDefault()?.GetType() == type)
if (leftSideSettings.Children.FirstOrDefault()?.GetType() == type)
return true;

if (rightSideSettings.Children?.FirstOrDefault()?.GetType() == type)
if (rightSideSettings.Children.FirstOrDefault()?.GetType() == type)
return true;

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private static float getBaseHue(LyricEditorMode mode)
return 255 / 360f; // purple

default:
throw new InvalidEnumArgumentException($@"{mode} colour scheme does not provide a hue value in {nameof(getBaseHue)}.");
throw new InvalidEnumArgumentException($"{mode} colour scheme does not provide a hue value in {nameof(getBaseHue)}.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public ConfirmReGeneratePageDialog(Action<bool> okAction)
{
new PopupDialogOkButton
{
Text = @"Yes. Go for it.",
Text = "Yes. Go for it.",
Action = () => okAction(true),
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!",
Text = "No! Abort mission!",
Action = () => okAction(false),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public DeleteSingerDialog(Action<bool> okAction)
{
new PopupDialogOkButton
{
Text = @"Yes. Go for it.",
Text = "Yes. Go for it.",
Action = () => okAction(true),
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!",
Text = "No! Abort mission!",
Action = () => okAction(false),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public DeleteLanguagePopupDialog(CultureInfo currentLanguage, Action<bool> okAct
{
new PopupDialogOkButton
{
Text = @"Yes. Go for it.",
Text = "Yes. Go for it.",
Action = () => okAction(true),
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!",
Text = "No! Abort mission!",
Action = () => okAction(false),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public SelectedLanguage()
[BackgroundDependencyLoader]
private void load(OverlayColourProvider? colourProvider)
{
background.Colour = colourProvider?.Background5 ?? Color4Extensions.FromHex(@"1c2125");
background.Colour = colourProvider?.Background5 ?? Color4Extensions.FromHex("1c2125");
}

public string Text
Expand Down Expand Up @@ -186,7 +186,7 @@ private void load(OverlayColourProvider? colourProvider)
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider?.Background5 ?? Color4Extensions.FromHex(@"1c2125"),
Colour = colourProvider?.Background5 ?? Color4Extensions.FromHex("1c2125"),
},
new Container
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public UseLanguageDetectorPopupDialog(Action<bool> okAction)
{
new PopupDialogOkButton
{
Text = @"OK",
Text = "OK",
Action = () => okAction(true),
},
new PopupDialogCancelButton
{
Text = @"Cancel",
Text = "Cancel",
Action = () => okAction(false),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,23 @@ private PopupDialog createLoadExceptionDialog(FileLoadException loadException)
=> new OkPopupDialog
{
Icon = FontAwesome.Solid.Bug,
HeaderText = @"File loading error",
HeaderText = "File loading error",
BodyText = loadException.Message,
};

private PopupDialog createUnknownExceptionDialog()
=> new OkPopupDialog
{
Icon = FontAwesome.Solid.Bug,
HeaderText = @"Unknown error",
BodyText = @"Unknown error QAQa.",
HeaderText = "Unknown error",
BodyText = "Unknown error QAQa.",
};

private PopupDialog createCompleteDialog()
=> new OkPopupDialog(_ => { Complete(); })
{
Icon = FontAwesome.Regular.CheckCircle,
HeaderText = @"Import success",
HeaderText = "Import success",
BodyText = "Lyrics has been imported.",
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ public partial class ImportLyricDialog : PopupDialog
public ImportLyricDialog(Action<bool> resetAction)
{
Icon = FontAwesome.Regular.TrashAlt;
HeaderText = @"Confirm import lyric file?";
HeaderText = "Confirm import lyric file?";
BodyText = "Import lyric file will clean-up all exist lyric.";

Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Go for it.",
Text = "Yes. Go for it.",
Action = () => resetAction(true),
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!",
Text = "No! Abort mission!",
Action = () => resetAction(false),
},
};
Expand Down
Loading

0 comments on commit 4a6ffdc

Please sign in to comment.