added more exception guards
This commit is contained in:
parent
dfe174b4e7
commit
68fa74593f
@ -3,6 +3,7 @@ using System.Drawing.Drawing2D;
|
|||||||
using TaikoSoundEditor.Data;
|
using TaikoSoundEditor.Data;
|
||||||
using TaikoSoundEditor.Extensions;
|
using TaikoSoundEditor.Extensions;
|
||||||
using TaikoSoundEditor.Properties;
|
using TaikoSoundEditor.Properties;
|
||||||
|
using TaikoSoundEditor.Utils;
|
||||||
|
|
||||||
namespace TaikoSoundEditor.Controls
|
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();
|
MusicOrdersPanel.Invalidate();
|
||||||
}
|
});
|
||||||
|
|
||||||
private void MusicOrdersPanel_Paint(object sender, PaintEventArgs e)
|
private void MusicOrdersPanel_Paint(object sender, PaintEventArgs e) => ExceptionGuard.Run(() =>
|
||||||
{
|
{
|
||||||
RefreshMusicOrdersPanel(e.Graphics);
|
RefreshMusicOrdersPanel(e.Graphics);
|
||||||
}
|
});
|
||||||
|
|
||||||
private void LeftButton_Click(object sender, EventArgs e)
|
private void LeftButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -170,21 +171,21 @@ namespace TaikoSoundEditor.Controls
|
|||||||
if (CurrentPage < PagesCount - 1) CurrentPage++;
|
if (CurrentPage < PagesCount - 1) CurrentPage++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MusicOrdersPanel_MouseMove(object sender, MouseEventArgs e)
|
private void MusicOrdersPanel_MouseMove(object sender, MouseEventArgs e) => ExceptionGuard.Run(() =>
|
||||||
{
|
{
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
});
|
||||||
|
|
||||||
private void MusicOrdersPanel_MouseLeave(object sender, EventArgs e)
|
private void MusicOrdersPanel_MouseLeave(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
||||||
{
|
{
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
});
|
||||||
|
|
||||||
public HashSet<SongCard> Selection = new();
|
public HashSet<SongCard> Selection = new();
|
||||||
public HashSet<SongCard> CutSelection = 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;
|
if (e.Button != MouseButtons.Left) return;
|
||||||
Select();
|
Select();
|
||||||
@ -288,7 +289,7 @@ namespace TaikoSoundEditor.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
CutActive = RemoveActive = Selection.Count > 0;
|
CutActive = RemoveActive = Selection.Count > 0;
|
||||||
}
|
});
|
||||||
|
|
||||||
private bool _CutActive = false;
|
private bool _CutActive = false;
|
||||||
public bool CutActive
|
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;
|
PasteMode = false;
|
||||||
foreach (var card in CutSelection)
|
foreach (var card in CutSelection)
|
||||||
@ -348,7 +349,7 @@ namespace TaikoSoundEditor.Controls
|
|||||||
CutActive = RemoveActive = Selection.Count > 0;
|
CutActive = RemoveActive = Selection.Count > 0;
|
||||||
|
|
||||||
MusicOrdersPanel.Invalidate();
|
MusicOrdersPanel.Invalidate();
|
||||||
}
|
});
|
||||||
|
|
||||||
private bool _PasteMode = false;
|
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;
|
PasteMode = !PasteMode;
|
||||||
|
|
||||||
@ -372,9 +373,9 @@ namespace TaikoSoundEditor.Controls
|
|||||||
Selection.Clear();
|
Selection.Clear();
|
||||||
CutActive = RemoveActive = false;
|
CutActive = RemoveActive = false;
|
||||||
MusicOrdersPanel.Invalidate();
|
MusicOrdersPanel.Invalidate();
|
||||||
}
|
});
|
||||||
|
|
||||||
private void RemoveButton_Click(object sender, EventArgs e)
|
private void RemoveButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
||||||
{
|
{
|
||||||
var toRemove = Selection.ToList();
|
var toRemove = Selection.ToList();
|
||||||
if (Selection.Count == 0)
|
if (Selection.Count == 0)
|
||||||
@ -398,7 +399,7 @@ namespace TaikoSoundEditor.Controls
|
|||||||
if (!PasteActive) PasteMode = false;
|
if (!PasteActive) PasteMode = false;
|
||||||
CurrentPage = CurrentPage;
|
CurrentPage = CurrentPage;
|
||||||
MusicOrdersPanel.Invalidate();
|
MusicOrdersPanel.Invalidate();
|
||||||
}
|
});
|
||||||
|
|
||||||
public delegate void OnSongRemoved(MusicOrderViewer sender, MusicOrder mo);
|
public delegate void OnSongRemoved(MusicOrderViewer sender, MusicOrder mo);
|
||||||
public event OnSongRemoved SongRemoved;
|
public event OnSongRemoved SongRemoved;
|
||||||
|
22
MainForm.cs
22
MainForm.cs
@ -23,7 +23,7 @@ namespace TaikoSoundEditor
|
|||||||
|
|
||||||
private void TabControl_SelectedIndexChanged(object sender, EventArgs e)
|
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
|
#region Editor
|
||||||
@ -96,7 +96,7 @@ namespace TaikoSoundEditor
|
|||||||
|
|
||||||
private bool indexChanging = false;
|
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;
|
if (indexChanging) return;
|
||||||
indexChanging = true;
|
indexChanging = true;
|
||||||
@ -105,21 +105,21 @@ namespace TaikoSoundEditor
|
|||||||
Logger.Info($"Selection Changed MusicItem: {item}");
|
Logger.Info($"Selection Changed MusicItem: {item}");
|
||||||
LoadMusicInfo(item);
|
LoadMusicInfo(item);
|
||||||
indexChanging = false;
|
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;
|
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;
|
if (indexChanging) return;
|
||||||
indexChanging = true;
|
indexChanging = true;
|
||||||
LoadedMusicBox.SelectedItem = null;
|
LoadedMusicBox.SelectedItem = null;
|
||||||
var item = NewSoundsBox.SelectedItem as NewSongData;
|
var item = NewSoundsBox.SelectedItem as NewSongData;
|
||||||
LoadNewSongData(item);
|
LoadNewSongData(item);
|
||||||
}
|
});
|
||||||
|
|
||||||
#endregion
|
#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)
|
if (SoundViewTab.SelectedTab == MusicOrderTab)
|
||||||
{
|
{
|
||||||
@ -220,7 +220,7 @@ namespace TaikoSoundEditor
|
|||||||
LoadNewSongData(item);
|
LoadNewSongData(item);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
private bool simpleBoxLoading = false;
|
private bool simpleBoxLoading = false;
|
||||||
private void SimpleBoxChanged(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
private void SimpleBoxChanged(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
||||||
@ -284,7 +284,7 @@ namespace TaikoSoundEditor
|
|||||||
throw new InvalidOperationException("Nothing to remove.");
|
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)
|
if (LoadedMusicBox.SelectedItem != null)
|
||||||
{
|
{
|
||||||
@ -305,6 +305,6 @@ namespace TaikoSoundEditor
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
-->
|
-->
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<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 />
|
<LastFailureDetails />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user