mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-03-21 17:48:28 -05:00
Minor tweaks
use switch expr for auto-backup load trycatch plugin activator (just in case) extract dialog prompt for easier reading remove dead method
This commit is contained in:
parent
9793e9f1a0
commit
44589e6fbb
|
|
@ -174,11 +174,6 @@ private static Image GetSprite(PKM pk, SaveFile sav, int box, int slot, bool fla
|
|||
Resources.party1, Resources.party2, Resources.party3, Resources.party4, Resources.party5, Resources.party6,
|
||||
};
|
||||
|
||||
public static void GetSpriteGlow(PKM pk, byte[] bgr, out byte[] pixels, out Image baseSprite, bool forceHollow = false)
|
||||
{
|
||||
GetSpriteGlow(pk, bgr[0], bgr[1], bgr[2], out pixels, out baseSprite, forceHollow);
|
||||
}
|
||||
|
||||
public static void GetSpriteGlow(PKM pk, byte blue, byte green, byte red, out byte[] pixels, out Image baseSprite, bool forceHollow = false)
|
||||
{
|
||||
bool egg = pk.IsEgg;
|
||||
|
|
|
|||
|
|
@ -190,12 +190,12 @@ private void FormLoadInitialFiles(string[] args)
|
|||
private bool LoadAutoDetectedSAV()
|
||||
{
|
||||
var startup = Settings.Startup;
|
||||
if (startup.AutoLoadSaveOnStartup == AutoLoadSetting.RecentBackup)
|
||||
return LoadMostRecentBackup();
|
||||
if (startup.AutoLoadSaveOnStartup == AutoLoadSetting.LastLoaded)
|
||||
return LoadMostRecentlyLoaded(startup.RecentlyLoaded);
|
||||
|
||||
return false;
|
||||
return startup.AutoLoadSaveOnStartup switch
|
||||
{
|
||||
AutoLoadSetting.RecentBackup => LoadMostRecentBackup(),
|
||||
AutoLoadSetting.LastLoaded => LoadMostRecentlyLoaded(startup.RecentlyLoaded),
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
private bool LoadMostRecentlyLoaded(IReadOnlyList<string> paths)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,15 @@ public static class PluginLoader
|
|||
{
|
||||
foreach (var t in pluginTypes)
|
||||
{
|
||||
var activate = (T?) Activator.CreateInstance(t);
|
||||
T? activate;
|
||||
try { activate = (T?)Activator.CreateInstance(t); }
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"Unable to load plugin [{t.Name}]: {t.FullName}", ex.Message);
|
||||
continue;
|
||||
}
|
||||
if (activate != null)
|
||||
yield return activate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ private void AddConstList(EventLabelCollection list, ushort[] values)
|
|||
lbl.Click += (sender, e) => mtb.Value = 0;
|
||||
bool updating = false;
|
||||
mtb.ValueChanged += ChangeConstValue;
|
||||
void ChangeConstValue(object sender, EventArgs e)
|
||||
void ChangeConstValue(object? sender, EventArgs e)
|
||||
{
|
||||
if (updating)
|
||||
return;
|
||||
|
|
@ -253,7 +253,8 @@ private void DiffSaves()
|
|||
return;
|
||||
}
|
||||
|
||||
if (DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Copy Event Constant diff to clipboard?"))
|
||||
var promptCopy = WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Copy Event Constant diff to clipboard?");
|
||||
if (promptCopy == DialogResult.Yes)
|
||||
WinFormsUtil.SetClipboardText(string.Join(Environment.NewLine, diff.WorkDiff));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user