mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-15 09:39:13 -05:00
Misc tweaks
No functional change
This commit is contained in:
parent
a471f1bd8c
commit
c19a4605d5
|
|
@ -686,7 +686,7 @@ private static string GetAbilityHeldItem(GameStrings strings, int ability, int i
|
|||
}
|
||||
}
|
||||
if (count == 0)
|
||||
return "";
|
||||
return string.Empty;
|
||||
|
||||
var result = new StringBuilder();
|
||||
int ctr = 0;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public sealed class StatDisplayConfig
|
|||
{
|
||||
Names = [],
|
||||
Separator = "/",
|
||||
ValueGap = "",
|
||||
ValueGap = string.Empty,
|
||||
AlwaysShow = true,
|
||||
};
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ public sealed class StatDisplayConfig
|
|||
{
|
||||
Names = [],
|
||||
Separator = "/",
|
||||
ValueGap = "",
|
||||
ValueGap = string.Empty,
|
||||
AlwaysShow = true,
|
||||
MinimumDigits = 2,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -97,14 +97,14 @@ public IReadOnlyList<string> Summarize()
|
|||
if (SetFlags.Count == 0)
|
||||
list.Add("None.");
|
||||
|
||||
list.Add("");
|
||||
list.Add(string.Empty);
|
||||
list.Add("Flags: OFF");
|
||||
list.Add("==========");
|
||||
list.AddRange(fOff);
|
||||
if (ClearedFlags.Count == 0)
|
||||
list.Add("None.");
|
||||
|
||||
list.Add("");
|
||||
list.Add(string.Empty);
|
||||
list.Add("Work:");
|
||||
list.Add("=====");
|
||||
if (WorkChanged.Count == 0)
|
||||
|
|
|
|||
|
|
@ -64,14 +64,14 @@ public IReadOnlyList<string> Summarize()
|
|||
if (SetFlags.Count == 0)
|
||||
list.Add("None.");
|
||||
|
||||
list.Add("");
|
||||
list.Add(string.Empty);
|
||||
list.Add("Flags: OFF");
|
||||
list.Add("==========");
|
||||
list.AddRange(fOff);
|
||||
if (ClearedFlags.Count == 0)
|
||||
list.Add("None.");
|
||||
|
||||
list.Add("");
|
||||
list.Add(string.Empty);
|
||||
list.Add("Work:");
|
||||
list.Add("=====");
|
||||
if (WorkChanged.Count == 0)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public IReadOnlyList<string> Summarize()
|
|||
if (SetFlags.Count == 0)
|
||||
list.Add("None.");
|
||||
|
||||
list.Add("");
|
||||
list.Add(string.Empty);
|
||||
list.Add("Flags: OFF");
|
||||
list.Add("==========");
|
||||
list.AddRange(fOff);
|
||||
|
|
@ -82,14 +82,14 @@ public IReadOnlyList<string> Summarize()
|
|||
if (SetFlags.Count == 0)
|
||||
list.Add("None.");
|
||||
|
||||
list.Add("");
|
||||
list.Add(string.Empty);
|
||||
list.Add("System: OFF");
|
||||
list.Add("==========");
|
||||
list.AddRange(sOff);
|
||||
if (ClearedSystem.Count == 0)
|
||||
list.Add("None.");
|
||||
|
||||
list.Add("");
|
||||
list.Add(string.Empty);
|
||||
list.Add("Work:");
|
||||
list.Add("=====");
|
||||
if (WorkChanged.Count == 0)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ internal static class Encounters3Colo
|
|||
/// <summary>
|
||||
/// When transferring from Gen3->Gen4, a Spanish OT:Duking has the Á char changed to い.
|
||||
/// </summary>
|
||||
/// <see cref="StringConverter345.TransferGlyphs34(System.ReadOnlySpan{byte},int,int,System.Span{byte})"/> cref=""/>
|
||||
/// <remarks>
|
||||
/// <see cref="StringConverter345.TransferGlyphs34(System.ReadOnlySpan{byte},int,int,System.Span{byte})"/>
|
||||
/// </remarks>
|
||||
internal const string TrainerNameDukingSpanish4 = "GERMいN";
|
||||
|
||||
internal static readonly EncounterGift3Colo[] Gifts =
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public static void Reload()
|
|||
|
||||
private static BinLinkerAccessor Get([ConstantExpected] string resource, [Length(2, 2)] ReadOnlySpan<byte> ident)
|
||||
{
|
||||
var exePath = Path.GetDirectoryName(Environment.ProcessPath) ?? "";
|
||||
var exePath = Path.GetDirectoryName(Environment.ProcessPath) ?? string.Empty;
|
||||
var file = $"encounter_{resource}.pkl";
|
||||
var fullPath = Path.Combine(exePath, file);
|
||||
var data = File.Exists(fullPath) ? File.ReadAllBytes(fullPath) : Util.GetBinaryResource(file);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public sealed record EncounterTrade4RanchGift : IEncounterable, IEncounterMatch,
|
|||
4 => "GIULIA",
|
||||
5 => "EUKALIA",
|
||||
7 => "Eulalia",
|
||||
_ => "",
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
private const string _name = "My Pokémon Ranch - Trade";
|
||||
|
|
|
|||
|
|
@ -138,10 +138,9 @@ private void SetPINGA(PB8 pk, in EncounterCriteria criteria, PersonalInfo8BDSP p
|
|||
else if (isRandomGender)
|
||||
{
|
||||
var rand = rng.NextUInt(252) + 1;
|
||||
var randGender = rand < ratio ? (byte)1 : (byte)0;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(randGender))
|
||||
gender = rand < ratio ? (byte)1 : (byte)0;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(gender))
|
||||
continue;
|
||||
gender = randGender;
|
||||
}
|
||||
|
||||
// nature
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public SaveHandlerSplitResult TrySplit(ReadOnlySpan<byte> input)
|
|||
// No authentication to see if it actually is a header; no size collisions expected.
|
||||
var header = input[..sizeHeader].ToArray();
|
||||
var data = input[sizeHeader..].ToArray();
|
||||
return new SaveHandlerSplitResult(data, header, [], this);
|
||||
return new SaveHandlerSplitResult(data, header, default, this);
|
||||
}
|
||||
|
||||
public void Finalize(Span<byte> data) { }
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public sealed class SaveHandlerDeSmuME : ISaveHandler
|
|||
var footer = input[RealSize..].ToArray();
|
||||
var data = input[..RealSize].ToArray();
|
||||
|
||||
return new SaveHandlerSplitResult(data, [], footer, this);
|
||||
return new SaveHandlerSplitResult(data, default, footer, this);
|
||||
}
|
||||
|
||||
public void Finalize(Span<byte> data) { }
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public SaveHandlerSplitResult TrySplit(ReadOnlySpan<byte> input)
|
|||
var footer = input[RealSize..].ToArray();
|
||||
var data = input[..RealSize].ToArray();
|
||||
|
||||
return new SaveHandlerSplitResult(data, [], footer, this);
|
||||
return new SaveHandlerSplitResult(data, default, footer, this);
|
||||
}
|
||||
|
||||
public void Finalize(Span<byte> data) { }
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ private static bool IsGameMatchHeader(ReadOnlySpan<byte> data, ReadOnlySpan<char
|
|||
var header = input[..headerSize].ToArray();
|
||||
var data = input[headerSize..].ToArray();
|
||||
|
||||
return new SaveHandlerSplitResult(data, header, [], this);
|
||||
return new SaveHandlerSplitResult(data, header, default, this);
|
||||
}
|
||||
|
||||
public void Finalize(Span<byte> data) { }
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public sealed class SaveHandlerNSO : ISaveHandler
|
|||
var obj = new UnpackedHeaderNSOReadOnly(input);
|
||||
var header = input[..obj.Length];
|
||||
var data = input[obj.Length..];
|
||||
return new SaveHandlerSplitResult([..data], [..header], [], this);
|
||||
return new SaveHandlerSplitResult([..data], header.ToArray(), default, this);
|
||||
}
|
||||
|
||||
public void Finalize(Span<byte> input)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -9,10 +11,10 @@ namespace PKHeX.Core;
|
|||
/// <param name="Header">The header segment of the save operation, which may contain metadata or other relevant information.</param>
|
||||
/// <param name="Footer">The footer segment of the save operation, which may contain additional metadata or checksums.</param>
|
||||
/// <param name="Handler">The save handler responsible for processing the save operation, providing methods for recognition and finalization.</param>
|
||||
public sealed class SaveHandlerSplitResult(byte[] Data, byte[] Header, byte[] Footer, ISaveHandler Handler)
|
||||
public sealed class SaveHandlerSplitResult(byte[] Data, Memory<byte> Header, Memory<byte> Footer, ISaveHandler Handler)
|
||||
{
|
||||
public readonly byte[] Header = Header;
|
||||
public readonly byte[] Footer = Footer;
|
||||
public readonly Memory<byte> Header = Header;
|
||||
public readonly Memory<byte> Footer = Footer;
|
||||
public readonly byte[] Data = Data;
|
||||
public readonly ISaveHandler Handler = Handler;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ protected override void OnEnter(EventArgs e)
|
|||
Invalidate();
|
||||
base.OnEnter(e);
|
||||
AccessibilityObject.RaiseAutomationNotification(AutomationNotificationKind.Other,
|
||||
AutomationNotificationProcessing.All, AccessibleDescription ?? AccessibleName ?? "");
|
||||
AutomationNotificationProcessing.All, AccessibleDescription ?? AccessibleName ?? string.Empty);
|
||||
}
|
||||
|
||||
protected override void OnLeave(EventArgs e)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ protected override void OnEnter(EventArgs e)
|
|||
Invalidate();
|
||||
base.OnEnter(e);
|
||||
AccessibilityObject.RaiseAutomationNotification(AutomationNotificationKind.Other,
|
||||
AutomationNotificationProcessing.All, AccessibleDescription ?? AccessibleName ?? "");
|
||||
AutomationNotificationProcessing.All, AccessibleDescription ?? AccessibleName ?? string.Empty);
|
||||
}
|
||||
protected override void OnLeave(EventArgs e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ public string UpdateNatureModification(Nature nature)
|
|||
var decr = L_Stats[dn + 1];
|
||||
incr.ForeColor = StatIncreased;
|
||||
decr.ForeColor = StatDecreased;
|
||||
return $"+{incr.Text} / -{decr.Text}".Replace(":", "");
|
||||
return $"+{incr.Text} / -{decr.Text}".Replace(":", string.Empty);
|
||||
}
|
||||
|
||||
public void SetATKIVGender(byte gender)
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ public static string AppendEncounterInfo(LegalityAnalysis la, string text)
|
|||
{
|
||||
var result = new List<string>(8) { text };
|
||||
if (text.Length != 0) // add a blank line between the set and the encounter info if isn't already a blank line
|
||||
result.Add("");
|
||||
result.Add(string.Empty);
|
||||
LegalityFormatting.AddEncounterInfo(la, result);
|
||||
return string.Join(Environment.NewLine, result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ private void ClickShowdownImportPKM(object sender, EventArgs e)
|
|||
// Get Simulator Data
|
||||
var text = Clipboard.GetText();
|
||||
var sets = BattleTemplateTeams.TryGetSets(text);
|
||||
var set = sets.FirstOrDefault() ?? new(""); // take only first set
|
||||
var set = sets.FirstOrDefault() ?? new(string.Empty); // take only first set
|
||||
|
||||
if (set.Species == 0)
|
||||
{ WinFormsUtil.Alert(MsgSimulatorFailClipboard); return; }
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<TargetFramework>net9.0-windows</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
||||
<ApplicationHighDpiMode>SystemAware</ApplicationHighDpiMode>
|
||||
<ForceDesignerDpiUnaware>true</ForceDesignerDpiUnaware>
|
||||
<CETCompat>false</CETCompat>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ private void PopEntry(ushort species, byte form, string name, IPersonalTable pt)
|
|||
int c = 0;
|
||||
|
||||
var bst = p.GetBaseStatTotal();
|
||||
cells[c++].Value = species.ToString(pt.MaxSpeciesID > 999 ? "0000" : "000") + (form > 0 ? $"-{form:00}" : "");
|
||||
cells[c++].Value = species.ToString(pt.MaxSpeciesID > 999 ? "0000" : "000") + (form > 0 ? $"-{form:00}" : string.Empty);
|
||||
cells[c++].Value = SpriteUtil.GetSprite(species, form, 0, 0, 0, false, Shiny.Never, SAV.Context);
|
||||
cells[c++].Value = name;
|
||||
cells[c++].Value = GetIsNative(p, species);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ private static ReadOnlySpan<char> GetTranslationFile(ReadOnlySpan<char> lang)
|
|||
}
|
||||
|
||||
var txt = (string?)Properties.Resources.ResourceManager.GetObject(file);
|
||||
return txt ?? "";
|
||||
return txt ?? string.Empty;
|
||||
}
|
||||
|
||||
private static IEnumerable<object> GetTranslatableControls(Control f)
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ internal static void HorizontallyCenter(this Control child, Control parent)
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches upwards through the control hierarchy to find the first parent control of type <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <param name="sender">Child control to start searching from.</param>
|
||||
/// <returns>The first parent control of type <typeparamref name="T"/>, or null if none found.</returns>
|
||||
public static T? GetUnderlyingControl<T>(object sender) where T : class
|
||||
{
|
||||
while (true)
|
||||
|
|
@ -77,6 +82,11 @@ internal static void HorizontallyCenter(this Control child, Control parent)
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a window of type <typeparamref name="T"/> already exists and brings it to the front if it does.
|
||||
/// </summary>
|
||||
/// <param name="parent">The parent form to center the window on.</param>
|
||||
/// <returns><c>true</c> if the window exists and was brought to the front; otherwise, <c>false</c>.</returns>
|
||||
public static bool OpenWindowExists<T>(this Form parent) where T : Form
|
||||
{
|
||||
var form = FirstFormOfType<T>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user