Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sailro committed Apr 28, 2024
1 parent 1a5018f commit f19e356
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 34 deletions.
14 changes: 7 additions & 7 deletions ConsoleCommands/BaseListCommand.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using EFT.InventoryLogic;
using EFT.Trainer.Extensions;
using EFT.Trainer.Features;
using JsonType;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System;
using System.Linq;
using System.Text.RegularExpressions;
using Comfort.Common;
using EFT.Interactive;
using EFT.InventoryLogic;
using EFT.Trainer.Extensions;
using EFT.Trainer.Features;
using JsonType;

#nullable enable

namespace EFT.Trainer.ConsoleCommands;

internal abstract class BaseListCommand : LootItemsRelatedCommand
internal abstract class BaseListCommand : ConsoleCommandWithArgument
{
public override string Pattern => OptionalArgumentPattern;
protected virtual ELootRarity? Rarity => null;
Expand Down
2 changes: 1 addition & 1 deletion ConsoleCommands/BaseTemplateCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using EFT.InventoryLogic;
using System.Collections.Generic;
using System.Linq;
using Comfort.Common;
using EFT.InventoryLogic;

#nullable enable

Expand Down
7 changes: 3 additions & 4 deletions ConsoleCommands/BaseTrackCommand.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using EFT.Trainer.Configuration;
using EFT.Trainer.Extensions;
using System.Text.RegularExpressions;
using EFT.Trainer.Configuration;
using JsonType;
using System.Text.RegularExpressions;
using UnityEngine;

#nullable enable

namespace EFT.Trainer.ConsoleCommands;

internal abstract class BaseTrackCommand : LootItemsRelatedCommand
internal abstract class BaseTrackCommand : ConsoleCommandWithArgument
{
private static string ColorNames => string.Join("|", ColorConverter.ColorNames());
public override string Pattern => $"(?<{ValueGroup}>.+?)(?<{ExtraGroup}> ({ColorNames}|\\[[\\.,\\d ]*\\]{{1}}))?";
Expand Down
2 changes: 1 addition & 1 deletion ConsoleCommands/BaseTrackListCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace EFT.Trainer.ConsoleCommands;

internal abstract class BaseTrackListCommand : LootItemsRelatedCommand
internal abstract class BaseTrackListCommand : ConsoleCommandWithArgument
{
public override string Pattern => RequiredArgumentPattern;

Expand Down
6 changes: 5 additions & 1 deletion ConsoleCommands/ConsoleCommand.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using EFT.UI;
using System;
using EFT.UI;

#nullable enable

namespace EFT.Trainer.ConsoleCommands;

internal abstract class ConsoleCommand
{
private readonly Lazy<Features.LootItems> _lootItems = new(() => Features.FeatureFactory.GetFeature<Features.LootItems>()!);
protected Features.LootItems LootItemsFeature => _lootItems.Value;

public abstract string Name { get; }

internal void AddConsoleLog(string log)
Expand Down
1 change: 0 additions & 1 deletion ConsoleCommands/List.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using JetBrains.Annotations;
using JsonType;

#nullable enable

Expand Down
11 changes: 0 additions & 11 deletions ConsoleCommands/LootItemsRelatedCommand.cs

This file was deleted.

8 changes: 1 addition & 7 deletions ConsoleCommands/TrackList.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using EFT.Trainer.Extensions;
using EFT.Trainer.Extensions;
using JetBrains.Annotations;

#nullable enable
Expand All @@ -11,11 +10,6 @@ internal class TrackList : ConsoleCommandWithoutArgument
{
public override string Name => "tracklist";

// Unfortunately we cannot use BaseTrackCommand or LootItemsRelatedCommand here
private readonly Lazy<Features.LootItems> _lootItems = new(() => Features.FeatureFactory.GetFeature<Features.LootItems>()!);
private Features.LootItems LootItems => _lootItems.Value;


public override void Execute()
{
ShowTrackList(this, LootItems);
Expand Down
1 change: 0 additions & 1 deletion NLog.EFT.Trainer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
<Compile Include="ConsoleCommands\ListRare.cs" />
<Compile Include="ConsoleCommands\ListSuperRare.cs" />
<Compile Include="ConsoleCommands\LoadTrackList.cs" />
<Compile Include="ConsoleCommands\LootItemsRelatedCommand.cs" />
<Compile Include="ConsoleCommands\SaveTrackList.cs" />
<Compile Include="ConsoleCommands\Spawn.cs" />
<Compile Include="ConsoleCommands\Status.cs" />
Expand Down

0 comments on commit f19e356

Please sign in to comment.