diff --git a/pkNX.Containers/Container.cs b/pkNX.Containers/Container.cs
index 783fd462..6bca69ea 100644
--- a/pkNX.Containers/Container.cs
+++ b/pkNX.Containers/Container.cs
@@ -10,19 +10,16 @@ public static class Container
///
/// File location
/// File type
- public static IFileContainer GetContainer(string path, ContainerType t)
+ public static IFileContainer GetContainer(string path, ContainerType t) => t switch
{
- return t switch
- {
- ContainerType.GARC => new GARC(path),
- ContainerType.Mini => MiniUtil.GetMini(path),
- ContainerType.SARC => new SARC(path),
- ContainerType.Folder => new FolderContainer(path),
- ContainerType.SingleFile => new SingleFileContainer(path),
- ContainerType.GFPack => new GFPack(path),
- _ => throw new ArgumentOutOfRangeException(nameof(t), t, null),
- };
- }
+ ContainerType.GARC => new GARC(path),
+ ContainerType.Mini => MiniUtil.GetMini(path),
+ ContainerType.SARC => new SARC(path),
+ ContainerType.Folder => new FolderContainer(path),
+ ContainerType.SingleFile => new SingleFileContainer(path),
+ ContainerType.GFPack => new GFPack(path),
+ _ => throw new ArgumentOutOfRangeException(nameof(t), t, null),
+ };
///
/// Gets a for the stream.
diff --git a/pkNX.Containers/LargeContainer.cs b/pkNX.Containers/LargeContainer.cs
index 5a35a2e2..00fb799d 100644
--- a/pkNX.Containers/LargeContainer.cs
+++ b/pkNX.Containers/LargeContainer.cs
@@ -135,7 +135,8 @@ await using (var bw = new BinaryWriter(stream))
File.Move(writePath, path);
}
- Stream?.Dispose();
+ if (Stream is { } x)
+ await x.DisposeAsync().ConfigureAwait(false);
Reader?.Dispose();
Stream = stream;
diff --git a/pkNX.Game/Editors/TypeChartEditor.cs b/pkNX.Game/Editors/TypeChartEditor.cs
index 462c15d5..df8b87ca 100644
--- a/pkNX.Game/Editors/TypeChartEditor.cs
+++ b/pkNX.Game/Editors/TypeChartEditor.cs
@@ -68,11 +68,10 @@ public static byte[] GetTypeChartImageData(int itemsize, int itemsPerRow, byte[]
byte[] gridColor = BitConverter.GetBytes(0x17000000);
for (int i = 0; i < width * height; i++)
{
- if (i % itemsize == 0 || i / (itemsize * itemsPerRow) % itemsize == 0)
- {
- var ofs = (i / (itemsize * itemsPerRow) * width * 4) + (i % (itemsize * itemsPerRow) * 4);
- Buffer.BlockCopy(gridColor, 0, bmpData, ofs, 4);
- }
+ if (i % itemsize != 0 && i / (itemsize * itemsPerRow) % itemsize != 0)
+ continue;
+ var ofs = (i / (itemsize * itemsPerRow) * width * 4) + (i % (itemsize * itemsPerRow) * 4);
+ Buffer.BlockCopy(gridColor, 0, bmpData, ofs, 4);
}
return bmpData;
diff --git a/pkNX.Game/Text/TextManager.cs b/pkNX.Game/Text/TextManager.cs
index 9dc8f964..076702e4 100644
--- a/pkNX.Game/Text/TextManager.cs
+++ b/pkNX.Game/Text/TextManager.cs
@@ -37,9 +37,8 @@ internal string[] GetStrings(TextName file, IFileContainer textFile, bool remap
throw new ArgumentException($"Unknown {nameof(TextName)} provided.", file.ToString());
byte[] data;
- string path = info.FileName;
- if (!string.IsNullOrWhiteSpace(path) && textFile is FolderContainer c)
- data = c.GetFileData(info.FileName) ?? throw new ArgumentException($"File not found: {path}", nameof(textFile));
+ if (textFile is FolderContainer c)
+ data = c.GetFileData(info.FileName) ?? throw new ArgumentException($"File not found: {info.FileName}", nameof(textFile));
else
data = textFile[info.Index];
diff --git a/pkNX.Game/Text/TextMapping.cs b/pkNX.Game/Text/TextMapping.cs
index c965bc14..c113d755 100644
--- a/pkNX.Game/Text/TextMapping.cs
+++ b/pkNX.Game/Text/TextMapping.cs
@@ -1,203 +1,201 @@
using System.Collections.Generic;
using pkNX.Structures;
+using static pkNX.Game.TextName;
namespace pkNX.Game;
public static class TextMapping
{
- public static IReadOnlyCollection GetMapping(GameVersion game)
+ public static IReadOnlyCollection GetMapping(GameVersion game) => game switch
{
- return game switch
- {
- GameVersion.XY => XY,
- GameVersion.ORASDEMO => AO,
- GameVersion.ORAS => AO,
- GameVersion.SMDEMO => SMDEMO,
- GameVersion.SN => SM,
- GameVersion.MN => SM,
- GameVersion.US => USUM,
- GameVersion.UM => USUM,
- GameVersion.GP => GG,
- GameVersion.GE => GG,
- GameVersion.GG => GG,
- GameVersion.SW => SWSH,
- GameVersion.SH => SWSH,
- GameVersion.SWSH => SWSH,
- GameVersion.PLA => PLA,
- _ => throw new System.ArgumentOutOfRangeException($"No text mapping for {game}"),
- };
- }
+ GameVersion.XY => XY,
+ GameVersion.ORASDEMO => AO,
+ GameVersion.ORAS => AO,
+ GameVersion.SMDEMO => SMDEMO,
+ GameVersion.SN => SM,
+ GameVersion.MN => SM,
+ GameVersion.US => USUM,
+ GameVersion.UM => USUM,
+ GameVersion.GP => GG,
+ GameVersion.GE => GG,
+ GameVersion.GG => GG,
+ GameVersion.SW => SWSH,
+ GameVersion.SH => SWSH,
+ GameVersion.SWSH => SWSH,
+ GameVersion.PLA => PLA,
+ _ => throw new System.ArgumentOutOfRangeException($"No text mapping for {game}"),
+ };
private static readonly TextReference[] XY =
{
- new(005, TextName.Forms),
- new(013, TextName.MoveNames),
- new(015, TextName.MoveFlavor),
- new(017, TextName.Types),
- new(020, TextName.TrainerClasses),
- new(021, TextName.TrainerNames),
- new(022, TextName.TrainerText),
- new(034, TextName.AbilityNames),
- new(047, TextName.Natures),
- new(072, TextName.metlist_00000),
- new(080, TextName.SpeciesNames),
- new(096, TextName.ItemNames),
- new(099, TextName.ItemFlavor),
- new(130, TextName.MaisonTrainerNames),
- new(131, TextName.SuperTrainerNames),
- new(141, TextName.OPowerFlavor),
+ new(005, Forms),
+ new(013, MoveNames),
+ new(015, MoveFlavor),
+ new(017, TypeNames),
+ new(020, TrainerClasses),
+ new(021, TrainerNames),
+ new(022, TrainerText),
+ new(034, AbilityNames),
+ new(047, Natures),
+ new(072, metlist_00000),
+ new(080, SpeciesNames),
+ new(096, ItemNames),
+ new(099, ItemFlavor),
+ new(130, MaisonTrainerNames),
+ new(131, SuperTrainerNames),
+ new(141, OPowerFlavor),
};
private static readonly TextReference[] AO =
{
- new(005, TextName.Forms),
- new(014, TextName.MoveNames),
- new(016, TextName.MoveFlavor),
- new(018, TextName.Types),
- new(021, TextName.TrainerClasses),
- new(022, TextName.TrainerNames),
- new(023, TextName.TrainerText),
- new(037, TextName.AbilityNames),
- new(051, TextName.Natures),
- new(090, TextName.metlist_00000),
- new(098, TextName.SpeciesNames),
- new(114, TextName.ItemNames),
- new(117, TextName.ItemFlavor),
- new(153, TextName.MaisonTrainerNames),
- new(154, TextName.SuperTrainerNames),
- new(165, TextName.OPowerFlavor),
+ new(005, Forms),
+ new(014, MoveNames),
+ new(016, MoveFlavor),
+ new(018, TypeNames),
+ new(021, TrainerClasses),
+ new(022, TrainerNames),
+ new(023, TrainerText),
+ new(037, AbilityNames),
+ new(051, Natures),
+ new(090, metlist_00000),
+ new(098, SpeciesNames),
+ new(114, ItemNames),
+ new(117, ItemFlavor),
+ new(153, MaisonTrainerNames),
+ new(154, SuperTrainerNames),
+ new(165, OPowerFlavor),
};
private static readonly TextReference[] SMDEMO =
{
- new(020, TextName.ItemFlavor),
- new(021, TextName.ItemNames),
- new(026, TextName.SpeciesNames),
- new(030, TextName.metlist_00000),
- new(044, TextName.Forms),
- new(044, TextName.Natures),
- new(046, TextName.AbilityNames),
- new(049, TextName.TrainerText),
- new(050, TextName.TrainerNames),
- new(051, TextName.TrainerClasses),
- new(052, TextName.Types),
- new(054, TextName.MoveFlavor),
- new(055, TextName.MoveNames),
+ new(020, ItemFlavor),
+ new(021, ItemNames),
+ new(026, SpeciesNames),
+ new(030, metlist_00000),
+ new(044, Forms),
+ new(044, Natures),
+ new(046, AbilityNames),
+ new(049, TrainerText),
+ new(050, TrainerNames),
+ new(051, TrainerClasses),
+ new(052, TypeNames),
+ new(054, MoveFlavor),
+ new(055, MoveNames),
};
private static readonly TextReference[] SM =
{
- new(035, TextName.ItemFlavor),
- new(036, TextName.ItemNames),
- new(055, TextName.SpeciesNames),
- new(067, TextName.metlist_00000),
- new(086, TextName.BattleRoyalNames),
- new(087, TextName.Natures),
- new(096, TextName.AbilityNames),
- new(099, TextName.BattleTreeNames),
- new(104, TextName.TrainerText),
- new(105, TextName.TrainerNames),
- new(106, TextName.TrainerClasses),
- new(107, TextName.Types),
- new(112, TextName.MoveFlavor),
- new(113, TextName.MoveNames),
- new(114, TextName.Forms),
- new(116, TextName.SpeciesClassifications),
- new(119, TextName.PokedexEntry1),
- new(120, TextName.PokedexEntry2),
+ new(035, ItemFlavor),
+ new(036, ItemNames),
+ new(055, SpeciesNames),
+ new(067, metlist_00000),
+ new(086, BattleRoyalNames),
+ new(087, Natures),
+ new(096, AbilityNames),
+ new(099, BattleTreeNames),
+ new(104, TrainerText),
+ new(105, TrainerNames),
+ new(106, TrainerClasses),
+ new(107, TypeNames),
+ new(112, MoveFlavor),
+ new(113, MoveNames),
+ new(114, Forms),
+ new(116, SpeciesClassifications),
+ new(119, PokedexEntry1),
+ new(120, PokedexEntry2),
};
private static readonly TextReference[] USUM =
{
- new(039, TextName.ItemFlavor),
- new(040, TextName.ItemNames),
- new(060, TextName.SpeciesNames),
- new(072, TextName.metlist_00000),
- new(091, TextName.BattleRoyalNames),
- new(092, TextName.Natures),
- new(101, TextName.AbilityNames),
- new(104, TextName.BattleTreeNames),
- new(109, TextName.TrainerText),
- new(110, TextName.TrainerNames),
- new(111, TextName.TrainerClasses),
- new(112, TextName.Types),
- new(117, TextName.MoveFlavor),
- new(118, TextName.MoveNames),
- new(119, TextName.Forms),
- new(121, TextName.SpeciesClassifications),
- new(124, TextName.PokedexEntry1),
- new(125, TextName.PokedexEntry2),
+ new(039, ItemFlavor),
+ new(040, ItemNames),
+ new(060, SpeciesNames),
+ new(072, metlist_00000),
+ new(091, BattleRoyalNames),
+ new(092, Natures),
+ new(101, AbilityNames),
+ new(104, BattleTreeNames),
+ new(109, TrainerText),
+ new(110, TrainerNames),
+ new(111, TrainerClasses),
+ new(112, TypeNames),
+ new(117, MoveFlavor),
+ new(118, MoveNames),
+ new(119, Forms),
+ new(121, SpeciesClassifications),
+ new(124, PokedexEntry1),
+ new(125, PokedexEntry2),
};
private static readonly TextReference[] GG =
{
- new("iteminfo.dat", TextName.ItemFlavor),
- new("itemname.dat", TextName.ItemNames),
- new("monsname.dat", TextName.SpeciesNames),
- new("place_name.dat", TextName.metlist_00000),
- new("seikaku.dat", TextName.Natures),
- new("tokusei.dat", TextName.AbilityNames),
- new("tokuseiinfo.dat", TextName.AbilityFlavor),
- new("trname.dat", TextName.TrainerNames),
- new("trtype.dat", TextName.TrainerClasses),
- new("trmsg.dat", TextName.TrainerText),
- new("typename.dat", TextName.Types),
- new("wazainfo.dat", TextName.MoveFlavor),
- new("wazaname.dat", TextName.MoveNames),
- new("zkn_form.dat", TextName.Forms),
- new("zkn_type.dat", TextName.SpeciesClassifications),
- new("zukan_comment_A.dat", TextName.PokedexEntry1),
+ new("iteminfo.dat", ItemFlavor),
+ new("itemname.dat", ItemNames),
+ new("monsname.dat", SpeciesNames),
+ new("place_name.dat", metlist_00000),
+ new("seikaku.dat", Natures),
+ new("tokusei.dat", AbilityNames),
+ new("tokuseiinfo.dat", AbilityFlavor),
+ new("trname.dat", TrainerNames),
+ new("trtype.dat", TrainerClasses),
+ new("trmsg.dat", TrainerText),
+ new("typename.dat", TypeNames),
+ new("wazainfo.dat", MoveFlavor),
+ new("wazaname.dat", MoveNames),
+ new("zkn_form.dat", Forms),
+ new("zkn_type.dat", SpeciesClassifications),
+ new("zukan_comment_A.dat", PokedexEntry1),
};
private static readonly TextReference[] SWSH =
{
- new("iteminfo.dat", TextName.ItemFlavor),
- new("itemname.dat", TextName.ItemNames),
- new("monsname.dat", TextName.SpeciesNames),
- new("place_name_indirect.dat", TextName.metlist_00000),
- new("place_name_spe.dat", TextName.metlist_30000),
- new("place_name_out.dat", TextName.metlist_40000),
- new("place_name_per.dat", TextName.metlist_60000),
- new("seikaku.dat", TextName.Natures),
- new("tokusei.dat", TextName.AbilityNames),
- new("tokuseiinfo.dat", TextName.AbilityFlavor),
- new("trname.dat", TextName.TrainerNames),
- new("trtype.dat", TextName.TrainerClasses),
- new("trmsg.dat", TextName.TrainerText),
- new("typename.dat", TextName.Types),
- new("wazainfo.dat", TextName.MoveFlavor),
- new("wazaname.dat", TextName.MoveNames),
- new("zkn_form.dat", TextName.Forms),
- new("zkn_type.dat", TextName.SpeciesClassifications),
- new("zukan_comment_A.dat", TextName.PokedexEntry1),
- new("zukan_comment_B.dat", TextName.PokedexEntry2),
- new("ribbon.dat", TextName.RibbonMark),
- new("poke_memory_feeling.dat", TextName.MemoryFeelings),
+ new("iteminfo.dat", ItemFlavor),
+ new("itemname.dat", ItemNames),
+ new("monsname.dat", SpeciesNames),
+ new("place_name_indirect.dat", metlist_00000),
+ new("place_name_spe.dat", metlist_30000),
+ new("place_name_out.dat", metlist_40000),
+ new("place_name_per.dat", metlist_60000),
+ new("seikaku.dat", Natures),
+ new("tokusei.dat", AbilityNames),
+ new("tokuseiinfo.dat", AbilityFlavor),
+ new("trname.dat", TrainerNames),
+ new("trtype.dat", TrainerClasses),
+ new("trmsg.dat", TrainerText),
+ new("typename.dat", TypeNames),
+ new("wazainfo.dat", MoveFlavor),
+ new("wazaname.dat", MoveNames),
+ new("zkn_form.dat", Forms),
+ new("zkn_type.dat", SpeciesClassifications),
+ new("zukan_comment_A.dat", PokedexEntry1),
+ new("zukan_comment_B.dat", PokedexEntry2),
+ new("ribbon.dat", RibbonMark),
+ new("poke_memory_feeling.dat", MemoryFeelings),
};
private static readonly TextReference[] PLA =
{
- new("iteminfo.dat", TextName.ItemFlavor),
- new("itemname.dat", TextName.ItemNames),
- new("monsname.dat", TextName.SpeciesNames),
- new("place_name_indirect.dat", TextName.metlist_00000),
- new("place_name_spe.dat", TextName.metlist_30000),
- new("place_name_out.dat", TextName.metlist_40000),
- new("place_name_per.dat", TextName.metlist_60000),
- new("seikaku.dat", TextName.Natures),
- new("tokusei.dat", TextName.AbilityNames),
- new("tokuseiinfo.dat", TextName.AbilityFlavor),
- new("trname.dat", TextName.TrainerNames),
- new("trtype.dat", TextName.TrainerClasses),
- new("trmsg.dat", TextName.TrainerText),
- new("typename.dat", TextName.Types),
- new("wazainfo.dat", TextName.MoveFlavor),
- new("wazaname.dat", TextName.MoveNames),
- new("zkn_form.dat", TextName.Forms),
- new("zkn_type.dat", TextName.SpeciesClassifications),
- new("zukan_comment_A.dat", TextName.PokedexEntry1),
- new("zukan_comment_B.dat", TextName.PokedexEntry2),
- new("ribbon.dat", TextName.RibbonMark),
- new("poke_memory_feeling.dat", TextName.MemoryFeelings),
+ new("iteminfo.dat", ItemFlavor),
+ new("itemname.dat", ItemNames),
+ new("monsname.dat", SpeciesNames),
+ new("place_name_indirect.dat", metlist_00000),
+ new("place_name_spe.dat", metlist_30000),
+ new("place_name_out.dat", metlist_40000),
+ new("place_name_per.dat", metlist_60000),
+ new("seikaku.dat", Natures),
+ new("tokusei.dat", AbilityNames),
+ new("tokuseiinfo.dat", AbilityFlavor),
+ new("trname.dat", TrainerNames),
+ new("trtype.dat", TrainerClasses),
+ new("trmsg.dat", TrainerText),
+ new("typename.dat", TypeNames),
+ new("wazainfo.dat", MoveFlavor),
+ new("wazaname.dat", MoveNames),
+ new("zkn_form.dat", Forms),
+ new("zkn_type.dat", SpeciesClassifications),
+ new("zukan_comment_A.dat", PokedexEntry1),
+ new("zukan_comment_B.dat", PokedexEntry2),
+ new("ribbon.dat", RibbonMark),
+ new("poke_memory_feeling.dat", MemoryFeelings),
};
}
diff --git a/pkNX.Game/Text/TextName.cs b/pkNX.Game/Text/TextName.cs
index 3000d9b3..e6bcf80a 100644
--- a/pkNX.Game/Text/TextName.cs
+++ b/pkNX.Game/Text/TextName.cs
@@ -12,7 +12,7 @@ public enum TextName
ItemFlavor,
SpeciesNames,
- Types,
+ TypeNames,
Natures,
Forms,
diff --git a/pkNX.Randomization/Randomizers/EvolutionRandomizer.cs b/pkNX.Randomization/Randomizers/EvolutionRandomizer.cs
index 650e1b33..a4e2db42 100644
--- a/pkNX.Randomization/Randomizers/EvolutionRandomizer.cs
+++ b/pkNX.Randomization/Randomizers/EvolutionRandomizer.cs
@@ -58,11 +58,10 @@ private void Randomize(EvolutionSet evos, int species)
{
foreach (var evo in evos.PossibleEvolutions)
{
- if (evo.Method != 0)
- {
- evo.Species = (ushort)RandSpec.GetRandomSpecies(evo.Species, species);
- evo.Form = (byte)RandForm.GetRandomForme(evo.Species, false, false, true, Game.SWSH, Personal.Table);
- }
+ if (evo.Method == 0)
+ continue;
+ evo.Species = (ushort)RandSpec.GetRandomSpecies(evo.Species, species);
+ evo.Form = (byte)RandForm.GetRandomForme(evo.Species, false, false, true, Game.SWSH, Personal.Table);
}
}
diff --git a/pkNX.Randomization/Randomizers/Personal/PersonalRandomizer.cs b/pkNX.Randomization/Randomizers/Personal/PersonalRandomizer.cs
index ec80bc43..1f0bbb10 100644
--- a/pkNX.Randomization/Randomizers/Personal/PersonalRandomizer.cs
+++ b/pkNX.Randomization/Randomizers/Personal/PersonalRandomizer.cs
@@ -23,10 +23,12 @@ public PersonalRandomizer(IPersonalTable table, GameInfo game, EvolutionSet[] ev
Game = game;
Table = table;
Evolutions = evolutions;
- if (File.Exists("bannedabilites.txt"))
+
+ const string bannedExternalFile = "bannedabilites.txt";
+ if (File.Exists(bannedExternalFile))
{
- var data = File.ReadAllLines("bannedabilities.txt");
var list = new List(BannedAbilities);
+ var data = File.ReadLines(bannedExternalFile);
list.AddRange(data.Select(z => Convert.ToInt32(z)));
BannedAbilities = list;
}
diff --git a/pkNX.Randomization/Randomizers/TrainerRandomizer.cs b/pkNX.Randomization/Randomizers/TrainerRandomizer.cs
index 46211824..70e156c5 100644
--- a/pkNX.Randomization/Randomizers/TrainerRandomizer.cs
+++ b/pkNX.Randomization/Randomizers/TrainerRandomizer.cs
@@ -134,14 +134,13 @@ private void SetRandomClass(VsTrainer tr)
private void DetermineSpecies(IPokeData pk)
{
- if (Settings.RandomizeTeam)
- {
- int Type = Settings.TeamTypeThemed ? Util.Random.Next(17) : -1;
- RandomizeSpecFormItem(pk, Type);
+ if (!Settings.RandomizeTeam)
+ return;
+ int Type = Settings.TeamTypeThemed ? Util.Random.Next(17) : -1;
+ RandomizeSpecFormItem(pk, Type);
- pk.Gender = 0; // random
- pk.Nature = Util.Random.Next(25); // random
- }
+ pk.Gender = 0; // random
+ pk.Nature = Util.Random.Next(25); // random
}
private void RandomizeSpecFormItem(IPokeData pk, int Type)
@@ -270,9 +269,6 @@ public static void BoostLevel(IPokeData pk, double ratio)
public void ModifyAllPokemon(Action act)
{
- if (act == null)
- throw new ArgumentException(nameof(act));
-
foreach (var tr in Trainers.Where(z => z.Team.Count != 0))
{
foreach (var pk in tr.Team)
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Config/ConfigureTable8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Config/ConfigureTable8a.cs
index 769158a6..3a842a03 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Config/ConfigureTable8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Config/ConfigureTable8a.cs
@@ -1,7 +1,6 @@
using System;
using System.ComponentModel;
using FlatSharp.Attributes;
-using pkNX.Containers;
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable ClassNeverInstantiated.Global
diff --git a/pkNX.Structures.FlatBuffers/Arceus/DressUp/DressUpColorType8a.cs b/pkNX.Structures.FlatBuffers/Arceus/DressUp/DressUpColorType8a.cs
index cfc60bac..5c411a61 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/DressUp/DressUpColorType8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/DressUp/DressUpColorType8a.cs
@@ -1,7 +1,6 @@
-using FlatSharp.Attributes;
+using FlatSharp.Attributes;
// ReSharper disable UnusedMember.Global
-#pragma warning disable RCS1154 // Sort enum members.
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Arceus/DressUp/DressUpTable8a.cs b/pkNX.Structures.FlatBuffers/Arceus/DressUp/DressUpTable8a.cs
index c589bd3a..dec9f597 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/DressUp/DressUpTable8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/DressUp/DressUpTable8a.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.ComponentModel;
using FlatSharp.Attributes;
@@ -74,7 +74,6 @@ public class DressUpEntry8a
[FlatBufferItem(49)] public string MotionPath { get; set; } = string.Empty;
[FlatBufferItem(50)] public byte Field_50 { get; set; }
[FlatBufferItem(51)] public uint Field_51 { get; set; } // Unused
- [FlatBufferItem(52)] public string CategoryName { get; set; } = String.Empty;
- [FlatBufferItem(53)] public string SubCategoryName { get; set; } = String.Empty;
-
+ [FlatBufferItem(52)] public string CategoryName { get; set; } = string.Empty;
+ [FlatBufferItem(53)] public string SubCategoryName { get; set; } = string.Empty;
}
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Field/NewHuge/NewHugeOutbreakLottery8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Field/NewHuge/NewHugeOutbreakLottery8a.cs
index 8c252fc1..3de85381 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Field/NewHuge/NewHugeOutbreakLottery8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Field/NewHuge/NewHugeOutbreakLottery8a.cs
@@ -47,7 +47,6 @@ public class NewHugeOutbreakLottery8a
[Category(MapSetting), Description("Number of outbreaks that use the Rare1 table.")]
[FlatBufferItem(06)] public int OutbreakRare1 { get; set; }
-
[Category(OutbreakSetting), Description("Minimum number of Pokémon to spawn in the first wave.")]
[FlatBufferItem(07)] public int CountFirstMin { get; set; }
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Field/Slots/EncounterMultiplerArchive8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Field/Slots/EncounterMultiplerArchive8a.cs
index a7659392..4318ce8f 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Field/Slots/EncounterMultiplerArchive8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Field/Slots/EncounterMultiplerArchive8a.cs
@@ -30,8 +30,8 @@ public EncounterMultiplier8a GetEncounterMultiplier(EncounterSlot8a slot)
public EncounterMultiplier8a GetEntry(ushort species, ushort form)
{
- return Table.FirstOrDefault(x => x.Species == species && x.Form == form) ??
- new EncounterMultiplier8a { };
+ return Array.Find(Table, x => x.Species == species && x.Form == form) ??
+ new EncounterMultiplier8a();
}
public bool HasEntry(ushort species, ushort form)
diff --git a/pkNX.Structures.FlatBuffers/Arceus/NPC/NPCModelSet8a.cs b/pkNX.Structures.FlatBuffers/Arceus/NPC/NPCModelSet8a.cs
index c6c83ecf..bdac45c4 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/NPC/NPCModelSet8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/NPC/NPCModelSet8a.cs
@@ -1,8 +1,6 @@
-using FlatSharp.Attributes;
+using FlatSharp.Attributes;
using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Text;
namespace pkNX.Structures.FlatBuffers;
@@ -68,4 +66,4 @@ public class NPCModelColorConfig
[FlatBufferItem(07)] public uint[] R3 { get; set; } = Array.Empty();
[FlatBufferItem(08)] public uint[] G3 { get; set; } = Array.Empty();
[FlatBufferItem(09)] public uint[] B3 { get; set; } = Array.Empty();
-}
\ No newline at end of file
+}
diff --git a/pkNX.Structures.FlatBuffers/Arceus/NPC/NPCResidentType8a.cs b/pkNX.Structures.FlatBuffers/Arceus/NPC/NPCResidentType8a.cs
index 091b2d0c..a7b50b24 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/NPC/NPCResidentType8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/NPC/NPCResidentType8a.cs
@@ -1,10 +1,7 @@
-using FlatSharp.Attributes;
+using FlatSharp.Attributes;
namespace pkNX.Structures.FlatBuffers;
-
-#pragma warning disable RCS1154 // Sort enum members.
-
[FlatBufferEnum(typeof(ulong))]
public enum NPCResidentType8a : ulong
{
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Poke/EvolutionTable8.cs b/pkNX.Structures.FlatBuffers/Arceus/Poke/EvolutionTable8.cs
index 02596687..01089bb0 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Poke/EvolutionTable8.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Poke/EvolutionTable8.cs
@@ -32,8 +32,8 @@ public byte[] Write()
if (Table is null)
return Array.Empty();
- using MemoryStream ms = new();
- using BinaryWriter bw = new(ms);
+ using var ms = new MemoryStream();
+ using var bw = new BinaryWriter(ms);
foreach (var evo in Table)
{
// ReSharper disable RedundantCast
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Poke/Model Set/PokeModelSet8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Poke/Model Set/PokeModelSet8a.cs
index 65b76304..afd61eea 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Poke/Model Set/PokeModelSet8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Poke/Model Set/PokeModelSet8a.cs
@@ -1,11 +1,9 @@
using FlatSharp.Attributes;
using pkNX.Containers;
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
-using System.Text;
namespace pkNX.Structures.FlatBuffers;
@@ -17,8 +15,8 @@ public class PokeModelSet8a : IFlatBufferArchive
public PokeModelSetEntry8a GetEntry(ushort species)
{
- return Table.FirstOrDefault(z => z.Species == species) ??
- new PokeModelSetEntry8a { };
+ return Array.Find(Table, z => z.Species == species) ??
+ new PokeModelSetEntry8a();
}
public bool HasEntry(ushort species)
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeAIArchive8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeAIArchive8a.cs
index 44a5be9e..7979cfec 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeAIArchive8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeAIArchive8a.cs
@@ -22,8 +22,8 @@ public class PokeAIArchive8a : IFlatBufferArchive
public PokeAI8a GetEntry(ushort species, ushort form)
{
- return Table.FirstOrDefault(z => z.Species == species && z.Form == form) ??
- new PokeAI8a { };
+ return Array.Find(Table, z => z.Species == species && z.Form == form) ??
+ new PokeAI8a();
}
public bool HasEntry(ushort species, ushort form, bool isAlpha)
@@ -167,5 +167,5 @@ public class PokeAIBehaviour
public static readonly PokeAIBehaviour Behaviour_04_Params = new() { BehaviourHash = 1234775724179408742, Parameters = new string[] { "3", "5", "60", "90", "4", "run", "Normal" } };
[FlatBufferItem(00)] public ulong BehaviourHash { get; set; } = 9252365659083253459;
- [FlatBufferItem(01)] public string[] Parameters { get; set; } = new string[] { "0.5", "35" };
+ [FlatBufferItem(01)] public string[] Parameters { get; set; } = { "0.5", "35" };
}
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeMiscTable8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeMiscTable8a.cs
index 21e39717..45b2a6c5 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeMiscTable8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeMiscTable8a.cs
@@ -22,7 +22,7 @@ public class PokeMiscTable8a : IFlatBufferArchive
public PokeMisc8a GetEntry(ushort species, ushort form)
{
- return Table.FirstOrDefault(z => z.Species == species && z.Form == form) ??
+ return Array.Find(Table, z => z.Species == species && z.Form == form) ??
new PokeMisc8a { Value = $"{species}-{form} is not in {nameof(PokeMiscTable8a)}." };
}
@@ -61,7 +61,7 @@ public class PokeMisc8a
public PokeDropItem8a? AlphaDropTable { get; set; }
[FlatBufferItem(09)] public string Value { get; set; } = "pm0000_00_00";
- [FlatBufferItem(10)] public uint[] Field_10 { get; set; } = new uint[] { 0, 1, 2, 3 };
+ [FlatBufferItem(10)] public uint[] Field_10 { get; set; } = { 0, 1, 2, 3 };
[FlatBufferItem(11)] public int Field_11 { get; set; } = 0;
[FlatBufferItem(12)] public int Field_12 { get; set; } = 4;
[FlatBufferItem(13)] public int Field_13 { get; set; } = 10;
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeResource/PokeInfoList.cs b/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeResource/PokeInfoList.cs
index 1374feb2..6d9735b2 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeResource/PokeInfoList.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeResource/PokeInfoList.cs
@@ -26,13 +26,13 @@ public class PokeInfoList8a : IFlatBufferArchive
public PokeInfo8a GetEntry(ushort species)
{
- return Table.FirstOrDefault(z => z.Species == species) ??
- new PokeInfo8a { };
+ return Array.Find(Table, z => z.Species == species) ??
+ new PokeInfo8a();
}
public bool HasEntry(ushort species)
{
- return Table.Any(x => x.Species == species);
+ return Array.Exists(Table, x => x.Species == species);
}
public PokeInfo8a AddEntry(ushort species, byte formCount)
@@ -60,7 +60,7 @@ public PokeInfo8a AddEntry(ushort species, byte formCount)
new() {
Detail = new PokeInfoDetail8a_5[] {
new() {
- AssetName = $"{species:0000}_{genderId:000}_{form:000}_n_00000000_fn_n"
+ AssetName = $"{species:0000}_{genderId:000}_{form:000}_n_00000000_fn_n",
}
}
}
@@ -72,7 +72,7 @@ public PokeInfo8a AddEntry(ushort species, byte formCount)
new() {
Detail = new PokeInfoDetail8a_5[] {
new() {
- AssetName = $"{species:0000}_{genderId:000}_{form:000}_n_00000000_fn_r"
+ AssetName = $"{species:0000}_{genderId:000}_{form:000}_n_00000000_fn_r",
}
}
}
@@ -82,7 +82,6 @@ public PokeInfo8a AddEntry(ushort species, byte formCount)
};
}
-
Table = Table.Append(entry)
.OrderBy(x => x.Species)
.ToArray();
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeResource/PokeResourceTable8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeResource/PokeResourceTable8a.cs
index 94253a8f..c0c32679 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeResource/PokeResourceTable8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Poke/PokeResource/PokeResourceTable8a.cs
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
-using System.Data;
using System.Diagnostics;
using System.Linq;
using FlatSharp.Attributes;
@@ -23,8 +22,8 @@ public class PokeResourceTable8a : IFlatBufferArchive
public PokeModelConfig8a GetEntry(ushort species, ushort form, byte gender)
{
- return Table.FirstOrDefault(x => x.Meta.Species == species && x.Meta.Form == form && x.Meta.Gender == gender) ??
- new PokeModelConfig8a { };
+ return Array.Find(Table, x => x.Meta.Species == species && x.Meta.Form == form && x.Meta.Gender == gender) ??
+ new PokeModelConfig8a();
}
public bool HasEntry(ushort species, ushort form, byte gender)
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowEffectHitType8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowEffectHitType8a.cs
index feb6ea99..98336de8 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowEffectHitType8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowEffectHitType8a.cs
@@ -17,5 +17,5 @@ public enum ThrowEffectHitType8a : ulong
EffectUnk1Hit = 0x262b03b924121730,
EffectUnk2Hit = 0x7f5d5908e7deb625,
EffectUnk3Hit = 0x9fa86e9cc66822a,
- EffectUnk4Hit = 0x69d10d3d31d81522,
+ EffectUnk4Hit = 0x69d10d3d31d81522,
}
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowItemCategoryType8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowItemCategoryType8a.cs
index 0014c8c7..a900a8e6 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowItemCategoryType8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowItemCategoryType8a.cs
@@ -1,8 +1,6 @@
using FlatSharp.Attributes;
// ReSharper disable UnusedMember.Global
-#pragma warning disable RCS1154 // Sort enum members.
-
namespace pkNX.Structures.FlatBuffers;
[FlatBufferEnum(typeof(ulong))]
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowPermissionSetType8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowPermissionSetType8a.cs
index f9028c20..f1760fee 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowPermissionSetType8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowPermissionSetType8a.cs
@@ -1,8 +1,6 @@
using FlatSharp.Attributes;
// ReSharper disable UnusedMember.Global
-#pragma warning disable RCS1154 // Sort enum members.
-
namespace pkNX.Structures.FlatBuffers;
[FlatBufferEnum(typeof(ulong))]
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowableParamTable8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowableParamTable8a.cs
index 68a60ede..79f58fb1 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowableParamTable8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Throw/ThrowableParamTable8a.cs
@@ -18,7 +18,7 @@ public class ThrowableParamTable8a : IFlatBufferArchive
public void AddEntry(int itemID)
{
- Table = Table.Append(new ThrowableParam8a() { ItemID = itemID });
+ Table = Table.Append(new ThrowableParam8a { ItemID = itemID });
}
[FlatBufferItem(0)] public ThrowableParam8a[] Table { get; set; } = Array.Empty();
diff --git a/pkNX.Structures.FlatBuffers/Arceus/Util/ArchiveContents8a.cs b/pkNX.Structures.FlatBuffers/Arceus/Util/ArchiveContents8a.cs
index f2f85992..1940238e 100644
--- a/pkNX.Structures.FlatBuffers/Arceus/Util/ArchiveContents8a.cs
+++ b/pkNX.Structures.FlatBuffers/Arceus/Util/ArchiveContents8a.cs
@@ -22,7 +22,7 @@ public class ArchiveContents8a : IFlatBufferArchive
public ArchiveContent8a AddEntry()
{
- var entry = new ArchiveContent8a { };
+ var entry = new ArchiveContent8a();
Table = Table.Append(entry);
return entry;
diff --git a/pkNX.Structures.FlatBuffers/Gen7/EncounterArchive7b.cs b/pkNX.Structures.FlatBuffers/Gen7/EncounterArchive7b.cs
index 01be3a67..a366b489 100644
--- a/pkNX.Structures.FlatBuffers/Gen7/EncounterArchive7b.cs
+++ b/pkNX.Structures.FlatBuffers/Gen7/EncounterArchive7b.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen7/ShopInventory.cs b/pkNX.Structures.FlatBuffers/Gen7/ShopInventory.cs
index c55690e2..18bbe12a 100644
--- a/pkNX.Structures.FlatBuffers/Gen7/ShopInventory.cs
+++ b/pkNX.Structures.FlatBuffers/Gen7/ShopInventory.cs
@@ -8,7 +8,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/BattleTower/BattleTowerPoke8Archive.cs b/pkNX.Structures.FlatBuffers/Gen8/BattleTower/BattleTowerPoke8Archive.cs
index 8e4db2f0..b3203931 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/BattleTower/BattleTowerPoke8Archive.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/BattleTower/BattleTowerPoke8Archive.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/BattleTower/BattleTowerTrainer8Archive.cs b/pkNX.Structures.FlatBuffers/Gen8/BattleTower/BattleTowerTrainer8Archive.cs
index e4d5edea..d283c7d4 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/BattleTower/BattleTowerTrainer8Archive.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/BattleTower/BattleTowerTrainer8Archive.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Gift/EncounterGift8Archive.cs b/pkNX.Structures.FlatBuffers/Gen8/Gift/EncounterGift8Archive.cs
index e7490176..41cefd13 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Gift/EncounterGift8Archive.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Gift/EncounterGift8Archive.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Gift/GiftEncounter8.cs b/pkNX.Structures.FlatBuffers/Gen8/Gift/GiftEncounter8.cs
index e5597d00..72e92610 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Gift/GiftEncounter8.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Gift/GiftEncounter8.cs
@@ -9,7 +9,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleDistributionReward8Archive.cs b/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleDistributionReward8Archive.cs
index 6f236fec..44425c34 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleDistributionReward8Archive.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleDistributionReward8Archive.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleLevel8Archive.cs b/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleLevel8Archive.cs
index 8e8f0e7b..3063f7f4 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleLevel8Archive.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleLevel8Archive.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleReward8Archive.cs b/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleReward8Archive.cs
index 3d8543c0..cbd8b036 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleReward8Archive.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Nest/NestHoleReward8Archive.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Other/ArchiveContent.cs b/pkNX.Structures.FlatBuffers/Gen8/Other/ArchiveContent.cs
index 52658085..e28d4fd2 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Other/ArchiveContent.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Other/ArchiveContent.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Other/Rental8.cs b/pkNX.Structures.FlatBuffers/Gen8/Other/Rental8.cs
index 0557f770..607becaa 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Other/Rental8.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Other/Rental8.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Other/ScriptMeta.cs b/pkNX.Structures.FlatBuffers/Gen8/Other/ScriptMeta.cs
index c57453c7..abeda767 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Other/ScriptMeta.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Other/ScriptMeta.cs
@@ -6,7 +6,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Other/SymbolBehavior.cs b/pkNX.Structures.FlatBuffers/Gen8/Other/SymbolBehavior.cs
index a2f0355e..69632fc9 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Other/SymbolBehavior.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Other/SymbolBehavior.cs
@@ -6,7 +6,6 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures.FlatBuffers/Gen8/Static/EncounterStatic8.cs b/pkNX.Structures.FlatBuffers/Gen8/Static/EncounterStatic8.cs
index 71b77fe8..8a050273 100644
--- a/pkNX.Structures.FlatBuffers/Gen8/Static/EncounterStatic8.cs
+++ b/pkNX.Structures.FlatBuffers/Gen8/Static/EncounterStatic8.cs
@@ -8,7 +8,6 @@
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
#nullable disable
-#pragma warning disable CA1819 // Properties should not return arrays
namespace pkNX.Structures.FlatBuffers;
diff --git a/pkNX.Structures/Evolution/EvolutionSet6.cs b/pkNX.Structures/Evolution/EvolutionSet6.cs
index 30162a85..cf3cd875 100644
--- a/pkNX.Structures/Evolution/EvolutionSet6.cs
+++ b/pkNX.Structures/Evolution/EvolutionSet6.cs
@@ -39,8 +39,8 @@ private static EvolutionMethod GetEvo(byte[] data, int offset)
public override byte[] Write()
{
- using MemoryStream ms = new MemoryStream();
- using BinaryWriter bw = new BinaryWriter(ms);
+ using var ms = new MemoryStream();
+ using var bw = new BinaryWriter(ms);
foreach (EvolutionMethod evo in PossibleEvolutions)
{
bw.Write((ushort)evo.Method);
diff --git a/pkNX.Structures/Evolution/EvolutionSet7.cs b/pkNX.Structures/Evolution/EvolutionSet7.cs
index 93bff80f..555b70ee 100644
--- a/pkNX.Structures/Evolution/EvolutionSet7.cs
+++ b/pkNX.Structures/Evolution/EvolutionSet7.cs
@@ -20,8 +20,8 @@ public EvolutionSet7(ReadOnlySpan data)
public override byte[] Write()
{
- using MemoryStream ms = new();
- using BinaryWriter bw = new(ms);
+ using var ms = new MemoryStream();
+ using var bw = new BinaryWriter(ms);
foreach (EvolutionMethod evo in PossibleEvolutions)
{
bw.Write((ushort)evo.Method);
diff --git a/pkNX.Structures/Evolution/EvolutionSet8.cs b/pkNX.Structures/Evolution/EvolutionSet8.cs
index b558dd96..6306b0ef 100644
--- a/pkNX.Structures/Evolution/EvolutionSet8.cs
+++ b/pkNX.Structures/Evolution/EvolutionSet8.cs
@@ -20,8 +20,8 @@ public EvolutionSet8(ReadOnlySpan data)
public override byte[] Write()
{
- using MemoryStream ms = new();
- using BinaryWriter bw = new(ms);
+ using var ms = new MemoryStream();
+ using var bw = new BinaryWriter(ms);
foreach (EvolutionMethod evo in PossibleEvolutions)
{
bw.Write((ushort)evo.Method);
diff --git a/pkNX.Structures/Item/Item8.cs b/pkNX.Structures/Item/Item8.cs
index d19012c8..e4b0106b 100644
--- a/pkNX.Structures/Item/Item8.cs
+++ b/pkNX.Structures/Item/Item8.cs
@@ -101,7 +101,7 @@ public static Item8[] GetArray(byte[] bin)
for (var i = 0; i < result.Length; i++)
{
var entryIndex = BitConverter.ToUInt16(bin, 0x44 + (2 * i));
- if (entryIndex >= maxEntryIndex) { throw new ArgumentException(); }
+ if (entryIndex >= maxEntryIndex) { throw new IndexOutOfRangeException(); }
result[i] = new Item8(i, bin.Slice(entriesStart + (entryIndex * SIZE), SIZE));
}
@@ -119,7 +119,7 @@ public static byte[] SetArray(Item8[] array, byte[] bin)
for (int i = 0; i < array.Length; i++)
{
var entryIndex = BitConverter.ToUInt16(bin, 0x44 + (2 * i));
- if (entryIndex >= maxEntryIndex) { throw new ArgumentException(); }
+ if (entryIndex >= maxEntryIndex) { throw new IndexOutOfRangeException(); }
var data = array[i].Data;
data.CopyTo(bin, entriesStart + (entryIndex * SIZE));
diff --git a/pkNX.Structures/Item/Item8a.cs b/pkNX.Structures/Item/Item8a.cs
index 2c0ea5ce..b5b0f4a1 100644
--- a/pkNX.Structures/Item/Item8a.cs
+++ b/pkNX.Structures/Item/Item8a.cs
@@ -85,7 +85,7 @@ public static Item8a[] GetArray(byte[] bin)
for (var i = 0; i < result.Length; i++)
{
var entryIndex = BitConverter.ToUInt16(bin, 0x4C + (2 * i));
- if (entryIndex >= maxEntryIndex) { throw new ArgumentException(); }
+ if (entryIndex >= maxEntryIndex) { throw new IndexOutOfRangeException(); }
result[i] = new Item8a(i, bin.Slice(entriesStart + (entryIndex * SIZE), SIZE));
}
@@ -103,7 +103,7 @@ public static byte[] SetArray(Item8a[] array, byte[] bin)
for (int i = 0; i < array.Length; i++)
{
var entryIndex = BitConverter.ToUInt16(bin, 0x4C + (2 * i));
- if (entryIndex >= maxEntryIndex) { throw new ArgumentException(); }
+ if (entryIndex >= maxEntryIndex) { throw new IndexOutOfRangeException(); }
var data = array[i].Data;
data.CopyTo(bin, entriesStart + (entryIndex * SIZE));
diff --git a/pkNX.Structures/Learnset/Learnset6.cs b/pkNX.Structures/Learnset/Learnset6.cs
index 59b7020a..23093526 100644
--- a/pkNX.Structures/Learnset/Learnset6.cs
+++ b/pkNX.Structures/Learnset/Learnset6.cs
@@ -24,8 +24,8 @@ public Learnset6(byte[] data)
public override byte[] Write()
{
Count = (ushort)Moves.Length;
- using MemoryStream ms = new MemoryStream();
- using BinaryWriter bw = new BinaryWriter(ms);
+ using var ms = new MemoryStream();
+ using var bw = new BinaryWriter(ms);
for (int i = 0; i < Count; i++)
{
bw.Write((short)Moves[i]);
diff --git a/pkNX.Structures/Learnset/Learnset8.cs b/pkNX.Structures/Learnset/Learnset8.cs
index 2a7c1558..6b46363f 100644
--- a/pkNX.Structures/Learnset/Learnset8.cs
+++ b/pkNX.Structures/Learnset/Learnset8.cs
@@ -38,8 +38,8 @@ public Learnset8(byte[] data)
public override byte[] Write()
{
Count = (ushort)Moves.Length;
- using MemoryStream ms = new MemoryStream();
- using BinaryWriter bw = new BinaryWriter(ms);
+ using var ms = new MemoryStream();
+ using var bw = new BinaryWriter(ms);
for (int i = 0; i < Count; i++)
{
bw.Write((short)Moves[i]);
diff --git a/pkNX.Structures/TableUtil.cs b/pkNX.Structures/TableUtil.cs
index 0a41f59d..c5097a98 100644
--- a/pkNX.Structures/TableUtil.cs
+++ b/pkNX.Structures/TableUtil.cs
@@ -15,7 +15,7 @@ public static class TableUtil
/// 2 dimensional sheet of cells
public static string GetTable(IEnumerable arr) where T : class => string.Join(Environment.NewLine, GetTableRaw(arr));
- private const string sep = "\t";
+ private const char sep = '\t';
private static IEnumerable GetTableRaw(IEnumerable arr) where T : class
=> Table(arr).Select(row => string.Join(sep, row));
private static IEnumerable GetTableRaw(IEnumerable arr, Type t) where T : class
@@ -94,7 +94,7 @@ private static string GetFormattedString(object? obj)
if (obj is ulong u)
return u.ToString("X16");
if (obj is IEnumerable x and not string)
- return string.Join("|", JoinEnumerator(x.GetEnumerator()).Select(GetFormattedString));
+ return string.Join('|', JoinEnumerator(x.GetEnumerator()).Select(GetFormattedString));
var objType = obj.GetType();
if (objType.IsEnum)
@@ -104,7 +104,7 @@ private static string GetFormattedString(object? obj)
return obj.ToString() ?? string.Empty;
var props = objType.GetProperties();
- return string.Join("|", props.Select(z => GetFormattedString(z.GetValue(obj))));
+ return string.Join('|', props.Select(z => GetFormattedString(z.GetValue(obj))));
}
private static IEnumerable