mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-16 13:28:35 +00:00
Update to .NET 9, c# 13 (#4390)
This commit is contained in:
parent
adb67922c5
commit
ceb669c112
112 changed files with 442 additions and 356 deletions
|
@ -35,6 +35,23 @@ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:sug
|
||||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggest
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggest
|
||||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggest
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggest
|
||||||
dotnet_style_parentheses_in_other_operators = always_for_clarity:suggest
|
dotnet_style_parentheses_in_other_operators = always_for_clarity:suggest
|
||||||
|
csharp_indent_labels = one_less_than_current
|
||||||
|
csharp_using_directive_placement = outside_namespace:silent
|
||||||
|
csharp_prefer_simple_using_statement = true:suggestion
|
||||||
|
csharp_style_namespace_declarations = block_scoped:silent
|
||||||
|
csharp_style_prefer_method_group_conversion = true:silent
|
||||||
|
csharp_style_prefer_top_level_statements = true:silent
|
||||||
|
csharp_style_prefer_primary_constructors = true:suggestion
|
||||||
|
csharp_prefer_system_threading_lock = true:suggestion
|
||||||
|
csharp_style_expression_bodied_methods = false:silent
|
||||||
|
csharp_style_expression_bodied_constructors = false:silent
|
||||||
|
csharp_style_expression_bodied_operators = false:silent
|
||||||
|
csharp_style_expression_bodied_properties = true:silent
|
||||||
|
csharp_style_expression_bodied_indexers = true:silent
|
||||||
|
csharp_style_expression_bodied_accessors = true:silent
|
||||||
|
csharp_style_expression_bodied_lambdas = true:silent
|
||||||
|
csharp_style_expression_bodied_local_functions = false:silent
|
||||||
|
dotnet_diagnostic.WFO1000.severity = none
|
||||||
|
|
||||||
[*.{cs,vb}]
|
[*.{cs,vb}]
|
||||||
#### Naming styles ####
|
#### Naming styles ####
|
||||||
|
@ -43,3 +60,67 @@ dotnet_style_parentheses_in_other_operators = always_for_clarity:suggest
|
||||||
|
|
||||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||||
|
|
||||||
|
[*.{cs,vb}]
|
||||||
|
#### Naming styles ####
|
||||||
|
|
||||||
|
# Naming rules
|
||||||
|
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||||
|
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||||
|
|
||||||
|
# Symbol specifications
|
||||||
|
|
||||||
|
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||||
|
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.interface.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||||
|
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.types.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||||
|
|
||||||
|
# Naming styles
|
||||||
|
|
||||||
|
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||||
|
dotnet_naming_style.begins_with_i.required_suffix =
|
||||||
|
dotnet_naming_style.begins_with_i.word_separator =
|
||||||
|
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style.pascal_case.required_prefix =
|
||||||
|
dotnet_naming_style.pascal_case.required_suffix =
|
||||||
|
dotnet_naming_style.pascal_case.word_separator =
|
||||||
|
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style.pascal_case.required_prefix =
|
||||||
|
dotnet_naming_style.pascal_case.required_suffix =
|
||||||
|
dotnet_naming_style.pascal_case.word_separator =
|
||||||
|
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||||
|
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||||
|
tab_width = 4
|
||||||
|
end_of_line = crlf
|
||||||
|
dotnet_style_coalesce_expression = true:suggestion
|
||||||
|
dotnet_style_null_propagation = true:suggestion
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
|
||||||
|
dotnet_style_prefer_auto_properties = true:silent
|
||||||
|
dotnet_style_object_initializer = true:suggestion
|
||||||
|
dotnet_style_collection_initializer = true:suggestion
|
||||||
|
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
||||||
|
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
|
||||||
|
dotnet_style_prefer_conditional_expression_over_return = true:silent
|
||||||
|
dotnet_style_explicit_tuple_names = true:suggestion
|
||||||
|
|
||||||
|
# IDE0130: Namespace does not match folder structure
|
||||||
|
dotnet_diagnostic.IDE0130.severity = none
|
||||||
|
|
4
.github/README-de.md
vendored
4
.github/README-de.md
vendored
|
@ -28,9 +28,9 @@ PKHeX erwartet entschlüsselte Spielstände. Da diese konsolenspezifisch verschl
|
||||||
|
|
||||||
## Erstellen
|
## Erstellen
|
||||||
|
|
||||||
PKHeX ist eine Windows Forms Anwendung, welche die [.NET 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) runtime benötigt.
|
PKHeX ist eine Windows Forms Anwendung, welche die [.NET 9.0](https://dotnet.microsoft.com/download/dotnet/9.0) runtime benötigt.
|
||||||
|
|
||||||
Die Anwendung kann mit jedem Kompiler erstellt werden, der C# 12 unterstützt.
|
Die Anwendung kann mit jedem Kompiler erstellt werden, der C# 13 unterstützt.
|
||||||
|
|
||||||
### Erstell Konfiguration
|
### Erstell Konfiguration
|
||||||
|
|
||||||
|
|
4
.github/README-es.md
vendored
4
.github/README-es.md
vendored
|
@ -28,9 +28,9 @@ PKHeX espera archivos de guardado que no estén cifrados con las claves específ
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
PKHeX es una aplicación de Windows Forms que requiere [.NET 8.0](https://dotnet.microsoft.com/download/dotnet/8.0).
|
PKHeX es una aplicación de Windows Forms que requiere [.NET 9.0](https://dotnet.microsoft.com/download/dotnet/9.0).
|
||||||
|
|
||||||
El archivo ejecutable puede ser construido con cualquier compilador que soporte C# 12.
|
El archivo ejecutable puede ser construido con cualquier compilador que soporte C# 13.
|
||||||
|
|
||||||
### Configuraciones del Build
|
### Configuraciones del Build
|
||||||
|
|
||||||
|
|
4
.github/README-fr.md
vendored
4
.github/README-fr.md
vendored
|
@ -27,9 +27,9 @@ PKHeX attend des fichiers de sauvegarde qui ne sont pas chiffrés avec des clés
|
||||||
|
|
||||||
## Construction
|
## Construction
|
||||||
|
|
||||||
PKHeX est une application Windows Forms qui nécessite [.NET 8.0.](https://dotnet.microsoft.com/download/dotnet/8.0)
|
PKHeX est une application Windows Forms qui nécessite [.NET 9.0.](https://dotnet.microsoft.com/download/dotnet/9.0)
|
||||||
|
|
||||||
L'exécutable peut être construit avec n'importe quel compilateur prenant en charge C# 12.
|
L'exécutable peut être construit avec n'importe quel compilateur prenant en charge C# 13.
|
||||||
|
|
||||||
### Construire les configurations
|
### Construire les configurations
|
||||||
|
|
||||||
|
|
4
.github/README-it.md
vendored
4
.github/README-it.md
vendored
|
@ -28,9 +28,9 @@ PKHeX si aspetta file di salvataggio non criptati con le chiavi specifiche della
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
PKHeX è un applicazione Windows Form che necessita del [.NET Desktop Runtime 8.0](https://dotnet.microsoft.com/download/dotnet/8.0).
|
PKHeX è un applicazione Windows Form che necessita del [.NET Desktop Runtime 9.0](https://dotnet.microsoft.com/download/dotnet/9.0).
|
||||||
|
|
||||||
L'eseguibile può essere compilato con qualsiasi compiler che supporti C# 12.
|
L'eseguibile può essere compilato con qualsiasi compiler che supporti C# 13.
|
||||||
|
|
||||||
### Configurazioni di Build
|
### Configurazioni di Build
|
||||||
|
|
||||||
|
|
4
.github/README-zh-Hans.md
vendored
4
.github/README-zh-Hans.md
vendored
|
@ -28,9 +28,9 @@ PKHeX 所读取存档文件必须是未经主机唯一密钥加密,因此请
|
||||||
|
|
||||||
## 构建
|
## 构建
|
||||||
|
|
||||||
PKHeX 是 Windows 窗口应用程序,依赖于 [.NET 8.0](https://dotnet.microsoft.com/download/dotnet/8.0)。
|
PKHeX 是 Windows 窗口应用程序,依赖于 [.NET 9.0](https://dotnet.microsoft.com/download/dotnet/9.0)。
|
||||||
|
|
||||||
可以使用任何支持 C# 12 的编译器生成可执行文件。
|
可以使用任何支持 C# 13 的编译器生成可执行文件。
|
||||||
|
|
||||||
### 构建配置
|
### 构建配置
|
||||||
|
|
||||||
|
|
4
.github/README-zh-Hant.md
vendored
4
.github/README-zh-Hant.md
vendored
|
@ -28,9 +28,9 @@ PKHeX 所讀取檔案須未經主機唯一密鑰加密,因而請使用儲存
|
||||||
|
|
||||||
## 構建
|
## 構建
|
||||||
|
|
||||||
PKHeX 係 Windows 窗體應用程式,其須依賴於 [.NET 7.0](https://dotnet.microsoft.com/download/dotnet/8.0)。
|
PKHeX 係 Windows 窗體應用程式,其須依賴於 [.NET 9.0](https://dotnet.microsoft.com/download/dotnet/9.0)。
|
||||||
|
|
||||||
程式可透過任意支援 C# 12 之編譯器構建。
|
程式可透過任意支援 C# 13 之編譯器構建。
|
||||||
|
|
||||||
### 構建配置
|
### 構建配置
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>24.11.11</Version>
|
<Version>24.11.11</Version>
|
||||||
<LangVersion>12</LangVersion>
|
<LangVersion>13</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<NeutralLanguage>en</NeutralLanguage>
|
<NeutralLanguage>en</NeutralLanguage>
|
||||||
<Product>PKHeX</Product>
|
<Product>PKHeX</Product>
|
||||||
|
|
|
@ -12,8 +12,8 @@ public static class BoxManipDefaults
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common sorting actions.
|
/// Common sorting actions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly IReadOnlyList<BoxManipBase> SortCommon = new List<BoxManipBase>
|
public static readonly IReadOnlyList<BoxManipBase> SortCommon =
|
||||||
{
|
[
|
||||||
new BoxManipSort(SortSpecies, EntitySorting.OrderBySpecies),
|
new BoxManipSort(SortSpecies, EntitySorting.OrderBySpecies),
|
||||||
new BoxManipSort(SortSpeciesReverse, EntitySorting.OrderByDescendingSpecies),
|
new BoxManipSort(SortSpeciesReverse, EntitySorting.OrderByDescendingSpecies),
|
||||||
new BoxManipSort(SortLevel, EntitySorting.OrderByLevel),
|
new BoxManipSort(SortLevel, EntitySorting.OrderByLevel),
|
||||||
|
@ -24,13 +24,13 @@ public static class BoxManipDefaults
|
||||||
new BoxManipSortComplex(SortParty, (list, sav, start) => list.BubbleUp(sav, i => ((SAV7b)sav).Blocks.Storage.IsParty(i), start), s => s is SAV7b),
|
new BoxManipSortComplex(SortParty, (list, sav, start) => list.BubbleUp(sav, i => ((SAV7b)sav).Blocks.Storage.IsParty(i), start), s => s is SAV7b),
|
||||||
new BoxManipSort(SortShiny, list => list.OrderByCustom(pk => !pk.IsShiny)),
|
new BoxManipSort(SortShiny, list => list.OrderByCustom(pk => !pk.IsShiny)),
|
||||||
new BoxManipSort(SortRandom, list => list.OrderByCustom(_ => Util.Rand.Next())),
|
new BoxManipSort(SortRandom, list => list.OrderByCustom(_ => Util.Rand.Next())),
|
||||||
};
|
];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Advanced sorting actions.
|
/// Advanced sorting actions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly IReadOnlyList<BoxManipBase> SortAdvanced = new List<BoxManipBase>
|
public static readonly IReadOnlyList<BoxManipBase> SortAdvanced =
|
||||||
{
|
[
|
||||||
new BoxManipSort(SortUsage, EntitySorting.OrderByUsage, s => s.Generation >= 3),
|
new BoxManipSort(SortUsage, EntitySorting.OrderByUsage, s => s.Generation >= 3),
|
||||||
new BoxManipSort(SortPotential, list => list.OrderByCustom(pk => (pk.MaxIV * 6) - pk.IVTotal)),
|
new BoxManipSort(SortPotential, list => list.OrderByCustom(pk => (pk.MaxIV * 6) - pk.IVTotal)),
|
||||||
new BoxManipSort(SortTraining, list => list.OrderByCustom(pk => (pk.MaxEV * 6) - pk.EVTotal)),
|
new BoxManipSort(SortTraining, list => list.OrderByCustom(pk => (pk.MaxEV * 6) - pk.EVTotal)),
|
||||||
|
@ -45,13 +45,13 @@ public static class BoxManipDefaults
|
||||||
new BoxManipSort(SortMarks, list => list.OrderByCustom(pk => pk is IRibbonSetMarks s ? int.MaxValue - s.MarkCount : 0), s => s.BlankPKM is IRibbonSetMarks),
|
new BoxManipSort(SortMarks, list => list.OrderByCustom(pk => pk is IRibbonSetMarks s ? int.MaxValue - s.MarkCount : 0), s => s.BlankPKM is IRibbonSetMarks),
|
||||||
new BoxManipSort(SortLegal, list => list.OrderByCustom(pk => !new LegalityAnalysis(pk).Valid)),
|
new BoxManipSort(SortLegal, list => list.OrderByCustom(pk => !new LegalityAnalysis(pk).Valid)),
|
||||||
new BoxManipSort(SortEncounterType, list => list.OrderByCustom(pk => new LegalityAnalysis(pk).Info.EncounterMatch.LongName)),
|
new BoxManipSort(SortEncounterType, list => list.OrderByCustom(pk => new LegalityAnalysis(pk).Info.EncounterMatch.LongName)),
|
||||||
};
|
];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common deletion actions.
|
/// Common deletion actions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly IReadOnlyList<BoxManipBase> ClearCommon = new List<BoxManipBase>
|
public static readonly IReadOnlyList<BoxManipBase> ClearCommon =
|
||||||
{
|
[
|
||||||
new BoxManipClear(DeleteAll, _ => true),
|
new BoxManipClear(DeleteAll, _ => true),
|
||||||
new BoxManipClear(DeleteEggs, pk => pk.IsEgg, s => s.Generation >= 2 && s is not SAV8LA),
|
new BoxManipClear(DeleteEggs, pk => pk.IsEgg, s => s.Generation >= 2 && s is not SAV8LA),
|
||||||
new BoxManipClearComplex(DeletePastGen, (pk, sav) => pk.Generation != sav.Generation, s => s.Generation >= 4),
|
new BoxManipClearComplex(DeletePastGen, (pk, sav) => pk.Generation != sav.Generation, s => s.Generation >= 4),
|
||||||
|
@ -61,13 +61,13 @@ public static class BoxManipDefaults
|
||||||
new BoxManipClear(DeleteItemless, pk => pk.HeldItem == 0, s => s is not SAV8LA),
|
new BoxManipClear(DeleteItemless, pk => pk.HeldItem == 0, s => s is not SAV8LA),
|
||||||
new BoxManipClear(DeleteIllegal, pk => !new LegalityAnalysis(pk).Valid),
|
new BoxManipClear(DeleteIllegal, pk => !new LegalityAnalysis(pk).Valid),
|
||||||
new BoxManipClearDuplicate<string>(DeleteClones, pk => SearchUtil.GetCloneDetectMethod(CloneDetectionMethod.HashDetails)(pk)),
|
new BoxManipClearDuplicate<string>(DeleteClones, pk => SearchUtil.GetCloneDetectMethod(CloneDetectionMethod.HashDetails)(pk)),
|
||||||
};
|
];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common modifying actions.
|
/// Common modifying actions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly IReadOnlyList<BoxManipBase> ModifyCommon = new List<BoxManipBase>
|
public static readonly IReadOnlyList<BoxManipBase> ModifyCommon =
|
||||||
{
|
[
|
||||||
new BoxManipModifyComplex(ModifyHatchEggs, (pk, sav) => pk.ForceHatchPKM(sav), s => s.Generation >= 2 && s is not SAV8LA),
|
new BoxManipModifyComplex(ModifyHatchEggs, (pk, sav) => pk.ForceHatchPKM(sav), s => s.Generation >= 2 && s is not SAV8LA),
|
||||||
new BoxManipModify(ModifyMaxFriendship, pk => pk.MaximizeFriendship()),
|
new BoxManipModify(ModifyMaxFriendship, pk => pk.MaximizeFriendship()),
|
||||||
new BoxManipModify(ModifyMaxLevel, pk => pk.MaximizeLevel()),
|
new BoxManipModify(ModifyMaxLevel, pk => pk.MaximizeLevel()),
|
||||||
|
@ -78,5 +78,5 @@ public static class BoxManipDefaults
|
||||||
new BoxManipModify(ModifyRemoveNicknames, pk => pk.SetDefaultNickname()),
|
new BoxManipModify(ModifyRemoveNicknames, pk => pk.SetDefaultNickname()),
|
||||||
new BoxManipModify(ModifyRemoveItem, pk => pk.HeldItem = 0, s => s.Generation >= 2),
|
new BoxManipModify(ModifyRemoveItem, pk => pk.HeldItem = 0, s => s.Generation >= 2),
|
||||||
new BoxManipModify(ModifyHeal, pk => pk.Heal(), s => s.Generation >= 6), // HP stored in box, or official code has bugged transfer PP the user would like to rectify.
|
new BoxManipModify(ModifyHeal, pk => pk.Heal(), s => s.Generation >= 6), // HP stored in box, or official code has bugged transfer PP the user would like to rectify.
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ public sealed class EventWork<T> : EventVar where T : struct
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Values with known behavior. They are labeled with a humanized string.
|
/// Values with known behavior. They are labeled with a humanized string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly IList<EventWorkVal> Options = new List<EventWorkVal> { new() };
|
public readonly List<EventWorkVal> Options = [new()];
|
||||||
|
|
||||||
public EventWork(int index, EventVarType t, IReadOnlyList<string> pieces) : base(index, t, pieces[1])
|
public EventWork(int index, EventVarType t, IReadOnlyList<string> pieces) : base(index, t, pieces[1])
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,30 +11,30 @@ public sealed class GameDataSource
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of <see cref="Region3DSIndex"/> values to display.
|
/// List of <see cref="Region3DSIndex"/> values to display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly IReadOnlyList<ComboItem> Regions = new List<ComboItem>
|
public static readonly IReadOnlyList<ComboItem> Regions =
|
||||||
{
|
[
|
||||||
new ("Japan (日本)", 0),
|
new ("Japan (日本)", 0),
|
||||||
new ("Americas (NA/SA)", 1),
|
new ("Americas (NA/SA)", 1),
|
||||||
new ("Europe (EU/AU)", 2),
|
new ("Europe (EU/AU)", 2),
|
||||||
new ("China (中国大陆)", 4),
|
new ("China (中国大陆)", 4),
|
||||||
new ("Korea (한국)", 5),
|
new ("Korea (한국)", 5),
|
||||||
new ("Taiwan (香港/台灣)", 6),
|
new ("Taiwan (香港/台灣)", 6),
|
||||||
};
|
];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of <see cref="LanguageID"/> values to display.
|
/// List of <see cref="LanguageID"/> values to display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly ComboItem[] LanguageList =
|
private static readonly ComboItem[] LanguageList =
|
||||||
[
|
[
|
||||||
new ComboItem("JPN (日本語)", (int)LanguageID.Japanese),
|
new ("JPN (日本語)", (int)LanguageID.Japanese),
|
||||||
new ComboItem("ENG (English)", (int)LanguageID.English),
|
new ("ENG (English)", (int)LanguageID.English),
|
||||||
new ComboItem("FRE (Français)", (int)LanguageID.French),
|
new ("FRE (Français)", (int)LanguageID.French),
|
||||||
new ComboItem("ITA (Italiano)", (int)LanguageID.Italian),
|
new ("ITA (Italiano)", (int)LanguageID.Italian),
|
||||||
new ComboItem("GER (Deutsch)", (int)LanguageID.German),
|
new ("GER (Deutsch)", (int)LanguageID.German),
|
||||||
new ComboItem("ESP (Español)", (int)LanguageID.Spanish),
|
new ("ESP (Español)", (int)LanguageID.Spanish),
|
||||||
new ComboItem("KOR (한국어)", (int)LanguageID.Korean),
|
new ("KOR (한국어)", (int)LanguageID.Korean),
|
||||||
new ComboItem("CHS (简体中文)", (int)LanguageID.ChineseS),
|
new ("CHS (简体中文)", (int)LanguageID.ChineseS),
|
||||||
new ComboItem("CHT (繁體中文)", (int)LanguageID.ChineseT),
|
new ("CHT (繁體中文)", (int)LanguageID.ChineseT),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -101,7 +101,7 @@ public static class EncounterEvent
|
||||||
/// Reloads the locally stored event templates.
|
/// Reloads the locally stored event templates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="paths">External folder(s) to source individual mystery gift template files from.</param>
|
/// <param name="paths">External folder(s) to source individual mystery gift template files from.</param>
|
||||||
public static void RefreshMGDB(params string[] paths)
|
public static void RefreshMGDB(params ReadOnlySpan<string> paths)
|
||||||
{
|
{
|
||||||
// If no paths are provided, clear the arrays. See the bottom of this method.
|
// If no paths are provided, clear the arrays. See the bottom of this method.
|
||||||
HashSet<PCD>? g4 = null; List<PCD>? lg4 = null;
|
HashSet<PCD>? g4 = null; List<PCD>? lg4 = null;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible1(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible1(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible2(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version, PKM Entity) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible2(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version, PKM Entity) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible3(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible3(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible3GC(EvoCriteria[] Chain, EncounterTypeGroup Flags) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible3GC(EvoCriteria[] Chain, EncounterTypeGroup Flags) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible4(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version, PKM Entity) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible4(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version, PKM Entity) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible5(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible5(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible6(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible6(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible7(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible7(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible7GG(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible7GG(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible7GO(EvoCriteria[] Chain, EncounterTypeGroup Flags) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible7GO(EvoCriteria[] Chain, EncounterTypeGroup Flags) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible8(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible8(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible8GO(EvoCriteria[] Chain, EncounterTypeGroup Flags) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible8GO(EvoCriteria[] Chain, EncounterTypeGroup Flags) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible8a(EvoCriteria[] Chain, EncounterTypeGroup Flags) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible8a(EvoCriteria[] Chain, EncounterTypeGroup Flags) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible8b(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version, PKM Entity) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible8b(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version, PKM Entity) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record struct EncounterPossible9(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
public record struct EncounterPossible9(EvoCriteria[] Chain, EncounterTypeGroup Flags, GameVersion Version) : IEnumerator<IEncounterable>
|
||||||
{
|
{
|
||||||
public IEncounterable Current { get; private set; }
|
public IEncounterable Current { get; private set; } = null!;
|
||||||
|
|
||||||
private int Index;
|
private int Index;
|
||||||
private int SubIndex;
|
private int SubIndex;
|
||||||
|
|
|
@ -671,7 +671,7 @@ public static class MethodFinder
|
||||||
pidiv = PIDIV.None;
|
pidiv = PIDIV.None;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private static PIDIV AnalyzeGB(PKM _)
|
private static PIDIV AnalyzeGB(PKM _)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Concurrent;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
@ -52,7 +52,8 @@ public static class WordFilter
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Due to some messages repeating (Trainer names), keep a list of repeated values for faster lookup.
|
/// Due to some messages repeating (Trainer names), keep a list of repeated values for faster lookup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Dictionary<string, string?> Lookup = new(INIT_COUNT);
|
private static readonly ConcurrentDictionary<string, string?>.AlternateLookup<ReadOnlySpan<char>> Lookup =
|
||||||
|
new ConcurrentDictionary<string, string?>().GetAlternateLookup<ReadOnlySpan<char>>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks to see if a phrase contains filtered content.
|
/// Checks to see if a phrase contains filtered content.
|
||||||
|
@ -60,45 +61,35 @@ public static class WordFilter
|
||||||
/// <param name="message">Phrase to check for</param>
|
/// <param name="message">Phrase to check for</param>
|
||||||
/// <param name="regMatch">Matching regex that filters the phrase.</param>
|
/// <param name="regMatch">Matching regex that filters the phrase.</param>
|
||||||
/// <returns>Boolean result if the message is filtered or not.</returns>
|
/// <returns>Boolean result if the message is filtered or not.</returns>
|
||||||
public static bool IsFiltered(string message, [NotNullWhen(true)] out string? regMatch)
|
public static bool IsFiltered(ReadOnlySpan<char> message, [NotNullWhen(true)] out string? regMatch)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(message) || message.Length <= 1)
|
if (message.IsWhiteSpace() || message.Length <= 1)
|
||||||
{
|
{
|
||||||
regMatch = null;
|
regMatch = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check dictionary
|
// Check dictionary
|
||||||
lock (dictLock)
|
if (Lookup.TryGetValue(message, out regMatch))
|
||||||
{
|
return regMatch != null;
|
||||||
if (Lookup.TryGetValue(message, out regMatch))
|
|
||||||
return regMatch != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make the string lowercase invariant
|
// Make the string lowercase invariant
|
||||||
Span<char> lowercase = stackalloc char[message.Length];
|
Span<char> lowercase = stackalloc char[message.Length];
|
||||||
for (int i = 0; i < lowercase.Length; i++)
|
message.ToLowerInvariant(lowercase);
|
||||||
lowercase[i] = char.ToLowerInvariant(message[i]);
|
|
||||||
|
|
||||||
// not in dictionary, check patterns
|
// not in dictionary, check patterns
|
||||||
if (TryMatch(lowercase, out regMatch))
|
if (TryMatch(lowercase, out regMatch))
|
||||||
{
|
{
|
||||||
lock (dictLock)
|
Lookup.TryAdd(message, regMatch);
|
||||||
Lookup[message] = regMatch;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// didn't match any pattern, cache result
|
// didn't match any pattern, cache result
|
||||||
lock (dictLock)
|
if ((Lookup.Dictionary.Count & ~MAX_COUNT) != 0)
|
||||||
{
|
Lookup.Dictionary.Clear(); // reset
|
||||||
if ((Lookup.Count & ~MAX_COUNT) != 0)
|
Lookup.TryAdd(message, regMatch = null);
|
||||||
Lookup.Clear(); // reset
|
|
||||||
Lookup[message] = regMatch = null;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly object dictLock = new();
|
|
||||||
private const int MAX_COUNT = (1 << 17) - 1; // arbitrary cap for max dictionary size
|
private const int MAX_COUNT = (1 << 17) - 1; // arbitrary cap for max dictionary size
|
||||||
private const int INIT_COUNT = 1 << 10; // arbitrary init size to limit future doublings
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public sealed class NicknameVerifier : Verifier
|
||||||
// Non-nicknamed strings have already been checked.
|
// Non-nicknamed strings have already been checked.
|
||||||
if (ParseSettings.Settings.WordFilter.IsEnabled(pk.Format) && pk.IsNicknamed)
|
if (ParseSettings.Settings.WordFilter.IsEnabled(pk.Format) && pk.IsNicknamed)
|
||||||
{
|
{
|
||||||
if (WordFilter.IsFiltered(nickname.ToString(), out var badPattern))
|
if (WordFilter.IsFiltered(nickname, out var badPattern))
|
||||||
data.AddLine(GetInvalid($"Word Filter: {badPattern}"));
|
data.AddLine(GetInvalid($"Word Filter: {badPattern}"));
|
||||||
if (TrainerNameVerifier.ContainsTooManyNumbers(nickname, data.Info.Generation))
|
if (TrainerNameVerifier.ContainsTooManyNumbers(nickname, data.Info.Generation))
|
||||||
data.AddLine(GetInvalid("Word Filter: Too many numbers."));
|
data.AddLine(GetInvalid("Word Filter: Too many numbers."));
|
||||||
|
|
|
@ -54,12 +54,14 @@ public sealed class TrainerNameVerifier : Verifier
|
||||||
|
|
||||||
if (ParseSettings.Settings.WordFilter.IsEnabled(pk.Format))
|
if (ParseSettings.Settings.WordFilter.IsEnabled(pk.Format))
|
||||||
{
|
{
|
||||||
if (WordFilter.IsFiltered(trainer.ToString(), out var badPattern))
|
if (WordFilter.IsFiltered(trainer, out var badPattern))
|
||||||
data.AddLine(GetInvalid($"Word Filter: {badPattern}"));
|
data.AddLine(GetInvalid($"Word Filter: {badPattern}"));
|
||||||
if (ContainsTooManyNumbers(trainer, data.Info.Generation))
|
if (ContainsTooManyNumbers(trainer, data.Info.Generation))
|
||||||
data.AddLine(GetInvalid("Word Filter: Too many numbers."));
|
data.AddLine(GetInvalid("Word Filter: Too many numbers."));
|
||||||
|
|
||||||
if (WordFilter.IsFiltered(pk.HandlingTrainerName, out badPattern))
|
Span<char> ht = stackalloc char[pk.TrashCharCountTrainer];
|
||||||
|
int nameLen = pk.LoadString(pk.HandlingTrainerTrash, ht);
|
||||||
|
if (WordFilter.IsFiltered(ht[..nameLen], out badPattern))
|
||||||
data.AddLine(GetInvalid($"Word Filter: {badPattern}"));
|
data.AddLine(GetInvalid($"Word Filter: {badPattern}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Description>Pokémon C# Class Library</Description>
|
<Description>Pokémon C# Class Library</Description>
|
||||||
<RootNamespace>PKHeX.Core</RootNamespace>
|
<RootNamespace>PKHeX.Core</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -157,11 +157,9 @@ public static class SpeciesName
|
||||||
}
|
}
|
||||||
|
|
||||||
Span<char> result = stackalloc char[nick.Length];
|
Span<char> result = stackalloc char[nick.Length];
|
||||||
nick.CopyTo(result);
|
|
||||||
|
|
||||||
// All names are uppercase.
|
// All names are uppercase.
|
||||||
foreach (ref var c in result)
|
nick.AsSpan().ToUpperInvariant(result);
|
||||||
c = char.ToUpperInvariant(c);
|
|
||||||
if (language == (int)LanguageID.French)
|
if (language == (int)LanguageID.French)
|
||||||
StringConverter4Util.StripDiacriticsFR4(result); // strips accents on E and I
|
StringConverter4Util.StripDiacriticsFR4(result); // strips accents on E and I
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public sealed class SaveBlockMetadata<T>
|
||||||
|
|
||||||
public IEnumerable<string> GetSortedBlockList()
|
public IEnumerable<string> GetSortedBlockList()
|
||||||
{
|
{
|
||||||
return BlockList.Select(z => z.Key).OrderBy(z => z);
|
return BlockList.Select(z => z.Key).Order();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDataIndirect GetBlock(string name) => BlockList.First(z => z.Key == name).Value;
|
public IDataIndirect GetBlock(string name) => BlockList.First(z => z.Key == name).Value;
|
||||||
|
|
|
@ -814,7 +814,7 @@ public sealed class SAV2 : SaveFile, ILangDeviantSave, IEventFlagArray, IEventWo
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsGBMobileAvailable => Japanese && Version == GameVersion.C;
|
public bool IsGBMobileAvailable => Japanese && Version == GameVersion.C;
|
||||||
public bool IsGBMobileEnabled => Japanese && Enum.IsDefined(typeof(GBMobileCableColor), GBMobileCable);
|
public bool IsGBMobileEnabled => Japanese && Enum.IsDefined(GBMobileCable);
|
||||||
|
|
||||||
public GBMobileCableColor GBMobileCable
|
public GBMobileCableColor GBMobileCable
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,7 @@ public sealed class SAV2Stadium : SAV_STADIUM, IBoxDetailName
|
||||||
ClearBoxes();
|
ClearBoxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected sealed override void SetChecksums()
|
protected override void SetChecksums()
|
||||||
{
|
{
|
||||||
base.SetChecksums();
|
base.SetChecksums();
|
||||||
SetMailChecksums();
|
SetMailChecksums();
|
||||||
|
|
|
@ -14,7 +14,7 @@ public sealed class Daycare8b(SAV8BS sav, Memory<byte> raw) : SaveBlock<SAV8BS>(
|
||||||
// BLOCK STRUCTURE
|
// BLOCK STRUCTURE
|
||||||
// PB8[2] Parents;
|
// PB8[2] Parents;
|
||||||
// bool32 eggExist;
|
// bool32 eggExist;
|
||||||
// ulong eggSeed; -- setter puts only 32 bits!
|
// ulong eggSeed; -- setter does sign extension from signed 32 bit value!
|
||||||
// int32 eggStepCount;
|
// int32 eggStepCount;
|
||||||
|
|
||||||
private const int SlotCount = 2;
|
private const int SlotCount = 2;
|
||||||
|
@ -62,9 +62,15 @@ public sealed class Daycare8b(SAV8BS sav, Memory<byte> raw) : SaveBlock<SAV8BS>(
|
||||||
set => WriteUInt64LittleEndian(ExtraData[4..], value);
|
set => WriteUInt64LittleEndian(ExtraData[4..], value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sign extension when setting a 32-bit integer seed to a 64-bit value.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>If the top bit is set in the 32-bit unsigned representation, bits 32-63 will be set as well.</remarks>
|
||||||
|
public void SetSeed(int seed) => Seed = (ulong)seed;
|
||||||
|
|
||||||
public int EggStepCount
|
public int EggStepCount
|
||||||
{
|
{
|
||||||
get => ReadInt32LittleEndian(ExtraData[8..]);
|
get => ReadInt32LittleEndian(ExtraData[12..]);
|
||||||
set => WriteInt32LittleEndian(ExtraData[8..], value);
|
set => WriteInt32LittleEndian(ExtraData[12..], value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,9 +151,9 @@ public sealed class FashionUnlock8(SAV8SWSH sav, SCBlock block) : SaveBlock<SAV8
|
||||||
];
|
];
|
||||||
|
|
||||||
private static ReadOnlySpan<ushort> InvalidFashionOffset_M => [
|
private static ReadOnlySpan<ushort> InvalidFashionOffset_M => [
|
||||||
0x969, 0xB00, 0xC48, 0xC49, 0xC4A, 0xD57, 0xE37, 0xE38, 0xE39
|
0x969, 0xB00, 0xC48, 0xC49, 0xC4A, 0xD57, 0xE37, 0xE38, 0xE39,
|
||||||
];
|
];
|
||||||
private static ReadOnlySpan<ushort> InvalidFashionOffset_F => [
|
private static ReadOnlySpan<ushort> InvalidFashionOffset_F => [
|
||||||
0x95D, 0xB00, 0xD76, 0xD77, 0xE41, 0xE47
|
0x95D, 0xB00, 0xD76, 0xD77, 0xE41, 0xE47,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public sealed class Mail2 : MailDetail
|
||||||
};
|
};
|
||||||
|
|
||||||
#region Offsets
|
#region Offsets
|
||||||
public static int GetMailboxOffset(int language) => 0x600 + (COUNT_PARTY * 2) * GetMailSize(language);
|
public static int GetMailboxOffset(int language) => 0x600 + ((COUNT_PARTY * 2) * GetMailSize(language));
|
||||||
|
|
||||||
private static int GetMailOffset(int index, int size)
|
private static int GetMailOffset(int index, int size)
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ public sealed class Mail2 : MailDetail
|
||||||
{
|
{
|
||||||
if ((uint)index >= COUNT_MAILBOX)
|
if ((uint)index >= COUNT_MAILBOX)
|
||||||
throw new ArgumentOutOfRangeException(nameof(index));
|
throw new ArgumentOutOfRangeException(nameof(index));
|
||||||
return (index * size) + (0x600 + (COUNT_PARTY * 2) * size + 1);
|
return (index * size) + (0x600 + ((COUNT_PARTY * 2) * size) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetMailboxOffsetStadium2(int language) => SAV2Stadium.MailboxBlockOffset(language) + 1;
|
public static int GetMailboxOffsetStadium2(int language) => SAV2Stadium.MailboxBlockOffset(language) + 1;
|
||||||
|
@ -137,7 +137,7 @@ public sealed class Mail2 : MailDetail
|
||||||
|
|
||||||
public override void SetMessage(string line1, string line2, bool userEntered)
|
public override void SetMessage(string line1, string line2, bool userEntered)
|
||||||
{
|
{
|
||||||
if (IsEmpty == true && line1 == string.Empty && line2 == string.Empty)
|
if (IsEmpty == true && line1.Length == 0 && line2.Length == 0)
|
||||||
{
|
{
|
||||||
Data.AsSpan(0, MESSAGE_LENGTH).Clear();
|
Data.AsSpan(0, MESSAGE_LENGTH).Clear();
|
||||||
return;
|
return;
|
||||||
|
@ -158,7 +158,7 @@ public sealed class Mail2 : MailDetail
|
||||||
// Japanese/international user-entered mail always has a line break at index 0x10
|
// Japanese/international user-entered mail always has a line break at index 0x10
|
||||||
var span1 = Data.AsSpan(0, LINE_LENGTH);
|
var span1 = Data.AsSpan(0, LINE_LENGTH);
|
||||||
SetString(span1, line1, LINE_LENGTH);
|
SetString(span1, line1, LINE_LENGTH);
|
||||||
if (line2 != string.Empty) // Pad the first line with spaces if needed
|
if (line2.Length != 0) // Pad the first line with spaces if needed
|
||||||
span1.Replace<byte>(0x50, 0x7F);
|
span1.Replace<byte>(0x50, 0x7F);
|
||||||
Data[LINE_LENGTH] = LineBreakCode;
|
Data[LINE_LENGTH] = LineBreakCode;
|
||||||
var span2 = Data.AsSpan(LINE_LENGTH + 1, LINE_LENGTH);
|
var span2 = Data.AsSpan(LINE_LENGTH + 1, LINE_LENGTH);
|
||||||
|
|
|
@ -36,7 +36,7 @@ public sealed class Mail3 : MailDetail
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var span = Data.AsSpan(0x12, 8);
|
var span = Data.AsSpan(0x12, 8);
|
||||||
if (value == string.Empty)
|
if (value.Length == 0)
|
||||||
{
|
{
|
||||||
span.Fill(0xFF);
|
span.Fill(0xFF);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -117,55 +117,23 @@ public static partial class Util
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET9_0_OR_GREATER
|
|
||||||
REPLACE WITH TryFromHexString / TryToHexString
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses a variable length hex string (non-spaced, bytes in reverse order).
|
/// Parses a variable length hex string (non-spaced, bytes in order).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static byte[] GetBytesFromHexString(ReadOnlySpan<char> input)
|
public static byte[] GetBytesFromHexString(ReadOnlySpan<char> input)
|
||||||
{
|
=> Convert.FromHexString(input);
|
||||||
byte[] result = new byte[input.Length / 2];
|
|
||||||
GetBytesFromHexString(input, result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc cref="GetBytesFromHexString(ReadOnlySpan{char})"/>
|
/// <inheritdoc cref="GetBytesFromHexString(ReadOnlySpan{char})"/>
|
||||||
public static void GetBytesFromHexString(ReadOnlySpan<char> input, Span<byte> result)
|
public static void GetBytesFromHexString(ReadOnlySpan<char> input, Span<byte> result)
|
||||||
{
|
=> Convert.FromHexString(input, result, out _, out _);
|
||||||
for (int i = 0; i < result.Length; i++)
|
|
||||||
{
|
|
||||||
var slice = input.Slice(i * 2, 2);
|
|
||||||
result[^(i + 1)] = (byte)GetHexValue(slice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private const string HexChars = "0123456789ABCDEF";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts the byte array into a hex string (non-spaced, bytes in reverse order).
|
/// Converts the byte array into a hex string (non-spaced, bytes in order).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetHexStringFromBytes(ReadOnlySpan<byte> data)
|
public static string GetHexStringFromBytes(ReadOnlySpan<byte> data)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.Assert(data.Length is (4 or 8 or 12 or 16));
|
System.Diagnostics.Debug.Assert(data.Length is (4 or 8 or 12 or 16));
|
||||||
Span<char> result = stackalloc char[data.Length * 2];
|
return Convert.ToHexString(data);
|
||||||
GetHexStringFromBytes(data, result);
|
|
||||||
return new string(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc cref="GetHexStringFromBytes(ReadOnlySpan{byte})"/>
|
|
||||||
public static void GetHexStringFromBytes(ReadOnlySpan<byte> data, Span<char> result)
|
|
||||||
{
|
|
||||||
if (result.Length != data.Length * 2)
|
|
||||||
throw new ArgumentException("Result buffer must be twice the size of the input buffer.");
|
|
||||||
for (int i = 0; i < data.Length; i++)
|
|
||||||
{
|
|
||||||
// Write tuples from the opposite side of the result buffer.
|
|
||||||
var offset = (data.Length - i - 1) * 2;
|
|
||||||
result[offset + 0] = HexChars[data[i] >> 4];
|
|
||||||
result[offset + 1] = HexChars[data[i] & 0xF];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net9.0-windows</TargetFramework>
|
||||||
<RootNamespace>PKHeX.Drawing.Misc</RootNamespace>
|
<RootNamespace>PKHeX.Drawing.Misc</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net9.0-windows</TargetFramework>
|
||||||
<RootNamespace>PKHeX.Drawing.PokeSprite</RootNamespace>
|
<RootNamespace>PKHeX.Drawing.PokeSprite</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net9.0-windows</TargetFramework>
|
||||||
<RootNamespace>PKHeX.Drawing</RootNamespace>
|
<RootNamespace>PKHeX.Drawing</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -84,13 +84,13 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
FlickerInterface();
|
FlickerInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class ValidationRequiredSet(Control[] Controls, Func<PKM, bool> ShouldCheck, Func<Control, bool> State)
|
private sealed class ValidationRequiredSet(Control[] controls, Func<PKM, bool> shouldCheck, Func<Control, bool> isState)
|
||||||
{
|
{
|
||||||
public Control? IsNotValid(PKM pk)
|
public Control? IsNotValid(PKM pk)
|
||||||
{
|
{
|
||||||
if (!ShouldCheck(pk))
|
if (!shouldCheck(pk))
|
||||||
return null;
|
return null;
|
||||||
return Array.Find(Controls, z => State(z));
|
return Array.Find(controls, z => isState(z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
// General Use Functions //
|
// General Use Functions //
|
||||||
private void SetDetailsOT(ITrainerInfo tr)
|
private void SetDetailsOT<T>(T tr) where T : ITrainerInfo
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(tr.OT))
|
if (string.IsNullOrWhiteSpace(tr.OT))
|
||||||
return;
|
return;
|
||||||
|
@ -423,7 +423,7 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
UpdateNickname(this, EventArgs.Empty);
|
UpdateNickname(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDetailsHT(ITrainerInfo tr)
|
private void SetDetailsHT<T>(T tr) where T : ITrainerInfo
|
||||||
{
|
{
|
||||||
var trainer = tr.OT;
|
var trainer = tr.OT;
|
||||||
if (trainer.Length == 0)
|
if (trainer.Length == 0)
|
||||||
|
@ -998,8 +998,8 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
if (FieldsLoaded && sender == CB_Form)
|
if (FieldsLoaded && sender == CB_Form)
|
||||||
{
|
{
|
||||||
Entity.Form = (byte)CB_Form.SelectedIndex;
|
Entity.Form = (byte)CB_Form.SelectedIndex;
|
||||||
uint EXP = Experience.GetEXP(Entity.CurrentLevel, Entity.PersonalInfo.EXPGrowth);
|
uint exp = Experience.GetEXP(Entity.CurrentLevel, Entity.PersonalInfo.EXPGrowth);
|
||||||
TB_EXP.Text = EXP.ToString();
|
TB_EXP.Text = exp.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStats();
|
UpdateStats();
|
||||||
|
@ -1182,8 +1182,8 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Recalculate EXP for Given Level
|
// Recalculate EXP for Given Level
|
||||||
uint EXP = Experience.GetEXP(Entity.CurrentLevel, Entity.PersonalInfo.EXPGrowth);
|
uint exp = Experience.GetEXP(Entity.CurrentLevel, Entity.PersonalInfo.EXPGrowth);
|
||||||
TB_EXP.Text = EXP.ToString();
|
TB_EXP.Text = exp.ToString();
|
||||||
|
|
||||||
// Check for Gender Changes
|
// Check for Gender Changes
|
||||||
UC_Gender.Gender = Entity.GetSaneGender();
|
UC_Gender.Gender = Entity.GetSaneGender();
|
||||||
|
@ -1242,11 +1242,11 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
private void ReloadMetLocations(GameVersion version, EntityContext context)
|
private void ReloadMetLocations(GameVersion version, EntityContext context)
|
||||||
{
|
{
|
||||||
var metList = GameInfo.GetLocationList(version, context, egg: false);
|
var metList = GameInfo.GetLocationList(version, context, egg: false);
|
||||||
CB_MetLocation.DataSource = new BindingSource(metList, null);
|
CB_MetLocation.DataSource = new BindingSource(metList, string.Empty);
|
||||||
CB_MetLocation.DropDownWidth = GetWidth(metList, CB_MetLocation.Font);
|
CB_MetLocation.DropDownWidth = GetWidth(metList, CB_MetLocation.Font);
|
||||||
|
|
||||||
var eggList = GameInfo.GetLocationList(version, context, egg: true);
|
var eggList = GameInfo.GetLocationList(version, context, egg: true);
|
||||||
CB_EggLocation.DataSource = new BindingSource(eggList, null);
|
CB_EggLocation.DataSource = new BindingSource(eggList, string.Empty);
|
||||||
CB_EggLocation.DropDownWidth = GetWidth(eggList, CB_EggLocation.Font);
|
CB_EggLocation.DropDownWidth = GetWidth(eggList, CB_EggLocation.Font);
|
||||||
|
|
||||||
static int GetWidth(IReadOnlyCollection<ComboItem> items, Font f)
|
static int GetWidth(IReadOnlyCollection<ComboItem> items, Font f)
|
||||||
|
@ -1800,7 +1800,7 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
{
|
{
|
||||||
FieldsLoaded = false;
|
FieldsLoaded = false;
|
||||||
var index = WinFormsUtil.GetIndex(c);
|
var index = WinFormsUtil.GetIndex(c);
|
||||||
c.DataSource = new BindingSource(LegalMoveSource.Display.DataSource, null);
|
c.DataSource = new BindingSource(LegalMoveSource.Display.DataSource, string.Empty);
|
||||||
c.SelectedValue = index;
|
c.SelectedValue = index;
|
||||||
FieldsLoaded = true;
|
FieldsLoaded = true;
|
||||||
}
|
}
|
||||||
|
@ -2008,7 +2008,7 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
{
|
{
|
||||||
FieldsLoaded = false;
|
FieldsLoaded = false;
|
||||||
|
|
||||||
bool TranslationRequired = false;
|
bool isTranslationRequired = false;
|
||||||
PopulateFilteredDataSources(sav);
|
PopulateFilteredDataSources(sav);
|
||||||
PopulateFields(Entity);
|
PopulateFields(Entity);
|
||||||
|
|
||||||
|
@ -2027,7 +2027,7 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
{
|
{
|
||||||
Hidden_TC.TabPages.Insert(1, Hidden_Met);
|
Hidden_TC.TabPages.Insert(1, Hidden_Met);
|
||||||
TC_Editor.TabPages.Insert(1, Tab_Met);
|
TC_Editor.TabPages.Insert(1, Tab_Met);
|
||||||
TranslationRequired = true;
|
isTranslationRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Entity.Format <= 2 && Hidden_TC.TabPages.Contains(Hidden_Cosmetic))
|
if (Entity.Format <= 2 && Hidden_TC.TabPages.Contains(Hidden_Cosmetic))
|
||||||
|
@ -2039,7 +2039,7 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
{
|
{
|
||||||
Hidden_TC.TabPages.Insert(4, Hidden_Cosmetic);
|
Hidden_TC.TabPages.Insert(4, Hidden_Cosmetic);
|
||||||
TC_Editor.TabPages.Insert(4, Tab_Cosmetic);
|
TC_Editor.TabPages.Insert(4, Tab_Cosmetic);
|
||||||
TranslationRequired = true;
|
isTranslationRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HaX && sav is SAV7b)
|
if (!HaX && sav is SAV7b)
|
||||||
|
@ -2058,7 +2058,7 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
// pk2 save files do not have an Origin Game stored. Prompt the met location list to update.
|
// pk2 save files do not have an Origin Game stored. Prompt the met location list to update.
|
||||||
if (Entity.Format == 2)
|
if (Entity.Format == 2)
|
||||||
CheckMetLocationChange(GameVersion.C, Entity.Context);
|
CheckMetLocationChange(GameVersion.C, Entity.Context);
|
||||||
return TranslationRequired;
|
return isTranslationRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CenterSubEditors()
|
private void CenterSubEditors()
|
||||||
|
@ -2082,13 +2082,12 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once FieldCanBeMadeReadOnly.Global
|
public Action<IBattleTemplate> LoadShowdownSet { get; set; }
|
||||||
public Action<IBattleTemplate> LoadShowdownSet;
|
|
||||||
|
|
||||||
private void LoadShowdownSetDefault(IBattleTemplate Set)
|
private void LoadShowdownSetDefault(IBattleTemplate set)
|
||||||
{
|
{
|
||||||
var pk = PreparePKM();
|
var pk = PreparePKM();
|
||||||
pk.ApplySetDetails(Set);
|
pk.ApplySetDetails(set);
|
||||||
PopulateFields(pk);
|
PopulateFields(pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2152,9 +2151,9 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
SetCountrySubRegion(CB_Country, "countries");
|
SetCountrySubRegion(CB_Country, "countries");
|
||||||
CB_3DSReg.DataSource = source.ConsoleRegions;
|
CB_3DSReg.DataSource = source.ConsoleRegions;
|
||||||
|
|
||||||
CB_GroundTile.DataSource = new BindingSource(source.G4GroundTiles, null);
|
CB_GroundTile.DataSource = new BindingSource(source.G4GroundTiles, string.Empty);
|
||||||
CB_Nature.DataSource = new BindingSource(source.Natures, null);
|
CB_Nature.DataSource = new BindingSource(source.Natures, string.Empty);
|
||||||
CB_StatNature.DataSource = new BindingSource(source.Natures, null);
|
CB_StatNature.DataSource = new BindingSource(source.Natures, string.Empty);
|
||||||
|
|
||||||
// Sub-editors
|
// Sub-editors
|
||||||
Stats.InitializeDataSources();
|
Stats.InitializeDataSources();
|
||||||
|
@ -2166,7 +2165,7 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
|
||||||
{
|
{
|
||||||
if (!force && exist.DataSource is BindingSource b && b.Count == update.Count)
|
if (!force && exist.DataSource is BindingSource b && b.Count == update.Count)
|
||||||
return;
|
return;
|
||||||
exist.DataSource = new BindingSource(update, null);
|
exist.DataSource = new BindingSource(update, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PopulateFilteredDataSources(ITrainerInfo sav, bool force = false)
|
private void PopulateFilteredDataSources(ITrainerInfo sav, bool force = false)
|
||||||
|
|
|
@ -739,8 +739,8 @@ public partial class StatEditor : UserControl
|
||||||
var tera = Util.GetCBList(types[..TeraDisplayIndex]);
|
var tera = Util.GetCBList(types[..TeraDisplayIndex]);
|
||||||
tera.Insert(0, new(TeraOverrideNone, TeraOverrideNoneValue));
|
tera.Insert(0, new(TeraOverrideNone, TeraOverrideNoneValue));
|
||||||
tera.Add(new(types[TeraDisplayIndex], TeraStellarValue));
|
tera.Add(new(types[TeraDisplayIndex], TeraStellarValue));
|
||||||
CB_TeraTypeOriginal.DataSource = new BindingSource(tera, null);
|
CB_TeraTypeOriginal.DataSource = new BindingSource(tera, string.Empty);
|
||||||
CB_TeraTypeOverride.DataSource = new BindingSource(tera, null);
|
CB_TeraTypeOverride.DataSource = new BindingSource(tera, string.Empty);
|
||||||
|
|
||||||
ChangingFields = false;
|
ChangingFields = false;
|
||||||
}
|
}
|
||||||
|
@ -757,7 +757,7 @@ public partial class StatEditor : UserControl
|
||||||
MainEditor.UpdateSprite();
|
MainEditor.UpdateSprite();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void L_TeraTypeOverride_Click(object sender, EventArgs e) => CB_TeraTypeOverride.SelectedValue = Entity.SV ? (int)TeraOverrideNoneValue : CB_TeraTypeOriginal.SelectedValue;
|
private void L_TeraTypeOverride_Click(object sender, EventArgs e) => CB_TeraTypeOverride.SelectedValue = Entity.SV ? (int)TeraOverrideNoneValue : CB_TeraTypeOriginal.SelectedValue!;
|
||||||
|
|
||||||
private void ChangeTeraType(object sender, EventArgs e)
|
private void ChangeTeraType(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Threading;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using PKHeX.Drawing;
|
using PKHeX.Drawing;
|
||||||
|
@ -20,7 +21,7 @@ public sealed class BitmapAnimator : IDisposable
|
||||||
private Image? ExtraLayer;
|
private Image? ExtraLayer;
|
||||||
private Image?[]? GlowCache;
|
private Image?[]? GlowCache;
|
||||||
private Image? OriginalBackground;
|
private Image? OriginalBackground;
|
||||||
private readonly object Lock = new();
|
private readonly Lock Lock = new();
|
||||||
|
|
||||||
private PictureBox? pb;
|
private PictureBox? pb;
|
||||||
private int GlowInterval;
|
private int GlowInterval;
|
||||||
|
|
|
@ -695,8 +695,10 @@ public partial class SAVEditor : UserControl, ISlotViewer<PictureBox>, ISaveFile
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
form = new SAV_GroupViewer(sav, M.Env.PKMEditor, g);
|
form = new SAV_GroupViewer(sav, M.Env.PKMEditor, g)
|
||||||
form.Owner = ParentForm;
|
{
|
||||||
|
Owner = ParentForm,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
form.BringToFront();
|
form.BringToFront();
|
||||||
form.Show();
|
form.Show();
|
||||||
|
@ -1263,7 +1265,7 @@ public partial class SAVEditor : UserControl, ISlotViewer<PictureBox>, ISaveFile
|
||||||
var current = br.CurrentSlot;
|
var current = br.CurrentSlot;
|
||||||
var list = br.SaveNames.Select((z, i) => new ComboItem(z, i)).ToList();
|
var list = br.SaveNames.Select((z, i) => new ComboItem(z, i)).ToList();
|
||||||
CB_SaveSlot.InitializeBinding();
|
CB_SaveSlot.InitializeBinding();
|
||||||
CB_SaveSlot.DataSource = new BindingSource(list, null);
|
CB_SaveSlot.DataSource = new BindingSource(list, string.Empty);
|
||||||
CB_SaveSlot.SelectedValue = current;
|
CB_SaveSlot.SelectedValue = current;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1418,35 +1420,42 @@ public partial class SAVEditor : UserControl, ISlotViewer<PictureBox>, ISaveFile
|
||||||
|
|
||||||
private async void TabMouseMove(object sender, MouseEventArgs e)
|
private async void TabMouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (!IsBoxDragActive)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (e.Location == DragStartPoint)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Gather data
|
|
||||||
var src = SAV.CurrentBox;
|
|
||||||
var bin = SAV.GetBoxBinary(src);
|
|
||||||
|
|
||||||
// Create Temp File to Drag
|
|
||||||
var newFile = Path.Combine(Path.GetTempPath(), $"box_{src}.bin");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var img = new Bitmap(Box.Width, Box.Height);
|
if (!IsBoxDragActive)
|
||||||
Box.DrawToBitmap(img, new Rectangle(0, 0, Box.Width, Box.Height));
|
return;
|
||||||
using var cursor = Cursor = new Cursor(img.GetHicon());
|
|
||||||
await File.WriteAllBytesAsync(newFile, bin).ConfigureAwait(true);
|
if (e.Location == DragStartPoint)
|
||||||
DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { newFile }), DragDropEffects.Copy);
|
return;
|
||||||
|
|
||||||
|
// Gather data
|
||||||
|
var src = SAV.CurrentBox;
|
||||||
|
var bin = SAV.GetBoxBinary(src);
|
||||||
|
|
||||||
|
// Create Temp File to Drag
|
||||||
|
var newFile = Path.Combine(Path.GetTempPath(), $"box_{src}.bin");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var img = new Bitmap(Box.Width, Box.Height);
|
||||||
|
Box.DrawToBitmap(img, new Rectangle(0, 0, Box.Width, Box.Height));
|
||||||
|
using var cursor = Cursor = new Cursor(img.GetHicon());
|
||||||
|
await File.WriteAllBytesAsync(newFile, bin).ConfigureAwait(true);
|
||||||
|
DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { newFile }), DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
// Tons of things can happen with drag & drop; don't try to handle things, just indicate failure.
|
||||||
|
catch (Exception x)
|
||||||
|
{ WinFormsUtil.Error("Drag && Drop Error", x); }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Cursor = Cursors.Default;
|
||||||
|
await Task.Delay(100).ConfigureAwait(false);
|
||||||
|
IsBoxDragActive = false;
|
||||||
|
await DeleteAsync(newFile, 20_000).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Tons of things can happen with drag & drop; don't try to handle things, just indicate failure.
|
catch
|
||||||
catch (Exception x)
|
|
||||||
{ WinFormsUtil.Error("Drag && Drop Error", x); }
|
|
||||||
finally
|
|
||||||
{
|
{
|
||||||
Cursor = Cursors.Default;
|
// Ignore.
|
||||||
await Task.Delay(100).ConfigureAwait(false);
|
|
||||||
IsBoxDragActive = false;
|
|
||||||
await DeleteAsync(newFile, 20_000).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Media;
|
using System.Media;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
@ -170,12 +169,19 @@ public sealed class SlotChangeManager(SAVEditor se) : IDisposable
|
||||||
|
|
||||||
private async void DeleteAsync(string path, int delay)
|
private async void DeleteAsync(string path, int delay)
|
||||||
{
|
{
|
||||||
await Task.Delay(delay).ConfigureAwait(true);
|
try
|
||||||
if (!File.Exists(path) || Drag.Info.CurrentPath == path)
|
{
|
||||||
return;
|
await Task.Delay(delay).ConfigureAwait(true);
|
||||||
|
if (!File.Exists(path) || Drag.Info.CurrentPath == path)
|
||||||
|
return;
|
||||||
|
|
||||||
try { File.Delete(path); }
|
try { File.Delete(path); }
|
||||||
catch (Exception ex) { Debug.WriteLine(ex.Message); }
|
catch (Exception ex) { Debug.WriteLine(ex.Message); }
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Ignore.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string CreateDragDropPKM(PictureBox pb, bool encrypt, out bool external)
|
private string CreateDragDropPKM(PictureBox pb, bool encrypt, out bool external)
|
||||||
|
@ -201,7 +207,8 @@ public sealed class SlotChangeManager(SAVEditor se) : IDisposable
|
||||||
private bool TryMakeDragDropPKM(PictureBox pb, byte[] data, string newfile)
|
private bool TryMakeDragDropPKM(PictureBox pb, byte[] data, string newfile)
|
||||||
{
|
{
|
||||||
File.WriteAllBytes(newfile, data);
|
File.WriteAllBytes(newfile, data);
|
||||||
var img = (Bitmap)pb.Image;
|
if (pb.Image is not Bitmap img)
|
||||||
|
return false;
|
||||||
Drag.SetCursor(pb.FindForm(), new Cursor(img.GetHicon()));
|
Drag.SetCursor(pb.FindForm(), new Cursor(img.GetHicon()));
|
||||||
Hover.Stop();
|
Hover.Stop();
|
||||||
pb.Image = null;
|
pb.Image = null;
|
||||||
|
@ -379,7 +386,7 @@ public sealed class SlotChangeManager(SAVEditor se) : IDisposable
|
||||||
LastSlot.CurrentBackground?.Dispose();
|
LastSlot.CurrentBackground?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateBoxViewAtBoxIndexes(params int[] boxIndexes)
|
private void UpdateBoxViewAtBoxIndexes(params ReadOnlySpan<int> boxIndexes)
|
||||||
{
|
{
|
||||||
foreach (var box in Boxes)
|
foreach (var box in Boxes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -174,7 +174,7 @@ public partial class PokePreview : Form
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sb.AppendLine(line.ToString());
|
sb.Append(line).AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
var detail = sb.ToString();
|
var detail = sb.ToString();
|
||||||
|
@ -182,7 +182,7 @@ public partial class PokePreview : Form
|
||||||
while (lines.MoveNext())
|
while (lines.MoveNext())
|
||||||
{
|
{
|
||||||
var line = lines.Current;
|
var line = lines.Current;
|
||||||
sb.AppendLine(line.ToString());
|
sb.Append(line).AppendLine();
|
||||||
}
|
}
|
||||||
var enc = sb.ToString();
|
var enc = sb.ToString();
|
||||||
return (detail.TrimEnd(), enc.TrimEnd());
|
return (detail.TrimEnd(), enc.TrimEnd());
|
||||||
|
|
|
@ -1100,7 +1100,8 @@ public partial class Main : Form
|
||||||
|
|
||||||
var qr = QREncode.GenerateQRCode(pk);
|
var qr = QREncode.GenerateQRCode(pk);
|
||||||
|
|
||||||
var sprite = dragout.Image;
|
if (dragout.Image is not Bitmap sprite)
|
||||||
|
return;
|
||||||
var la = new LegalityAnalysis(pk, C_SAV.SAV.Personal);
|
var la = new LegalityAnalysis(pk, C_SAV.SAV.Personal);
|
||||||
if (la.Parsed && pk.Species != 0)
|
if (la.Parsed && pk.Species != 0)
|
||||||
{
|
{
|
||||||
|
@ -1214,6 +1215,7 @@ public partial class Main : Form
|
||||||
e.Effect = DragDropEffects.Copy;
|
e.Effect = DragDropEffects.Copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReSharper disable once AsyncVoidMethod
|
||||||
private async void Dragout_MouseDown(object sender, MouseEventArgs e)
|
private async void Dragout_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Button != MouseButtons.Left)
|
if (e.Button != MouseButtons.Left)
|
||||||
|
@ -1292,17 +1294,24 @@ public partial class Main : Form
|
||||||
|
|
||||||
private async void Main_FormClosing(object sender, FormClosingEventArgs e)
|
private async void Main_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
if (C_SAV.SAV.State.Edited || PKME_Tabs.PKMIsUnsaved)
|
try
|
||||||
{
|
{
|
||||||
var prompt = WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgProgramCloseUnsaved, MsgProgramCloseConfirm);
|
if (C_SAV.SAV.State.Edited || PKME_Tabs.PKMIsUnsaved)
|
||||||
if (prompt != DialogResult.Yes)
|
|
||||||
{
|
{
|
||||||
e.Cancel = true;
|
var prompt = WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgProgramCloseUnsaved, MsgProgramCloseConfirm);
|
||||||
return;
|
if (prompt != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
await PKHeXSettings.SaveSettings(ConfigPath, Settings).ConfigureAwait(false);
|
await PKHeXSettings.SaveSettings(ConfigPath, Settings).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Ignore; program is shutting down.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -49,6 +49,8 @@ public partial class QR : Form
|
||||||
private void ResizeWindow()
|
private void ResizeWindow()
|
||||||
{
|
{
|
||||||
var img = PB_QR.Image;
|
var img = PB_QR.Image;
|
||||||
|
if (img == null)
|
||||||
|
return;
|
||||||
splitContainer1.Height = splitContainer1.Panel1.Height + img.Height;
|
splitContainer1.Height = splitContainer1.Panel1.Height + img.Height;
|
||||||
splitContainer1.Width = img.Width;
|
splitContainer1.Width = img.Width;
|
||||||
}
|
}
|
||||||
|
@ -76,9 +78,11 @@ public partial class QR : Form
|
||||||
|
|
||||||
private void PB_QR_Click(object sender, EventArgs e)
|
private void PB_QR_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (PB_QR.Image is not { } img)
|
||||||
|
return;
|
||||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgQRClipboardImage))
|
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgQRClipboardImage))
|
||||||
return;
|
return;
|
||||||
try { Clipboard.SetImage(PB_QR.Image); }
|
try { Clipboard.SetImage(img); }
|
||||||
// Clipboard can be locked periodically, just notify on failure.
|
// Clipboard can be locked periodically, just notify on failure.
|
||||||
catch { WinFormsUtil.Alert(MsgQRClipboardFail); }
|
catch { WinFormsUtil.Alert(MsgQRClipboardFail); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net9.0-windows</TargetFramework>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ForceDesignerDpiUnaware>true</ForceDesignerDpiUnaware>
|
<ForceDesignerDpiUnaware>true</ForceDesignerDpiUnaware>
|
||||||
|
|
|
@ -32,6 +32,14 @@ internal static class Program
|
||||||
// Run the application
|
// Run the application
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
|
var args = Environment.GetCommandLineArgs();
|
||||||
|
// if an arg is "dark", set the color mode to dark
|
||||||
|
if (args.Length > 1 && args[1] == "dark")
|
||||||
|
#pragma warning disable WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
|
||||||
|
Application.SetColorMode(SystemColorMode.Dark);
|
||||||
|
#pragma warning restore WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
|
||||||
|
|
||||||
var splash = new SplashScreen();
|
var splash = new SplashScreen();
|
||||||
new Task(() => splash.ShowDialog()).Start();
|
new Task(() => splash.ShowDialog()).Start();
|
||||||
new Task(() => EncounterEvent.RefreshMGDB(WinForms.Main.MGDatabasePath)).Start();
|
new Task(() => EncounterEvent.RefreshMGDB(WinForms.Main.MGDatabasePath)).Start();
|
||||||
|
|
|
@ -168,15 +168,12 @@ public sealed class StartupSettings : IStartupSettings
|
||||||
if (!GameLanguage.IsLanguageValid(value))
|
if (!GameLanguage.IsLanguageValid(value))
|
||||||
{
|
{
|
||||||
// Migrate old language codes set in earlier versions.
|
// Migrate old language codes set in earlier versions.
|
||||||
switch (value)
|
_language = value switch
|
||||||
{
|
{
|
||||||
case "zh":
|
"zh" => "zh-Hans",
|
||||||
_language = "zh-Hans";
|
"zh2" => "zh-Hant",
|
||||||
break;
|
_ => _language,
|
||||||
case "zh2":
|
};
|
||||||
_language = "zh-Hant";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_language = value;
|
_language = value;
|
||||||
|
|
|
@ -10,11 +10,7 @@ public partial class BoxExporter : Form
|
||||||
private readonly SaveFile SAV;
|
private readonly SaveFile SAV;
|
||||||
private readonly IFileNamer<PKM>[] Namers = [.. EntityFileNamer.AvailableNamers];
|
private readonly IFileNamer<PKM>[] Namers = [.. EntityFileNamer.AvailableNamers];
|
||||||
|
|
||||||
private BoxExportSettings Settings
|
private readonly BoxExportSettings Settings;
|
||||||
{
|
|
||||||
get => (BoxExportSettings)PG_Settings.SelectedObject;
|
|
||||||
init => PG_Settings.SelectedObject = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BoxExporter(SaveFile sav, ExportOverride eo = ExportOverride.None)
|
public BoxExporter(SaveFile sav, ExportOverride eo = ExportOverride.None)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +22,7 @@ public partial class BoxExporter : Form
|
||||||
var settings = obj.BoxExport;
|
var settings = obj.BoxExport;
|
||||||
if (eo != 0)
|
if (eo != 0)
|
||||||
settings = settings with { Scope = eo == ExportOverride.All ? BoxExportScope.All : BoxExportScope.Current };
|
settings = settings with { Scope = eo == ExportOverride.All ? BoxExportScope.All : BoxExportScope.Current };
|
||||||
Settings = settings;
|
PG_Settings.SelectedObject = Settings = settings;
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (var i = 0; i < Namers.Length; i++)
|
for (var i = 0; i < Namers.Length; i++)
|
||||||
|
|
|
@ -224,8 +224,8 @@ public partial class MemoryAmie : Form
|
||||||
var strings = MemStrings;
|
var strings = MemStrings;
|
||||||
CB_OTMemory.InitializeBinding();
|
CB_OTMemory.InitializeBinding();
|
||||||
CB_CTMemory.InitializeBinding();
|
CB_CTMemory.InitializeBinding();
|
||||||
CB_OTMemory.DataSource = new BindingSource(strings.Memory, null);
|
CB_OTMemory.DataSource = new BindingSource(strings.Memory, string.Empty);
|
||||||
CB_CTMemory.DataSource = new BindingSource(strings.Memory, null);
|
CB_CTMemory.DataSource = new BindingSource(strings.Memory, string.Empty);
|
||||||
|
|
||||||
// Quality Chooser
|
// Quality Chooser
|
||||||
AddIntensity(this, strings.Species[0].Text); // None
|
AddIntensity(this, strings.Species[0].Text); // None
|
||||||
|
@ -258,7 +258,7 @@ public partial class MemoryAmie : Form
|
||||||
var memIndex = Memories.GetMemoryArgType(memory, memoryGen);
|
var memIndex = Memories.GetMemoryArgType(memory, memoryGen);
|
||||||
var args = MemStrings.GetArgumentStrings(memIndex, memoryGen);
|
var args = MemStrings.GetArgumentStrings(memIndex, memoryGen);
|
||||||
CB_OTVar.InitializeBinding();
|
CB_OTVar.InitializeBinding();
|
||||||
CB_OTVar.DataSource = new BindingSource(args, null);
|
CB_OTVar.DataSource = new BindingSource(args, string.Empty);
|
||||||
LOTV.Text = TextArgs.GetMemoryCategory(memIndex, memoryGen);
|
LOTV.Text = TextArgs.GetMemoryCategory(memIndex, memoryGen);
|
||||||
LOTV.Visible = CB_OTVar.Visible = CB_OTVar.Enabled = args.Count > 1;
|
LOTV.Visible = CB_OTVar.Visible = CB_OTVar.Enabled = args.Count > 1;
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ public partial class MemoryAmie : Form
|
||||||
var memIndex = Memories.GetMemoryArgType(memory, memoryGen);
|
var memIndex = Memories.GetMemoryArgType(memory, memoryGen);
|
||||||
var argvals = MemStrings.GetArgumentStrings(memIndex, memoryGen);
|
var argvals = MemStrings.GetArgumentStrings(memIndex, memoryGen);
|
||||||
CB_CTVar.InitializeBinding();
|
CB_CTVar.InitializeBinding();
|
||||||
CB_CTVar.DataSource = new BindingSource(argvals, null);
|
CB_CTVar.DataSource = new BindingSource(argvals, string.Empty);
|
||||||
LCTV.Text = TextArgs.GetMemoryCategory(memIndex, memoryGen);
|
LCTV.Text = TextArgs.GetMemoryCategory(memIndex, memoryGen);
|
||||||
LCTV.Visible = CB_CTVar.Visible = CB_CTVar.Enabled = argvals.Count > 1;
|
LCTV.Visible = CB_CTVar.Visible = CB_CTVar.Enabled = argvals.Count > 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ public partial class MoveShopEditor : Form
|
||||||
for (int i = 0; i < dgv.Rows.Count; i++)
|
for (int i = 0; i < dgv.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var row = dgv.Rows[i];
|
var row = dgv.Rows[i];
|
||||||
var index = int.Parse((string)row.Cells[ColumnIndex].Value) - Bias;
|
var index = int.Parse((string)row.Cells[ColumnIndex].Value!) - Bias;
|
||||||
var purchased = row.Cells[ColumnPurchased];
|
var purchased = row.Cells[ColumnPurchased];
|
||||||
var mastered = row.Cells[ColumnMastered];
|
var mastered = row.Cells[ColumnMastered];
|
||||||
purchased.Value = Shop.GetPurchasedRecordFlag(index);
|
purchased.Value = Shop.GetPurchasedRecordFlag(index);
|
||||||
|
@ -190,11 +190,11 @@ public partial class MoveShopEditor : Form
|
||||||
for (int i = 0; i < dgv.Rows.Count; i++)
|
for (int i = 0; i < dgv.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var row = dgv.Rows[i];
|
var row = dgv.Rows[i];
|
||||||
var index = int.Parse((string)row.Cells[ColumnIndex].Value) - Bias;
|
var index = int.Parse((string)row.Cells[ColumnIndex].Value!) - Bias;
|
||||||
var purchased = row.Cells[ColumnPurchased];
|
var purchased = row.Cells[ColumnPurchased];
|
||||||
var mastered = row.Cells[ColumnMastered];
|
var mastered = row.Cells[ColumnMastered];
|
||||||
Shop.SetPurchasedRecordFlag(index, (bool)purchased.Value);
|
Shop.SetPurchasedRecordFlag(index, (bool)purchased.Value!);
|
||||||
Master.SetMasteredRecordFlag(index, (bool)mastered.Value);
|
Master.SetMasteredRecordFlag(index, (bool)mastered.Value!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public partial class TechRecordEditor : Form
|
||||||
{
|
{
|
||||||
var row = dgv.Rows[i];
|
var row = dgv.Rows[i];
|
||||||
var index = int.Parse(row.Cells[ColumnIndex].Value?.ToString() ?? "");
|
var index = int.Parse(row.Cells[ColumnIndex].Value?.ToString() ?? "");
|
||||||
Record.SetMoveRecordFlag(index, (bool)row.Cells[ColumnHasFlag].Value);
|
Record.SetMoveRecordFlag(index, (bool)row.Cells[ColumnHasFlag].Value!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ public partial class TechRecordEditor : Form
|
||||||
|
|
||||||
// Toggle the checkbox of cell 0
|
// Toggle the checkbox of cell 0
|
||||||
var cell = row.Cells[ColumnHasFlag];
|
var cell = row.Cells[ColumnHasFlag];
|
||||||
cell.Value = !(bool)cell.Value;
|
cell.Value = !(bool)cell.Value!;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PressKeyCell(object sender, KeyEventArgs e)
|
private void PressKeyCell(object sender, KeyEventArgs e)
|
||||||
|
@ -151,7 +151,7 @@ public partial class TechRecordEditor : Form
|
||||||
|
|
||||||
// Toggle the checkbox of cell 0
|
// Toggle the checkbox of cell 0
|
||||||
var cell = row.Cells[ColumnHasFlag];
|
var cell = row.Cells[ColumnHasFlag];
|
||||||
cell.Value = !(bool)cell.Value;
|
cell.Value = !(bool)cell.Value!;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SortColumn(object sender, DataGridViewCellMouseEventArgs e)
|
private void SortColumn(object sender, DataGridViewCellMouseEventArgs e)
|
||||||
|
|
|
@ -127,7 +127,7 @@ public partial class TrashEditor : Form
|
||||||
TB_Text.TextChanged += (_, _) => UpdateString(TB_Text);
|
TB_Text.TextChanged += (_, _) => UpdateString(TB_Text);
|
||||||
|
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.SpeciesDataSource, null);
|
CB_Species.DataSource = new BindingSource(GameInfo.SpeciesDataSource, string.Empty);
|
||||||
|
|
||||||
CB_Language.InitializeBinding();
|
CB_Language.InitializeBinding();
|
||||||
CB_Language.DataSource = GameInfo.LanguageDataSource(generation);
|
CB_Language.DataSource = GameInfo.LanguageDataSource(generation);
|
||||||
|
|
|
@ -302,7 +302,7 @@ public partial class SAV_Database : Form
|
||||||
foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4 })
|
foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4 })
|
||||||
{
|
{
|
||||||
cb.InitializeBinding();
|
cb.InitializeBinding();
|
||||||
cb.DataSource = new BindingSource(moves, null);
|
cb.DataSource = new BindingSource(moves, string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,6 +594,7 @@ public partial class SAV_Database : Form
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReSharper disable once AsyncVoidMethod
|
||||||
private async void B_Search_Click(object sender, EventArgs e)
|
private async void B_Search_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
B_Search.Enabled = false;
|
B_Search.Enabled = false;
|
||||||
|
|
|
@ -126,7 +126,7 @@ public partial class SAV_Encounters : Form
|
||||||
private EncounterTypeGroup[] GetTypes()
|
private EncounterTypeGroup[] GetTypes()
|
||||||
{
|
{
|
||||||
return TypeFilters.Controls.OfType<CheckBox>().Where(z => z.Checked).Select(z => z.Name)
|
return TypeFilters.Controls.OfType<CheckBox>().Where(z => z.Checked).Select(z => z.Name)
|
||||||
.Select(z => (EncounterTypeGroup)Enum.Parse(typeof(EncounterTypeGroup), z)).ToArray();
|
.Select(Enum.Parse<EncounterTypeGroup>).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly PictureBox[] PKXBOXES;
|
private readonly PictureBox[] PKXBOXES;
|
||||||
|
@ -213,7 +213,7 @@ public partial class SAV_Encounters : Form
|
||||||
foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4 })
|
foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4 })
|
||||||
{
|
{
|
||||||
cb.InitializeBinding();
|
cb.InitializeBinding();
|
||||||
cb.DataSource = new BindingSource(DS_Move, null);
|
cb.DataSource = new BindingSource(DS_Move, string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,6 +386,7 @@ public partial class SAV_Encounters : Form
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReSharper disable once AsyncVoidMethod
|
||||||
private async void B_Search_Click(object sender, EventArgs e)
|
private async void B_Search_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
B_Search.Enabled = false;
|
B_Search.Enabled = false;
|
||||||
|
|
|
@ -368,7 +368,7 @@ public partial class SAV_FolderList : Form
|
||||||
{
|
{
|
||||||
if (dg.RowCount == 0)
|
if (dg.RowCount == 0)
|
||||||
return;
|
return;
|
||||||
var cm = (CurrencyManager?)BindingContext?[dg.DataSource];
|
var cm = (CurrencyManager?)BindingContext?[dg.DataSource!];
|
||||||
cm?.SuspendBinding();
|
cm?.SuspendBinding();
|
||||||
int column = CB_FilterColumn.SelectedIndex - 1;
|
int column = CB_FilterColumn.SelectedIndex - 1;
|
||||||
var text = TB_FilterTextContains.Text.AsSpan();
|
var text = TB_FilterTextContains.Text.AsSpan();
|
||||||
|
|
|
@ -214,7 +214,7 @@ public partial class SAV_MysteryGiftDB : Form
|
||||||
foreach (var cb in arr)
|
foreach (var cb in arr)
|
||||||
{
|
{
|
||||||
cb.InitializeBinding();
|
cb.InitializeBinding();
|
||||||
cb.DataSource = new BindingSource(moves, null);
|
cb.DataSource = new BindingSource(moves, string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public partial class SAV_Misc3 : Form
|
||||||
ReadDecorations(h);
|
ReadDecorations(h);
|
||||||
|
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.ToList(), null);
|
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.ToList(), string.Empty);
|
||||||
LoadPaintings();
|
LoadPaintings();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -64,7 +64,7 @@ public partial class SAV_Misc3 : Form
|
||||||
{
|
{
|
||||||
cba[i].Items.Clear();
|
cba[i].Items.Clear();
|
||||||
cba[i].InitializeBinding();
|
cba[i].InitializeBinding();
|
||||||
cba[i].DataSource = new BindingSource(legal, null);
|
cba[i].DataSource = new BindingSource(legal, string.Empty);
|
||||||
var g3Species = SAV.GetWork(0x43 + i);
|
var g3Species = SAV.GetWork(0x43 + i);
|
||||||
var species = SpeciesConverter.GetNational3(g3Species);
|
var species = SpeciesConverter.GetNational3(g3Species);
|
||||||
cba[i].SelectedValue = (int)species;
|
cba[i].SelectedValue = (int)species;
|
||||||
|
@ -604,7 +604,7 @@ public partial class SAV_Misc3 : Form
|
||||||
int ctr = 0;
|
int ctr = 0;
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
{
|
{
|
||||||
var deco = (Decoration3)(int)dgv.Rows[i].Cells[0].Value;
|
var deco = (Decoration3)(int)dgv.Rows[i].Cells[0].Value!;
|
||||||
if (deco == Decoration3.NONE) // Compression of Empty Slots
|
if (deco == Decoration3.NONE) // Compression of Empty Slots
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ public partial class SAV_Roamer3 : Form
|
||||||
SAV = sav;
|
SAV = sav;
|
||||||
|
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species, null);
|
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species, string.Empty);
|
||||||
|
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,9 @@ public partial class SAV_Geonet4 : Form
|
||||||
for (int i = 0; i < DGV_Geonet.Rows.Count; i++)
|
for (int i = 0; i < DGV_Geonet.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var row = DGV_Geonet.Rows[i];
|
var row = DGV_Geonet.Rows[i];
|
||||||
var country = (int)row.Cells[0].Value;
|
var country = (int)row.Cells[0].Value!;
|
||||||
var subregion = (int)row.Cells[2].Value;
|
var subregion = (int)row.Cells[2].Value!;
|
||||||
var point = (GeonetPoint)row.Cells[4].Value;
|
var point = (GeonetPoint)row.Cells[4].Value!;
|
||||||
if (country > 0)
|
if (country > 0)
|
||||||
Geonet.SetCountrySubregion((byte)country, (byte)subregion, point);
|
Geonet.SetCountrySubregion((byte)country, (byte)subregion, point);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public partial class SAV_Misc4 : Form
|
||||||
accessories = GameInfo.Strings.accessories;
|
accessories = GameInfo.Strings.accessories;
|
||||||
backdrops = GameInfo.Strings.backdrops;
|
backdrops = GameInfo.Strings.backdrops;
|
||||||
poketchapps = GameInfo.Strings.poketchapps;
|
poketchapps = GameInfo.Strings.poketchapps;
|
||||||
backdropsSorted = [.. backdrops.OrderBy(z => z)]; // sorted copy
|
backdropsSorted = [.. backdrops.Order()]; // sorted copy
|
||||||
|
|
||||||
StatNUDA = [NUD_Stat0, NUD_Stat1, NUD_Stat2, NUD_Stat3];
|
StatNUDA = [NUD_Stat0, NUD_Stat1, NUD_Stat2, NUD_Stat3];
|
||||||
StatLabelA = [L_Stat0, L_Stat1, L_Stat2, L_Stat3]; // Current, Trade, Record, Trade
|
StatLabelA = [L_Stat0, L_Stat1, L_Stat2, L_Stat3]; // Current, Trade, Record, Trade
|
||||||
|
@ -360,7 +360,7 @@ public partial class SAV_Misc4 : Form
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
|
|
||||||
var speciesList = GameInfo.FilteredSources.Species.Skip(1).ToList();
|
var speciesList = GameInfo.FilteredSources.Species.Skip(1).ToList();
|
||||||
CB_Species.DataSource = new BindingSource(speciesList, null);
|
CB_Species.DataSource = new BindingSource(speciesList, string.Empty);
|
||||||
|
|
||||||
editing = false;
|
editing = false;
|
||||||
CB_Stats1.SelectedIndex = 0;
|
CB_Stats1.SelectedIndex = 0;
|
||||||
|
@ -887,7 +887,7 @@ public partial class SAV_Misc4 : Form
|
||||||
DisplayIndex = 0,
|
DisplayIndex = 0,
|
||||||
Width = 190,
|
Width = 190,
|
||||||
FlatStyle = FlatStyle.Flat,
|
FlatStyle = FlatStyle.Flat,
|
||||||
DataSource = new BindingSource(backdropsSorted, null),
|
DataSource = new BindingSource(backdropsSorted, string.Empty),
|
||||||
};
|
};
|
||||||
DGV_Backdrops.Columns.Add(dgv);
|
DGV_Backdrops.Columns.Add(dgv);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public partial class SAV_Pokedex4 : Form
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
var filtered = GameInfo.FilteredSources;
|
var filtered = GameInfo.FilteredSources;
|
||||||
CB_Species.DataSource = new BindingSource(filtered.Species.Skip(1).ToList(), null);
|
CB_Species.DataSource = new BindingSource(filtered.Species.Skip(1).ToList(), string.Empty);
|
||||||
|
|
||||||
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
||||||
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.specieslist[i]}");
|
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.specieslist[i]}");
|
||||||
|
|
|
@ -42,28 +42,28 @@ public partial class SAV_Underground : Form
|
||||||
// Goods
|
// Goods
|
||||||
DGV_UGGoods.Rows.Add(SAV4Sinnoh.UG_POUCH_SIZE);
|
DGV_UGGoods.Rows.Add(SAV4Sinnoh.UG_POUCH_SIZE);
|
||||||
|
|
||||||
Item_Goods.DataSource = new BindingSource(ugGoodsSorted, null);
|
Item_Goods.DataSource = new BindingSource(ugGoodsSorted, string.Empty);
|
||||||
Item_Goods.DisplayIndex = 0;
|
Item_Goods.DisplayIndex = 0;
|
||||||
DGV_UGGoods.CancelEdit();
|
DGV_UGGoods.CancelEdit();
|
||||||
|
|
||||||
// Spheres
|
// Spheres
|
||||||
DGV_UGSpheres.Rows.Add(MAX_SIZE);
|
DGV_UGSpheres.Rows.Add(MAX_SIZE);
|
||||||
|
|
||||||
Item_Spheres.DataSource = new BindingSource(ugSpheres, null);
|
Item_Spheres.DataSource = new BindingSource(ugSpheres, string.Empty);
|
||||||
Item_Spheres.DisplayIndex = 0;
|
Item_Spheres.DisplayIndex = 0;
|
||||||
DGV_UGSpheres.CancelEdit();
|
DGV_UGSpheres.CancelEdit();
|
||||||
|
|
||||||
// Traps
|
// Traps
|
||||||
DGV_UGTraps.Rows.Add(MAX_SIZE);
|
DGV_UGTraps.Rows.Add(MAX_SIZE);
|
||||||
|
|
||||||
Item_Traps.DataSource = new BindingSource(ugTrapsSorted, null);
|
Item_Traps.DataSource = new BindingSource(ugTrapsSorted, string.Empty);
|
||||||
Item_Traps.DisplayIndex = 0;
|
Item_Traps.DisplayIndex = 0;
|
||||||
DGV_UGTraps.CancelEdit();
|
DGV_UGTraps.CancelEdit();
|
||||||
|
|
||||||
// Treasures
|
// Treasures
|
||||||
DGV_UGTreasures.Rows.Add(MAX_SIZE);
|
DGV_UGTreasures.Rows.Add(MAX_SIZE);
|
||||||
|
|
||||||
Item_Treasures.DataSource = new BindingSource(ugTreasuresSorted, null);
|
Item_Treasures.DataSource = new BindingSource(ugTreasuresSorted, string.Empty);
|
||||||
Item_Treasures.DisplayIndex = 0;
|
Item_Treasures.DisplayIndex = 0;
|
||||||
DGV_UGTreasures.CancelEdit();
|
DGV_UGTreasures.CancelEdit();
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public partial class SAV_Underground : Form
|
||||||
int ctr = 0;
|
int ctr = 0;
|
||||||
for (int i = 0; i < DGV_UGGoods.Rows.Count; i++)
|
for (int i = 0; i < DGV_UGGoods.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var str = DGV_UGGoods.Rows[i].Cells[0].Value.ToString();
|
var str = DGV_UGGoods.Rows[i].Cells[0].Value!.ToString();
|
||||||
var itemindex = Array.IndexOf(ugGoods, str);
|
var itemindex = Array.IndexOf(ugGoods, str);
|
||||||
|
|
||||||
if (itemindex <= 0)
|
if (itemindex <= 0)
|
||||||
|
@ -154,7 +154,7 @@ public partial class SAV_Underground : Form
|
||||||
for (int i = 0; i < DGV_UGSpheres.Rows.Count; i++)
|
for (int i = 0; i < DGV_UGSpheres.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var row = DGV_UGSpheres.Rows[i];
|
var row = DGV_UGSpheres.Rows[i];
|
||||||
var str = row.Cells[0].Value.ToString();
|
var str = row.Cells[0].Value!.ToString();
|
||||||
var itemindex = Array.IndexOf(ugSpheres, str);
|
var itemindex = Array.IndexOf(ugSpheres, str);
|
||||||
|
|
||||||
bool success = int.TryParse(row.Cells[1].Value?.ToString(), out var itemcnt);
|
bool success = int.TryParse(row.Cells[1].Value?.ToString(), out var itemcnt);
|
||||||
|
@ -170,7 +170,7 @@ public partial class SAV_Underground : Form
|
||||||
ctr = 0;
|
ctr = 0;
|
||||||
for (int i = 0; i < DGV_UGTraps.Rows.Count; i++)
|
for (int i = 0; i < DGV_UGTraps.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var str = DGV_UGTraps.Rows[i].Cells[0].Value.ToString();
|
var str = DGV_UGTraps.Rows[i].Cells[0].Value!.ToString();
|
||||||
var itemindex = Array.IndexOf(ugTraps, str);
|
var itemindex = Array.IndexOf(ugTraps, str);
|
||||||
|
|
||||||
if (itemindex <= 0)
|
if (itemindex <= 0)
|
||||||
|
@ -184,7 +184,7 @@ public partial class SAV_Underground : Form
|
||||||
ctr = 0;
|
ctr = 0;
|
||||||
for (int i = 0; i < DGV_UGTreasures.Rows.Count; i++)
|
for (int i = 0; i < DGV_UGTreasures.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var str = DGV_UGTreasures.Rows[i].Cells[0].Value.ToString();
|
var str = DGV_UGTreasures.Rows[i].Cells[0].Value!.ToString();
|
||||||
var itemindex = Array.IndexOf(ugTreasures, str);
|
var itemindex = Array.IndexOf(ugTreasures, str);
|
||||||
|
|
||||||
if (itemindex <= 0)
|
if (itemindex <= 0)
|
||||||
|
|
|
@ -248,13 +248,15 @@ public partial class SAV_DLC5 : Form
|
||||||
|
|
||||||
private void B_ExportPNGCGear_Click(object sender, EventArgs e)
|
private void B_ExportPNGCGear_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (PB_CGearBackground.Image is not { } img)
|
||||||
|
return;
|
||||||
using var sfd = new SaveFileDialog();
|
using var sfd = new SaveFileDialog();
|
||||||
sfd.Filter = "PNG File|*.png";
|
sfd.Filter = "PNG File|*.png";
|
||||||
sfd.FileName = "Background.png";
|
sfd.FileName = "Background.png";
|
||||||
if (sfd.ShowDialog() != DialogResult.OK)
|
if (sfd.ShowDialog() != DialogResult.OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PB_CGearBackground.Image.Save(sfd.FileName, ImageFormat.Png);
|
img.Save(sfd.FileName, ImageFormat.Png);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void B_ImportCGB_Click(object sender, EventArgs e)
|
private void B_ImportCGB_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -144,7 +144,7 @@ public partial class SAV_Misc5 : Form
|
||||||
states.Add(new ComboItem($"Unknown (0x{c:X2})", c));
|
states.Add(new ComboItem($"Unknown (0x{c:X2})", c));
|
||||||
cbr[i].Items.Clear();
|
cbr[i].Items.Clear();
|
||||||
cbr[i].InitializeBinding();
|
cbr[i].InitializeBinding();
|
||||||
cbr[i].DataSource = new BindingSource(states.Where(v => v.Value >= 2 || v.Value == c).ToList(), null);
|
cbr[i].DataSource = new BindingSource(states.Where(v => v.Value >= 2 || v.Value == c).ToList(), string.Empty);
|
||||||
cbr[i].SelectedValue = (int)c;
|
cbr[i].SelectedValue = (int)c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public partial class SAV_Misc5 : Form
|
||||||
states.Add(new ComboItem($"Unknown (0x{current:X2})", current));
|
states.Add(new ComboItem($"Unknown (0x{current:X2})", current));
|
||||||
CB_RoamStatus.Items.Clear();
|
CB_RoamStatus.Items.Clear();
|
||||||
CB_RoamStatus.InitializeBinding();
|
CB_RoamStatus.InitializeBinding();
|
||||||
CB_RoamStatus.DataSource = new BindingSource(states, null);
|
CB_RoamStatus.DataSource = new BindingSource(states, string.Empty);
|
||||||
CB_RoamStatus.SelectedValue = (int)current;
|
CB_RoamStatus.SelectedValue = (int)current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ public partial class SAV_Misc5 : Form
|
||||||
{
|
{
|
||||||
cb.Items.Clear();
|
cb.Items.Clear();
|
||||||
cb.InitializeBinding();
|
cb.InitializeBinding();
|
||||||
cb.DataSource = new BindingSource(PassPowerB, null);
|
cb.DataSource = new BindingSource(PassPowerB, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
CB_PassPower1.SelectedValue = (int)pass.PassPower1;
|
CB_PassPower1.SelectedValue = (int)pass.PassPower1;
|
||||||
|
@ -512,9 +512,9 @@ public partial class SAV_Misc5 : Form
|
||||||
CB_Gender.InitializeBinding();
|
CB_Gender.InitializeBinding();
|
||||||
|
|
||||||
var filtered = GameInfo.FilteredSources;
|
var filtered = GameInfo.FilteredSources;
|
||||||
CB_Species.DataSource = new BindingSource(filtered.Species, null);
|
CB_Species.DataSource = new BindingSource(filtered.Species, string.Empty);
|
||||||
CB_Move.DataSource = new BindingSource(filtered.Moves, null);
|
CB_Move.DataSource = new BindingSource(filtered.Moves, string.Empty);
|
||||||
CB_Areas.DataSource = new BindingSource(areas, null);
|
CB_Areas.DataSource = new BindingSource(areas, string.Empty);
|
||||||
|
|
||||||
CB_Areas.SelectedIndex = 0;
|
CB_Areas.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ public partial class SAV_Misc5 : Form
|
||||||
|
|
||||||
private void SetGenders(EntreeSlot slot)
|
private void SetGenders(EntreeSlot slot)
|
||||||
{
|
{
|
||||||
CB_Gender.DataSource = new BindingSource(GetGenderChoices(slot.Species), null);
|
CB_Gender.DataSource = new BindingSource(GetGenderChoices(slot.Species), string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void B_RandForest_Click(object sender, EventArgs e)
|
private void B_RandForest_Click(object sender, EventArgs e)
|
||||||
|
@ -660,7 +660,7 @@ public partial class SAV_Misc5 : Form
|
||||||
L_Form.Visible = CB_Form.Enabled = CB_Form.Visible = hasForms;
|
L_Form.Visible = CB_Form.Enabled = CB_Form.Visible = hasForms;
|
||||||
|
|
||||||
var list = FormConverter.GetFormList(slot.Species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Context);
|
var list = FormConverter.GetFormList(slot.Species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Context);
|
||||||
CB_Form.DataSource = new BindingSource(list, null);
|
CB_Form.DataSource = new BindingSource(list, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReadSubway()
|
private void ReadSubway()
|
||||||
|
|
|
@ -26,7 +26,7 @@ public partial class SAV_Pokedex5 : Form
|
||||||
|
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), null);
|
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), string.Empty);
|
||||||
|
|
||||||
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
||||||
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.Species[i]}");
|
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.Species[i]}");
|
||||||
|
|
|
@ -94,17 +94,17 @@ public partial class SAV_UnityTower : Form
|
||||||
for (int i = 0; i < DGV_Geonet.Rows.Count; i++)
|
for (int i = 0; i < DGV_Geonet.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var row = DGV_Geonet.Rows[i];
|
var row = DGV_Geonet.Rows[i];
|
||||||
var country = (int)row.Cells[0].Value;
|
var country = (int)row.Cells[0].Value!;
|
||||||
var subregion = (int)row.Cells[2].Value;
|
var subregion = (int)row.Cells[2].Value!;
|
||||||
var point = (GeonetPoint)row.Cells[4].Value;
|
var point = (GeonetPoint)row.Cells[4].Value!;
|
||||||
if (country > 0)
|
if (country > 0)
|
||||||
UnityTower.SetCountrySubregion((byte)country, (byte)subregion, point);
|
UnityTower.SetCountrySubregion((byte)country, (byte)subregion, point);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < DGV_UnityTower.Rows.Count; i++)
|
for (int i = 0; i < DGV_UnityTower.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
var row = DGV_UnityTower.Rows[i];
|
var row = DGV_UnityTower.Rows[i];
|
||||||
var unlocked = (bool)row.Cells[0].Value;
|
var unlocked = (bool)row.Cells[0].Value!;
|
||||||
var country = (int)row.Cells[1].Value;
|
var country = (int)row.Cells[1].Value!;
|
||||||
UnityTower.SetUnityTowerFloor((byte)country, unlocked);
|
UnityTower.SetUnityTowerFloor((byte)country, unlocked);
|
||||||
}
|
}
|
||||||
UnityTower.SetSAVCountry();
|
UnityTower.SetSAVCountry();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public partial class SAV_HallOfFame : Form
|
||||||
|
|
||||||
var filtered = GameInfo.FilteredSources;
|
var filtered = GameInfo.FilteredSources;
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(filtered.Species, null);
|
CB_Species.DataSource = new BindingSource(filtered.Species, string.Empty);
|
||||||
|
|
||||||
CB_Move1.InitializeBinding();
|
CB_Move1.InitializeBinding();
|
||||||
CB_Move2.InitializeBinding();
|
CB_Move2.InitializeBinding();
|
||||||
|
@ -50,13 +50,13 @@ public partial class SAV_HallOfFame : Form
|
||||||
CB_Move4.InitializeBinding();
|
CB_Move4.InitializeBinding();
|
||||||
|
|
||||||
var MoveList = filtered.Moves;
|
var MoveList = filtered.Moves;
|
||||||
CB_Move1.DataSource = new BindingSource(MoveList, null);
|
CB_Move1.DataSource = new BindingSource(MoveList, string.Empty);
|
||||||
CB_Move2.DataSource = new BindingSource(MoveList, null);
|
CB_Move2.DataSource = new BindingSource(MoveList, string.Empty);
|
||||||
CB_Move3.DataSource = new BindingSource(MoveList, null);
|
CB_Move3.DataSource = new BindingSource(MoveList, string.Empty);
|
||||||
CB_Move4.DataSource = new BindingSource(MoveList, null);
|
CB_Move4.DataSource = new BindingSource(MoveList, string.Empty);
|
||||||
|
|
||||||
CB_HeldItem.InitializeBinding();
|
CB_HeldItem.InitializeBinding();
|
||||||
CB_HeldItem.DataSource = new BindingSource(filtered.Items, null);
|
CB_HeldItem.DataSource = new BindingSource(filtered.Items, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void B_Cancel_Click(object sender, EventArgs e) => Close();
|
private void B_Cancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
|
@ -22,7 +22,7 @@ public partial class SAV_Link6 : Form
|
||||||
foreach (var cb in (ComboBox[])[CB_Item1, CB_Item2, CB_Item3, CB_Item4, CB_Item5, CB_Item6])
|
foreach (var cb in (ComboBox[])[CB_Item1, CB_Item2, CB_Item3, CB_Item4, CB_Item5, CB_Item6])
|
||||||
{
|
{
|
||||||
cb.InitializeBinding();
|
cb.InitializeBinding();
|
||||||
cb.DataSource = new BindingSource(filtered.Items, null);
|
cb.DataSource = new BindingSource(filtered.Items, string.Empty);
|
||||||
}
|
}
|
||||||
Gifts = SAV.Link.Gifts;
|
Gifts = SAV.Link.Gifts;
|
||||||
LoadLinkData();
|
LoadLinkData();
|
||||||
|
|
|
@ -27,7 +27,7 @@ public partial class SAV_PokedexORAS : Form
|
||||||
|
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), null);
|
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), string.Empty);
|
||||||
|
|
||||||
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
||||||
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.specieslist[i]}");
|
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.specieslist[i]}");
|
||||||
|
|
|
@ -27,7 +27,7 @@ public partial class SAV_PokedexXY : Form
|
||||||
|
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), null);
|
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), string.Empty);
|
||||||
|
|
||||||
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
||||||
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.specieslist[i]}");
|
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.specieslist[i]}");
|
||||||
|
|
|
@ -73,7 +73,9 @@ public partial class SAV_Pokepuff : Form
|
||||||
{
|
{
|
||||||
if (e.ColumnIndex != 1)
|
if (e.ColumnIndex != 1)
|
||||||
return;
|
return;
|
||||||
((ComboBox)((DataGridView)sender).EditingControl).DroppedDown = true;
|
if (sender is not DataGridView { EditingControl: ComboBox cb })
|
||||||
|
return;
|
||||||
|
cb.DroppedDown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void B_Cancel_Click(object sender, EventArgs e)
|
private void B_Cancel_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -48,10 +48,10 @@ public partial class SAV_SecretBase : Form
|
||||||
CB_Form.InitializeBinding();
|
CB_Form.InitializeBinding();
|
||||||
|
|
||||||
var filtered = GameInfo.FilteredSources;
|
var filtered = GameInfo.FilteredSources;
|
||||||
CB_Ball.DataSource = new BindingSource(filtered.Balls, null);
|
CB_Ball.DataSource = new BindingSource(filtered.Balls, string.Empty);
|
||||||
CB_HeldItem.DataSource = new BindingSource(filtered.Items, null);
|
CB_HeldItem.DataSource = new BindingSource(filtered.Items, string.Empty);
|
||||||
CB_Species.DataSource = new BindingSource(filtered.Species, null);
|
CB_Species.DataSource = new BindingSource(filtered.Species, string.Empty);
|
||||||
CB_Nature.DataSource = new BindingSource(filtered.Natures, null);
|
CB_Nature.DataSource = new BindingSource(filtered.Natures, string.Empty);
|
||||||
|
|
||||||
CB_Move1.InitializeBinding();
|
CB_Move1.InitializeBinding();
|
||||||
CB_Move2.InitializeBinding();
|
CB_Move2.InitializeBinding();
|
||||||
|
@ -59,10 +59,10 @@ public partial class SAV_SecretBase : Form
|
||||||
CB_Move4.InitializeBinding();
|
CB_Move4.InitializeBinding();
|
||||||
|
|
||||||
var moves = filtered.Moves;
|
var moves = filtered.Moves;
|
||||||
CB_Move1.DataSource = new BindingSource(moves, null);
|
CB_Move1.DataSource = new BindingSource(moves, string.Empty);
|
||||||
CB_Move2.DataSource = new BindingSource(moves, null);
|
CB_Move2.DataSource = new BindingSource(moves, string.Empty);
|
||||||
CB_Move3.DataSource = new BindingSource(moves, null);
|
CB_Move3.DataSource = new BindingSource(moves, string.Empty);
|
||||||
CB_Move4.DataSource = new BindingSource(moves, null);
|
CB_Move4.DataSource = new BindingSource(moves, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReloadSecretBaseList()
|
private void ReloadSecretBaseList()
|
||||||
|
@ -321,7 +321,7 @@ public partial class SAV_SecretBase : Form
|
||||||
{
|
{
|
||||||
var abilities = PersonalTable.AO.GetFormEntry(species, form);
|
var abilities = PersonalTable.AO.GetFormEntry(species, form);
|
||||||
var list = GameInfo.FilteredSources.GetAbilityList(abilities);
|
var list = GameInfo.FilteredSources.GetAbilityList(abilities);
|
||||||
CB_Ability.DataSource = new BindingSource(list, null);
|
CB_Ability.DataSource = new BindingSource(list, string.Empty);
|
||||||
CB_Ability.SelectedIndex = abilityIndex < 3 ? abilityIndex : 0;
|
CB_Ability.SelectedIndex = abilityIndex < 3 ? abilityIndex : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ public partial class SAV_SecretBase : Form
|
||||||
CB_Form.Enabled = CB_Form.Visible = hasForms;
|
CB_Form.Enabled = CB_Form.Visible = hasForms;
|
||||||
|
|
||||||
var list = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Context);
|
var list = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Context);
|
||||||
CB_Form.DataSource = new BindingSource(list, null);
|
CB_Form.DataSource = new BindingSource(list, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSpecies(object sender, EventArgs e)
|
private void UpdateSpecies(object sender, EventArgs e)
|
||||||
|
|
|
@ -35,10 +35,10 @@ public partial class SAV_SuperTrain : Form
|
||||||
dataGridView1.Columns.Clear();
|
dataGridView1.Columns.Clear();
|
||||||
{
|
{
|
||||||
CB_Species1.InitializeBinding();
|
CB_Species1.InitializeBinding();
|
||||||
CB_Species1.DataSource = new BindingSource(GameInfo.FilteredSources.Species, null);
|
CB_Species1.DataSource = new BindingSource(GameInfo.FilteredSources.Species, string.Empty);
|
||||||
|
|
||||||
CB_Species2.InitializeBinding();
|
CB_Species2.InitializeBinding();
|
||||||
CB_Species2.DataSource = new BindingSource(GameInfo.FilteredSources.Species, null);
|
CB_Species2.DataSource = new BindingSource(GameInfo.FilteredSources.Species, string.Empty);
|
||||||
}
|
}
|
||||||
listBox1.SelectedIndex = 0;
|
listBox1.SelectedIndex = 0;
|
||||||
FillTrainingBags();
|
FillTrainingBags();
|
||||||
|
@ -86,8 +86,9 @@ public partial class SAV_SuperTrain : Form
|
||||||
{
|
{
|
||||||
if (e.ColumnIndex != 1)
|
if (e.ColumnIndex != 1)
|
||||||
return;
|
return;
|
||||||
ComboBox comboBox = (ComboBox)dataGridView1.EditingControl;
|
if (sender is not DataGridView { EditingControl: ComboBox cb })
|
||||||
comboBox.DroppedDown = true;
|
return;
|
||||||
|
cb.DroppedDown = true;
|
||||||
}
|
}
|
||||||
catch { System.Diagnostics.Debug.WriteLine("Failed to modify item."); }
|
catch { System.Diagnostics.Debug.WriteLine("Failed to modify item."); }
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@ public partial class SAV_SuperTrain : Form
|
||||||
int emptyslots = 0;
|
int emptyslots = 0;
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
var bag = dataGridView1.Rows[i].Cells[1].Value.ToString();
|
var bag = dataGridView1.Rows[i].Cells[1].Value!.ToString();
|
||||||
if (Array.IndexOf(trba, bag) == 0)
|
if (Array.IndexOf(trba, bag) == 0)
|
||||||
{
|
{
|
||||||
emptyslots++;
|
emptyslots++;
|
||||||
|
|
|
@ -255,7 +255,7 @@ public partial class SAV_Trainer : Form
|
||||||
if (SAV is SAV6XY xy)
|
if (SAV is SAV6XY xy)
|
||||||
{
|
{
|
||||||
var xystat = (MyStatus6XY)xy.Status;
|
var xystat = (MyStatus6XY)xy.Status;
|
||||||
xystat.Fashion = (TrainerFashion6)PG_CurrentAppearance.SelectedObject;
|
xystat.Fashion = (TrainerFashion6)PG_CurrentAppearance.SelectedObject!;
|
||||||
xystat.Nickname = TB_TRNick.Text;
|
xystat.Nickname = TB_TRNick.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public partial class SAV_Capture7GG : Form
|
||||||
// Fill List
|
// Fill List
|
||||||
var species = GameInfo.FilteredSources.Species.Where(z => IsLegalSpecies(z.Value)).ToList();
|
var species = GameInfo.FilteredSources.Species.Where(z => IsLegalSpecies(z.Value)).ToList();
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(species, null);
|
CB_Species.DataSource = new BindingSource(species, string.Empty);
|
||||||
foreach (var (text, value) in species.OrderBy(z => z.Value))
|
foreach (var (text, value) in species.OrderBy(z => z.Value))
|
||||||
LB_Species.Items.Add($"{value:000}: {text}");
|
LB_Species.Items.Add($"{value:000}: {text}");
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public partial class SAV_HallOfFame7 : Form
|
||||||
var cb = entries[i];
|
var cb = entries[i];
|
||||||
cb.Items.Clear();
|
cb.Items.Clear();
|
||||||
cb.InitializeBinding();
|
cb.InitializeBinding();
|
||||||
cb.DataSource = new BindingSource(specList, null);
|
cb.DataSource = new BindingSource(specList, string.Empty);
|
||||||
cb.SelectedValue = (int)block.GetEntry(i);
|
cb.SelectedValue = (int)block.GetEntry(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public partial class SAV_PokedexGG : Form
|
||||||
|
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), null);
|
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), string.Empty);
|
||||||
|
|
||||||
Dex = SAV.Blocks.Zukan;
|
Dex = SAV.Blocks.Zukan;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public partial class SAV_PokedexSM : Form
|
||||||
|
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), null);
|
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), string.Empty);
|
||||||
|
|
||||||
var Species = GameInfo.Strings.Species;
|
var Species = GameInfo.Strings.Species;
|
||||||
var names = Dex.GetEntryNames(Species);
|
var names = Dex.GetEntryNames(Species);
|
||||||
|
|
|
@ -60,7 +60,7 @@ public partial class SAV_Trainer7GG : Form
|
||||||
CB_Language.InitializeBinding();
|
CB_Language.InitializeBinding();
|
||||||
CB_Language.DataSource = GameInfo.LanguageDataSource(SAV.Generation);
|
CB_Language.DataSource = GameInfo.LanguageDataSource(SAV.Generation);
|
||||||
CB_Game.InitializeBinding();
|
CB_Game.InitializeBinding();
|
||||||
CB_Game.DataSource = new BindingSource(GameInfo.VersionDataSource.Where(z => GameVersion.Gen7b.Contains(z.Value)).ToList(), null);
|
CB_Game.DataSource = new BindingSource(GameInfo.VersionDataSource.Where(z => GameVersion.Gen7b.Contains(z.Value)).ToList(), string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadTrainerInfo()
|
private void LoadTrainerInfo()
|
||||||
|
|
|
@ -45,7 +45,7 @@ public partial class SAV_ZygardeCell : Form
|
||||||
var ew = SAV.EventWork;
|
var ew = SAV.EventWork;
|
||||||
for (int i = 0; i < dgv.RowCount; i++)
|
for (int i = 0; i < dgv.RowCount; i++)
|
||||||
{
|
{
|
||||||
string str = (string)dgv.Rows[i].Cells[2].Value;
|
string str = (string)dgv.Rows[i].Cells[2].Value!;
|
||||||
int val = Array.IndexOf(states, str);
|
int val = Array.IndexOf(states, str);
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
throw new IndexOutOfRangeException("Unable to find cell index.");
|
throw new IndexOutOfRangeException("Unable to find cell index.");
|
||||||
|
@ -73,7 +73,7 @@ public partial class SAV_ZygardeCell : Form
|
||||||
for (int i = 0; i < dgv.RowCount; i++)
|
for (int i = 0; i < dgv.RowCount; i++)
|
||||||
{
|
{
|
||||||
var state = dgv.Rows[i].Cells[2];
|
var state = dgv.Rows[i].Cells[2];
|
||||||
if (Array.IndexOf(states, (string)state.Value) != 2) // Not Collected
|
if (Array.IndexOf(states, (string)state.Value!) != 2) // Not Collected
|
||||||
added++;
|
added++;
|
||||||
state.Value = states[2];
|
state.Value = states[2];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using PKHeX.Core;
|
using PKHeX.Core;
|
||||||
|
@ -186,14 +186,14 @@ public partial class SAV_Poffin8b : Form
|
||||||
item.MstID = SetPoffinName(cells[1].Value?.ToString() ?? "");
|
item.MstID = SetPoffinName(cells[1].Value?.ToString() ?? "");
|
||||||
item.Level = Parse(cells[2]);
|
item.Level = Parse(cells[2]);
|
||||||
item.Taste = Parse(cells[3]);
|
item.Taste = Parse(cells[3]);
|
||||||
item.IsNew = (bool)cells[4].Value;
|
item.IsNew = (bool)cells[4].Value!;
|
||||||
item.FlavorSpicy = Parse(cells[5]);
|
item.FlavorSpicy = Parse(cells[5]);
|
||||||
item.FlavorDry = Parse(cells[6]);
|
item.FlavorDry = Parse(cells[6]);
|
||||||
item.FlavorSweet = Parse(cells[7]);
|
item.FlavorSweet = Parse(cells[7]);
|
||||||
item.FlavorBitter = Parse(cells[8]);
|
item.FlavorBitter = Parse(cells[8]);
|
||||||
item.FlavorSour = Parse(cells[9]);
|
item.FlavorSour = Parse(cells[9]);
|
||||||
|
|
||||||
static byte Parse(DataGridViewCell c) => (byte)(byte.TryParse(c.Value.ToString(), out var p) ? p : 0);
|
static byte Parse(DataGridViewCell c) => (byte)(byte.TryParse(c.Value!.ToString(), out var p) ? p : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public partial class SAV_PokedexBDSP : Form
|
||||||
|
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), null);
|
CB_Species.DataSource = new BindingSource(GameInfo.FilteredSources.Species.Skip(1).ToList(), string.Empty);
|
||||||
|
|
||||||
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
for (int i = 1; i < SAV.MaxSpeciesID + 1; i++)
|
||||||
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.specieslist[i]}");
|
LB_Species.Items.Add($"{i:000} - {GameInfo.Strings.specieslist[i]}");
|
||||||
|
|
|
@ -92,11 +92,11 @@ public partial class SAV_PokedexLA : Form
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
var species = GameInfo.FilteredSources.Species.Where(z => PokedexSave8a.GetDexIndex(PokedexType8a.Hisui, (ushort)z.Value) != 0).ToArray();
|
var species = GameInfo.FilteredSources.Species.Where(z => PokedexSave8a.GetDexIndex(PokedexType8a.Hisui, (ushort)z.Value) != 0).ToArray();
|
||||||
CB_Species.DataSource = new BindingSource(species, null);
|
CB_Species.DataSource = new BindingSource(species, string.Empty);
|
||||||
|
|
||||||
CB_DisplayForm.InitializeBinding();
|
CB_DisplayForm.InitializeBinding();
|
||||||
DisplayedForms = [new(GameInfo.Strings.types[0], 0)];
|
DisplayedForms = [new(GameInfo.Strings.types[0], 0)];
|
||||||
CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, null);
|
CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, string.Empty);
|
||||||
|
|
||||||
for (var d = 1; d < DexToSpecies.Length; d++)
|
for (var d = 1; d < DexToSpecies.Length; d++)
|
||||||
LB_Species.Items.Add($"{d:000} - {speciesNames[DexToSpecies[d]]}");
|
LB_Species.Items.Add($"{d:000} - {speciesNames[DexToSpecies[d]]}");
|
||||||
|
@ -157,7 +157,7 @@ public partial class SAV_PokedexLA : Form
|
||||||
|
|
||||||
DisplayedForms.Clear();
|
DisplayedForms.Clear();
|
||||||
DisplayedForms.Add(new ComboItem(GameInfo.Strings.types[0], 0));
|
DisplayedForms.Add(new ComboItem(GameInfo.Strings.types[0], 0));
|
||||||
CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, null);
|
CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, string.Empty);
|
||||||
|
|
||||||
lastForm = 0;
|
lastForm = 0;
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ public partial class SAV_PokedexLA : Form
|
||||||
DisplayedForms.Add(new ComboItem(ds[form], form));
|
DisplayedForms.Add(new ComboItem(ds[form], form));
|
||||||
}
|
}
|
||||||
|
|
||||||
CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, null);
|
CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, string.Empty);
|
||||||
LB_Forms.DataSource = sanitized;
|
LB_Forms.DataSource = sanitized;
|
||||||
LB_Forms.SelectedIndex = 0;
|
LB_Forms.SelectedIndex = 0;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public partial class SAV_PokedexSWSH : Form
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
var species = GameInfo.FilteredSources.Species.Where(z => Dex.DexLookup.ContainsKey((ushort)z.Value)).ToArray();
|
var species = GameInfo.FilteredSources.Species.Where(z => Dex.DexLookup.ContainsKey((ushort)z.Value)).ToArray();
|
||||||
CB_Species.DataSource = new BindingSource(species, null);
|
CB_Species.DataSource = new BindingSource(species, string.Empty);
|
||||||
|
|
||||||
var names = Indexes.Select(z => z.GetEntryName(speciesNames) + (Dex.DexLookup[z.Species].DexType == z.Entry.DexType ? string.Empty : "***"));
|
var names = Indexes.Select(z => z.GetEntryName(speciesNames) + (Dex.DexLookup[z.Species].DexType == z.Entry.DexType ? string.Empty : "***"));
|
||||||
foreach (var n in names)
|
foreach (var n in names)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -109,9 +109,9 @@ public partial class SAV_SealStickers8b : Form
|
||||||
var index = int.Parse(cells[0].Value?.ToString() ?? "0");
|
var index = int.Parse(cells[0].Value?.ToString() ?? "0");
|
||||||
var item = items[index];
|
var item = items[index];
|
||||||
|
|
||||||
item.Count = int.TryParse(cells[2].Value.ToString(), out var count) ? count : 0;
|
item.Count = int.TryParse(cells[2].Value!.ToString(), out var count) ? count : 0;
|
||||||
item.TotalCount = int.TryParse(cells[3].Value.ToString(), out var total) ? total : 0;
|
item.TotalCount = int.TryParse(cells[3].Value!.ToString(), out var total) ? total : 0;
|
||||||
item.IsGet = (bool)cells[4].Value;
|
item.IsGet = (bool)cells[4].Value!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -120,9 +120,9 @@ public partial class SAV_Underground8b : Form
|
||||||
var index = int.Parse(cells[0].Value?.ToString() ?? "0");
|
var index = int.Parse(cells[0].Value?.ToString() ?? "0");
|
||||||
var item = items[index];
|
var item = items[index];
|
||||||
|
|
||||||
item.Count = int.TryParse(cells[3].Value.ToString(), out var count) ? count : 0;
|
item.Count = int.TryParse(cells[3].Value!.ToString(), out var count) ? count : 0;
|
||||||
item.HideNewFlag = !(bool)cells[4].Value;
|
item.HideNewFlag = !(bool)cells[4].Value!;
|
||||||
item.IsFavoriteFlag = (bool)cells[5].Value;
|
item.IsFavoriteFlag = (bool)cells[5].Value!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ public partial class SAV_PokedexSV : Form
|
||||||
const int maxSpecies = (int)Species.IronLeaves; // 1010 -- no DLC species
|
const int maxSpecies = (int)Species.IronLeaves; // 1010 -- no DLC species
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
var species = GameInfo.SpeciesDataSource.Where(z => SAV.Personal.IsSpeciesInGame((ushort)z.Value) && z.Value <= maxSpecies).ToArray();
|
var species = GameInfo.SpeciesDataSource.Where(z => SAV.Personal.IsSpeciesInGame((ushort)z.Value) && z.Value <= maxSpecies).ToArray();
|
||||||
CB_Species.DataSource = new BindingSource(species, null);
|
CB_Species.DataSource = new BindingSource(species, string.Empty);
|
||||||
|
|
||||||
var list = species
|
var list = species
|
||||||
.Select(z => new DexMap(z))
|
.Select(z => new DexMap(z))
|
||||||
|
|
|
@ -38,7 +38,7 @@ public partial class SAV_PokedexSVKitakami : Form
|
||||||
// Fill List
|
// Fill List
|
||||||
CB_Species.InitializeBinding();
|
CB_Species.InitializeBinding();
|
||||||
var species = GameInfo.SpeciesDataSource.Where(z => SAV.Personal.IsSpeciesInGame((ushort)z.Value)).ToArray();
|
var species = GameInfo.SpeciesDataSource.Where(z => SAV.Personal.IsSpeciesInGame((ushort)z.Value)).ToArray();
|
||||||
CB_Species.DataSource = new BindingSource(species, null);
|
CB_Species.DataSource = new BindingSource(species, string.Empty);
|
||||||
|
|
||||||
var list = species
|
var list = species
|
||||||
.Select(z => new DexMap(z))
|
.Select(z => new DexMap(z))
|
||||||
|
|
|
@ -409,9 +409,9 @@ public partial class SAV_Trainer9 : Form
|
||||||
System.Media.SystemSounds.Asterisk.Play();
|
System.Media.SystemSounds.Asterisk.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void P_CurrPhoto_Click(object sender, EventArgs e) => IMG_Save(P_CurrPhoto.Image, "current_photo");
|
private void P_CurrPhoto_Click(object sender, EventArgs e) => IMG_Save(P_CurrPhoto.Image!, "current_photo");
|
||||||
private void P_CurrIcon_Click(object sender, EventArgs e) => IMG_Save(P_CurrIcon.Image, "current_icon");
|
private void P_CurrIcon_Click(object sender, EventArgs e) => IMG_Save(P_CurrIcon.Image!, "current_icon");
|
||||||
private void P_InitialIcon_Click(object sender, EventArgs e) => IMG_Save(P_InitialIcon.Image, "initial_icon");
|
private void P_InitialIcon_Click(object sender, EventArgs e) => IMG_Save(P_InitialIcon.Image!, "initial_icon");
|
||||||
|
|
||||||
private void B_UnlockClothing_Click(object sender, EventArgs e)
|
private void B_UnlockClothing_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,7 @@ public sealed partial class SAV_EventFlags : Form
|
||||||
if (e.ColumnIndex != 0 || e.RowIndex == -1)
|
if (e.ColumnIndex != 0 || e.RowIndex == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value;
|
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value!;
|
||||||
var index = labels[e.RowIndex].Index;
|
var index = labels[e.RowIndex].Index;
|
||||||
values[index] = chk;
|
values[index] = chk;
|
||||||
if (NUD_Flag.Value == index)
|
if (NUD_Flag.Value == index)
|
||||||
|
@ -139,7 +139,7 @@ public sealed partial class SAV_EventFlags : Form
|
||||||
if (e.ColumnIndex != 1)
|
if (e.ColumnIndex != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value;
|
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value!;
|
||||||
dgv.Rows[e.RowIndex].Cells[0].Value = !chk;
|
dgv.Rows[e.RowIndex].Cells[0].Value = !chk;
|
||||||
var index = labels[e.RowIndex].Index;
|
var index = labels[e.RowIndex].Index;
|
||||||
values[index] = !chk;
|
values[index] = !chk;
|
||||||
|
|
|
@ -119,7 +119,7 @@ public sealed partial class SAV_EventFlags2 : Form
|
||||||
if (e.ColumnIndex != 0 || e.RowIndex == -1)
|
if (e.ColumnIndex != 0 || e.RowIndex == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value;
|
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value!;
|
||||||
var index = labels[e.RowIndex].Index;
|
var index = labels[e.RowIndex].Index;
|
||||||
values[index] = chk;
|
values[index] = chk;
|
||||||
if (NUD_Flag.Value == index)
|
if (NUD_Flag.Value == index)
|
||||||
|
@ -139,7 +139,7 @@ public sealed partial class SAV_EventFlags2 : Form
|
||||||
if (e.ColumnIndex != 1)
|
if (e.ColumnIndex != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value;
|
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value!;
|
||||||
dgv.Rows[e.RowIndex].Cells[0].Value = !chk;
|
dgv.Rows[e.RowIndex].Cells[0].Value = !chk;
|
||||||
var index = labels[e.RowIndex].Index;
|
var index = labels[e.RowIndex].Index;
|
||||||
values[index] = !chk;
|
values[index] = !chk;
|
||||||
|
|
|
@ -134,7 +134,7 @@ public sealed partial class SAV_EventWork : Form
|
||||||
DropDownWidth = Width + 100,
|
DropDownWidth = Width + 100,
|
||||||
};
|
};
|
||||||
cb.InitializeBinding();
|
cb.InitializeBinding();
|
||||||
cb.DataSource = new BindingSource(f.Options.Select(z => new ComboItem(z.Text, z.Value)).ToList(), null);
|
cb.DataSource = new BindingSource(f.Options.Select(z => new ComboItem(z.Text, z.Value)).ToList(), string.Empty);
|
||||||
cb.SelectedValue = f.Value;
|
cb.SelectedValue = f.Value;
|
||||||
if (cb.SelectedIndex < 0)
|
if (cb.SelectedIndex < 0)
|
||||||
cb.SelectedIndex = 0;
|
cb.SelectedIndex = 0;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue