mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-20 11:14:43 -05:00
Simplify font logic
dont bother trycatching stuff that shouldn't fail
This commit is contained in:
@@ -22,7 +22,7 @@ public PKMEditor()
|
||||
GB_CurrentMoves.Click += ClickMoves;
|
||||
GB_RelearnMoves.Click += ClickMoves;
|
||||
|
||||
TB_Nickname.Font = FontUtil.GetPKXFont(11);
|
||||
TB_Nickname.Font = FontUtil.GetPKXFont();
|
||||
TB_OT.Font = (Font)TB_Nickname.Font.Clone();
|
||||
TB_OTt2.Font = (Font)TB_Nickname.Font.Clone();
|
||||
|
||||
@@ -312,7 +312,7 @@ public void UpdateUnicode(IReadOnlyList<string> symbols)
|
||||
else
|
||||
{
|
||||
BTN_Shinytize.Text = Draw.ShinyUnicode;
|
||||
TB_Nickname.Font = TB_OT.Font = TB_OTt2.Font = FontUtil.GetPKXFont(11);
|
||||
TB_Nickname.Font = TB_OT.Font = TB_OTt2.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
// Switch active gender labels to new if they are active.
|
||||
|
||||
@@ -62,7 +62,7 @@ private void RefreshImage()
|
||||
{
|
||||
SuspendLayout();
|
||||
ResumeLayout();
|
||||
Font font = !Main.Unicode ? Font : FontUtil.GetPKXFont((float)8.25);
|
||||
Font font = !Main.Unicode ? Font : FontUtil.GetPKXFont(8.25f);
|
||||
PB_QR.BackgroundImage = QRImageUtil.GetQRImageExtended(font, qr, icon, PB_QR.Width, PB_QR.Height, Lines, extraText);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public TrashEditor(TextBoxBase TB_NN, byte[] raw, SaveFile sav)
|
||||
if (raw != null)
|
||||
AddTrashEditing(raw.Length);
|
||||
|
||||
var f = FontUtil.GetPKXFont(12F);
|
||||
var f = FontUtil.GetPKXFont();
|
||||
AddCharEditing(f);
|
||||
TB_Text.MaxLength = TB_NN.MaxLength;
|
||||
TB_Text.Text = TB_NN.Text;
|
||||
|
||||
@@ -353,32 +353,24 @@ private static void TryAddPKMsFromFolder(ConcurrentBag<PKM> dbTemp, string file,
|
||||
|
||||
private static void TryAddPKMsFromSaveFilePath(ConcurrentBag<PKM> dbTemp, string file, string externalFilePrefix)
|
||||
{
|
||||
try
|
||||
var sav = SaveUtil.GetVariantSAV(file);
|
||||
if (sav == null)
|
||||
{
|
||||
var sav = SaveUtil.GetVariantSAV(file);
|
||||
if (sav == null)
|
||||
{
|
||||
Console.WriteLine("Unable to load SaveFile: " + file);
|
||||
return;
|
||||
}
|
||||
|
||||
var path = externalFilePrefix + Path.GetFileName(file);
|
||||
if (sav.HasBox)
|
||||
{
|
||||
foreach (var pk in sav.BoxData)
|
||||
addPKM(pk);
|
||||
}
|
||||
|
||||
void addPKM(PKM pk)
|
||||
{
|
||||
pk.Identifier = Path.Combine(path, pk.Identifier);
|
||||
dbTemp.Add(pk);
|
||||
}
|
||||
Console.WriteLine("Unable to load SaveFile: " + file);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
var path = externalFilePrefix + Path.GetFileName(file);
|
||||
if (sav.HasBox)
|
||||
{
|
||||
Console.WriteLine("ERROR: Unable to load SaveFile: " + file);
|
||||
Console.WriteLine(ex.Message);
|
||||
foreach (var pk in sav.BoxData)
|
||||
addPKM(pk);
|
||||
}
|
||||
|
||||
void addPKM(PKM pk)
|
||||
{
|
||||
pk.Identifier = Path.Combine(path, pk.Identifier);
|
||||
dbTemp.Add(pk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ public SAV_HallOfFame(SaveFile sav)
|
||||
Setup();
|
||||
LB_DataEntry.SelectedIndex = 0;
|
||||
NUP_PartyIndex_ValueChanged(null, EventArgs.Empty);
|
||||
try { TB_Nickname.Font = TB_OT.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_Nickname.Font = TB_OT.Font = FontUtil.GetPKXFont();
|
||||
editing = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public SAV_SecretBase(SaveFile sav)
|
||||
SetupComboBoxes();
|
||||
PopFavorite();
|
||||
PopFavorite();
|
||||
TB_FOT.Font = TB_FT1.Font = TB_FT2.Font = TB_FSay1.Font = TB_FSay2.Font = TB_FSay3.Font = TB_FSay4.Font = LB_Favorite.Font = FontUtil.GetPKXFont(11);
|
||||
TB_FOT.Font = TB_FT1.Font = TB_FT2.Font = TB_FSay1.Font = TB_FSay2.Font = TB_FSay3.Font = TB_FSay4.Font = LB_Favorite.Font = FontUtil.GetPKXFont();
|
||||
CB_Ability.InitializeBinding();
|
||||
|
||||
LB_Favorite.SelectedIndex = 0;
|
||||
|
||||
@@ -18,13 +18,9 @@ public SAV_Trainer(SaveFile sav)
|
||||
SAV = (SAV6)(Origin = sav).Clone();
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try
|
||||
{
|
||||
TB_OTName.Font = FontUtil.GetPKXFont(11);
|
||||
if (SAV is SAV6XY)
|
||||
TB_TRNick.Font = TB_OTName.Font;
|
||||
}
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = FontUtil.GetPKXFont();
|
||||
if (SAV is SAV6XY)
|
||||
TB_TRNick.Font = TB_OTName.Font;
|
||||
}
|
||||
|
||||
B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999";
|
||||
|
||||
@@ -33,8 +33,7 @@ public SAV_FestivalPlaza(SaveFile sav)
|
||||
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try { TB_OTName.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
var cc = SAV.Festa.FestaCoins;
|
||||
|
||||
@@ -19,8 +19,7 @@ public SAV_Trainer7(SaveFile sav)
|
||||
Loading = true;
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try { TB_OTName.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999";
|
||||
|
||||
@@ -23,8 +23,7 @@ public SAV_Trainer7GG(SaveFile sav)
|
||||
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try { TB_OTName.Font = TB_RivalName.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = TB_RivalName.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999";
|
||||
|
||||
@@ -18,8 +18,7 @@ public SAV_Trainer8(SaveFile sav)
|
||||
Loading = true;
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try { TB_OTName.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
B_MaxCash.Click += (sender, e) => MT_Money.Text = SAV.MaxMoney.ToString();
|
||||
|
||||
@@ -29,7 +29,7 @@ static FontUtil()
|
||||
CustomFonts.AddFontFile(g6path);
|
||||
}
|
||||
|
||||
public static Font GetPKXFont(float size)
|
||||
public static Font GetPKXFont(float size = 11f)
|
||||
{
|
||||
if (GeneratedFonts.TryGetValue(size, out var f))
|
||||
return f;
|
||||
|
||||
Reference in New Issue
Block a user