diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs
index 80de291c6..49a5e0d83 100644
--- a/PKHeX.WinForms/MainWindow/Main.cs
+++ b/PKHeX.WinForms/MainWindow/Main.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
-using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -278,8 +277,8 @@ private void mainMenuOpen(object sender, EventArgs e)
OpenFileDialog ofd = new OpenFileDialog
{
Filter = $"Supported Files|main;*.sav;*.bin;*.{ekx};{supported};*.bak" +
- $"|3DS Main Files|main" +
- $"|Save Files|*.sav" +
+ "|3DS Main Files|main" +
+ "|Save Files|*.sav" +
$"|Decrypted PKM File|{supported}" +
$"|Encrypted PKM File|*.{ekx}" +
"|Binary File|*.bin" +
diff --git a/PKHeX.WinForms/MainWindow/MainCK3.cs b/PKHeX.WinForms/MainWindow/MainCK3.cs
index d247fc54f..622367ddc 100644
--- a/PKHeX.WinForms/MainWindow/MainCK3.cs
+++ b/PKHeX.WinForms/MainWindow/MainCK3.cs
@@ -41,10 +41,7 @@ private void populateFieldsCK3()
CB_GameOrigin.SelectedValue = ck3.Version;
CB_EncounterType.SelectedValue = ck3.Gen4 ? ck3.EncounterType : 0;
CB_Ball.SelectedValue = ck3.Ball;
-
- int cr = ck3.CurrentRegion;
- int or = ck3.OriginalRegion;
- int ver = ck3.Version;
+
CB_MetLocation.SelectedValue = ck3.Met_Location;
TB_MetLevel.Text = ck3.Met_Level.ToString();
diff --git a/PKHeX.WinForms/MainWindow/MainPK4.cs b/PKHeX.WinForms/MainWindow/MainPK4.cs
index 2d4b12219..c222bf9f5 100644
--- a/PKHeX.WinForms/MainWindow/MainPK4.cs
+++ b/PKHeX.WinForms/MainWindow/MainPK4.cs
@@ -51,14 +51,7 @@ private void populateFieldsPK4()
GB_EggConditions.Enabled = true;
CB_EggLocation.SelectedValue = pk4.Egg_Location;
- if (pk4.EggMetDate.HasValue)
- {
- CAL_EggDate.Value = pk4.EggMetDate.Value;
- }
- else
- {
- CAL_EggDate.Value = new DateTime(2000, 1, 1);
- }
+ CAL_EggDate.Value = pk4.EggMetDate ?? new DateTime(2000, 1, 1);
}
else { CAL_EggDate.Value = new DateTime(2000, 01, 01); CHK_AsEgg.Checked = GB_EggConditions.Enabled = false; CB_EggLocation.SelectedValue = 0; }
diff --git a/PKHeX.WinForms/Subforms/KChart.cs b/PKHeX.WinForms/Subforms/KChart.cs
index 513abd929..694583ad8 100644
--- a/PKHeX.WinForms/Subforms/KChart.cs
+++ b/PKHeX.WinForms/Subforms/KChart.cs
@@ -69,7 +69,7 @@ private void popEntry(int index)
row.Cells[r++].Value = p.SPE.ToString("000");
row.Cells[r++].Value = abilities[p.Abilities[0]];
row.Cells[r++].Value = abilities[p.Abilities[1]];
- row.Cells[r++].Value = abilities[p.Abilities[2]];
+ row.Cells[r].Value = abilities[p.Abilities[2]];
DGV.Rows.Add(row);
}
private static Color mapColor(int v)
diff --git a/PKHeX.WinForms/Subforms/PKM Editors/Text.cs b/PKHeX.WinForms/Subforms/PKM Editors/Text.cs
index 7cd8fdae1..287736220 100644
--- a/PKHeX.WinForms/Subforms/PKM Editors/Text.cs
+++ b/PKHeX.WinForms/Subforms/PKM Editors/Text.cs
@@ -1,7 +1,6 @@
using System;
using System.Drawing;
using System.Windows.Forms;
-using PKHeX.Core;
namespace PKHeX.WinForms
{
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_ZygardeCell.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_ZygardeCell.cs
index 10b1c76b6..44121f7ee 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_ZygardeCell.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_ZygardeCell.cs
@@ -17,8 +17,7 @@ public SAV_ZygardeCell()
// Use constants 0x18C/2 = 198 thru +95
ushort[] constants = SAV.EventConsts;
ushort[] cells = constants.Skip(celloffset).Take(cellcount).ToArray();
-
- int receivedCount = cells.Count(cell => cell == 2);
+
int cellCount = constants[cellstotal];
int cellCollected = constants[cellscollected];
@@ -92,7 +91,7 @@ private void B_GiveAll_Click(object sender, EventArgs e)
#region locations -- lazy
- private string[] locations =
+ private readonly string[] locations =
{
"Verdant Cave - Trial Site",
"Ruins of Conflict - Outside",
diff --git a/PKHeX.WinForms/Util/CyberGadgetUtil.cs b/PKHeX.WinForms/Util/CyberGadgetUtil.cs
index be1aaf8a8..e89b35a57 100644
--- a/PKHeX.WinForms/Util/CyberGadgetUtil.cs
+++ b/PKHeX.WinForms/Util/CyberGadgetUtil.cs
@@ -3,7 +3,7 @@
namespace PKHeX.WinForms
{
- public class CyberGadgetUtil
+ public static class CyberGadgetUtil
{
public static string GetTempFolder()
{
@@ -13,7 +13,7 @@ public static string GetCacheFolder()
{
return Path.Combine(GetBackupLocation(), "cache");
}
- public static string GetRegistryValue(string key)
+ private static string GetRegistryValue(string key)
{
Microsoft.Win32.RegistryKey currentUser = Microsoft.Win32.Registry.CurrentUser;
Microsoft.Win32.RegistryKey key3 = currentUser.OpenSubKey(GetRegistryBase());
@@ -25,11 +25,11 @@ public static string GetRegistryValue(string key)
currentUser.Close();
return str;
}
- public static string GetRegistryBase()
+ private static string GetRegistryBase()
{
return @"SOFTWARE\CYBER Gadget\3DSSaveEditor";
}
- public static string GetBackupLocation()
+ private static string GetBackupLocation()
{
string registryValue = GetRegistryValue("Location");
if (!string.IsNullOrEmpty(registryValue))
diff --git a/PKHeX/MysteryGifts/PL6.cs b/PKHeX/MysteryGifts/PL6.cs
index 8b3d7c5a0..7694dcc25 100644
--- a/PKHeX/MysteryGifts/PL6.cs
+++ b/PKHeX/MysteryGifts/PL6.cs
@@ -9,7 +9,7 @@ public class PL6 //: PokemonLink
public const int Size = 0xA47;
public const string Filter = "Pokémon Link Data|*.pl6|All Files (*.*)|*.*";
- public byte[] Data;
+ public readonly byte[] Data;
public PL6(byte[] data = null)
{
Data = (byte[])(data?.Clone() ?? new byte[Size]);
diff --git a/PKHeX/PKHeX.Core.csproj b/PKHeX/PKHeX.Core.csproj
index 3a7b2e88e..b63f78184 100644
--- a/PKHeX/PKHeX.Core.csproj
+++ b/PKHeX/PKHeX.Core.csproj
@@ -191,7 +191,6 @@
-
diff --git a/PKHeX/PKM/PKM.cs b/PKHeX/PKM/PKM.cs
index 6b5942185..b1f8fef7b 100644
--- a/PKHeX/PKM/PKM.cs
+++ b/PKHeX/PKM/PKM.cs
@@ -267,7 +267,7 @@ public byte[] Write()
public bool AO => Version == (int)GameVersion.AS || Version == (int)GameVersion.OR;
public bool SM => Version == (int)GameVersion.SN || Version == (int)GameVersion.MN;
protected bool PtHGSS => GameVersion.Pt == (GameVersion)Version || HGSS;
- public bool HGSS => new[] {GameVersion.HG, GameVersion.SS}.Contains((GameVersion)Version);
+ protected bool HGSS => new[] {GameVersion.HG, GameVersion.SS}.Contains((GameVersion)Version);
public bool Gen5 => Version >= 20 && Version <= 23;
public bool Gen4 => Version >= 7 && Version <= 12 && Version != 9;
public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15;
@@ -506,7 +506,7 @@ public virtual ushort[] getStats(PersonalInfo p)
{
int level = CurrentLevel;
ushort[] Stats = new ushort[6];
- Stats[0] = (ushort)(p.HP == 1 ? 1 : (((HT_HP ? 31 : IV_HP) + 2 * p.HP + EV_HP / 4 + 100) * level / 100 + 10));
+ Stats[0] = (ushort)(p.HP == 1 ? 1 : ((HT_HP ? 31 : IV_HP) + 2 * p.HP + EV_HP / 4 + 100) * level / 100 + 10);
Stats[1] = (ushort)(((HT_ATK ? 31 : IV_ATK) + 2 * p.ATK + EV_ATK / 4) * level / 100 + 5);
Stats[2] = (ushort)(((HT_DEF ? 31 : IV_DEF) + 2 * p.DEF + EV_DEF / 4) * level / 100 + 5);
Stats[4] = (ushort)(((HT_SPA ? 31 : IV_SPA) + 2 * p.SPA + EV_SPA / 4) * level / 100 + 5);
diff --git a/PKHeX/PKM/XK3.cs b/PKHeX/PKM/XK3.cs
index f9c1f08da..9b4a470ad 100644
--- a/PKHeX/PKM/XK3.cs
+++ b/PKHeX/PKM/XK3.cs
@@ -1,5 +1,4 @@
using System;
-using System.Linq;
namespace PKHeX.Core
{
diff --git a/PKHeX/PersonalInfo/PersonalInfo.cs b/PKHeX/PersonalInfo/PersonalInfo.cs
index eaa484d48..0f923cfb2 100644
--- a/PKHeX/PersonalInfo/PersonalInfo.cs
+++ b/PKHeX/PersonalInfo/PersonalInfo.cs
@@ -40,9 +40,9 @@ public abstract class PersonalInfo
public virtual int Height { get; set; } = 0;
public virtual int Weight { get; set; } = 0;
- public bool[] TMHM { get; set; }
- public bool[] TypeTutors { get; set; }
- public bool[][] SpecialTutors { get; set; } = new bool[0][];
+ public bool[] TMHM { get; protected set; }
+ public bool[] TypeTutors { get; protected set; }
+ public bool[][] SpecialTutors { get; protected set; } = new bool[0][];
protected static bool[] getBits(byte[] data)
{
diff --git a/PKHeX/Saves/SAV2.cs b/PKHeX/Saves/SAV2.cs
index d68064545..70248c81a 100644
--- a/PKHeX/Saves/SAV2.cs
+++ b/PKHeX/Saves/SAV2.cs
@@ -617,7 +617,7 @@ public override void setSeen(PKM pkm, bool seen = true)
int ofs = bit >> 3;
byte bitval = (byte)(1 << (bit & 7));
// Set the Seen Flag
- Data[PokedexSeenOffset + ofs] &= (byte)(~bitval);
+ Data[PokedexSeenOffset + ofs] &= (byte)~bitval;
if (seen)
Data[PokedexSeenOffset + ofs] |= bitval;
}
@@ -634,7 +634,7 @@ public override void setCaught(PKM pkm, bool caught = true)
int ofs = bit >> 3;
byte bitval = (byte)(1 << (bit & 7));
// Set the Captured Flag
- Data[PokedexCaughtOffset + ofs] &= (byte)(~bitval);
+ Data[PokedexCaughtOffset + ofs] &= (byte)~bitval;
if (caught)
{
Data[PokedexCaughtOffset + ofs] |= bitval;
@@ -643,7 +643,7 @@ public override void setCaught(PKM pkm, bool caught = true)
// Give all Unown caught to prevent a crash on pokedex view
for (int i = 1; i <= 26; i++)
{
- Data[PokedexSeenOffset + 0x1F + i] = (byte)(i);
+ Data[PokedexSeenOffset + 0x1F + i] = (byte)i;
}
}
}
diff --git a/PKHeX/Saves/SAV7.cs b/PKHeX/Saves/SAV7.cs
index 269959569..6b81668ad 100644
--- a/PKHeX/Saves/SAV7.cs
+++ b/PKHeX/Saves/SAV7.cs
@@ -1179,12 +1179,6 @@ public override string MiscSaveInfo()
$"{b.ID:00}: {b.Offset:X5}-{b.Offset + b.Length:X5}, {b.Length:X5}{Environment.NewLine}");
}
- public override bool RequiresMemeCrypto
- {
- get
- {
- return true;
- }
- }
+ public override bool RequiresMemeCrypto => true;
}
}
diff --git a/PKHeX/Saves/SaveUtil.cs b/PKHeX/Saves/SaveUtil.cs
index b381159bf..b10179e8a 100644
--- a/PKHeX/Saves/SaveUtil.cs
+++ b/PKHeX/Saves/SaveUtil.cs
@@ -461,7 +461,8 @@ public static bool detectSaveFile(out string path, params string[] extra)
///
/// Folder to look within
/// Search all subfolders
- /// Full path of all save files that match criteria.
+ /// Full path of all save files that match criteria.
+ /// Boolean indicating whether or not operation was successful.
public static bool getSavesFromFolder(string folderPath, bool deep, out IEnumerable result)
{
if (!Directory.Exists(folderPath))
diff --git a/PKHeX/Saves/Substructures/MemeCrypto.cs b/PKHeX/Saves/Substructures/MemeCrypto.cs
index fa74a83b5..db80e33de 100644
--- a/PKHeX/Saves/Substructures/MemeCrypto.cs
+++ b/PKHeX/Saves/Substructures/MemeCrypto.cs
@@ -1,5 +1,4 @@
using System;
-using System.ComponentModel.Design;
using System.IO;
using System.Linq;
using System.Numerics;
@@ -270,7 +269,7 @@ public static byte[] Resign(byte[] sav7, bool throwIfUnsupported = true)
byte[] ChecksumTable = new byte[0x140];
Array.Copy(sav7, 0x6BC00, ChecksumTable, 0, 0x140);
- SignMemeData(sha256.ComputeHash(ChecksumTable).Concat((ReverseCrypt(CurSig) ?? new byte[0x60])).ToArray()).CopyTo(outSav, 0x6BB00);
+ SignMemeData(sha256.ComputeHash(ChecksumTable).Concat(ReverseCrypt(CurSig) ?? new byte[0x60]).ToArray()).CopyTo(outSav, 0x6BB00);
}
return outSav;
}
diff --git a/PKHeX/Saves/Substructures/QR7.cs b/PKHeX/Saves/Substructures/QR7.cs
index b9c47033a..2cc26d3a1 100644
--- a/PKHeX/Saves/Substructures/QR7.cs
+++ b/PKHeX/Saves/Substructures/QR7.cs
@@ -19,7 +19,7 @@ namespace PKHeX.Core
// sizeof(QR7) == 0x1A2
- public class QR7
+ public static class QR7
{
private static bool hasGenderDifferences(int species)
{
diff --git a/PKHeX/Util/CryptoUtil.cs b/PKHeX/Util/CryptoUtil.cs
index 70065c381..cccfc4f66 100644
--- a/PKHeX/Util/CryptoUtil.cs
+++ b/PKHeX/Util/CryptoUtil.cs
@@ -1,8 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Security.Cryptography;
-using System.Text;
namespace PKHeX.Core
{
diff --git a/PKHeX/Util/CyberGadgetUtil.cs b/PKHeX/Util/CyberGadgetUtil.cs
deleted file mode 100644
index d20fbc7fc..000000000
--- a/PKHeX/Util/CyberGadgetUtil.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.IO;
-
-namespace PKHeX.Core
-{
- public class CyberGadgetUtil
- {
- public static string GetTempFolder()
- {
- return Path.Combine(Path.GetTempPath(), "3DSSE");
- }
- public static string GetCacheFolder()
- {
- return Path.Combine(GetBackupLocation(), "cache");
- }
- public static string GetRegistryValue(string key)
- {
- Microsoft.Win32.RegistryKey currentUser = Microsoft.Win32.Registry.CurrentUser;
- Microsoft.Win32.RegistryKey key3 = currentUser.OpenSubKey(GetRegistryBase());
- if (key3 == null)
- return null;
-
- string str = key3.GetValue(key) as string;
- key3.Close();
- currentUser.Close();
- return str;
- }
- public static string GetRegistryBase()
- {
- return @"SOFTWARE\CYBER Gadget\3DSSaveEditor";
- }
- public static string GetBackupLocation()
- {
- string registryValue = GetRegistryValue("Location");
- if (!string.IsNullOrEmpty(registryValue))
- {
- Directory.CreateDirectory(registryValue);
- return registryValue;
- }
- string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "3DSSaveBank");
- if (Directory.Exists(GetRegistryBase()))
- Directory.CreateDirectory(path);
- return path;
- }
- }
-}
diff --git a/Tests/PKHeX.Tests/Properties/AssemblyInfo.cs b/Tests/PKHeX.Tests/Properties/AssemblyInfo.cs
index 24b24f48a..ca6b4b728 100644
--- a/Tests/PKHeX.Tests/Properties/AssemblyInfo.cs
+++ b/Tests/PKHeX.Tests/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/Tests/PKHeX.Tests/Util/DateUtilTests.cs b/Tests/PKHeX.Tests/Util/DateUtilTests.cs
index 5fb0caa0d..11b3e05f5 100644
--- a/Tests/PKHeX.Tests/Util/DateUtilTests.cs
+++ b/Tests/PKHeX.Tests/Util/DateUtilTests.cs
@@ -1,5 +1,4 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-using PKHeX.Core;
namespace PKHeX.Tests.Util
{