1
0
mirror of synced 2024-11-24 04:20:10 +01:00

added more exception guards

This commit is contained in:
NotImplementedLife 2023-07-30 08:32:58 +03:00
parent dfe174b4e7
commit 68fa74593f
3 changed files with 47 additions and 46 deletions

View File

@ -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<SongCard> Selection = new();
public HashSet<SongCard> 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();
@ -288,7 +289,7 @@ namespace TaikoSoundEditor.Controls
}
CutActive = RemoveActive = Selection.Count > 0;
}
});
private bool _CutActive = false;
public bool CutActive
@ -327,7 +328,7 @@ 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)
@ -348,7 +349,7 @@ namespace TaikoSoundEditor.Controls
CutActive = RemoveActive = Selection.Count > 0;
MusicOrdersPanel.Invalidate();
}
});
private bool _PasteMode = false;
@ -363,7 +364,7 @@ namespace TaikoSoundEditor.Controls
}
private void PasteButton_Click(object sender, EventArgs e)
private void PasteButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() =>
{
PasteMode = !PasteMode;
@ -372,9 +373,9 @@ 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)
@ -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;

View File

@ -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;
var item = NewSoundsBox.SelectedItem as NewSongData;
LoadNewSongData(item);
}
});
#endregion
@ -194,7 +194,7 @@ namespace TaikoSoundEditor
}
});
private void SoundViewTab_SelectedIndexChanged(object sender, EventArgs e)
private void SoundViewTab_SelectedIndexChanged(object sender, EventArgs e) => ExceptionGuard.Run(() =>
{
if (SoundViewTab.SelectedTab == MusicOrderTab)
{
@ -220,7 +220,7 @@ namespace TaikoSoundEditor
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;
}
}
});
}
}

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>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;</History>
<History>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;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>