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

Release 0.9.9.52 #839

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Daybreak.GWCA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif()
set(VERSION_MAJOR 0)
set(VERSION_MINOR 9)
set(VERSION_PATCH 9)
set(VERSION_TWEAK 48)
set(VERSION_TWEAK 52)

set(VERSION_RC "${CMAKE_CURRENT_BINARY_DIR}/version.rc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in" "${VERSION_RC}" @ONLY)
Expand Down
79 changes: 0 additions & 79 deletions Daybreak.Tests/Services/JsonLoggerProviderTests.cs

This file was deleted.

10 changes: 0 additions & 10 deletions Daybreak/Configuration/Options/ILiteCollectionOptions.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Daybreak/Configuration/Options/LoggingOptions.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Daybreak/Configuration/Options/NotificationStorageOptions.cs

This file was deleted.

7 changes: 2 additions & 5 deletions Daybreak/Configuration/Options/PriceHistoryOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Daybreak.Attributes;
using Daybreak.Services.TradeChat.Models;
using System;
using System.Collections.Generic;

Expand All @@ -8,13 +7,11 @@ namespace Daybreak.Configuration.Options;
[OptionsName(Name = "Price History")]
[OptionsIgnore]
[OptionsSynchronizationIgnore]
internal sealed class PriceHistoryOptions : ILiteCollectionOptions<TraderQuoteDTO>
internal sealed class PriceHistoryOptions
{
public string HttpsUri { get; set; } = "https://kamadan.gwtoolbox.com/";

public string CollectionName => "price_history";

public TimeSpan UpdateInterval { get; set; } = TimeSpan.FromHours(1);

public Dictionary<string, DateTime> PriceHistoryMetadata { get; set; } = [];
public Dictionary<string, DateTime> PricingHistoryMetadata { get; set; } = [];
}
11 changes: 0 additions & 11 deletions Daybreak/Configuration/Options/TraderMessagesOptions.cs

This file was deleted.

17 changes: 7 additions & 10 deletions Daybreak/Configuration/ProjectConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Microsoft.Extensions.Logging;
using Slim;
using System.Extensions;
using LiteDB;
using Daybreak.Services.Options;
using Daybreak.Models;
using Microsoft.CorrelationVector;
Expand Down Expand Up @@ -90,6 +89,8 @@
using Daybreak.Launch;
using Daybreak.Utils;
using Daybreak.Views.Installation;
using Realms;
using Daybreak.Services.Logging.Models;

namespace Daybreak.Configuration;

Expand Down Expand Up @@ -137,7 +138,6 @@ public override void RegisterServices(IServiceCollection services)
services.AddSingleton<IPostUpdateActionProvider>(sp => sp.GetRequiredService<PostUpdateActionManager>());
services.AddSingleton<IMenuService, MenuService>();
services.AddSingleton<IMenuServiceInitializer, MenuService>(sp => sp.GetRequiredService<IMenuService>().Cast<MenuService>());
services.AddSingleton<ILiteDatabase, LiteDatabase>(sp => new LiteDatabase(PathUtils.GetAbsolutePathFromRoot("Daybreak.db")));
services.AddSingleton<IMutexHandler, MutexHandler>();
services.AddSingleton<IShortcutManager, ShortcutManager>();
services.AddSingleton<IMetricsService, MetricsService>();
Expand Down Expand Up @@ -287,10 +287,10 @@ public override void RegisterStartupActions(IStartupActionProducer startupAction
startupActionProducer.RegisterAction<RenameInstallerAction>();
startupActionProducer.RegisterAction<FixSymbolicLinkStartupAction>();
startupActionProducer.RegisterAction<UpdateUModAction>();
startupActionProducer.RegisterAction<FixPriceHistoryEntries>();
startupActionProducer.RegisterAction<CredentialsOptionsMigrator>();
startupActionProducer.RegisterAction<BrowserHistorySizeEnforcer>();
startupActionProducer.RegisterAction<CleanupDatabases>();
startupActionProducer.RegisterAction<DeleteOldDatabase>();
}

public override void RegisterPostUpdateActions(IPostUpdateActionProducer postUpdateActionProducer)
Expand Down Expand Up @@ -371,13 +371,10 @@ public override void RegisterOptions(IOptionsProducer optionsProducer)
optionsProducer.RegisterOptions<ScreenManagerOptions>();
optionsProducer.RegisterOptions<KamadanTradeChatOptions>();
optionsProducer.RegisterOptions<AscalonTradeChatOptions>();
optionsProducer.RegisterOptions<LoggingOptions>();
optionsProducer.RegisterOptions<PriceHistoryOptions>();
optionsProducer.RegisterOptions<TraderQuotesOptions>();
optionsProducer.RegisterOptions<PathfindingOptions>();
optionsProducer.RegisterOptions<NotificationStorageOptions>();
optionsProducer.RegisterOptions<TradeAlertingOptions>();
optionsProducer.RegisterOptions<TraderMessagesOptions>();
optionsProducer.RegisterOptions<EventNotifierOptions>();
optionsProducer.RegisterOptions<PluginsServiceOptions>();
optionsProducer.RegisterOptions<GuildwarsExecutableOptions>();
Expand Down Expand Up @@ -426,10 +423,10 @@ public override void RegisterLaunchArgumentHandlers(IArgumentHandlerProducer arg

private void RegisterLiteCollections(IServiceCollection services)
{
this.RegisterLiteCollection<Models.Log, LoggingOptions>(services);
this.RegisterLiteCollection<TraderQuoteDTO, PriceHistoryOptions>(services);
this.RegisterLiteCollection<NotificationDTO, NotificationStorageOptions>(services);
this.RegisterLiteCollection<TraderMessageDTO, TraderMessagesOptions>(services);
this.RegisterCollection<LogDTO>(services);
this.RegisterCollection<TraderQuoteDTO>(services);
this.RegisterCollection<NotificationDTO>(services);
this.RegisterCollection<TraderMessageDTO>(services);
}

private IServiceCollection RegisterHttpClients(IServiceCollection services)
Expand Down
10 changes: 5 additions & 5 deletions Daybreak/Daybreak.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<LangVersion>preview</LangVersion>
<ApplicationIcon>Daybreak.ico</ApplicationIcon>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
<Version>0.9.9.51</Version>
<Version>0.9.9.52</Version>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<UserSecretsId>cfb2a489-db80-448d-a969-80270f314c46</UserSecretsId>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
Expand Down Expand Up @@ -95,19 +95,19 @@
<PackageReference Include="DiffPlex" Version="1.7.2" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.67" />
<PackageReference Include="ini-parser-netstandard" Version="2.5.2" />
<PackageReference Include="LiteDB" Version="5.0.20" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.WPF" Version="2.0.0-rc2" />
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
<PackageReference Include="Microsoft.CorrelationVector" Version="1.0.42" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2792.45" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2849.39" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
<PackageReference Include="NAudio" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="PeNet" Version="4.1.0" />
<PackageReference Include="Plumsy" Version="1.1.0" />
<PackageReference Include="Realm" Version="20.0.0" />
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
<PackageReference Include="SharpNav" Version="0.9.2" />
<PackageReference Include="Slim" Version="1.9.2" />
Expand All @@ -120,8 +120,8 @@
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="SystemExtensions.NetCore" Version="1.6.9" />
<PackageReference Include="SystemExtensions.NetStandard" Version="1.6.9" />
<PackageReference Include="SystemExtensions.NetCore" Version="1.6.11" />
<PackageReference Include="SystemExtensions.NetStandard" Version="1.6.11" />
<PackageReference Include="SystemExtensions.NetStandard.DependencyInjection" Version="1.6.9" />
<PackageReference Include="WpfExtended" Version="0.7.7" />
<PackageReference Include="WpfExtended.SourceGeneration" Version="0.3.0" />
Expand Down
3 changes: 3 additions & 0 deletions Daybreak/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Realm />
</Weavers>
2 changes: 1 addition & 1 deletion Daybreak/Models/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public sealed class Log
public LogLevel LogLevel { get; set; }
public string? CorrelationVector { get; set; }
public string? EventId { get; set; }
public DateTime LogTime { get; set; }
public DateTimeOffset LogTime { get; set; }
}
17 changes: 7 additions & 10 deletions Daybreak/Models/Plugins/PluginConfigurationBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Daybreak.Configuration.Options;
using Daybreak.Services.ApplicationArguments;
using Daybreak.Services.ApplicationArguments;
using Daybreak.Services.Browser;
using Daybreak.Services.Database;
using Daybreak.Services.Drawing;
using Daybreak.Services.Metrics;
using Daybreak.Services.Mods;
Expand All @@ -10,11 +10,10 @@
using Daybreak.Services.Startup;
using Daybreak.Services.Updater.PostUpdate;
using Daybreak.Utils;
using LiteDB;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Http.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Realms;
using Slim;
using System.Core.Extensions;
using System.Net.Http;
Expand Down Expand Up @@ -43,14 +42,12 @@ public PluginConfigurationBase()
{
}

public void RegisterLiteCollection<TCollectionType, TOptionsType>(IServiceCollection services)
where TOptionsType : class, ILiteCollectionOptions<TCollectionType>
public void RegisterCollection<TCollectionType>(IServiceCollection services)
where TCollectionType : RealmObject, new()
{
services.AddSingleton(sp =>
services.AddScoped<IDatabaseCollection<TCollectionType>>(sp =>
{
var options = sp.GetRequiredService<IOptions<TOptionsType>>();
var liteDatabase = sp.GetRequiredService<ILiteDatabase>();
return liteDatabase.GetCollection<TCollectionType>(options.Value.CollectionName, BsonAutoId.Int64);
return new RealmDatabaseCollection<TCollectionType>();
});
}

Expand Down
25 changes: 25 additions & 0 deletions Daybreak/Services/Database/IDatabaseCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Daybreak.Services.Database;

public interface IDatabaseCollection<TObject>
where TObject : new()
{
long Count();

bool Add(TObject value);

bool AddBulk(IEnumerable<TObject> value);

bool Update(TObject value);

void Delete(TObject obj);

void DeleteAll();

IEnumerable<TObject> FindAll();

IEnumerable<TObject> FindAll(Expression<Func<TObject, bool>> filter);
}
Loading
Loading