refactoring
This commit is contained in:
parent
696fd07e86
commit
50d32abd49
20 changed files with 334 additions and 225 deletions
|
|
@ -1,29 +0,0 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Poe2Trade.Core;
|
||||
|
||||
public class AppConfig
|
||||
{
|
||||
public List<string> TradeUrls { get; set; } = [];
|
||||
public string Poe2LogPath { get; set; } = @"C:\Program Files (x86)\Steam\steamapps\common\Path of Exile 2\logs\Client.txt";
|
||||
public string Poe2WindowTitle { get; set; } = "Path of Exile 2";
|
||||
public string BrowserUserDataDir { get; set; } = "./browser-data";
|
||||
public int TravelTimeoutMs { get; set; } = 15000;
|
||||
public int StashScanTimeoutMs { get; set; } = 10000;
|
||||
public int WaitForMoreItemsMs { get; set; } = 20000;
|
||||
public int BetweenTradesDelayMs { get; set; } = 5000;
|
||||
|
||||
public static AppConfig Load(string? configPath = null)
|
||||
{
|
||||
var builder = new ConfigurationBuilder();
|
||||
var path = configPath ?? "appsettings.json";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
builder.AddJsonFile(path, optional: true);
|
||||
}
|
||||
var configuration = builder.Build();
|
||||
var config = new AppConfig();
|
||||
configuration.Bind(config);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
12
src/Poe2Trade.Core/Delays.cs
Normal file
12
src/Poe2Trade.Core/Delays.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
namespace Poe2Trade.Core;
|
||||
|
||||
public static class Delays
|
||||
{
|
||||
public const int PostFocus = 300;
|
||||
public const int PostTravel = 1500;
|
||||
public const int PostStashOpen = 1000;
|
||||
public const int ClickInterval = 150;
|
||||
public const int PostEscape = 500;
|
||||
public const int PageLoad = 2000;
|
||||
public const int EmptyRefreshWait = 5000;
|
||||
}
|
||||
|
|
@ -8,9 +8,6 @@
|
|||
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue