diff --git a/.editorconfig b/.editorconfig index 2ebcdee7..a86730e7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,117 +1,4 @@ -# To learn more about .editorconfig see https://aka.ms/editorconfigdocs -############################### -# Core EditorConfig Options # -############################### -# All files -[*] -indent_style = tab -# Code files -[*.{cs,csx,vb,vbx}] -indent_size = 4 -insert_final_newline = true -charset = utf-8 -############################### -# .NET Coding Conventions # -############################### -[*.{cs,vb}] -# Organize usings -dotnet_sort_system_directives_first = true -# this. preferences -dotnet_style_qualification_for_field = false:silent -dotnet_style_qualification_for_property = false:silent -dotnet_style_qualification_for_method = false:silent -dotnet_style_qualification_for_event = false:silent -# Language keywords vs BCL types preferences -dotnet_style_predefined_type_for_locals_parameters_members = true:silent -dotnet_style_predefined_type_for_member_access = true:silent -# Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent -dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent -# Modifier preferences -dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent -dotnet_style_readonly_field = true:suggestion -# Expression-level preferences -dotnet_style_object_initializer = true:suggestion -dotnet_style_collection_initializer = true:suggestion -dotnet_style_explicit_tuple_names = true:suggestion -dotnet_style_null_propagation = true:suggestion -dotnet_style_coalesce_expression = true:suggestion -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent -dotnet_style_prefer_inferred_tuple_names = true:suggestion -dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion -dotnet_style_prefer_auto_properties = true:silent -dotnet_style_prefer_conditional_expression_over_assignment = true:silent -dotnet_style_prefer_conditional_expression_over_return = true:silent -############################### -# Naming Conventions # -############################### -# Style Definitions -dotnet_naming_style.pascal_case_style.capitalization = pascal_case -# Use PascalCase for constant fields -dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields -dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style -dotnet_naming_symbols.constant_fields.applicable_kinds = field -dotnet_naming_symbols.constant_fields.applicable_accessibilities = * -dotnet_naming_symbols.constant_fields.required_modifiers = const -############################### -# C# Coding Conventions # -############################### -[*.cs] -# var preferences -csharp_style_var_for_built_in_types = true:silent -csharp_style_var_when_type_is_apparent = true:silent -csharp_style_var_elsewhere = true:silent -# Expression-bodied members -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 -# Pattern matching preferences -csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_pattern_matching_over_as_with_null_check = true:suggestion -# Null-checking preferences -csharp_style_throw_expression = true:suggestion -csharp_style_conditional_delegate_call = true:suggestion -# Modifier preferences -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion -# Expression-level preferences -csharp_prefer_braces = true:silent -csharp_style_deconstructed_variable_declaration = true:suggestion -csharp_prefer_simple_default_expression = true:suggestion -csharp_style_pattern_local_over_anonymous_function = true:suggestion -csharp_style_inlined_variable_declaration = true:suggestion -############################### -# C# Formatting Rules # -############################### -# New line preferences -csharp_new_line_before_open_brace = all -csharp_new_line_before_else = true -csharp_new_line_before_catch = true -csharp_new_line_before_finally = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_between_query_expression_clauses = true -# Indentation preferences -csharp_indent_case_contents = true -csharp_indent_switch_labels = true -csharp_indent_labels = flush_left -# Space preferences -csharp_space_after_cast = false -csharp_space_after_keywords_in_control_flow_statements = true -csharp_space_between_method_call_parameter_list_parentheses = false -csharp_space_between_method_declaration_parameter_list_parentheses = false -csharp_space_between_parentheses = false -csharp_space_before_colon_in_inheritance_clause = true -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_around_binary_operators = before_and_after -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -csharp_space_between_method_call_name_and_opening_parenthesis = false -csharp_space_between_method_call_empty_parameter_list_parentheses = false -# Wrapping preferences -csharp_preserve_single_line_statements = true -csharp_preserve_single_line_blocks = true +[*.cs] + +# CS0105: Using directive appeared previously in this namespace +dotnet_diagnostic.CS0105.severity = suggestion diff --git a/FrEee.Assets/FrEee.Assets.csproj b/FrEee.Assets/FrEee.Assets.csproj index 9145612e..f987cd31 100644 --- a/FrEee.Assets/FrEee.Assets.csproj +++ b/FrEee.Assets/FrEee.Assets.csproj @@ -34,6 +34,9 @@ PreserveNewest + + + false diff --git a/FrEee.Tests/Objects/Abilities/AbilityTest.cs b/FrEee.Tests/Objects/Abilities/AbilityTest.cs index 1b843c37..4815e497 100644 --- a/FrEee.Tests/Objects/Abilities/AbilityTest.cs +++ b/FrEee.Tests/Objects/Abilities/AbilityTest.cs @@ -2,9 +2,7 @@ using FrEee.Objects.Abilities; using FrEee.Objects.Civilization; using FrEee.Objects.Space; -using FrEee.Objects.Technology; using FrEee.Objects.Vehicles; -using FrEee.Modding; using FrEee.Modding.Templates; using FrEee.Extensions; using NUnit.Framework; diff --git a/FrEee.Tests/TestUtilities.cs b/FrEee.Tests/TestUtilities.cs index a2e7d09f..b3f578e8 100644 --- a/FrEee.Tests/TestUtilities.cs +++ b/FrEee.Tests/TestUtilities.cs @@ -4,8 +4,6 @@ using FrEee.Objects.Technology; using FrEee.Objects.Vehicles; using FrEee.Modding; -using System; -using System.Reflection; namespace FrEee.Tests; diff --git a/FrEee.Tests/Utility/DataTest.cs b/FrEee.Tests/Utility/DataTest.cs index ba836b72..2d59f221 100644 --- a/FrEee.Tests/Utility/DataTest.cs +++ b/FrEee.Tests/Utility/DataTest.cs @@ -1,14 +1,8 @@ -using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; using NUnit.Framework; -using System; using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Security; -using System.Security.Permissions; -using System.Security.Policy; namespace FrEee.Tests.Utility; diff --git a/FrEee.Tests/Utility/Extensions/EnumerableExtensionsTest.cs b/FrEee.Tests/Utility/Extensions/EnumerableExtensionsTest.cs index e77d7a30..f8b139e6 100644 --- a/FrEee.Tests/Utility/Extensions/EnumerableExtensionsTest.cs +++ b/FrEee.Tests/Utility/Extensions/EnumerableExtensionsTest.cs @@ -1,6 +1,5 @@ using FrEee.Extensions; using NUnit.Framework; -using System.Collections.Generic; using System.Linq; namespace FrEee.Tests.Utility.Extensions; diff --git a/FrEee.Tests/Utility/Extensions/ParserTest.cs b/FrEee.Tests/Utility/Extensions/ParserTest.cs index 9943781f..2466ce7d 100644 --- a/FrEee.Tests/Utility/Extensions/ParserTest.cs +++ b/FrEee.Tests/Utility/Extensions/ParserTest.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using NUnit.Framework; using System; diff --git a/FrEee.Tests/Utility/MathXTest.cs b/FrEee.Tests/Utility/MathXTest.cs index 26517a59..4cd7dbcc 100644 --- a/FrEee.Tests/Utility/MathXTest.cs +++ b/FrEee.Tests/Utility/MathXTest.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using NUnit.Framework; namespace FrEee.Tests.Utility; diff --git a/FrEee.Tests/Utility/PrngTest.cs b/FrEee.Tests/Utility/PrngTest.cs index fdb83482..69fc7a62 100644 --- a/FrEee.Tests/Utility/PrngTest.cs +++ b/FrEee.Tests/Utility/PrngTest.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using NUnit.Framework; namespace FrEee.Tests.Utility; diff --git a/FrEee.Tests/Utility/SerializerTest.cs b/FrEee.Tests/Utility/SerializerTest.cs index 5fb3201e..c7aab91d 100644 --- a/FrEee.Tests/Utility/SerializerTest.cs +++ b/FrEee.Tests/Utility/SerializerTest.cs @@ -4,11 +4,11 @@ using FrEee.Objects.Technology; using FrEee.Objects.Vehicles; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; using NUnit.Framework; using System.Collections.Generic; -using System.IO; using System.Linq; namespace FrEee.Tests.Utility; diff --git a/FrEee.Tests/Utility/VectorTest.cs b/FrEee.Tests/Utility/VectorTest.cs index 2bef17e4..8d302bf8 100644 --- a/FrEee.Tests/Utility/VectorTest.cs +++ b/FrEee.Tests/Utility/VectorTest.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using NUnit.Framework; namespace FrEee.Tests.Utility; diff --git a/FrEee.WinForms/Controls/AsteroidFieldReport.cs b/FrEee.WinForms/Controls/AsteroidFieldReport.cs index 1ac30b4c..75384df5 100644 --- a/FrEee.WinForms/Controls/AsteroidFieldReport.cs +++ b/FrEee.WinForms/Controls/AsteroidFieldReport.cs @@ -1,8 +1,7 @@ using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Interfaces; -using System; using System.Drawing; using System.Windows.Forms; diff --git a/FrEee.WinForms/Controls/BattleView.cs b/FrEee.WinForms/Controls/BattleView.cs index 7278590b..c32d5fdd 100644 --- a/FrEee.WinForms/Controls/BattleView.cs +++ b/FrEee.WinForms/Controls/BattleView.cs @@ -3,9 +3,8 @@ using FrEee.Objects.Combat.Grid; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; -using NAudio.MediaFoundation; using System; using System.Collections.Generic; using System.Drawing; diff --git a/FrEee.WinForms/Controls/ComponentReport.cs b/FrEee.WinForms/Controls/ComponentReport.cs index 2da9bcf1..531e57e6 100644 --- a/FrEee.WinForms/Controls/ComponentReport.cs +++ b/FrEee.WinForms/Controls/ComponentReport.cs @@ -1,7 +1,7 @@ using FrEee.Objects.Combat; using FrEee.Objects.Technology; using FrEee.Modding.Templates; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Interfaces; using System; diff --git a/FrEee.WinForms/Controls/DesignReport.cs b/FrEee.WinForms/Controls/DesignReport.cs index b6b906ab..dd525b36 100644 --- a/FrEee.WinForms/Controls/DesignReport.cs +++ b/FrEee.WinForms/Controls/DesignReport.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Technology; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Interfaces; using FrEee.WinForms.Utility.Extensions; diff --git a/FrEee.WinForms/Controls/FacilityReport.cs b/FrEee.WinForms/Controls/FacilityReport.cs index 367b7779..acd4afc4 100644 --- a/FrEee.WinForms/Controls/FacilityReport.cs +++ b/FrEee.WinForms/Controls/FacilityReport.cs @@ -1,6 +1,6 @@ using FrEee.Objects.Technology; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Interfaces; using System; diff --git a/FrEee.WinForms/Controls/FleetReport.cs b/FrEee.WinForms/Controls/FleetReport.cs index 3c11614e..79ff5ede 100644 --- a/FrEee.WinForms/Controls/FleetReport.cs +++ b/FrEee.WinForms/Controls/FleetReport.cs @@ -3,7 +3,7 @@ using FrEee.Objects.Commands; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Interfaces; using FrEee.WinForms.Utility.Extensions; diff --git a/FrEee.WinForms/Controls/GalaxyView.cs b/FrEee.WinForms/Controls/GalaxyView.cs index d5fc2bc3..bafd3e9a 100644 --- a/FrEee.WinForms/Controls/GalaxyView.cs +++ b/FrEee.WinForms/Controls/GalaxyView.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Objects.GalaxyViewModes; using System; @@ -27,7 +27,7 @@ public GalaxyView() /// /// An image to display as the background for this galaxy view. /// - public override Image BackgroundImage + public override Image? BackgroundImage { get { @@ -78,7 +78,7 @@ public int StarSystemDrawSize } } - private Image backgroundImage; + private Image? backgroundImage; private IGalaxyViewMode mode = GalaxyViewModes.All.First(); diff --git a/FrEee.WinForms/Controls/GamePanel.cs b/FrEee.WinForms/Controls/GamePanel.cs index f1e1a89c..8b124a00 100644 --- a/FrEee.WinForms/Controls/GamePanel.cs +++ b/FrEee.WinForms/Controls/GamePanel.cs @@ -43,13 +43,10 @@ protected override void OnPaint(PaintEventArgs pe) // http://support.microsoft.com/kb/953934 protected override void OnSizeChanged(EventArgs e) { - if (this.Handle != null) + this.BeginInvoke((MethodInvoker)delegate { - this.BeginInvoke((MethodInvoker)delegate - { - base.OnSizeChanged(e); - }); - } + base.OnSizeChanged(e); + }); } private void GamePanel_SizeChanged(object sender, EventArgs e) diff --git a/FrEee.WinForms/Controls/GameProgressBar.cs b/FrEee.WinForms/Controls/GameProgressBar.cs index 1120eb54..751ba549 100644 --- a/FrEee.WinForms/Controls/GameProgressBar.cs +++ b/FrEee.WinForms/Controls/GameProgressBar.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Drawing; diff --git a/FrEee.WinForms/Controls/MountReport.cs b/FrEee.WinForms/Controls/MountReport.cs index 88a9b089..03368ad3 100644 --- a/FrEee.WinForms/Controls/MountReport.cs +++ b/FrEee.WinForms/Controls/MountReport.cs @@ -1,6 +1,6 @@ using FrEee.Objects.Technology; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Interfaces; using FrEee.WinForms.Utility.Extensions; diff --git a/FrEee.WinForms/Controls/PlanetReport.cs b/FrEee.WinForms/Controls/PlanetReport.cs index c991ce84..d2fae4be 100644 --- a/FrEee.WinForms/Controls/PlanetReport.cs +++ b/FrEee.WinForms/Controls/PlanetReport.cs @@ -3,7 +3,7 @@ using FrEee.Objects.Commands; using FrEee.Objects.Space; using FrEee.Objects.Technology; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Interfaces; using FrEee.WinForms.Utility.Extensions; diff --git a/FrEee.WinForms/Controls/ResourceDisplay.cs b/FrEee.WinForms/Controls/ResourceDisplay.cs index 7e31fbb2..6142f3f4 100644 --- a/FrEee.WinForms/Controls/ResourceDisplay.cs +++ b/FrEee.WinForms/Controls/ResourceDisplay.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.ComponentModel; diff --git a/FrEee.WinForms/Controls/ResourceQuantityDisplay.cs b/FrEee.WinForms/Controls/ResourceQuantityDisplay.cs index 2c01f167..2260c747 100644 --- a/FrEee.WinForms/Controls/ResourceQuantityDisplay.cs +++ b/FrEee.WinForms/Controls/ResourceQuantityDisplay.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.WinForms.Interfaces; using System.Windows.Forms; diff --git a/FrEee.WinForms/Controls/SpaceVehicleReport.cs b/FrEee.WinForms/Controls/SpaceVehicleReport.cs index 30812d28..7f5b15e8 100644 --- a/FrEee.WinForms/Controls/SpaceVehicleReport.cs +++ b/FrEee.WinForms/Controls/SpaceVehicleReport.cs @@ -1,10 +1,9 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Commands; -using FrEee.Objects.Space; using FrEee.Objects.Technology; using FrEee.Objects.Vehicles; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Interfaces; using FrEee.WinForms.Utility.Extensions; @@ -375,14 +374,14 @@ public MountedComponentTemplate Template public static bool operator ==(ComponentGroup g1, ComponentGroup g2) { - if (g1.IsNull() && g2.IsNull()) + if (g1 is null && g2 is null) return true; - if (g1.IsNull() || g2.IsNull()) + if (g1 is null || g2 is null) return false; return g1.Template == g2.Template && g1.Hitpoints == g2.Hitpoints; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var x = obj as ComponentGroup; if (x == null) diff --git a/FrEee.WinForms/Controls/StarReport.cs b/FrEee.WinForms/Controls/StarReport.cs index 2a52ad64..07cbf46a 100644 --- a/FrEee.WinForms/Controls/StarReport.cs +++ b/FrEee.WinForms/Controls/StarReport.cs @@ -1,7 +1,6 @@ using FrEee.Objects.Space; using FrEee.Extensions; using FrEee.WinForms.Interfaces; -using System; using System.Drawing; using System.Windows.Forms; diff --git a/FrEee.WinForms/Controls/StormReport.cs b/FrEee.WinForms/Controls/StormReport.cs index 2bcb984f..29ac9ffe 100644 --- a/FrEee.WinForms/Controls/StormReport.cs +++ b/FrEee.WinForms/Controls/StormReport.cs @@ -1,7 +1,6 @@ using FrEee.Objects.Space; using FrEee.Extensions; using FrEee.WinForms.Interfaces; -using System; using System.Drawing; using System.Windows.Forms; diff --git a/FrEee.WinForms/Controls/WarpPointReport.cs b/FrEee.WinForms/Controls/WarpPointReport.cs index d44d4b09..4dae8d29 100644 --- a/FrEee.WinForms/Controls/WarpPointReport.cs +++ b/FrEee.WinForms/Controls/WarpPointReport.cs @@ -1,7 +1,6 @@ using FrEee.Objects.Space; using FrEee.Extensions; using FrEee.WinForms.Interfaces; -using System; using System.Drawing; using System.Windows.Forms; diff --git a/FrEee.WinForms/DataGridView/DataGridViewProgressCell.cs b/FrEee.WinForms/DataGridView/DataGridViewProgressCell.cs index 941524a7..73b43c22 100644 --- a/FrEee.WinForms/DataGridView/DataGridViewProgressCell.cs +++ b/FrEee.WinForms/DataGridView/DataGridViewProgressCell.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Drawing; diff --git a/FrEee.WinForms/DataGridView/GridColumnConfig.cs b/FrEee.WinForms/DataGridView/GridColumnConfig.cs index da361948..983cd3fa 100644 --- a/FrEee.WinForms/DataGridView/GridColumnConfig.cs +++ b/FrEee.WinForms/DataGridView/GridColumnConfig.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using System; using System.Drawing; using System.Windows.Forms; diff --git a/FrEee.WinForms/Forms/BattleResultsForm.cs b/FrEee.WinForms/Forms/BattleResultsForm.cs index 5a5d81fc..21d3e33f 100644 --- a/FrEee.WinForms/Forms/BattleResultsForm.cs +++ b/FrEee.WinForms/Forms/BattleResultsForm.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Civilization; using FrEee.Objects.Combat; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.DataGridView; using FrEee.WinForms.Interfaces; @@ -160,7 +160,7 @@ private class CombatantInfo public string HullName { get; set; } public int HullSize { get; set; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var ci = obj as CombatantInfo; if (ci == null) diff --git a/FrEee.WinForms/Forms/CommandsForm.cs b/FrEee.WinForms/Forms/CommandsForm.cs index 9164b755..0a11f68c 100644 --- a/FrEee.WinForms/Forms/CommandsForm.cs +++ b/FrEee.WinForms/Forms/CommandsForm.cs @@ -1,18 +1,8 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Objects.Combat; -using FrEee.Objects.LogMessages; -using FrEee.Objects.Space; -using FrEee.Objects.Technology; -using FrEee.Modding.Templates; -using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; -using System.Collections.Generic; -using System.Data; using System.Drawing; -using System.Linq; -using System.Windows.Forms; namespace FrEee.WinForms.Forms; diff --git a/FrEee.WinForms/Forms/ConstructionQueueForm.cs b/FrEee.WinForms/Forms/ConstructionQueueForm.cs index a30b613b..617feb3e 100644 --- a/FrEee.WinForms/Forms/ConstructionQueueForm.cs +++ b/FrEee.WinForms/Forms/ConstructionQueueForm.cs @@ -5,7 +5,7 @@ using FrEee.Objects.Space; using FrEee.Objects.Technology; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Controls; using FrEee.WinForms.Utility.Extensions; diff --git a/FrEee.WinForms/Forms/ConstructionQueueListForm.cs b/FrEee.WinForms/Forms/ConstructionQueueListForm.cs index 60856cc3..e31937d3 100644 --- a/FrEee.WinForms/Forms/ConstructionQueueListForm.cs +++ b/FrEee.WinForms/Forms/ConstructionQueueListForm.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/DebugForm.cs b/FrEee.WinForms/Forms/DebugForm.cs index db58cf59..37c41928 100644 --- a/FrEee.WinForms/Forms/DebugForm.cs +++ b/FrEee.WinForms/Forms/DebugForm.cs @@ -3,7 +3,6 @@ using FrEee.Modding; using System; using System.Drawing; -using System.Windows.Forms; namespace FrEee.WinForms.Forms; diff --git a/FrEee.WinForms/Forms/DesignListForm.cs b/FrEee.WinForms/Forms/DesignListForm.cs index a6bd7022..1bc07608 100644 --- a/FrEee.WinForms/Forms/DesignListForm.cs +++ b/FrEee.WinForms/Forms/DesignListForm.cs @@ -4,7 +4,7 @@ using FrEee.Objects.Commands; using FrEee.Objects.Space; using FrEee.Objects.Technology; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/DiplomacyForm.cs b/FrEee.WinForms/Forms/DiplomacyForm.cs index fd404e4d..c2d67c6b 100644 --- a/FrEee.WinForms/Forms/DiplomacyForm.cs +++ b/FrEee.WinForms/Forms/DiplomacyForm.cs @@ -8,7 +8,7 @@ using FrEee.Objects.Technology; using FrEee.Objects.Vehicles; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/EditorForm.cs b/FrEee.WinForms/Forms/EditorForm.cs index f1cfa801..353626d4 100644 --- a/FrEee.WinForms/Forms/EditorForm.cs +++ b/FrEee.WinForms/Forms/EditorForm.cs @@ -1,5 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using FrEee.WinForms.Interfaces; using FrEee.WinForms.Utility.Extensions; diff --git a/FrEee.WinForms/Forms/EmpireListForm.cs b/FrEee.WinForms/Forms/EmpireListForm.cs index 8ce33872..fcfa93c8 100644 --- a/FrEee.WinForms/Forms/EmpireListForm.cs +++ b/FrEee.WinForms/Forms/EmpireListForm.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Civilization; using FrEee.Objects.Commands; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/EmpireSetupForm.cs b/FrEee.WinForms/Forms/EmpireSetupForm.cs index cbf4befa..5c1ab6d8 100644 --- a/FrEee.WinForms/Forms/EmpireSetupForm.cs +++ b/FrEee.WinForms/Forms/EmpireSetupForm.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Space; using FrEee.Setup; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/FleetTransferForm.cs b/FrEee.WinForms/Forms/FleetTransferForm.cs index 23056ea9..fd1ce711 100644 --- a/FrEee.WinForms/Forms/FleetTransferForm.cs +++ b/FrEee.WinForms/Forms/FleetTransferForm.cs @@ -3,7 +3,7 @@ using FrEee.Objects.Commands; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Controls; using FrEee.WinForms.Utility.Extensions; diff --git a/FrEee.WinForms/Forms/GameForm.cs b/FrEee.WinForms/Forms/GameForm.cs index 4d419649..6e6b058f 100644 --- a/FrEee.WinForms/Forms/GameForm.cs +++ b/FrEee.WinForms/Forms/GameForm.cs @@ -1,17 +1,6 @@ -using FrEee.Interfaces; -using FrEee.Objects.Abilities; -using FrEee.Objects.Civilization; -using FrEee.Objects.Commands; -using FrEee.Objects.Orders; -using FrEee.Objects.Space; -using FrEee.Extensions; -using FrEee.WinForms.Objects; -using FrEee.WinForms.Utility.Extensions; +using FrEee.WinForms.Objects; using System; -using System.Collections.Generic; -using System.Data; using System.Diagnostics; -using System.Linq; using System.Windows.Forms; namespace FrEee.WinForms.Forms; diff --git a/FrEee.WinForms/Forms/GameOverForm.cs b/FrEee.WinForms/Forms/GameOverForm.cs index a6af489f..4534fc7a 100644 --- a/FrEee.WinForms/Forms/GameOverForm.cs +++ b/FrEee.WinForms/Forms/GameOverForm.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.WinForms.Objects; using System; using System.IO; diff --git a/FrEee.WinForms/Forms/GameSetupForm.cs b/FrEee.WinForms/Forms/GameSetupForm.cs index e78e971f..c7831369 100644 --- a/FrEee.WinForms/Forms/GameSetupForm.cs +++ b/FrEee.WinForms/Forms/GameSetupForm.cs @@ -7,7 +7,7 @@ using FrEee.Setup.WarpPointPlacementStrategies; using FrEee.Modding; using FrEee.Modding.Templates; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/HostConsoleForm.cs b/FrEee.WinForms/Forms/HostConsoleForm.cs index f7ba9f8e..967e96ae 100644 --- a/FrEee.WinForms/Forms/HostConsoleForm.cs +++ b/FrEee.WinForms/Forms/HostConsoleForm.cs @@ -1,19 +1,15 @@ -using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; using FrEee.Processes; -using FrEee.Modding; -using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; -using FrEee.Extensions; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.WinForms.Utility.Extensions; using System; using System.Data; using System.Drawing; using System.IO; using System.Linq; -using System.Reflection; using System.Threading; using System.Windows.Forms; diff --git a/FrEee.WinForms/Forms/HullPickerForm.cs b/FrEee.WinForms/Forms/HullPickerForm.cs index b465e72f..0942ef1c 100644 --- a/FrEee.WinForms/Forms/HullPickerForm.cs +++ b/FrEee.WinForms/Forms/HullPickerForm.cs @@ -1,7 +1,7 @@ using FrEee.Enumerations; using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/MainGameForm.cs b/FrEee.WinForms/Forms/MainGameForm.cs index 9a0afad4..3187a6f5 100644 --- a/FrEee.WinForms/Forms/MainGameForm.cs +++ b/FrEee.WinForms/Forms/MainGameForm.cs @@ -8,7 +8,7 @@ using FrEee.Objects.Technology; using FrEee.Objects.Vehicles; using FrEee.Processes; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Controls; using FrEee.WinForms.Interfaces; diff --git a/FrEee.WinForms/Forms/MainMenuForm.cs b/FrEee.WinForms/Forms/MainMenuForm.cs index c9da7cbd..e3f8ebcd 100644 --- a/FrEee.WinForms/Forms/MainMenuForm.cs +++ b/FrEee.WinForms/Forms/MainMenuForm.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Vehicles; using FrEee.Setup; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Objects; using FrEee.WinForms.Utility; diff --git a/FrEee.WinForms/Forms/MinistersForm.cs b/FrEee.WinForms/Forms/MinistersForm.cs index 6f7a9fd0..c67c935e 100644 --- a/FrEee.WinForms/Forms/MinistersForm.cs +++ b/FrEee.WinForms/Forms/MinistersForm.cs @@ -1,17 +1,11 @@ -using FrEee.Interfaces; -using FrEee.Objects.Civilization; +using FrEee.Objects.Civilization; using FrEee.Objects.Commands; -using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; -using FrEee.Extensions; -using FrEee.WinForms.Utility.Extensions; +using FrEee.Utility; using System; using System.Collections.Generic; using System.Data; -using System.Diagnostics; using System.Drawing; using System.Linq; -using System.Windows.Forms; namespace FrEee.WinForms.Forms; diff --git a/FrEee.WinForms/Forms/ModPickerForm.cs b/FrEee.WinForms/Forms/ModPickerForm.cs index 314c29e8..da44beb9 100644 --- a/FrEee.WinForms/Forms/ModPickerForm.cs +++ b/FrEee.WinForms/Forms/ModPickerForm.cs @@ -1,6 +1,6 @@ using FrEee.Modding; using FrEee.Modding.Loaders; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/MountPickerForm.cs b/FrEee.WinForms/Forms/MountPickerForm.cs index 0158fcbd..241badbc 100644 --- a/FrEee.WinForms/Forms/MountPickerForm.cs +++ b/FrEee.WinForms/Forms/MountPickerForm.cs @@ -1,5 +1,4 @@ using FrEee.Interfaces; -using FrEee.Objects.Civilization; using FrEee.Objects.Technology; using FrEee.Modding; using FrEee.Extensions; diff --git a/FrEee.WinForms/Forms/PlanetListForm.cs b/FrEee.WinForms/Forms/PlanetListForm.cs index 33700bb8..cee18b54 100644 --- a/FrEee.WinForms/Forms/PlanetListForm.cs +++ b/FrEee.WinForms/Forms/PlanetListForm.cs @@ -3,7 +3,7 @@ using FrEee.Objects.Orders; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.DataGridView; using FrEee.WinForms.Objects; diff --git a/FrEee.WinForms/Forms/RecycleForm.cs b/FrEee.WinForms/Forms/RecycleForm.cs index 63ba16b8..f7970e78 100644 --- a/FrEee.WinForms/Forms/RecycleForm.cs +++ b/FrEee.WinForms/Forms/RecycleForm.cs @@ -70,7 +70,14 @@ private IEnumerable SelectedVehiclesInSpace { get { - return treeVehicles.GetAllNodes().Where(n => n.Tag is SpaceVehicle && n.Checked).Select(n => n.Tag as SpaceVehicle).Where(v => !(v is IUnit && ((IUnit)v).Container != null)); + return treeVehicles.GetAllNodes() + .Where(n => + n.Tag is SpaceVehicle && n.Checked) + .Select(n => + n.Tag as SpaceVehicle) + .Where(v => + !(v is IUnit && ((IUnit)v).Container != null)) + .ExceptNull(); } } diff --git a/FrEee.WinForms/Forms/ResearchForm.cs b/FrEee.WinForms/Forms/ResearchForm.cs index 9f13d8ab..a8cbee05 100644 --- a/FrEee.WinForms/Forms/ResearchForm.cs +++ b/FrEee.WinForms/Forms/ResearchForm.cs @@ -1,10 +1,9 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Commands; -using FrEee.Objects.Space; using FrEee.Objects.Technology; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Utility.Extensions; using System; diff --git a/FrEee.WinForms/Forms/ScoresForm.cs b/FrEee.WinForms/Forms/ScoresForm.cs index 4f12598a..6b35e53d 100644 --- a/FrEee.WinForms/Forms/ScoresForm.cs +++ b/FrEee.WinForms/Forms/ScoresForm.cs @@ -1,5 +1,4 @@ -using FrEee.Objects.Civilization; -using FrEee.Objects.Space; +using FrEee.Objects.Space; using FrEee.Extensions; using FrEee.WinForms.DataGridView; using System; diff --git a/FrEee.WinForms/Forms/ShipListForm.cs b/FrEee.WinForms/Forms/ShipListForm.cs index 348840b0..b1037026 100644 --- a/FrEee.WinForms/Forms/ShipListForm.cs +++ b/FrEee.WinForms/Forms/ShipListForm.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Civilization; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.DataGridView; using FrEee.WinForms.Objects; diff --git a/FrEee.WinForms/Forms/StatusForm.cs b/FrEee.WinForms/Forms/StatusForm.cs index 3eb019bd..a005346e 100644 --- a/FrEee.WinForms/Forms/StatusForm.cs +++ b/FrEee.WinForms/Forms/StatusForm.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Threading; diff --git a/FrEee.WinForms/Forms/VehicleDesignForm.cs b/FrEee.WinForms/Forms/VehicleDesignForm.cs index d8a7df73..8fcbdb20 100644 --- a/FrEee.WinForms/Forms/VehicleDesignForm.cs +++ b/FrEee.WinForms/Forms/VehicleDesignForm.cs @@ -4,7 +4,7 @@ using FrEee.Objects.Technology; using FrEee.Modding; using FrEee.Modding.Templates; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Controls; using FrEee.WinForms.Utility.Extensions; diff --git a/FrEee.WinForms/GamePropertyGrid.cs b/FrEee.WinForms/GamePropertyGrid.cs index 0dd9de8b..d6483470 100644 --- a/FrEee.WinForms/GamePropertyGrid.cs +++ b/FrEee.WinForms/GamePropertyGrid.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Space; using FrEee.Modding; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using FrEee.WinForms.Controls; using FrEee.WinForms.Interfaces; diff --git a/FrEee.WinForms/Objects/GalaxyViewModes/ConstructionMode.cs b/FrEee.WinForms/Objects/GalaxyViewModes/ConstructionMode.cs index 93250556..34a0f038 100644 --- a/FrEee.WinForms/Objects/GalaxyViewModes/ConstructionMode.cs +++ b/FrEee.WinForms/Objects/GalaxyViewModes/ConstructionMode.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System.Drawing; using System.Linq; diff --git a/FrEee.WinForms/Objects/GalaxyViewModes/ResearchIntelMode.cs b/FrEee.WinForms/Objects/GalaxyViewModes/ResearchIntelMode.cs index 885fbffa..95b7c4e4 100644 --- a/FrEee.WinForms/Objects/GalaxyViewModes/ResearchIntelMode.cs +++ b/FrEee.WinForms/Objects/GalaxyViewModes/ResearchIntelMode.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System.Drawing; using System.Linq; diff --git a/FrEee.WinForms/Objects/GalaxyViewModes/ResourcesMode.cs b/FrEee.WinForms/Objects/GalaxyViewModes/ResourcesMode.cs index 45abaf20..e330a274 100644 --- a/FrEee.WinForms/Objects/GalaxyViewModes/ResourcesMode.cs +++ b/FrEee.WinForms/Objects/GalaxyViewModes/ResourcesMode.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System.Drawing; using System.Linq; diff --git a/FrEee.WinForms/Objects/GalaxyViewModes/SpaceYardMode.cs b/FrEee.WinForms/Objects/GalaxyViewModes/SpaceYardMode.cs index 1bf7c837..338a3488 100644 --- a/FrEee.WinForms/Objects/GalaxyViewModes/SpaceYardMode.cs +++ b/FrEee.WinForms/Objects/GalaxyViewModes/SpaceYardMode.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System.Drawing; using System.Linq; diff --git a/FrEee.WinForms/Program.cs b/FrEee.WinForms/Program.cs index 7dbc68bb..bd725f69 100644 --- a/FrEee.WinForms/Program.cs +++ b/FrEee.WinForms/Program.cs @@ -1,11 +1,8 @@ -using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; using FrEee.Processes; -using FrEee.Modding; -using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using FrEee.WinForms.Forms; using FrEee.WinForms.Utility; diff --git a/FrEee.WinForms/Utility/Extensions/GuiExtensions.cs b/FrEee.WinForms/Utility/Extensions/GuiExtensions.cs index 88621f36..aee10ede 100644 --- a/FrEee.WinForms/Utility/Extensions/GuiExtensions.cs +++ b/FrEee.WinForms/Utility/Extensions/GuiExtensions.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.WinForms.Forms; using System; using System.Collections.Generic; diff --git a/FrEee.WinForms/Utility/Gui.cs b/FrEee.WinForms/Utility/Gui.cs index 8734f5cd..ceefe92b 100644 --- a/FrEee.WinForms/Utility/Gui.cs +++ b/FrEee.WinForms/Utility/Gui.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; using FrEee.WinForms.Forms; using FrEee.WinForms.Objects; -using Microsoft.Scripting.Utils; namespace FrEee.WinForms.Utility; diff --git a/FrEee/Enumerations/AbilityTargets.cs b/FrEee/Enumerations/AbilityTargets.cs index 92a4c687..aa2c055c 100644 --- a/FrEee/Enumerations/AbilityTargets.cs +++ b/FrEee/Enumerations/AbilityTargets.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; namespace FrEee.Enumerations; diff --git a/FrEee/Enumerations/AbilityValueRule.cs b/FrEee/Enumerations/AbilityValueRule.cs index 874fcbda..c0c56e6d 100644 --- a/FrEee/Enumerations/AbilityValueRule.cs +++ b/FrEee/Enumerations/AbilityValueRule.cs @@ -1,5 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Enumerations; /// diff --git a/FrEee/Enumerations/AllianceLevel.cs b/FrEee/Enumerations/AllianceLevel.cs index 8567af75..16b004ea 100644 --- a/FrEee/Enumerations/AllianceLevel.cs +++ b/FrEee/Enumerations/AllianceLevel.cs @@ -1,5 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Enumerations; /// diff --git a/FrEee/Enumerations/AllowedTrades.cs b/FrEee/Enumerations/AllowedTrades.cs index 23dd8edf..e9d408ec 100644 --- a/FrEee/Enumerations/AllowedTrades.cs +++ b/FrEee/Enumerations/AllowedTrades.cs @@ -1,5 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Enumerations; public enum AllowedTrades diff --git a/FrEee/Enumerations/EmpirePlacement.cs b/FrEee/Enumerations/EmpirePlacement.cs index bf62aa62..19fa07c5 100644 --- a/FrEee/Enumerations/EmpirePlacement.cs +++ b/FrEee/Enumerations/EmpirePlacement.cs @@ -1,5 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Enumerations; public enum EmpirePlacement diff --git a/FrEee/Enumerations/ScoreDisplay.cs b/FrEee/Enumerations/ScoreDisplay.cs index 33d541fd..0cfecb35 100644 --- a/FrEee/Enumerations/ScoreDisplay.cs +++ b/FrEee/Enumerations/ScoreDisplay.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; namespace FrEee.Enumerations; diff --git a/FrEee/Enumerations/VehicleTypes.cs b/FrEee/Enumerations/VehicleTypes.cs index b8f62eef..00616d15 100644 --- a/FrEee/Enumerations/VehicleTypes.cs +++ b/FrEee/Enumerations/VehicleTypes.cs @@ -1,6 +1,5 @@ using System; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Enumerations; /// diff --git a/FrEee/Enumerations/WeaponTargets.cs b/FrEee/Enumerations/WeaponTargets.cs index 23f3ebc0..ab25770e 100644 --- a/FrEee/Enumerations/WeaponTargets.cs +++ b/FrEee/Enumerations/WeaponTargets.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; namespace FrEee.Enumerations; diff --git a/FrEee/Enumerations/WeaponTypes.cs b/FrEee/Enumerations/WeaponTypes.cs index 9f3ba576..b9b6a6b1 100644 --- a/FrEee/Enumerations/WeaponTypes.cs +++ b/FrEee/Enumerations/WeaponTypes.cs @@ -1,6 +1,5 @@ using System; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Enumerations; /// diff --git a/FrEee/Extensions/AbilityExtensions.cs b/FrEee/Extensions/AbilityExtensions.cs index 3378321a..be1e3b0e 100644 --- a/FrEee/Extensions/AbilityExtensions.cs +++ b/FrEee/Extensions/AbilityExtensions.cs @@ -10,8 +10,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Extensions; @@ -25,15 +23,15 @@ public static class AbilityExtensions /// /// /// - public static IEnumerable Abilities(this IAbilityObject obj, Func sourceFilter = null) + public static IEnumerable Abilities(this IAbilityObject obj, Func? sourceFilter = null) { if (obj == null) return Enumerable.Empty(); - if (sourceFilter == null && Galaxy.Current != null && Galaxy.Current.IsAbilityCacheEnabled) + if (sourceFilter is null && Galaxy.Current is not null && Galaxy.Current.IsAbilityCacheEnabled) { // use the ability cache - if (Galaxy.Current.AbilityCache[obj] == null) + if (Galaxy.Current.AbilityCache[obj] is null) Galaxy.Current.AbilityCache[obj] = obj.UnstackedAbilities(true, sourceFilter).Stack(obj).ToArray(); return Galaxy.Current.AbilityCache[obj]; } @@ -41,7 +39,7 @@ public static IEnumerable Abilities(this IAbilityObject obj, Func AbilityTree(this IAbilityObject obj, Func sourceFilter = null) + public static ILookup AbilityTree(this IAbilityObject obj, Func? sourceFilter = null) { return obj.UnstackedAbilities(true, sourceFilter).StackToTree(obj); } diff --git a/FrEee/Extensions/ChecksExtensions.cs b/FrEee/Extensions/ChecksExtensions.cs index 1b00961d..cb7ee7c1 100644 --- a/FrEee/Extensions/ChecksExtensions.cs +++ b/FrEee/Extensions/ChecksExtensions.cs @@ -12,8 +12,7 @@ using System.Dynamic; using System.Linq; using System.Reflection; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Extensions; public static class ChecksExtensions @@ -289,6 +288,7 @@ public static bool StillExists(this T old, IEnumerable oldItems, IEnumerab /// The key. /// public static bool TestContainsKey(this IDictionary dict, TKey key) + where TKey: notnull { var hash = EqualityComparer.Default.GetHashCode(key); return dict.Any( diff --git a/FrEee/Extensions/CommonExtensions.cs b/FrEee/Extensions/CommonExtensions.cs index 5b2db43e..8e6d2fa4 100644 --- a/FrEee/Extensions/CommonExtensions.cs +++ b/FrEee/Extensions/CommonExtensions.cs @@ -21,7 +21,7 @@ using FrEee.Objects.Vehicles; using FrEee.Modding; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Serialization; namespace FrEee.Extensions; @@ -254,11 +254,11 @@ public static void DealWithMines(this ISpaceObject sobj) /// /// /// - public static T Default(this object value, T def = default(T), bool throwIfWrongType = false) + public static T Default(this object value, T def = default, bool throwIfWrongType = false) { if (throwIfWrongType && !(value is T)) throw new InvalidCastException($"Cannot convert {value} to type {typeof(T)}."); - return value == null || !(value is T) ? def : (T)value; + return value is null or not T ? def : (T)value; } /// diff --git a/FrEee/Extensions/ComparisonExtensions.cs b/FrEee/Extensions/ComparisonExtensions.cs index 2879fa8a..c0ceb486 100644 --- a/FrEee/Extensions/ComparisonExtensions.cs +++ b/FrEee/Extensions/ComparisonExtensions.cs @@ -73,17 +73,6 @@ public static bool IsInt(this IFormula f) return f.Value.ToString().IsInt(); } - /// - /// Tests if an object is null. - /// Useful for writing == operators that don't infinitely recurse. - /// - /// - /// - public static bool IsNull(this object o) - { - return o == null; - } - /// /// Gets a description of an object's timestamp as a memory age. /// diff --git a/FrEee/Extensions/ConversionExtensions.cs b/FrEee/Extensions/ConversionExtensions.cs index b47f159c..315fa8c0 100644 --- a/FrEee/Extensions/ConversionExtensions.cs +++ b/FrEee/Extensions/ConversionExtensions.cs @@ -1,5 +1,5 @@ using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Drawing; using System.Globalization; diff --git a/FrEee/Extensions/CopyingExtensions.cs b/FrEee/Extensions/CopyingExtensions.cs index 86f2d060..c2808b70 100644 --- a/FrEee/Extensions/CopyingExtensions.cs +++ b/FrEee/Extensions/CopyingExtensions.cs @@ -1,11 +1,10 @@ using FrEee.Interfaces; using FrEee.Objects.Technology; using FrEee.Serialization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Reflection; diff --git a/FrEee/Extensions/EnumerableExtensions.cs b/FrEee/Extensions/EnumerableExtensions.cs index 49bd2511..0c20133c 100644 --- a/FrEee/Extensions/EnumerableExtensions.cs +++ b/FrEee/Extensions/EnumerableExtensions.cs @@ -2,8 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Extensions; /// @@ -21,6 +20,9 @@ public static IEnumerable ExceptSingle(this IEnumerable src, T badguy) return src.Except(new T[] { badguy }); } + public static IEnumerable ExceptNull(this IEnumerable src) + => src.Where(q => q is not null).Cast(); + /// /// Flattens groupings into a single sequence. /// diff --git a/FrEee/Extensions/GameEnumerableExtensions.cs b/FrEee/Extensions/GameEnumerableExtensions.cs index 6b8e06c6..1d0ec119 100644 --- a/FrEee/Extensions/GameEnumerableExtensions.cs +++ b/FrEee/Extensions/GameEnumerableExtensions.cs @@ -6,10 +6,8 @@ using FrEee.Objects.Abilities; using FrEee.Objects.Civilization; using FrEee.Objects.Space; -using FrEee.Modding; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Extensions; /// diff --git a/FrEee/Extensions/MathExtensions.cs b/FrEee/Extensions/MathExtensions.cs index a5fde50e..6d35d2c8 100644 --- a/FrEee/Extensions/MathExtensions.cs +++ b/FrEee/Extensions/MathExtensions.cs @@ -1,10 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Extensions; public static class MathExtensions diff --git a/FrEee/Extensions/Parser.cs b/FrEee/Extensions/Parser.cs index fc24135a..0f85493f 100644 --- a/FrEee/Extensions/Parser.cs +++ b/FrEee/Extensions/Parser.cs @@ -2,8 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Extensions; /// diff --git a/FrEee/Interfaces/IConstructable.cs b/FrEee/Interfaces/IConstructable.cs index 7283f8a9..8f1085e2 100644 --- a/FrEee/Interfaces/IConstructable.cs +++ b/FrEee/Interfaces/IConstructable.cs @@ -1,6 +1,5 @@ using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Interfaces; /// diff --git a/FrEee/Interfaces/IConstructionOrder.cs b/FrEee/Interfaces/IConstructionOrder.cs index d82d27fa..72316aea 100644 --- a/FrEee/Interfaces/IConstructionOrder.cs +++ b/FrEee/Interfaces/IConstructionOrder.cs @@ -1,6 +1,4 @@ -using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Interfaces; public interface IConstructionOrder : IOrder, INamed diff --git a/FrEee/Interfaces/IConstructionTemplate.cs b/FrEee/Interfaces/IConstructionTemplate.cs index a50646fc..29e2d15e 100644 --- a/FrEee/Interfaces/IConstructionTemplate.cs +++ b/FrEee/Interfaces/IConstructionTemplate.cs @@ -1,6 +1,5 @@ using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Interfaces; /// diff --git a/FrEee/Interfaces/IConstructor.cs b/FrEee/Interfaces/IConstructor.cs index 2180ae9e..a9012e80 100644 --- a/FrEee/Interfaces/IConstructor.cs +++ b/FrEee/Interfaces/IConstructor.cs @@ -1,9 +1,4 @@ using FrEee.Objects.Civilization; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Interfaces; diff --git a/FrEee/Interfaces/IDamageable.cs b/FrEee/Interfaces/IDamageable.cs index 6605e721..93932470 100644 --- a/FrEee/Interfaces/IDamageable.cs +++ b/FrEee/Interfaces/IDamageable.cs @@ -1,7 +1,5 @@ using FrEee.Objects.Combat; -using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Interfaces; /// diff --git a/FrEee/Interfaces/IDesign.cs b/FrEee/Interfaces/IDesign.cs index 7be4e4eb..be27324c 100644 --- a/FrEee/Interfaces/IDesign.cs +++ b/FrEee/Interfaces/IDesign.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Civilization; using FrEee.Objects.Technology; using FrEee.Modding.Templates; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Collections.Generic; namespace FrEee.Interfaces; diff --git a/FrEee/Interfaces/IHull.cs b/FrEee/Interfaces/IHull.cs index d6dbfd6b..17eac941 100644 --- a/FrEee/Interfaces/IHull.cs +++ b/FrEee/Interfaces/IHull.cs @@ -1,7 +1,7 @@ using FrEee.Enumerations; using FrEee.Objects.Technology; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Collections.Generic; using System.Drawing; diff --git a/FrEee/Interfaces/IIncomeProducer.cs b/FrEee/Interfaces/IIncomeProducer.cs index e8d1db01..9be15c81 100644 --- a/FrEee/Interfaces/IIncomeProducer.cs +++ b/FrEee/Interfaces/IIncomeProducer.cs @@ -1,5 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Interfaces; /// diff --git a/FrEee/Interfaces/IMineableSpaceObject.cs b/FrEee/Interfaces/IMineableSpaceObject.cs index 67e49b95..ffe8f07d 100644 --- a/FrEee/Interfaces/IMineableSpaceObject.cs +++ b/FrEee/Interfaces/IMineableSpaceObject.cs @@ -1,5 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Interfaces; /// diff --git a/FrEee/Interfaces/IMobileSpaceObject.cs b/FrEee/Interfaces/IMobileSpaceObject.cs index 85b3d978..88db6b85 100644 --- a/FrEee/Interfaces/IMobileSpaceObject.cs +++ b/FrEee/Interfaces/IMobileSpaceObject.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Collections.Generic; namespace FrEee.Interfaces; diff --git a/FrEee/Interfaces/IMovementOrder.cs b/FrEee/Interfaces/IMovementOrder.cs index d24b7e5c..570b01bc 100644 --- a/FrEee/Interfaces/IMovementOrder.cs +++ b/FrEee/Interfaces/IMovementOrder.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Collections.Generic; namespace FrEee.Interfaces; diff --git a/FrEee/Interfaces/IOwnable.cs b/FrEee/Interfaces/IOwnable.cs index a4e4b4fe..6505b460 100644 --- a/FrEee/Interfaces/IOwnable.cs +++ b/FrEee/Interfaces/IOwnable.cs @@ -1,6 +1,5 @@ using FrEee.Objects.Civilization; using FrEee.Serialization; -using FrEee.Utility; using FrEee.Serialization; namespace FrEee.Interfaces; diff --git a/FrEee/Interfaces/IPlanetOrder.cs b/FrEee/Interfaces/IPlanetOrder.cs index 2289264d..00ee638a 100644 --- a/FrEee/Interfaces/IPlanetOrder.cs +++ b/FrEee/Interfaces/IPlanetOrder.cs @@ -1,6 +1,4 @@ -using FrEee.Objects.Space; - -namespace FrEee.Interfaces; +namespace FrEee.Interfaces; /// /// An order that can be issued to a planet. diff --git a/FrEee/Interfaces/IRecyclable.cs b/FrEee/Interfaces/IRecyclable.cs index 55f6a616..b6b3769b 100644 --- a/FrEee/Interfaces/IRecyclable.cs +++ b/FrEee/Interfaces/IRecyclable.cs @@ -1,5 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Interfaces; /// diff --git a/FrEee/Interfaces/IReference.cs b/FrEee/Interfaces/IReference.cs index 56eaeabd..958fcdcb 100644 --- a/FrEee/Interfaces/IReference.cs +++ b/FrEee/Interfaces/IReference.cs @@ -29,25 +29,13 @@ public interface IReference : IReference [Serializable] public class ReferenceException : Exception, ISerializable { - public ReferenceException(string message, TID id = default(TID)) + public ReferenceException(string message, TID id = default) : base(message) { ID = id; } - protected ReferenceException(SerializationInfo info, StreamingContext ctx) - : base(info, ctx) - { - ID = (TID)info.GetValue("ID", typeof(TID)); - } - public TID ID { get; private set; } public Type Type { get { return typeof(TValue); } } - - void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - info.AddValue("ID", ID); - } } \ No newline at end of file diff --git a/FrEee/Interfaces/ISpaceObject.cs b/FrEee/Interfaces/ISpaceObject.cs index 65cae2fd..7ba56fb5 100644 --- a/FrEee/Interfaces/ISpaceObject.cs +++ b/FrEee/Interfaces/ISpaceObject.cs @@ -1,6 +1,4 @@ -using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Interfaces; public interface ISpaceObject : IOwnableAbilityObject, IPictorial, IReferrable, IFoggable, INamed, ILocated diff --git a/FrEee/Interfaces/IStarSystemPlacementStrategy.cs b/FrEee/Interfaces/IStarSystemPlacementStrategy.cs index 1351368f..745ed371 100644 --- a/FrEee/Interfaces/IStarSystemPlacementStrategy.cs +++ b/FrEee/Interfaces/IStarSystemPlacementStrategy.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Drawing; namespace FrEee.Interfaces; diff --git a/FrEee/Interfaces/IVehicle.cs b/FrEee/Interfaces/IVehicle.cs index 8757c885..e2e1b4c5 100644 --- a/FrEee/Interfaces/IVehicle.cs +++ b/FrEee/Interfaces/IVehicle.cs @@ -1,6 +1,6 @@ using FrEee.Objects.Technology; using FrEee.Serialization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Collections.Generic; namespace FrEee.Interfaces; diff --git a/FrEee/Modding/ComputedFormula.cs b/FrEee/Modding/ComputedFormula.cs index 693572d2..806bdf65 100644 --- a/FrEee/Modding/ComputedFormula.cs +++ b/FrEee/Modding/ComputedFormula.cs @@ -3,9 +3,9 @@ using System.Globalization; using System.Linq; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; -using FrEee.Extensions; +using FrEee.Utility; using FrEee.Serialization; +using FrEee.Extensions; namespace FrEee.Modding; @@ -85,9 +85,9 @@ public static implicit operator T(ComputedFormula f) public static bool operator ==(ComputedFormula f1, ComputedFormula f2) { - if (f1.IsNull() && f2.IsNull()) + if (f1 is null && f2 is null) return true; - if (f1.IsNull() || f2.IsNull()) + if (f1 is null || f2 is null) return false; return f1.Value.SafeEquals(f2.Value); } @@ -101,17 +101,17 @@ public Formula Compile() return new LiteralFormula(Value.ToStringInvariant()); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var x = obj as ComputedFormula; - if (x == null) + if (x is null) return false; return Equals(x); } - public bool Equals(ComputedFormula other) + public bool Equals(ComputedFormula? other) { - return IsDynamic == other.IsDynamic && Text == other.Text && Context == other.Context; + return other is not null && IsDynamic == other.IsDynamic && Text == other.Text && Context == other.Context; } public override T Evaluate(object host, IDictionary variables = null) diff --git a/FrEee/Modding/EventType.cs b/FrEee/Modding/EventType.cs index 755c037c..c8b23223 100644 --- a/FrEee/Modding/EventType.cs +++ b/FrEee/Modding/EventType.cs @@ -1,6 +1,4 @@ -using FrEee.Enumerations; -using FrEee.Interfaces; -using FrEee.Objects.Events; +using FrEee.Interfaces; using FrEee.Modding.Interfaces; using FrEee.Serialization; using System.Collections.Generic; diff --git a/FrEee/Modding/Field.cs b/FrEee/Modding/Field.cs index 889d5953..e3f39dd4 100644 --- a/FrEee/Modding/Field.cs +++ b/FrEee/Modding/Field.cs @@ -1,5 +1,4 @@ using FrEee.Interfaces; -using FrEee.Extensions; using System; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Modding/Formula.cs b/FrEee/Modding/Formula.cs index d0e369f4..681cab3e 100644 --- a/FrEee/Modding/Formula.cs +++ b/FrEee/Modding/Formula.cs @@ -174,19 +174,19 @@ public static implicit operator T(Formula f) return new ComputedFormula(string.Format("({0}) + str({1})", f1.Text, f2.Text), f1.Context, false); } - public int CompareTo(object obj) + public int CompareTo(object? obj) { if (obj is IFormula) return Value.CompareTo(((IFormula)obj).Value); return Value.CompareTo(obj); } - public int CompareTo(T other) + public int CompareTo(T? other) { return Value.CompareTo(other); } - public int CompareTo(Formula other) + public int CompareTo(Formula? other) { return Value.CompareTo(other.Value); } diff --git a/FrEee/Modding/Interfaces/IStellarObjectLocation.cs b/FrEee/Modding/Interfaces/IStellarObjectLocation.cs index 24d6d4cb..63fc325b 100644 --- a/FrEee/Modding/Interfaces/IStellarObjectLocation.cs +++ b/FrEee/Modding/Interfaces/IStellarObjectLocation.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Drawing; namespace FrEee.Modding.Interfaces; diff --git a/FrEee/Modding/LiteralFormula.cs b/FrEee/Modding/LiteralFormula.cs index 45acb614..e3546fb8 100644 --- a/FrEee/Modding/LiteralFormula.cs +++ b/FrEee/Modding/LiteralFormula.cs @@ -82,14 +82,14 @@ public static implicit operator T(LiteralFormula f) public static bool operator ==(LiteralFormula f1, Formula f2) { - if (f1.IsNull() && f2.IsNull()) + if (f1 is null && f2 is null) return true; - if (f1.IsNull() || f2.IsNull()) + if (f1 is null || f2 is null) return false; return f1.Value.SafeEquals(f2.Value); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var x = obj as LiteralFormula; if (ReferenceEquals(x, null)) @@ -97,7 +97,7 @@ public override bool Equals(object obj) return Equals(x); } - public bool Equals(LiteralFormula other) + public bool Equals(LiteralFormula? other) { return Text == other.Text; } diff --git a/FrEee/Modding/Loaders/ComponentLoader.cs b/FrEee/Modding/Loaders/ComponentLoader.cs index f1d57a9a..748b80ab 100644 --- a/FrEee/Modding/Loaders/ComponentLoader.cs +++ b/FrEee/Modding/Loaders/ComponentLoader.cs @@ -4,7 +4,7 @@ using FrEee.Modding.Enumerations; using FrEee.Modding.Interfaces; using FrEee.Modding.Templates; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Modding/Loaders/EmpireAILoader.cs b/FrEee/Modding/Loaders/EmpireAILoader.cs index a4ede398..caeb3998 100644 --- a/FrEee/Modding/Loaders/EmpireAILoader.cs +++ b/FrEee/Modding/Loaders/EmpireAILoader.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Civilization; using FrEee.Objects.Space; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Collections.Generic; using System.IO; using System.Reflection; diff --git a/FrEee/Modding/Loaders/EventLoader.cs b/FrEee/Modding/Loaders/EventLoader.cs index e2b111f4..abcf84bf 100644 --- a/FrEee/Modding/Loaders/EventLoader.cs +++ b/FrEee/Modding/Loaders/EventLoader.cs @@ -1,7 +1,6 @@ using FrEee.Enumerations; using FrEee.Objects.Events; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Modding/Loaders/EventTypeLoader.cs b/FrEee/Modding/Loaders/EventTypeLoader.cs index d01fb63e..a7590634 100644 --- a/FrEee/Modding/Loaders/EventTypeLoader.cs +++ b/FrEee/Modding/Loaders/EventTypeLoader.cs @@ -1,7 +1,6 @@ using FrEee.Interfaces; using FrEee.Modding.Interfaces; using FrEee.Serialization; -using FrEee.Extensions; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Modding/Loaders/FacilityLoader.cs b/FrEee/Modding/Loaders/FacilityLoader.cs index 4a15957e..75b16c28 100644 --- a/FrEee/Modding/Loaders/FacilityLoader.cs +++ b/FrEee/Modding/Loaders/FacilityLoader.cs @@ -1,7 +1,7 @@ using FrEee.Objects.Technology; using FrEee.Modding.Enumerations; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Modding/Loaders/HullLoader.cs b/FrEee/Modding/Loaders/HullLoader.cs index 9a9aef83..2b0db401 100644 --- a/FrEee/Modding/Loaders/HullLoader.cs +++ b/FrEee/Modding/Loaders/HullLoader.cs @@ -3,7 +3,7 @@ using FrEee.Objects.Vehicles; using FrEee.Modding.Enumerations; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Modding/Loaders/ModSettingsLoader.cs b/FrEee/Modding/Loaders/ModSettingsLoader.cs index b122d0bc..91ea5eaa 100644 --- a/FrEee/Modding/Loaders/ModSettingsLoader.cs +++ b/FrEee/Modding/Loaders/ModSettingsLoader.cs @@ -1,7 +1,6 @@ using FrEee.Enumerations; using FrEee.Objects.Civilization; using FrEee.Modding.Interfaces; -using System; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Modding/Loaders/MountLoader.cs b/FrEee/Modding/Loaders/MountLoader.cs index fb513b7d..3ee49c13 100644 --- a/FrEee/Modding/Loaders/MountLoader.cs +++ b/FrEee/Modding/Loaders/MountLoader.cs @@ -3,7 +3,6 @@ using FrEee.Modding.Enumerations; using FrEee.Modding.Interfaces; using FrEee.Extensions; -using System; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Modding/MetaRecord.cs b/FrEee/Modding/MetaRecord.cs index 46f1c803..5a2d54fc 100644 --- a/FrEee/Modding/MetaRecord.cs +++ b/FrEee/Modding/MetaRecord.cs @@ -25,7 +25,7 @@ public MetaRecord(IEnumerable lines) public string Filename { get; set; } - public IEnumerable Parameters + public new IEnumerable Parameters { get { diff --git a/FrEee/Modding/Mod.cs b/FrEee/Modding/Mod.cs index 2cf53a09..21b031df 100644 --- a/FrEee/Modding/Mod.cs +++ b/FrEee/Modding/Mod.cs @@ -12,7 +12,7 @@ using FrEee.Modding.Interfaces; using FrEee.Modding.Loaders; using FrEee.Modding.Templates; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; namespace FrEee.Modding; diff --git a/FrEee/Modding/ModReference.cs b/FrEee/Modding/ModReference.cs index 6997dca2..8308358e 100644 --- a/FrEee/Modding/ModReference.cs +++ b/FrEee/Modding/ModReference.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; @@ -114,7 +114,7 @@ public static implicit operator T(ModReference r) return r.Value; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var mref = obj as ModReference; if (mref == null) diff --git a/FrEee/Modding/ObjectFormula.cs b/FrEee/Modding/ObjectFormula.cs index 890873a7..72973130 100644 --- a/FrEee/Modding/ObjectFormula.cs +++ b/FrEee/Modding/ObjectFormula.cs @@ -1,6 +1,6 @@ using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; -using FrEee.Extensions; +using FrEee.Utility; +using FrEee.Serialization; using System; using System.Collections.Generic; using System.Globalization; @@ -87,7 +87,7 @@ public static implicit operator T(ObjectFormula f) return f.Value; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var x = obj as ObjectFormula; if (x == null) @@ -147,17 +147,17 @@ protected T ComputeValue() return Evaluate(Context, null); } - public int CompareTo(object obj) + public int CompareTo(object? obj) { throw new NotSupportedException(); } - public int CompareTo(T other) + public int CompareTo(T ?other) { throw new NotSupportedException(); } - public int CompareTo(ObjectFormula other) + public int CompareTo(ObjectFormula? other) { throw new NotSupportedException(); } diff --git a/FrEee/Modding/Scripts/CSScript.cs b/FrEee/Modding/Scripts/CSScript.cs index cc77e6d9..45cfc838 100644 --- a/FrEee/Modding/Scripts/CSScript.cs +++ b/FrEee/Modding/Scripts/CSScript.cs @@ -1,23 +1,18 @@ -using FrEee.Utility; using FrEee.Serialization; -using FrEee.Extensions; +using FrEee.Utility; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Scripting; using Microsoft.CodeAnalysis.Scripting; using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Modding; [Serializable] public class CSScript : IScript - { - public string ModuleName { get; set; } - public string Text { get; set; } + { + public string ModuleName { get; set; } + public string Text { get; set; } /// /// The directory that this script is found in. @@ -82,14 +77,14 @@ public Microsoft.CodeAnalysis.Scripting.ScriptRunner CreateScriptObject public static bool operator ==(CSScript s1, CSScript s2) { - if (s1.IsNull() && s2.IsNull()) + if (s1 is null && s2 is null) return true; - if (s1.IsNull() || s2.IsNull()) + if (s1 is null || s2 is null) return false; return s1.ModuleName == s2.ModuleName && s1.Text == s2.Text;// && s1.ExternalScripts.SafeSequenceEqual(s2.ExternalScripts); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is CSScript) { diff --git a/FrEee/Modding/Scripts/PythonScript.cs b/FrEee/Modding/Scripts/PythonScript.cs index 0c6bce9d..48bf0469 100644 --- a/FrEee/Modding/Scripts/PythonScript.cs +++ b/FrEee/Modding/Scripts/PythonScript.cs @@ -1,9 +1,8 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; using System.IO; -using System.Linq; namespace FrEee.Modding; @@ -155,18 +154,17 @@ public static PythonScript Load(string path) public static bool operator ==(PythonScript s1, PythonScript s2) { - if (s1.IsNull() && s2.IsNull()) + if (s1 is null && s2 is null) return true; - if (s1.IsNull() || s2.IsNull()) + if (s1 is null || s2 is null) return false; return s1.ModuleName == s2.ModuleName && s1.Text == s2.Text && s1.ExternalScripts.SafeSequenceEqual(s2.ExternalScripts); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { - if (obj is PythonScript) + if (obj is PythonScript s) { - var s = (PythonScript)obj; return s == this; } return false; diff --git a/FrEee/Modding/Scripts/PythonScriptEngine.cs b/FrEee/Modding/Scripts/PythonScriptEngine.cs index cc85b094..1c11e638 100644 --- a/FrEee/Modding/Scripts/PythonScriptEngine.cs +++ b/FrEee/Modding/Scripts/PythonScriptEngine.cs @@ -404,12 +404,12 @@ public CompiledCodeWithVariables(CompiledCode code, IDictionary return c1.Equals(c2); } - public bool Equals(CompiledCodeWithVariables other) + public bool Equals(CompiledCodeWithVariables? other) { return Code == other.Code && Variables.Keys.Count == other.Variables.Keys.Count && Variables.All(kvp => kvp.Value.SafeEquals(other.Variables[kvp.Key])); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is CompiledCodeWithVariables c) return this.Equals(c); @@ -442,14 +442,14 @@ public ScriptCode(string moduleName, string code, params PythonScript[] external public static bool operator ==(ScriptCode sc1, ScriptCode sc2) { - if (sc1.IsNull() && sc2.IsNull()) + if (sc1 is null && sc2 is null) return true; - if (sc1.IsNull() || sc2.IsNull()) + if (sc1 is null || sc2 is null) return false; return sc1.ModuleName == sc2.ModuleName && sc1.Code == sc2.Code && sc1.ExternalScripts.SequenceEqual(sc2.ExternalScripts); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { return obj as ScriptCode == this; } diff --git a/FrEee/Modding/StellarObjectLocations/CircleRadiusStellarObjectLocation.cs b/FrEee/Modding/StellarObjectLocations/CircleRadiusStellarObjectLocation.cs index 361f1a4e..bfb1059a 100644 --- a/FrEee/Modding/StellarObjectLocations/CircleRadiusStellarObjectLocation.cs +++ b/FrEee/Modding/StellarObjectLocations/CircleRadiusStellarObjectLocation.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Space; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Modding/StellarObjectLocations/CoordStellarObjectLocation.cs b/FrEee/Modding/StellarObjectLocations/CoordStellarObjectLocation.cs index b7cf29da..d5914249 100644 --- a/FrEee/Modding/StellarObjectLocations/CoordStellarObjectLocation.cs +++ b/FrEee/Modding/StellarObjectLocations/CoordStellarObjectLocation.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Space; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Drawing; diff --git a/FrEee/Modding/StellarObjectLocations/RingStellarObjectLocation.cs b/FrEee/Modding/StellarObjectLocations/RingStellarObjectLocation.cs index 35732cf8..f8fc383f 100644 --- a/FrEee/Modding/StellarObjectLocations/RingStellarObjectLocation.cs +++ b/FrEee/Modding/StellarObjectLocations/RingStellarObjectLocation.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Space; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Modding/StellarObjectLocations/SameAsStellarObjectLocation.cs b/FrEee/Modding/StellarObjectLocations/SameAsStellarObjectLocation.cs index 4f997173..f5e5678f 100644 --- a/FrEee/Modding/StellarObjectLocations/SameAsStellarObjectLocation.cs +++ b/FrEee/Modding/StellarObjectLocations/SameAsStellarObjectLocation.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Space; using FrEee.Modding.Interfaces; using FrEee.Modding.Templates; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Drawing; diff --git a/FrEee/Modding/StellarObjectSize.cs b/FrEee/Modding/StellarObjectSize.cs index 1317ae6e..8dc1022a 100644 --- a/FrEee/Modding/StellarObjectSize.cs +++ b/FrEee/Modding/StellarObjectSize.cs @@ -84,7 +84,7 @@ public string ModID /// public IDictionary TemplateParameters { get; set; } - public int CompareTo(object obj) + public int CompareTo(object? obj) { if (obj is StellarSize) return StellarSize.CompareTo(obj); @@ -93,7 +93,7 @@ public int CompareTo(object obj) return StellarSize.CompareTo(obj); } - public int CompareTo(StellarObjectSize obj) + public int CompareTo(StellarObjectSize? obj) { return StellarSize.CompareTo(obj.StellarSize); } diff --git a/FrEee/Modding/Templates/AsteroidFieldTemplate.cs b/FrEee/Modding/Templates/AsteroidFieldTemplate.cs index e16bc3aa..c6e525fd 100644 --- a/FrEee/Modding/Templates/AsteroidFieldTemplate.cs +++ b/FrEee/Modding/Templates/AsteroidFieldTemplate.cs @@ -2,7 +2,7 @@ using FrEee.Interfaces; using FrEee.Objects.Space; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Modding/Templates/ComponentTemplate.cs b/FrEee/Modding/Templates/ComponentTemplate.cs index 17c967e5..158aa386 100644 --- a/FrEee/Modding/Templates/ComponentTemplate.cs +++ b/FrEee/Modding/Templates/ComponentTemplate.cs @@ -2,10 +2,10 @@ using FrEee.Interfaces; using FrEee.Objects.Abilities; using FrEee.Objects.Civilization; -using FrEee.Objects.Space; using FrEee.Objects.Technology; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; using System; using System.Collections.Generic; @@ -318,7 +318,7 @@ public override string ToString() return Name; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { return obj is ComponentTemplate t && t == this; } diff --git a/FrEee/Modding/Templates/GalaxyTemplate.cs b/FrEee/Modding/Templates/GalaxyTemplate.cs index 9537a295..ea682f18 100644 --- a/FrEee/Modding/Templates/GalaxyTemplate.cs +++ b/FrEee/Modding/Templates/GalaxyTemplate.cs @@ -6,7 +6,7 @@ using FrEee.Objects.Space; using FrEee.Setup; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; namespace FrEee.Modding.Templates; diff --git a/FrEee/Modding/Templates/PlanetTemplate.cs b/FrEee/Modding/Templates/PlanetTemplate.cs index a26634ad..11650ec7 100644 --- a/FrEee/Modding/Templates/PlanetTemplate.cs +++ b/FrEee/Modding/Templates/PlanetTemplate.cs @@ -2,7 +2,7 @@ using FrEee.Interfaces; using FrEee.Objects.Space; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Modding/Templates/RandomAbilityTemplate.cs b/FrEee/Modding/Templates/RandomAbilityTemplate.cs index 74b0b9b8..11147241 100644 --- a/FrEee/Modding/Templates/RandomAbilityTemplate.cs +++ b/FrEee/Modding/Templates/RandomAbilityTemplate.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Abilities; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Modding/Templates/StarSystemTemplate.cs b/FrEee/Modding/Templates/StarSystemTemplate.cs index c97eb60d..f7967898 100644 --- a/FrEee/Modding/Templates/StarSystemTemplate.cs +++ b/FrEee/Modding/Templates/StarSystemTemplate.cs @@ -4,7 +4,7 @@ using FrEee.Objects.Space; using FrEee.Modding.Interfaces; using FrEee.Modding.StellarObjectLocations; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections.Generic; using System.Drawing; diff --git a/FrEee/Objects/AI/AI.cs b/FrEee/Objects/AI/AI.cs index fdf2b3ce..afc5f3b4 100644 --- a/FrEee/Objects/AI/AI.cs +++ b/FrEee/Objects/AI/AI.cs @@ -1,6 +1,6 @@ using FrEee.Modding; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/AI/CSAI.cs b/FrEee/Objects/AI/CSAI.cs index 5814dd4b..b13e7bb6 100644 --- a/FrEee/Objects/AI/CSAI.cs +++ b/FrEee/Objects/AI/CSAI.cs @@ -1,17 +1,14 @@ using FrEee.Objects.Civilization; using FrEee.Objects.Space; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using Microsoft.CodeAnalysis.Scripting; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Objects.AI; - [Serializable] +[Serializable] public class CSAI : AI where TDomain : Empire where TContext : Galaxy { public CSAI(string name, CSScript script, SafeDictionary> ministerNames) diff --git a/FrEee/Objects/AI/PythonAI.cs b/FrEee/Objects/AI/PythonAI.cs index 3a404d6c..f4b8b73e 100644 --- a/FrEee/Objects/AI/PythonAI.cs +++ b/FrEee/Objects/AI/PythonAI.cs @@ -1,14 +1,11 @@ using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Objects.AI; - [Serializable] +[Serializable] public class PythonAI : AI { public PythonAI(string name, PythonScript script, SafeDictionary> ministerNames) : base(name, script, ministerNames) diff --git a/FrEee/Objects/Abilities/AbilityRule.cs b/FrEee/Objects/Abilities/AbilityRule.cs index fbbb83c7..ecfb5394 100644 --- a/FrEee/Objects/Abilities/AbilityRule.cs +++ b/FrEee/Objects/Abilities/AbilityRule.cs @@ -2,7 +2,7 @@ using FrEee.Interfaces; using FrEee.Modding; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Civilization/Culture.cs b/FrEee/Objects/Civilization/Culture.cs index fd24ec48..c59676a5 100644 --- a/FrEee/Objects/Civilization/Culture.cs +++ b/FrEee/Objects/Civilization/Culture.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Civilization/Diplomacy/AcceptProposalAction.cs b/FrEee/Objects/Civilization/Diplomacy/AcceptProposalAction.cs index f192680e..3883daf7 100644 --- a/FrEee/Objects/Civilization/Diplomacy/AcceptProposalAction.cs +++ b/FrEee/Objects/Civilization/Diplomacy/AcceptProposalAction.cs @@ -1,5 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; diff --git a/FrEee/Objects/Civilization/Diplomacy/Action.cs b/FrEee/Objects/Civilization/Diplomacy/Action.cs index 80bc2faa..7fdf22e4 100644 --- a/FrEee/Objects/Civilization/Diplomacy/Action.cs +++ b/FrEee/Objects/Civilization/Diplomacy/Action.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Commands; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; namespace FrEee.Objects.Civilization.Diplomacy; diff --git a/FrEee/Objects/Civilization/Diplomacy/Clauses/Clause.cs b/FrEee/Objects/Civilization/Diplomacy/Clauses/Clause.cs index d2d2bd86..9078bf2d 100644 --- a/FrEee/Objects/Civilization/Diplomacy/Clauses/Clause.cs +++ b/FrEee/Objects/Civilization/Diplomacy/Clauses/Clause.cs @@ -1,7 +1,7 @@ using FrEee.Enumerations; using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using System.Collections.Generic; namespace FrEee.Objects.Civilization.Diplomacy.Clauses; diff --git a/FrEee/Objects/Civilization/Diplomacy/Clauses/CooperativeResearchClause.cs b/FrEee/Objects/Civilization/Diplomacy/Clauses/CooperativeResearchClause.cs index bfe653b2..e26666eb 100644 --- a/FrEee/Objects/Civilization/Diplomacy/Clauses/CooperativeResearchClause.cs +++ b/FrEee/Objects/Civilization/Diplomacy/Clauses/CooperativeResearchClause.cs @@ -1,5 +1,5 @@ using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System.Linq; using Tech = FrEee.Objects.Technology.Technology; diff --git a/FrEee/Objects/Civilization/Diplomacy/Clauses/FreeTradeClause.cs b/FrEee/Objects/Civilization/Diplomacy/Clauses/FreeTradeClause.cs index 6dbe5afd..62397945 100644 --- a/FrEee/Objects/Civilization/Diplomacy/Clauses/FreeTradeClause.cs +++ b/FrEee/Objects/Civilization/Diplomacy/Clauses/FreeTradeClause.cs @@ -1,5 +1,5 @@ using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; diff --git a/FrEee/Objects/Civilization/Diplomacy/Clauses/TributeClause.cs b/FrEee/Objects/Civilization/Diplomacy/Clauses/TributeClause.cs index f717d2d1..6502c1a8 100644 --- a/FrEee/Objects/Civilization/Diplomacy/Clauses/TributeClause.cs +++ b/FrEee/Objects/Civilization/Diplomacy/Clauses/TributeClause.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System.Linq; diff --git a/FrEee/Objects/Civilization/Diplomacy/Message.cs b/FrEee/Objects/Civilization/Diplomacy/Message.cs index a715db0d..ca44c334 100644 --- a/FrEee/Objects/Civilization/Diplomacy/Message.cs +++ b/FrEee/Objects/Civilization/Diplomacy/Message.cs @@ -2,7 +2,7 @@ using FrEee.Interfaces; using FrEee.Objects.Commands; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; using System.Drawing; diff --git a/FrEee/Objects/Civilization/Diplomacy/Proposal.cs b/FrEee/Objects/Civilization/Diplomacy/Proposal.cs index aeebd25e..a1dce3b1 100644 --- a/FrEee/Objects/Civilization/Diplomacy/Proposal.cs +++ b/FrEee/Objects/Civilization/Diplomacy/Proposal.cs @@ -2,7 +2,7 @@ using FrEee.Interfaces; using FrEee.Objects.Commands; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Objects/Civilization/Diplomacy/RejectProposalAction.cs b/FrEee/Objects/Civilization/Diplomacy/RejectProposalAction.cs index c6f817d2..40ee4d53 100644 --- a/FrEee/Objects/Civilization/Diplomacy/RejectProposalAction.cs +++ b/FrEee/Objects/Civilization/Diplomacy/RejectProposalAction.cs @@ -1,5 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; diff --git a/FrEee/Objects/Civilization/Empire.cs b/FrEee/Objects/Civilization/Empire.cs index 4f02128b..86bf4f80 100644 --- a/FrEee/Objects/Civilization/Empire.cs +++ b/FrEee/Objects/Civilization/Empire.cs @@ -10,7 +10,6 @@ using FrEee.Objects.Vehicles; using FrEee.Modding; using FrEee.Modding.Interfaces; -using FrEee.Modding.Loaders; using FrEee.Utility; using FrEee.Serialization; using FrEee.Extensions; diff --git a/FrEee/Objects/Civilization/PlayerInfo.cs b/FrEee/Objects/Civilization/PlayerInfo.cs index 7cc36cf1..3c82de40 100644 --- a/FrEee/Objects/Civilization/PlayerInfo.cs +++ b/FrEee/Objects/Civilization/PlayerInfo.cs @@ -1,10 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Objects.Civilization; diff --git a/FrEee/Objects/Civilization/SpaceObjectWaypoint.cs b/FrEee/Objects/Civilization/SpaceObjectWaypoint.cs index 89a18338..b1ecef8c 100644 --- a/FrEee/Objects/Civilization/SpaceObjectWaypoint.cs +++ b/FrEee/Objects/Civilization/SpaceObjectWaypoint.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System; diff --git a/FrEee/Objects/Civilization/Waypoint.cs b/FrEee/Objects/Civilization/Waypoint.cs index b558ca10..41072111 100644 --- a/FrEee/Objects/Civilization/Waypoint.cs +++ b/FrEee/Objects/Civilization/Waypoint.cs @@ -2,7 +2,7 @@ using FrEee.Interfaces; using FrEee.Objects.Orders; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Objects/Combat/Grid/Battle.cs b/FrEee/Objects/Combat/Grid/Battle.cs index 1d5a8b03..35bab934 100644 --- a/FrEee/Objects/Combat/Grid/Battle.cs +++ b/FrEee/Objects/Combat/Grid/Battle.cs @@ -6,14 +6,14 @@ using FrEee.Objects.Technology; using FrEee.Objects.Vehicles; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using static System.Math; -using FrEee.Serialization; namespace FrEee.Objects.Combat.Grid; diff --git a/FrEee/Objects/Combat/Grid/BattleEvent.cs b/FrEee/Objects/Combat/Grid/BattleEvent.cs index 9320ba79..28a3c89d 100644 --- a/FrEee/Objects/Combat/Grid/BattleEvent.cs +++ b/FrEee/Objects/Combat/Grid/BattleEvent.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Interfaces; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; namespace FrEee.Objects.Combat.Grid; diff --git a/FrEee/Objects/Combat/Grid/CombatantAppearsEvent.cs b/FrEee/Objects/Combat/Grid/CombatantAppearsEvent.cs index d5ccc720..7e8661a2 100644 --- a/FrEee/Objects/Combat/Grid/CombatantAppearsEvent.cs +++ b/FrEee/Objects/Combat/Grid/CombatantAppearsEvent.cs @@ -1,6 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; -using System; +using FrEee.Utility; using System.Linq; namespace FrEee.Objects.Combat.Grid; diff --git a/FrEee/Objects/Combat/Grid/CombatantDestroyedEvent.cs b/FrEee/Objects/Combat/Grid/CombatantDestroyedEvent.cs index 3a9128e6..aed43a8e 100644 --- a/FrEee/Objects/Combat/Grid/CombatantDestroyedEvent.cs +++ b/FrEee/Objects/Combat/Grid/CombatantDestroyedEvent.cs @@ -1,6 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Objects.Combat.Grid; public class CombatantDestroyedEvent : BattleEvent diff --git a/FrEee/Objects/Combat/Grid/CombatantDisappearsEvent.cs b/FrEee/Objects/Combat/Grid/CombatantDisappearsEvent.cs index 6bd03951..98224c88 100644 --- a/FrEee/Objects/Combat/Grid/CombatantDisappearsEvent.cs +++ b/FrEee/Objects/Combat/Grid/CombatantDisappearsEvent.cs @@ -1,5 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; namespace FrEee.Objects.Combat.Grid; diff --git a/FrEee/Objects/Combat/Grid/CombatantMovesEvent.cs b/FrEee/Objects/Combat/Grid/CombatantMovesEvent.cs index b7eea53f..561c25f1 100644 --- a/FrEee/Objects/Combat/Grid/CombatantMovesEvent.cs +++ b/FrEee/Objects/Combat/Grid/CombatantMovesEvent.cs @@ -1,6 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Objects.Combat.Grid; public class CombatantMovesEvent : BattleEvent diff --git a/FrEee/Objects/Combat/Grid/Extensions.cs b/FrEee/Objects/Combat/Grid/Extensions.cs index 04455f0b..3d4f38b1 100644 --- a/FrEee/Objects/Combat/Grid/Extensions.cs +++ b/FrEee/Objects/Combat/Grid/Extensions.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; public static class Extensions diff --git a/FrEee/Objects/Combat/Grid/GroundBattle.cs b/FrEee/Objects/Combat/Grid/GroundBattle.cs index 9f13c7ea..f3ff6f9d 100644 --- a/FrEee/Objects/Combat/Grid/GroundBattle.cs +++ b/FrEee/Objects/Combat/Grid/GroundBattle.cs @@ -1,16 +1,13 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Objects.LogMessages; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Objects.Combat.Grid; diff --git a/FrEee/Objects/Combat/Grid/IBattleEvent.cs b/FrEee/Objects/Combat/Grid/IBattleEvent.cs index 29ebdfbc..87876ffb 100644 --- a/FrEee/Objects/Combat/Grid/IBattleEvent.cs +++ b/FrEee/Objects/Combat/Grid/IBattleEvent.cs @@ -1,6 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Objects.Combat.Grid; public interface IBattleEvent diff --git a/FrEee/Objects/Combat/Grid/SpaceBattle.cs b/FrEee/Objects/Combat/Grid/SpaceBattle.cs index 2a6e9a35..5663eab9 100644 --- a/FrEee/Objects/Combat/Grid/SpaceBattle.cs +++ b/FrEee/Objects/Combat/Grid/SpaceBattle.cs @@ -1,16 +1,11 @@ using FrEee.Interfaces; -using FrEee.Objects.LogMessages; using FrEee.Objects.Space; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; -using Microsoft.Scripting.Runtime; using System; using System.Collections.Generic; using System.Linq; -using System.Security.Principal; -using System.Text; -using System.Threading.Tasks; using static System.Math; namespace FrEee.Objects.Combat.Grid; diff --git a/FrEee/Objects/Combat/IBattle.cs b/FrEee/Objects/Combat/IBattle.cs index 1ca26dca..67f2f97b 100644 --- a/FrEee/Objects/Combat/IBattle.cs +++ b/FrEee/Objects/Combat/IBattle.cs @@ -1,8 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.LogMessages; -using FrEee.Objects.Technology; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System.Collections.Generic; namespace FrEee.Objects.Combat; diff --git a/FrEee/Objects/Combat/WeaponDisplayEffect.cs b/FrEee/Objects/Combat/WeaponDisplayEffect.cs index 62e49c01..82749c97 100644 --- a/FrEee/Objects/Combat/WeaponDisplayEffect.cs +++ b/FrEee/Objects/Combat/WeaponDisplayEffect.cs @@ -1,5 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Commands/ClearPlayerNoteCommand.cs b/FrEee/Objects/Commands/ClearPlayerNoteCommand.cs index ce210f20..7697685f 100644 --- a/FrEee/Objects/Commands/ClearPlayerNoteCommand.cs +++ b/FrEee/Objects/Commands/ClearPlayerNoteCommand.cs @@ -1,7 +1,5 @@ -using FrEee.Interfaces; -using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; -using FrEee.Extensions; +using FrEee.Objects.Civilization; +using FrEee.Utility; using System.Collections.Generic; namespace FrEee.Objects.Commands; diff --git a/FrEee/Objects/Commands/ClearPrivateNameCommand.cs b/FrEee/Objects/Commands/ClearPrivateNameCommand.cs index 07e89a4f..76447e11 100644 --- a/FrEee/Objects/Commands/ClearPrivateNameCommand.cs +++ b/FrEee/Objects/Commands/ClearPrivateNameCommand.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; namespace FrEee.Objects.Commands; diff --git a/FrEee/Objects/Commands/Command.cs b/FrEee/Objects/Commands/Command.cs index 2b54f176..7f9b76c1 100644 --- a/FrEee/Objects/Commands/Command.cs +++ b/FrEee/Objects/Commands/Command.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using System; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Objects/Commands/DeleteMessageCommand.cs b/FrEee/Objects/Commands/DeleteMessageCommand.cs index ab1419ad..6759fbdd 100644 --- a/FrEee/Objects/Commands/DeleteMessageCommand.cs +++ b/FrEee/Objects/Commands/DeleteMessageCommand.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; namespace FrEee.Objects.Commands; diff --git a/FrEee/Objects/Commands/JoinFleetCommand.cs b/FrEee/Objects/Commands/JoinFleetCommand.cs index 80f05098..4ef6bd32 100644 --- a/FrEee/Objects/Commands/JoinFleetCommand.cs +++ b/FrEee/Objects/Commands/JoinFleetCommand.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; diff --git a/FrEee/Objects/Commands/MinisterToggleCommand.cs b/FrEee/Objects/Commands/MinisterToggleCommand.cs index 1a2a9b25..4a495866 100644 --- a/FrEee/Objects/Commands/MinisterToggleCommand.cs +++ b/FrEee/Objects/Commands/MinisterToggleCommand.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; namespace FrEee.Objects.Commands; diff --git a/FrEee/Objects/Commands/OrderCommand.cs b/FrEee/Objects/Commands/OrderCommand.cs index 8628fa5d..8515c723 100644 --- a/FrEee/Objects/Commands/OrderCommand.cs +++ b/FrEee/Objects/Commands/OrderCommand.cs @@ -1,5 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Commands/SetObsoleteFlagCommand.cs b/FrEee/Objects/Commands/SetObsoleteFlagCommand.cs index 024a70c1..25a8919d 100644 --- a/FrEee/Objects/Commands/SetObsoleteFlagCommand.cs +++ b/FrEee/Objects/Commands/SetObsoleteFlagCommand.cs @@ -1,5 +1,5 @@ using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; diff --git a/FrEee/Objects/Commands/SetPlayerInfoCommand.cs b/FrEee/Objects/Commands/SetPlayerInfoCommand.cs index 76556b4a..6d4dcb5d 100644 --- a/FrEee/Objects/Commands/SetPlayerInfoCommand.cs +++ b/FrEee/Objects/Commands/SetPlayerInfoCommand.cs @@ -1,7 +1,5 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Objects.LogMessages; -using FrEee.Objects.Space; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Commands/SetPlayerNoteCommand.cs b/FrEee/Objects/Commands/SetPlayerNoteCommand.cs index 0ca4f732..d7c08e9d 100644 --- a/FrEee/Objects/Commands/SetPlayerNoteCommand.cs +++ b/FrEee/Objects/Commands/SetPlayerNoteCommand.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; namespace FrEee.Objects.Commands; diff --git a/FrEee/Objects/Commands/SetPrivateNameCommand.cs b/FrEee/Objects/Commands/SetPrivateNameCommand.cs index 9e119483..f7149a3a 100644 --- a/FrEee/Objects/Commands/SetPrivateNameCommand.cs +++ b/FrEee/Objects/Commands/SetPrivateNameCommand.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; namespace FrEee.Objects.Commands; diff --git a/FrEee/Objects/Commands/ToggleOrdersOnHoldCommand.cs b/FrEee/Objects/Commands/ToggleOrdersOnHoldCommand.cs index 6d8cbabc..f0167cc2 100644 --- a/FrEee/Objects/Commands/ToggleOrdersOnHoldCommand.cs +++ b/FrEee/Objects/Commands/ToggleOrdersOnHoldCommand.cs @@ -1,9 +1,4 @@ using FrEee.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Objects.Commands; diff --git a/FrEee/Objects/Commands/ToggleRepeatOrdersCommand.cs b/FrEee/Objects/Commands/ToggleRepeatOrdersCommand.cs index d613a475..4c1eccfe 100644 --- a/FrEee/Objects/Commands/ToggleRepeatOrdersCommand.cs +++ b/FrEee/Objects/Commands/ToggleRepeatOrdersCommand.cs @@ -1,9 +1,4 @@ using FrEee.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Objects.Commands; diff --git a/FrEee/Objects/Events/Event.cs b/FrEee/Objects/Events/Event.cs index ed3f2c31..a324a352 100644 --- a/FrEee/Objects/Events/Event.cs +++ b/FrEee/Objects/Events/Event.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Civilization; using FrEee.Objects.Space; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System.Collections.Generic; using System.Drawing; diff --git a/FrEee/Objects/Events/EventMessage.cs b/FrEee/Objects/Events/EventMessage.cs index d1521e6c..6b1f37bf 100644 --- a/FrEee/Objects/Events/EventMessage.cs +++ b/FrEee/Objects/Events/EventMessage.cs @@ -1,9 +1,4 @@ using FrEee.Modding.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Objects.Events; diff --git a/FrEee/Objects/Orders/ActivateAbilityOrder.cs b/FrEee/Objects/Orders/ActivateAbilityOrder.cs index cc4c3906..04ee2341 100644 --- a/FrEee/Objects/Orders/ActivateAbilityOrder.cs +++ b/FrEee/Objects/Orders/ActivateAbilityOrder.cs @@ -5,7 +5,7 @@ using FrEee.Objects.Space; using FrEee.Objects.Vehicles; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Objects/Orders/ColonizeOrder.cs b/FrEee/Objects/Orders/ColonizeOrder.cs index 0919038d..7035ee81 100644 --- a/FrEee/Objects/Orders/ColonizeOrder.cs +++ b/FrEee/Objects/Orders/ColonizeOrder.cs @@ -5,7 +5,7 @@ using FrEee.Objects.Space; using FrEee.Objects.Vehicles; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Orders/EvadeOrder.cs b/FrEee/Objects/Orders/EvadeOrder.cs index d50a54f9..1f381af0 100644 --- a/FrEee/Objects/Orders/EvadeOrder.cs +++ b/FrEee/Objects/Orders/EvadeOrder.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Orders/PathfindingOrder.cs b/FrEee/Objects/Orders/PathfindingOrder.cs index fe1e2272..58ccfef0 100644 --- a/FrEee/Objects/Orders/PathfindingOrder.cs +++ b/FrEee/Objects/Orders/PathfindingOrder.cs @@ -3,9 +3,9 @@ using FrEee.Objects.Civilization; using FrEee.Objects.LogMessages; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; -using System; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Objects/Orders/PursueOrder.cs b/FrEee/Objects/Orders/PursueOrder.cs index 70aad36e..6ff20990 100644 --- a/FrEee/Objects/Orders/PursueOrder.cs +++ b/FrEee/Objects/Orders/PursueOrder.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Orders/RecycleFacilityOrCargoOrder.cs b/FrEee/Objects/Orders/RecycleFacilityOrCargoOrder.cs index 974ff548..906025a7 100644 --- a/FrEee/Objects/Orders/RecycleFacilityOrCargoOrder.cs +++ b/FrEee/Objects/Orders/RecycleFacilityOrCargoOrder.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Civilization; using FrEee.Objects.LogMessages; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Objects/Orders/RecycleVehicleInSpaceOrder.cs b/FrEee/Objects/Orders/RecycleVehicleInSpaceOrder.cs index 6577d8a3..759657e0 100644 --- a/FrEee/Objects/Orders/RecycleVehicleInSpaceOrder.cs +++ b/FrEee/Objects/Orders/RecycleVehicleInSpaceOrder.cs @@ -3,7 +3,7 @@ using FrEee.Objects.LogMessages; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Objects/Orders/SentryOrder.cs b/FrEee/Objects/Orders/SentryOrder.cs index 6092b442..c3d5ee98 100644 --- a/FrEee/Objects/Orders/SentryOrder.cs +++ b/FrEee/Objects/Orders/SentryOrder.cs @@ -4,7 +4,7 @@ using FrEee.Objects.LogMessages; using FrEee.Objects.Space; using FrEee.Objects.Vehicles; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Orders/TransferCargoOrder.cs b/FrEee/Objects/Orders/TransferCargoOrder.cs index 504934a0..96c86b32 100644 --- a/FrEee/Objects/Orders/TransferCargoOrder.cs +++ b/FrEee/Objects/Orders/TransferCargoOrder.cs @@ -2,7 +2,7 @@ using FrEee.Objects.Civilization; using FrEee.Objects.LogMessages; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System.Collections.Generic; using System.Linq; diff --git a/FrEee/Objects/Space/Galaxy.cs b/FrEee/Objects/Space/Galaxy.cs index 1b8881af..ab5e2bc5 100644 --- a/FrEee/Objects/Space/Galaxy.cs +++ b/FrEee/Objects/Space/Galaxy.cs @@ -8,29 +8,27 @@ using FrEee.Objects.Commands; using FrEee.Objects.Events; using FrEee.Objects.LogMessages; -using FrEee.Objects.Vehicles; -using FrEee.Objects.VictoryConditions; using FrEee.Setup; using FrEee.Setup.WarpPointPlacementStrategies; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; using Microsoft.Scripting.Utils; using System; using System.Collections; using System.Collections.Generic; -using System.Configuration; using System.IO; using System.Linq; using System.Reflection; namespace FrEee.Objects.Space; - /// - /// Prevents IDs from being assigned to objects when calling AssignIDs. - /// TODO - move to utility namespace? - /// - public class DoNotAssignIDAttribute : Attribute +/// +/// Prevents IDs from being assigned to objects when calling AssignIDs. +/// TODO - move to utility namespace? +/// +public class DoNotAssignIDAttribute : Attribute { public DoNotAssignIDAttribute(bool recurse = true) { @@ -77,7 +75,7 @@ public Galaxy() /// /// The current galaxy. Shouldn't change except at loading a game or turn processing. /// - public static Galaxy Current { get; set; } + public static Galaxy? Current { get; set; } public AbilityTargets AbilityTarget { diff --git a/FrEee/Objects/Space/ObjectLocation.cs b/FrEee/Objects/Space/ObjectLocation.cs index 19d6ee2d..fbe3cc6a 100644 --- a/FrEee/Objects/Space/ObjectLocation.cs +++ b/FrEee/Objects/Space/ObjectLocation.cs @@ -1,4 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Drawing; @@ -41,7 +41,7 @@ public ObjectLocation(T item, Point location) return l1.Item.Equals(l2.Item) && l1.Location.Equals(l2.Location); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { return this == obj as ObjectLocation; } diff --git a/FrEee/Objects/Space/Sector.cs b/FrEee/Objects/Space/Sector.cs index 6f4dac23..27936e71 100644 --- a/FrEee/Objects/Space/Sector.cs +++ b/FrEee/Objects/Space/Sector.cs @@ -166,7 +166,7 @@ public IEnumerable SpaceObjects if (Empire.Current == null) result = result.Where(x => !x.IsMemory); - return result.ToArray(); + return result.ExceptNull().ToArray(); } } @@ -182,9 +182,9 @@ public IEnumerable SpaceObjects public static bool operator ==(Sector s1, Sector s2) { - if (s1.IsNull() && s2.IsNull()) + if (s1 is null && s2 is null) return true; - if (s1.IsNull() || s2.IsNull()) + if (s1 is null || s2 is null) return false; return s1.starSystem == s2.starSystem && s1.Coordinates == s2.Coordinates; } @@ -224,11 +224,10 @@ public Visibility CheckVisibility(Empire emp) throw new NotImplementedException(); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { - // TODO - upgrade equals to use "as" operator - if (obj is Sector) - return this == (Sector)obj; + if (obj is Sector s) + return this == s; return false; } diff --git a/FrEee/Objects/Space/StarSystem.cs b/FrEee/Objects/Space/StarSystem.cs index 1a9ad2f0..702dc549 100644 --- a/FrEee/Objects/Space/StarSystem.cs +++ b/FrEee/Objects/Space/StarSystem.cs @@ -3,14 +3,14 @@ using System.Drawing; using System.IO; using System.Linq; -using System.Reflection; using FrEee.Enumerations; using FrEee.Interfaces; using FrEee.Objects.Abilities; using FrEee.Objects.Civilization; using FrEee.Modding; using FrEee.Modding.Templates; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; namespace FrEee.Objects.Space; diff --git a/FrEee/Objects/Technology/ComponentReference.cs b/FrEee/Objects/Technology/ComponentReference.cs index 43574232..f4ee4fc9 100644 --- a/FrEee/Objects/Technology/ComponentReference.cs +++ b/FrEee/Objects/Technology/ComponentReference.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using FrEee.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; namespace FrEee.Objects.Technology; diff --git a/FrEee/Objects/Technology/FacilityUpgrade.cs b/FrEee/Objects/Technology/FacilityUpgrade.cs index 9b69b74f..bcca796c 100644 --- a/FrEee/Objects/Technology/FacilityUpgrade.cs +++ b/FrEee/Objects/Technology/FacilityUpgrade.cs @@ -90,7 +90,7 @@ public IEnumerable OlderVersions return x.SafeEquals(y); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var fu = obj as FacilityUpgrade; if (fu == null) diff --git a/FrEee/Objects/Technology/Hull.cs b/FrEee/Objects/Technology/Hull.cs index ea7c58ea..93d470f8 100644 --- a/FrEee/Objects/Technology/Hull.cs +++ b/FrEee/Objects/Technology/Hull.cs @@ -2,10 +2,10 @@ using FrEee.Interfaces; using FrEee.Objects.Abilities; using FrEee.Objects.Civilization; -using FrEee.Objects.Space; using FrEee.Objects.Vehicles; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; +using FrEee.Serialization; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Technology/Mount.cs b/FrEee/Objects/Technology/Mount.cs index b9215692..1a9f5608 100644 --- a/FrEee/Objects/Technology/Mount.cs +++ b/FrEee/Objects/Technology/Mount.cs @@ -2,10 +2,9 @@ using FrEee.Interfaces; using FrEee.Objects.Abilities; using FrEee.Objects.Civilization; -using FrEee.Objects.Space; using FrEee.Modding; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System.Collections.Generic; using System.Drawing; diff --git a/FrEee/Objects/Technology/MountedComponentTemplate.cs b/FrEee/Objects/Technology/MountedComponentTemplate.cs index 38543615..603b0a18 100644 --- a/FrEee/Objects/Technology/MountedComponentTemplate.cs +++ b/FrEee/Objects/Technology/MountedComponentTemplate.cs @@ -342,14 +342,14 @@ public int WeaponMinRange public static bool operator ==(MountedComponentTemplate t1, MountedComponentTemplate t2) { - if (t1.IsNull() && t2.IsNull()) + if (t1 is null && t2 is null) return true; - if (t1.IsNull() || t2.IsNull()) + if (t1 is null || t2 is null) return false; return t1.Container == t2.Container && t1.ComponentTemplate == t2.ComponentTemplate && t1.mount == t2.mount; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { // TODO - upgrade equals to use "as" operator if (obj is MountedComponentTemplate) diff --git a/FrEee/Objects/Technology/MountedComponentTemplateContainerPopulator.cs b/FrEee/Objects/Technology/MountedComponentTemplateContainerPopulator.cs index c8d9e6a0..06a2d8a4 100644 --- a/FrEee/Objects/Technology/MountedComponentTemplateContainerPopulator.cs +++ b/FrEee/Objects/Technology/MountedComponentTemplateContainerPopulator.cs @@ -1,12 +1,7 @@ -using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Objects.Technology; /// diff --git a/FrEee/Objects/Technology/Technology.cs b/FrEee/Objects/Technology/Technology.cs index 5028b3e8..52f90d39 100644 --- a/FrEee/Objects/Technology/Technology.cs +++ b/FrEee/Objects/Technology/Technology.cs @@ -4,7 +4,7 @@ using FrEee.Objects.Space; using FrEee.Modding; using FrEee.Modding.Interfaces; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Technology/TechnologyRequirement.cs b/FrEee/Objects/Technology/TechnologyRequirement.cs index 8259654f..5f1ce7c5 100644 --- a/FrEee/Objects/Technology/TechnologyRequirement.cs +++ b/FrEee/Objects/Technology/TechnologyRequirement.cs @@ -1,7 +1,7 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Modding; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using System; namespace FrEee.Objects.Technology; diff --git a/FrEee/Objects/Vehicles/Base.cs b/FrEee/Objects/Vehicles/Base.cs index 4c2e8da1..d233ca21 100644 --- a/FrEee/Objects/Vehicles/Base.cs +++ b/FrEee/Objects/Vehicles/Base.cs @@ -1,10 +1,6 @@ using FrEee.Enumerations; using FrEee.Interfaces; -using FrEee.Objects.Civilization; -using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; using System; -using System.Linq; namespace FrEee.Objects.Vehicles; diff --git a/FrEee/Objects/Vehicles/Design.cs b/FrEee/Objects/Vehicles/Design.cs index 3e4e72fc..b94c327b 100644 --- a/FrEee/Objects/Vehicles/Design.cs +++ b/FrEee/Objects/Vehicles/Design.cs @@ -739,7 +739,7 @@ public void Dispose() emp.KnownDesigns.Remove(this); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is Design d) { diff --git a/FrEee/Objects/Vehicles/Fighter.cs b/FrEee/Objects/Vehicles/Fighter.cs index da8ddbd9..3ded53e5 100644 --- a/FrEee/Objects/Vehicles/Fighter.cs +++ b/FrEee/Objects/Vehicles/Fighter.cs @@ -1,10 +1,9 @@ using FrEee.Enumerations; using FrEee.Interfaces; using FrEee.Objects.Civilization; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System; -using FrEee.Serialization; namespace FrEee.Objects.Vehicles; diff --git a/FrEee/Objects/Vehicles/MajorSpaceVehicle.cs b/FrEee/Objects/Vehicles/MajorSpaceVehicle.cs index e261f3ff..45c23f4e 100644 --- a/FrEee/Objects/Vehicles/MajorSpaceVehicle.cs +++ b/FrEee/Objects/Vehicles/MajorSpaceVehicle.cs @@ -7,8 +7,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Objects.Vehicles; diff --git a/FrEee/Objects/Vehicles/Ship.cs b/FrEee/Objects/Vehicles/Ship.cs index 82daf795..88c57776 100644 --- a/FrEee/Objects/Vehicles/Ship.cs +++ b/FrEee/Objects/Vehicles/Ship.cs @@ -1,8 +1,5 @@ using FrEee.Enumerations; -using FrEee.Interfaces; -using FrEee.Objects.Space; using System; -using System.Linq; namespace FrEee.Objects.Vehicles; diff --git a/FrEee/Objects/Vehicles/Troop.cs b/FrEee/Objects/Vehicles/Troop.cs index 87ac2f62..b057f940 100644 --- a/FrEee/Objects/Vehicles/Troop.cs +++ b/FrEee/Objects/Vehicles/Troop.cs @@ -2,7 +2,7 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Objects/Vehicles/WeaponPlatform.cs b/FrEee/Objects/Vehicles/WeaponPlatform.cs index 531f86ed..f6d4b2c7 100644 --- a/FrEee/Objects/Vehicles/WeaponPlatform.cs +++ b/FrEee/Objects/Vehicles/WeaponPlatform.cs @@ -2,7 +2,7 @@ using FrEee.Interfaces; using FrEee.Objects.Civilization; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Serialization; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Processes/TurnProcessor.cs b/FrEee/Processes/TurnProcessor.cs index 5580cca6..887c1ef5 100644 --- a/FrEee/Processes/TurnProcessor.cs +++ b/FrEee/Processes/TurnProcessor.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using FrEee.Interfaces; using FrEee.Objects.Civilization.Diplomacy.Clauses; using FrEee.Objects.Civilization; @@ -14,7 +12,7 @@ using FrEee.Objects.VictoryConditions; using FrEee.Modding; using FrEee.Extensions; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Enumerations; namespace FrEee.Processes; diff --git a/FrEee/Serialization/DataScalar.cs b/FrEee/Serialization/DataScalar.cs index 8a6114a3..750df1ef 100644 --- a/FrEee/Serialization/DataScalar.cs +++ b/FrEee/Serialization/DataScalar.cs @@ -1,5 +1,5 @@ using FrEee.Extensions; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using Newtonsoft.Json; using System; using System.Globalization; diff --git a/FrEee/Serialization/GalaxyReference.cs b/FrEee/Serialization/GalaxyReference.cs index 71f46de2..49d23a50 100644 --- a/FrEee/Serialization/GalaxyReference.cs +++ b/FrEee/Serialization/GalaxyReference.cs @@ -3,8 +3,7 @@ using FrEee.Extensions; using System; using System.Collections.Generic; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Serialization; /// @@ -143,14 +142,14 @@ public static implicit operator T(GalaxyReference r) public static bool operator ==(GalaxyReference r1, GalaxyReference r2) { - if (r1.IsNull() && r2.IsNull()) + if (r1 is null && r2 is null) return true; - if (r1.IsNull() || r2.IsNull()) + if (r1 is null || r2 is null) return false; return r1.ID == r2.ID; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { // TODO - upgrade equals to use "as" operator if (obj is GalaxyReference) diff --git a/FrEee/Serialization/IDataObject.cs b/FrEee/Serialization/IDataObject.cs index 5663340d..4b4fb0ba 100644 --- a/FrEee/Serialization/IDataObject.cs +++ b/FrEee/Serialization/IDataObject.cs @@ -1,5 +1,4 @@ -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Serialization; /// diff --git a/FrEee/Serialization/JsonContractResolver.cs b/FrEee/Serialization/JsonContractResolver.cs index 98b9b6be..4d0969b5 100644 --- a/FrEee/Serialization/JsonContractResolver.cs +++ b/FrEee/Serialization/JsonContractResolver.cs @@ -1,15 +1,12 @@ using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using System; -using System.Collections.Generic; using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization; - public class JsonContractResolver : DefaultContractResolver +public class JsonContractResolver : DefaultContractResolver { protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) diff --git a/FrEee/Serialization/JsonSerializer.cs b/FrEee/Serialization/JsonSerializer.cs index 097f31b9..626808b0 100644 --- a/FrEee/Serialization/JsonSerializer.cs +++ b/FrEee/Serialization/JsonSerializer.cs @@ -17,7 +17,7 @@ static JsonSerializer() MissingMemberHandling = MissingMemberHandling.Ignore, ObjectCreationHandling = ObjectCreationHandling.Auto, TypeNameHandling = TypeNameHandling.All, - TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple, + TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple, ContractResolver = new JsonContractResolver() }; } @@ -93,7 +93,7 @@ public string SerializeToString(object o) MissingMemberHandling = MissingMemberHandling.Ignore, ObjectCreationHandling = ObjectCreationHandling.Auto, TypeNameHandling = TypeNameHandling.None, - TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple, + TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple, ContractResolver = new JsonContractResolver() }; diff --git a/FrEee/Serialization/LegacySerializer.cs b/FrEee/Serialization/LegacySerializer.cs index 18728c39..5e4cba6f 100644 --- a/FrEee/Serialization/LegacySerializer.cs +++ b/FrEee/Serialization/LegacySerializer.cs @@ -1,5 +1,4 @@ using FrEee.Interfaces; -using FrEee.Objects.Civilization; using FrEee.Extensions; using FrEee.Serialization.Stringifiers; using System; @@ -14,8 +13,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Serialization; internal static class LegacySerializer @@ -185,7 +183,7 @@ private static object Deserialize(TextReader r, Type desiredType, bool isRoot, O type = new SafeType(typename).Type; } - catch (Exception ex) + catch { try { diff --git a/FrEee/Serialization/ObjectGraphParser.cs b/FrEee/Serialization/ObjectGraphParser.cs index b519d566..29181264 100644 --- a/FrEee/Serialization/ObjectGraphParser.cs +++ b/FrEee/Serialization/ObjectGraphParser.cs @@ -1,5 +1,5 @@ using FrEee.Extensions; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using System; using System.Collections; using System.Collections.Generic; diff --git a/FrEee/Serialization/Serializer.cs b/FrEee/Serialization/Serializer.cs index 04305b07..6a0e4a4a 100644 --- a/FrEee/Serialization/Serializer.cs +++ b/FrEee/Serialization/Serializer.cs @@ -2,7 +2,6 @@ using System; using System.IO; using System.Runtime.Serialization; -using System.Text; namespace FrEee.Serialization; diff --git a/FrEee/Serialization/SimpleDataObject.cs b/FrEee/Serialization/SimpleDataObject.cs index 6b22791e..de907ea0 100644 --- a/FrEee/Serialization/SimpleDataObject.cs +++ b/FrEee/Serialization/SimpleDataObject.cs @@ -1,5 +1,5 @@ using FrEee.Extensions; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using Newtonsoft.Json; using System; using static FrEee.Extensions.CommonExtensions; diff --git a/FrEee/Serialization/Stringifiers/DoubleLiteralFormulaStringifier.cs b/FrEee/Serialization/Stringifiers/DoubleLiteralFormulaStringifier.cs index 668a23c0..15625363 100644 --- a/FrEee/Serialization/Stringifiers/DoubleLiteralFormulaStringifier.cs +++ b/FrEee/Serialization/Stringifiers/DoubleLiteralFormulaStringifier.cs @@ -1,11 +1,5 @@ using FrEee.Modding; -using System; -using System.Collections.Generic; using System.ComponentModel.Composition; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/IStringifier.cs b/FrEee/Serialization/Stringifiers/IStringifier.cs index 4b5f1425..409a466b 100644 --- a/FrEee/Serialization/Stringifiers/IStringifier.cs +++ b/FrEee/Serialization/Stringifiers/IStringifier.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/IntLiteralFormulaStringifier.cs b/FrEee/Serialization/Stringifiers/IntLiteralFormulaStringifier.cs index f2157868..7e4fd077 100644 --- a/FrEee/Serialization/Stringifiers/IntLiteralFormulaStringifier.cs +++ b/FrEee/Serialization/Stringifiers/IntLiteralFormulaStringifier.cs @@ -1,11 +1,5 @@ using FrEee.Modding; -using System; -using System.Collections.Generic; using System.ComponentModel.Composition; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/PointStringifier.cs b/FrEee/Serialization/Stringifiers/PointStringifier.cs index a325b2f9..37cea331 100644 --- a/FrEee/Serialization/Stringifiers/PointStringifier.cs +++ b/FrEee/Serialization/Stringifiers/PointStringifier.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.ComponentModel.Composition; using System.Drawing; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/PopulationModifierStringifier.cs b/FrEee/Serialization/Stringifiers/PopulationModifierStringifier.cs index 8e37d6ae..895c56fd 100644 --- a/FrEee/Serialization/Stringifiers/PopulationModifierStringifier.cs +++ b/FrEee/Serialization/Stringifiers/PopulationModifierStringifier.cs @@ -1,11 +1,6 @@ using FrEee.Modding; -using System; -using System.Collections.Generic; using System.ComponentModel.Composition; -using System.Drawing; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/ResourceQuantityStringifier.cs b/FrEee/Serialization/Stringifiers/ResourceQuantityStringifier.cs index 12a24fa7..35e89993 100644 --- a/FrEee/Serialization/Stringifiers/ResourceQuantityStringifier.cs +++ b/FrEee/Serialization/Stringifiers/ResourceQuantityStringifier.cs @@ -1,12 +1,5 @@ -using FrEee.Modding; using FrEee.Utility; -using System; -using System.Collections.Generic; using System.ComponentModel.Composition; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/SizeStringifier.cs b/FrEee/Serialization/Stringifiers/SizeStringifier.cs index 3beedece..0b708bc5 100644 --- a/FrEee/Serialization/Stringifiers/SizeStringifier.cs +++ b/FrEee/Serialization/Stringifiers/SizeStringifier.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.ComponentModel.Composition; using System.Drawing; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/StringLiteralFormulaStringifier.cs b/FrEee/Serialization/Stringifiers/StringLiteralFormulaStringifier.cs index a84c8ae1..35dfffe0 100644 --- a/FrEee/Serialization/Stringifiers/StringLiteralFormulaStringifier.cs +++ b/FrEee/Serialization/Stringifiers/StringLiteralFormulaStringifier.cs @@ -1,11 +1,5 @@ using FrEee.Modding; -using System; -using System.Collections.Generic; using System.ComponentModel.Composition; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/Stringifier.cs b/FrEee/Serialization/Stringifiers/Stringifier.cs index 7478797f..23045452 100644 --- a/FrEee/Serialization/Stringifiers/Stringifier.cs +++ b/FrEee/Serialization/Stringifiers/Stringifier.cs @@ -1,9 +1,4 @@ -using FrEee.Objects.Space; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Serialization/Stringifiers/StringifierLibrary.cs b/FrEee/Serialization/Stringifiers/StringifierLibrary.cs index 30b4ed27..bcc27a6b 100644 --- a/FrEee/Serialization/Stringifiers/StringifierLibrary.cs +++ b/FrEee/Serialization/Stringifiers/StringifierLibrary.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Serialization.Stringifiers; diff --git a/FrEee/Setup/StarSystemPlacementStrategies/ClusteredStarSystemPlacementStrategy.cs b/FrEee/Setup/StarSystemPlacementStrategies/ClusteredStarSystemPlacementStrategy.cs index 9283a8ad..3ba463d9 100644 --- a/FrEee/Setup/StarSystemPlacementStrategies/ClusteredStarSystemPlacementStrategy.cs +++ b/FrEee/Setup/StarSystemPlacementStrategies/ClusteredStarSystemPlacementStrategy.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Setup/StarSystemPlacementStrategies/DiffuseStarSystemPlacementStrategy.cs b/FrEee/Setup/StarSystemPlacementStrategies/DiffuseStarSystemPlacementStrategy.cs index 1239b224..ec58d742 100644 --- a/FrEee/Setup/StarSystemPlacementStrategies/DiffuseStarSystemPlacementStrategy.cs +++ b/FrEee/Setup/StarSystemPlacementStrategies/DiffuseStarSystemPlacementStrategy.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Drawing; diff --git a/FrEee/Setup/StarSystemPlacementStrategies/GridStarSystemPlacementStrategy.cs b/FrEee/Setup/StarSystemPlacementStrategies/GridStarSystemPlacementStrategy.cs index 5fc07d66..077abc3a 100644 --- a/FrEee/Setup/StarSystemPlacementStrategies/GridStarSystemPlacementStrategy.cs +++ b/FrEee/Setup/StarSystemPlacementStrategies/GridStarSystemPlacementStrategy.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Drawing; diff --git a/FrEee/Setup/StarSystemPlacementStrategies/RandomStarSystemPlacementStrategy.cs b/FrEee/Setup/StarSystemPlacementStrategies/RandomStarSystemPlacementStrategy.cs index bf1c2301..159915f6 100644 --- a/FrEee/Setup/StarSystemPlacementStrategies/RandomStarSystemPlacementStrategy.cs +++ b/FrEee/Setup/StarSystemPlacementStrategies/RandomStarSystemPlacementStrategy.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Drawing; diff --git a/FrEee/Setup/StarSystemPlacementStrategies/SpiralStarSystemPlacementStrategy.cs b/FrEee/Setup/StarSystemPlacementStrategies/SpiralStarSystemPlacementStrategy.cs index 3b6fd3f4..916a9669 100644 --- a/FrEee/Setup/StarSystemPlacementStrategies/SpiralStarSystemPlacementStrategy.cs +++ b/FrEee/Setup/StarSystemPlacementStrategies/SpiralStarSystemPlacementStrategy.cs @@ -1,6 +1,6 @@ using FrEee.Interfaces; using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; using System.Collections.Generic; diff --git a/FrEee/Setup/WarpPointPlacementStrategies/RandomAlignedWarpPointPlacementStrategy.cs b/FrEee/Setup/WarpPointPlacementStrategies/RandomAlignedWarpPointPlacementStrategy.cs index e065c810..1f3d4ae9 100644 --- a/FrEee/Setup/WarpPointPlacementStrategies/RandomAlignedWarpPointPlacementStrategy.cs +++ b/FrEee/Setup/WarpPointPlacementStrategies/RandomAlignedWarpPointPlacementStrategy.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; +using FrEee.Utility; using FrEee.Extensions; using System; diff --git a/FrEee/Setup/WarpPointPlacementStrategies/RandomWarpPointPlacementStrategy.cs b/FrEee/Setup/WarpPointPlacementStrategies/RandomWarpPointPlacementStrategy.cs index add2acb5..0a7c6f8b 100644 --- a/FrEee/Setup/WarpPointPlacementStrategies/RandomWarpPointPlacementStrategy.cs +++ b/FrEee/Setup/WarpPointPlacementStrategies/RandomWarpPointPlacementStrategy.cs @@ -1,6 +1,5 @@ using FrEee.Objects.Space; -using FrEee.Utility; using FrEee.Serialization; - +using FrEee.Utility; namespace FrEee.Setup.WarpPointPlacementStrategies; /// diff --git a/FrEee/Utility/DynamicDictionary.cs b/FrEee/Utility/DynamicDictionary.cs index 03c7e982..da40dda0 100644 --- a/FrEee/Utility/DynamicDictionary.cs +++ b/FrEee/Utility/DynamicDictionary.cs @@ -141,14 +141,14 @@ public bool TryGetValue(object key, out object value) return true; } - public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value) + public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object? value) { var key = string.Join(",", indexes.Select(o => o.ToString()).ToArray()); dict[key] = value; return true; } - public override bool TrySetMember(SetMemberBinder binder, object value) + public override bool TrySetMember(SetMemberBinder binder, object? value) { dict[binder.Name] = value; return true; diff --git a/FrEee/Utility/IPopulator.cs b/FrEee/Utility/IPopulator.cs index 0ad7514d..b8ff9d01 100644 --- a/FrEee/Utility/IPopulator.cs +++ b/FrEee/Utility/IPopulator.cs @@ -1,10 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - namespace FrEee.Utility; public interface IPopulator diff --git a/FrEee/Utility/IntVector2.cs b/FrEee/Utility/IntVector2.cs index 8b953c62..d1c8819b 100644 --- a/FrEee/Utility/IntVector2.cs +++ b/FrEee/Utility/IntVector2.cs @@ -1,6 +1,5 @@ using FrEee.Extensions; using System; -using System.Collections; using System.Collections.Generic; using System.Linq; @@ -143,16 +142,16 @@ public int DistanceToManhattan(IntVector2 dest) return (dest - this).LengthManhattan; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is IntVector2 v) - return this.Equals(v); + return Equals(v); return false; } - public bool Equals(IntVector2 other) + public bool Equals(IntVector2? other) { - return X == other.X && Y == other.Y; + return other is not null && X == other.X && Y == other.Y; } public override int GetHashCode() diff --git a/FrEee/Utility/MathX.cs b/FrEee/Utility/MathX.cs index 68d3eb7e..a02017ef 100644 --- a/FrEee/Utility/MathX.cs +++ b/FrEee/Utility/MathX.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Utility; diff --git a/FrEee/Utility/PRNG.cs b/FrEee/Utility/PRNG.cs index 8440b39c..68a6874d 100644 --- a/FrEee/Utility/PRNG.cs +++ b/FrEee/Utility/PRNG.cs @@ -1,5 +1,4 @@ -using FrEee.Extensions; -using System; +using System; namespace FrEee.Utility; @@ -34,14 +33,14 @@ public PRNG(int seed) public static bool operator ==(PRNG r1, PRNG r2) { - if (r1.IsNull() && r2.IsNull()) + if (r1 is null && r2 is null) return true; - if (r1.IsNull() || r2.IsNull()) + if (r1 is null || r2 is null) return false; return r1.Seed == r2.Seed && r1.Iteration == r2.Iteration; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { // TODO - upgrade equals to use "as" operator if (obj is PRNG) diff --git a/FrEee/Utility/PopulateAttribute.cs b/FrEee/Utility/PopulateAttribute.cs index 82dcd39d..947f460f 100644 --- a/FrEee/Utility/PopulateAttribute.cs +++ b/FrEee/Utility/PopulateAttribute.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FrEee.Utility; diff --git a/FrEee/Utility/Resource.cs b/FrEee/Utility/Resource.cs index 70893c04..92d2b2d4 100644 --- a/FrEee/Utility/Resource.cs +++ b/FrEee/Utility/Resource.cs @@ -222,14 +222,14 @@ public static Resource Find(string name) public static bool operator ==(Resource r1, Resource r2) { - if (r1.IsNull() && r2.IsNull()) + if (r1 is null && r2 is null) return true; - if (r1.IsNull() || r2.IsNull()) + if (r1 is null || r2 is null) return false; return r1.Name == r2.Name && r1.Color == r2.Color && r1.IsGlobal == r2.IsGlobal && r1.IsLocal == r2.IsLocal && r1.PictureName == r2.PictureName; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var r = obj as Resource; if (ReferenceEquals(r, null)) diff --git a/FrEee/Utility/ResourceQuantity.cs b/FrEee/Utility/ResourceQuantity.cs index d4baa0c2..842e0ddc 100644 --- a/FrEee/Utility/ResourceQuantity.cs +++ b/FrEee/Utility/ResourceQuantity.cs @@ -126,9 +126,9 @@ public static ResourceQuantity Min(ResourceQuantity r1, ResourceQuantity r2) public static bool operator ==(ResourceQuantity r1, ResourceQuantity r2) { - if (r1.IsNull() && r2.IsNull()) + if (r1 is null && r2 is null) return true; - if (r1.IsNull() || r2.IsNull()) + if (r1 is null || r2 is null) return false; foreach (var key in r1.Keys.Union(r2.Keys)) { @@ -211,7 +211,7 @@ public int CompareTo(object obj) return this.Sum(kvp => kvp.Value).CompareTo(obj.ToString().ToInt()); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is ResourceQuantity rq) return this == rq;