Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.8 #17

Merged
merged 8 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix EML integration detection, include .editorconfig
  • Loading branch information
krzychu124 committed Nov 20, 2022
commit 4631360981a86ee8af78674ec24d12b43b82bc34
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

[*]

# Microsoft .NET properties
csharp_indent_braces = false
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_open_brace = accessors,events,indexers,properties
csharp_preferred_modifier_order = private, protected, public, virtual, volatile, abstract, internal, override, sealed, new, static, extern, unsafe, readonly, async:suggestion
csharp_preserve_single_line_blocks = true

# ReSharper properties
resharper_align_multiline_parameter = true
resharper_arguments_literal = positional
resharper_blank_lines_around_auto_property = 0
resharper_braces_for_for = required
resharper_csharp_align_multiline_binary_expressions_chain = true
resharper_csharp_blank_lines_around_invocable = 0
resharper_csharp_insert_final_newline = false
resharper_csharp_max_line_length = 286
resharper_csharp_wrap_parameters_style = chop_if_long
resharper_instance_members_qualify_declared_in =
resharper_keep_existing_embedded_block_arrangement = false
resharper_keep_existing_enum_arrangement = false
resharper_place_expr_property_on_single_line = true
resharper_remove_blank_lines_near_braces_in_declarations = false
resharper_space_within_single_line_array_initializer_braces = false
resharper_wrap_before_declaration_rpar = false
resharper_wrap_object_and_collection_initializer_style = wrap_if_long
5 changes: 3 additions & 2 deletions BrokenNodeDetector/BrokenNodeDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
using BrokenNodeDetector.UI;
using CitiesHarmony.API;
using ColossalFramework.UI;
using JetBrains.Annotations;
using UnityEngine;

namespace BrokenNodeDetector
{
public class BrokenNodeDetector : IUserMod {
public static readonly string Version = "0.7.1";
public static readonly string Version = "0.7.2";

public string Name => "Broken Node Detector " + Version;

public string Description => "Search for broken nodes when TM:PE vehicles despawn.";
public string Description => "Search for broken nodes when TM:PE vehicles despawn and more.";
#if TEST_UI
private MainUI _testUI;
#endif
Expand Down
3 changes: 2 additions & 1 deletion BrokenNodeDetector/BrokenNodeDetector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<Compile Include="UI\Tools\BndColorAnimator.cs" />
<Compile Include="UI\Tools\StuckCimsTool\StuckCims.cs" />
<Compile Include="UI\Tools\UIHelpers.cs" />
<Compile Include="UI\Tools\Utils\EMLUtisl.cs" />
<Compile Include="UI\Tools\Utils\UnityExtensions.cs" />
</ItemGroup>
<ItemGroup>
Expand All @@ -90,7 +91,7 @@
<Reference Include="EManagersLib.API">
<HintPath>..\Dependencies\EManagersLib.API.dll</HintPath>
</Reference>
<Reference Include="ICities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="ICities, Version=1.15.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\Dependencies\ICities.dll</HintPath>
</Reference>
<Reference Include="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Expand Down
9 changes: 8 additions & 1 deletion BrokenNodeDetector/UI/SettingsUI.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using BrokenNodeDetector.UI.Tools.Utils;
using ColossalFramework;
using ColossalFramework.UI;
using EManagersLib.API;
Expand All @@ -13,6 +14,7 @@ namespace BrokenNodeDetector.UI {
public class SettingsUI {
private const float ROW_WIDTH = 744f - 15f;
private const float ROW_HEIGHT = 34f;
private bool? _emlInstalled;

private SavedInputKey _currentlyEditingBinding;

Expand All @@ -25,7 +27,12 @@ public class SettingsUI {
UIHelperBase group2 = helper.AddGroup("Other");
UIPanel panel2 = CreateRowPanel((UIPanel) ((UIHelper) group2).self);
CreateResetMenuPosition(panel2);
CreateLabel(panel2, $"EML integration active: {(PropAPI.m_isEMLInstalled ? "<color #00FF00>Yes</color>" : "No")}", 1f, true);

if (!_emlInstalled.HasValue) {
_emlInstalled = EmlUtils.IsEmlInstalled();
}

CreateLabel(panel2, $"EML integration active: {(_emlInstalled.Value ? "<color #00FF00>Yes</color>" : "No")}", 1f, true);
panel2.autoLayoutDirection = LayoutDirection.Vertical;
panel2.autoLayoutPadding = new RectOffset(0, 0, 10, 10);
panel2.autoSize = true;
Expand Down
3 changes: 2 additions & 1 deletion BrokenNodeDetector/UI/Tools/DetectorFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ namespace BrokenNodeDetector.UI.Tools {
public class DetectorFactory : IDisposable {
private List<Detector> _detectors;

public DetectorFactory() {
public DetectorFactory() {
PropAPI.Initialize();
_detectors = new List<Detector> {
new BrokenNodes(),
new GhostNodes(),
Expand Down
23 changes: 23 additions & 0 deletions BrokenNodeDetector/UI/Tools/Utils/EMLUtisl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Reflection;
using ColossalFramework;
using ColossalFramework.Plugins;

namespace BrokenNodeDetector.UI.Tools.Utils {
public class EmlUtils {
internal static bool IsEmlInstalled() {
foreach (PluginManager.PluginInfo pluginInfo in Singleton<PluginManager>.instance.GetPluginsInfo()) {
try {
foreach (Assembly assembly in pluginInfo.GetAssemblies()) {
bool flag = assembly.GetName().Name.ToLower().Equals("emanagerslib");
if (flag) {
return pluginInfo.isEnabled;
}
}
} catch {
// ignore
}
}
return false;
}
}
}