diff --git a/Controls/MusicOrderViewer.cs b/Controls/MusicOrderViewer.cs index 492b3e5..f23c075 100644 --- a/Controls/MusicOrderViewer.cs +++ b/Controls/MusicOrderViewer.cs @@ -3,6 +3,7 @@ using System.Drawing.Drawing2D; using TaikoSoundEditor.Data; using TaikoSoundEditor.Extensions; using TaikoSoundEditor.Properties; +using TaikoSoundEditor.Utils; namespace TaikoSoundEditor.Controls { @@ -150,15 +151,15 @@ namespace TaikoSoundEditor.Controls } } - private void MusicOrdersPanel_Resize(object sender, EventArgs e) + private void MusicOrdersPanel_Resize(object sender, EventArgs e) => ExceptionGuard.Run(() => { MusicOrdersPanel.Invalidate(); - } + }); - private void MusicOrdersPanel_Paint(object sender, PaintEventArgs e) + private void MusicOrdersPanel_Paint(object sender, PaintEventArgs e) => ExceptionGuard.Run(() => { RefreshMusicOrdersPanel(e.Graphics); - } + }); private void LeftButton_Click(object sender, EventArgs e) { @@ -170,21 +171,21 @@ namespace TaikoSoundEditor.Controls if (CurrentPage < PagesCount - 1) CurrentPage++; } - private void MusicOrdersPanel_MouseMove(object sender, MouseEventArgs e) + private void MusicOrdersPanel_MouseMove(object sender, MouseEventArgs e) => ExceptionGuard.Run(() => { Invalidate(); - } + }); - private void MusicOrdersPanel_MouseLeave(object sender, EventArgs e) + private void MusicOrdersPanel_MouseLeave(object sender, EventArgs e) => ExceptionGuard.Run(() => { Invalidate(); - } + }); public HashSet Selection = new(); - public HashSet CutSelection = new(); + public HashSet CutSelection = new(); - private void MusicOrdersPanel_MouseDown(object sender, MouseEventArgs e) + private void MusicOrdersPanel_MouseDown(object sender, MouseEventArgs e) => ExceptionGuard.Run(() => { if (e.Button != MouseButtons.Left) return; Select(); @@ -208,13 +209,13 @@ namespace TaikoSoundEditor.Controls SongCard before = null, after = null; - for (int i = index; i < SongCards.Count; i++) + for (int i = index; i < SongCards.Count; i++) if (!SongCards[i].IsCut) { before = SongCards[i]; break; } - for (int i = index - 1; i >= 0; i--) + for (int i = index - 1; i >= 0; i--) if (!SongCards[i].IsCut) { after = SongCards[i]; @@ -234,7 +235,7 @@ namespace TaikoSoundEditor.Controls message = $"Do you want to move the selected songs before {before.Id}?"; } } - else if(after != null) + else if (after != null) { message = $"Do you want to move the selected songs after {after.Id}?"; } @@ -243,7 +244,7 @@ namespace TaikoSoundEditor.Controls return; SongCards.RemoveAll(CutSelection.Contains); - var ix = after != null ? SongCards.IndexOf(after)+1 : before != null ? SongCards.IndexOf(before) : 0; + var ix = after != null ? SongCards.IndexOf(after) + 1 : before != null ? SongCards.IndexOf(before) : 0; SongCards.InsertRange(ix, CutSelection); foreach (var c in CutSelection) c.IsCut = false; @@ -258,11 +259,11 @@ namespace TaikoSoundEditor.Controls if (index < 0 || index >= SongCards.Count) return; - var card = SongCards[index]; + var card = SongCards[index]; if (Form.ModifierKeys == Keys.Control) { - if(card.IsSelected) + if (card.IsSelected) { card.IsSelected = false; Selection.Remove(card); @@ -276,7 +277,7 @@ namespace TaikoSoundEditor.Controls } else { - foreach(var sel in Selection) + foreach (var sel in Selection) { sel.IsSelected = false; } @@ -288,7 +289,7 @@ namespace TaikoSoundEditor.Controls } CutActive = RemoveActive = Selection.Count > 0; - } + }); private bool _CutActive = false; public bool CutActive @@ -327,16 +328,16 @@ namespace TaikoSoundEditor.Controls } } - private void CutButton_Click(object sender, EventArgs e) + private void CutButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() => { PasteMode = false; - foreach(var card in CutSelection) + foreach (var card in CutSelection) { card.IsCut = false; } CutSelection.Clear(); - foreach(var card in Selection) + foreach (var card in Selection) { card.IsCut = true; card.IsSelected = false; @@ -348,7 +349,7 @@ namespace TaikoSoundEditor.Controls CutActive = RemoveActive = Selection.Count > 0; MusicOrdersPanel.Invalidate(); - } + }); private bool _PasteMode = false; @@ -360,10 +361,10 @@ namespace TaikoSoundEditor.Controls _PasteMode = value; PasteButton.FlatAppearance.BorderSize = _PasteMode ? 1 : 0; } - } + } - private void PasteButton_Click(object sender, EventArgs e) + private void PasteButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() => { PasteMode = !PasteMode; @@ -372,20 +373,20 @@ namespace TaikoSoundEditor.Controls Selection.Clear(); CutActive = RemoveActive = false; MusicOrdersPanel.Invalidate(); - } + }); - private void RemoveButton_Click(object sender, EventArgs e) + private void RemoveButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() => { var toRemove = Selection.ToList(); if (Selection.Count == 0) return; - var message = $"Are you sure you want to remove {toRemove.Count} song{(toRemove.Count!=1?"s":"")}?"; + var message = $"Are you sure you want to remove {toRemove.Count} song{(toRemove.Count != 1 ? "s" : "")}?"; if (MessageBox.Show(message, "Remove?", MessageBoxButtons.YesNo) != DialogResult.Yes) return; - foreach(var card in Selection) + foreach (var card in Selection) { SongCards.Remove(card); CutSelection.Remove(card); @@ -398,7 +399,7 @@ namespace TaikoSoundEditor.Controls if (!PasteActive) PasteMode = false; CurrentPage = CurrentPage; MusicOrdersPanel.Invalidate(); - } + }); public delegate void OnSongRemoved(MusicOrderViewer sender, MusicOrder mo); public event OnSongRemoved SongRemoved; diff --git a/MainForm.cs b/MainForm.cs index 1adbb07..76cd8f1 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -23,7 +23,7 @@ namespace TaikoSoundEditor private void TabControl_SelectedIndexChanged(object sender, EventArgs e) { - Logger.Info($"Commuted to tab {TabControl.SelectedIndex}"); + Logger.Info($"Commuted to tab {TabControl.SelectedIndex}.{TabControl.Name}"); } #region Editor @@ -96,7 +96,7 @@ namespace TaikoSoundEditor private bool indexChanging = false; - private void LoadedMusicBox_SelectedIndexChanged(object sender, EventArgs e) + private void LoadedMusicBox_SelectedIndexChanged(object sender, EventArgs e) => ExceptionGuard.Run(() => { if (indexChanging) return; indexChanging = true; @@ -105,21 +105,21 @@ namespace TaikoSoundEditor Logger.Info($"Selection Changed MusicItem: {item}"); LoadMusicInfo(item); indexChanging = false; - } + }); - private void EditorTable_Resize(object sender, EventArgs e) + private void EditorTable_Resize(object sender, EventArgs e) => ExceptionGuard.Run(() => { WordsGB.Height = WordSubGB.Height = WordDetailGB.Height = EditorTable.Height / 3; - } + }); - private void NewSoundsBox_SelectedIndexChanged(object sender, EventArgs e) + private void NewSoundsBox_SelectedIndexChanged(object sender, EventArgs e) => ExceptionGuard.Run(() => { if (indexChanging) return; indexChanging = true; - LoadedMusicBox.SelectedItem = null; + LoadedMusicBox.SelectedItem = null; var item = NewSoundsBox.SelectedItem as NewSongData; LoadNewSongData(item); - } + }); #endregion @@ -194,16 +194,16 @@ namespace TaikoSoundEditor } }); - private void SoundViewTab_SelectedIndexChanged(object sender, EventArgs e) + private void SoundViewTab_SelectedIndexChanged(object sender, EventArgs e) => ExceptionGuard.Run(() => { - if(SoundViewTab.SelectedTab==MusicOrderTab) + if (SoundViewTab.SelectedTab == MusicOrderTab) { MusicOrderViewer.Invalidate(); return; } if (!(SoundViewTab.SelectedTab == SoundViewerExpert || SoundViewTab.SelectedTab == SoundViewerSimple)) - return; + return; if (LoadedMusicBox.SelectedItem != null) { @@ -213,14 +213,14 @@ namespace TaikoSoundEditor return; } - if(NewSoundsBox.SelectedItem!=null) + if (NewSoundsBox.SelectedItem != null) { var item = NewSoundsBox.SelectedItem as NewSongData; Logger.Info($"Tab switched, reloading NewSongData: {item}"); LoadNewSongData(item); return; - } - } + } + }); private bool simpleBoxLoading = false; private void SimpleBoxChanged(object sender, EventArgs e) => ExceptionGuard.Run(() => @@ -284,7 +284,7 @@ namespace TaikoSoundEditor throw new InvalidOperationException("Nothing to remove."); }); - private void LocateInMusicOrderButton_Click(object sender, EventArgs e) + private void LocateInMusicOrderButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() => { if (LoadedMusicBox.SelectedItem != null) { @@ -305,6 +305,6 @@ namespace TaikoSoundEditor } return; } - } + }); } } \ No newline at end of file diff --git a/Properties/PublishProfiles/FolderProfile.pubxml.user b/Properties/PublishProfiles/FolderProfile.pubxml.user index c4dbf23..9499f4d 100644 --- a/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2023-07-29T08:28:56.2445862Z;True|2023-07-29T11:05:03.3876668+03:00;True|2023-07-29T10:54:04.8963992+03:00;True|2023-07-29T10:22:03.4096107+03:00;True|2023-07-29T10:05:26.6712083+03:00;True|2023-07-28T19:30:15.3174413+03:00;True|2023-07-22T19:07:39.3718711+03:00;True|2023-07-22T19:06:41.2393088+03:00;True|2023-07-22T12:07:26.2620601+03:00;True|2023-07-22T12:06:39.9230498+03:00;True|2023-07-22T11:29:18.0153916+03:00;True|2023-07-22T08:23:07.5000923+03:00;True|2023-07-21T20:03:15.6598520+03:00;True|2023-07-21T19:41:13.2800435+03:00;True|2023-07-19T13:08:33.4726289+03:00;True|2023-07-19T12:08:17.2430335+03:00;True|2023-07-18T09:38:50.7615921+03:00;True|2023-07-18T09:25:23.0403589+03:00;True|2023-07-17T17:57:08.1469738+03:00;True|2023-07-17T11:28:41.9554245+03:00;True|2023-07-17T11:15:26.2194507+03:00; + True|2023-07-30T05:20:21.5020489Z;True|2023-07-29T11:28:56.2445862+03:00;True|2023-07-29T11:05:03.3876668+03:00;True|2023-07-29T10:54:04.8963992+03:00;True|2023-07-29T10:22:03.4096107+03:00;True|2023-07-29T10:05:26.6712083+03:00;True|2023-07-28T19:30:15.3174413+03:00;True|2023-07-22T19:07:39.3718711+03:00;True|2023-07-22T19:06:41.2393088+03:00;True|2023-07-22T12:07:26.2620601+03:00;True|2023-07-22T12:06:39.9230498+03:00;True|2023-07-22T11:29:18.0153916+03:00;True|2023-07-22T08:23:07.5000923+03:00;True|2023-07-21T20:03:15.6598520+03:00;True|2023-07-21T19:41:13.2800435+03:00;True|2023-07-19T13:08:33.4726289+03:00;True|2023-07-19T12:08:17.2430335+03:00;True|2023-07-18T09:38:50.7615921+03:00;True|2023-07-18T09:25:23.0403589+03:00;True|2023-07-17T17:57:08.1469738+03:00;True|2023-07-17T11:28:41.9554245+03:00;True|2023-07-17T11:15:26.2194507+03:00; \ No newline at end of file