Skip to content

Commit

Permalink
Update to api 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Olaren15 committed Jul 2, 2024
1 parent 2bd991a commit 5c1322e
Show file tree
Hide file tree
Showing 20 changed files with 147 additions and 109 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ItemGroup>
<PackageReference
Include="SonarAnalyzer.CSharp"
Version="9.25.1.91650"
Version="9.28.0.94264"
PrivateAssets="all"
Condition="$(MSBuildProjectExtension) == '.csproj'"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace EasyTranslate.DalamudPlugin.Configuration;

public static class DalamudPluginModule
{
public static ServiceProvider CreateServiceProvider(DalamudPluginInterface pluginInterface)
public static ServiceProvider CreateServiceProvider(IDalamudPluginInterface pluginInterface)

Check failure on line 16 in EasyTranslate.DalamudPlugin/Configuration/DalamudPluginModule.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IDalamudPluginInterface' could not be found (are you missing a using directive or an assembly reference?)
{
return new ServiceCollection()
.AddDalamudServices(pluginInterface)
Expand All @@ -25,7 +25,7 @@ public static ServiceProvider CreateServiceProvider(DalamudPluginInterface plugi

private static IServiceCollection AddDalamudServices(
this IServiceCollection serviceCollection,
DalamudPluginInterface pluginInterface
IDalamudPluginInterface pluginInterface

Check failure on line 28 in EasyTranslate.DalamudPlugin/Configuration/DalamudPluginModule.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IDalamudPluginInterface' could not be found (are you missing a using directive or an assembly reference?)
)
{
return serviceCollection
Expand Down Expand Up @@ -67,7 +67,7 @@ private static IServiceCollection AddDalamudService<T>(this IServiceCollection s
serviceCollection.AddSingleton(
serviceProvider =>
{
DalamudPluginInterface? pluginInterface = serviceProvider.GetService<DalamudPluginInterface>();
IDalamudPluginInterface? pluginInterface = serviceProvider.GetService<IDalamudPluginInterface>();
DalamudServiceWrapper<T> wrapper = new(pluginInterface!);
return wrapper.Service;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ namespace EasyTranslate.DalamudPlugin.Configuration;

public class DalamudServiceWrapper<T>
{
public DalamudServiceWrapper(DalamudPluginInterface pluginInterface)
public DalamudServiceWrapper(IDalamudPluginInterface pluginInterface)

Check failure on line 10 in EasyTranslate.DalamudPlugin/Configuration/DalamudServiceWrapper.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IDalamudPluginInterface' could not be found (are you missing a using directive or an assembly reference?)
{
pluginInterface.Inject(this);
}

[PluginService]
[RequiredVersion("1.0")]
public T Service { get; init; }
[PluginService] public T Service { get; init; }
}
7 changes: 3 additions & 4 deletions EasyTranslate.DalamudPlugin/EasyTranslatePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Reflection;
using Dalamud.Interface;
using Dalamud.Interface.Windowing;
using Dalamud.IoC;
using Dalamud.Plugin;
using EasyTranslate.DalamudPlugin.Attributes;
using EasyTranslate.DalamudPlugin.Configuration;
Expand All @@ -15,14 +14,14 @@ namespace EasyTranslate.DalamudPlugin;
public sealed class EasyTranslatePlugin : IDalamudPlugin
{
private readonly ServiceProvider _serviceProvider;
private readonly UiBuilder _uiBuilder;
private readonly IUiBuilder _uiBuilder;

Check failure on line 17 in EasyTranslate.DalamudPlugin/EasyTranslatePlugin.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IUiBuilder' could not be found (are you missing a using directive or an assembly reference?)
private readonly WindowSystem _windowSystem;

public EasyTranslatePlugin([RequiredVersion("1.0")] DalamudPluginInterface pluginInterface)
public EasyTranslatePlugin(IDalamudPluginInterface pluginInterface)

Check failure on line 20 in EasyTranslate.DalamudPlugin/EasyTranslatePlugin.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IDalamudPluginInterface' could not be found (are you missing a using directive or an assembly reference?)
{
_serviceProvider = DalamudPluginModule.CreateServiceProvider(pluginInterface);
_windowSystem = _serviceProvider.GetService<WindowSystem>()!;
_uiBuilder = _serviceProvider.GetService<UiBuilder>()!;
_uiBuilder = _serviceProvider.GetService<IUiBuilder>()!;

_uiBuilder.Draw += _windowSystem.Draw;

Expand Down
4 changes: 2 additions & 2 deletions EasyTranslate.DalamudPlugin/Localisation/LanguageSwitcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace EasyTranslate.DalamudPlugin.Localisation;

public sealed class LanguageSwitcher : IDisposable
{
private readonly DalamudPluginInterface _pluginInterface;
private readonly IDalamudPluginInterface _pluginInterface;

Check failure on line 10 in EasyTranslate.DalamudPlugin/Localisation/LanguageSwitcher.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IDalamudPluginInterface' could not be found (are you missing a using directive or an assembly reference?)

public LanguageSwitcher(DalamudPluginInterface pluginInterface)
public LanguageSwitcher(IDalamudPluginInterface pluginInterface)

Check failure on line 12 in EasyTranslate.DalamudPlugin/Localisation/LanguageSwitcher.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IDalamudPluginInterface' could not be found (are you missing a using directive or an assembly reference?)
{
_pluginInterface = pluginInterface;

Expand Down
2 changes: 1 addition & 1 deletion EasyTranslate.DalamudPlugin/Search/ContentMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private PresentableContent ConvertToPresentableItem(Content content)
return new PresentableContent(
content.Type,
content.IconId,
content.IconId.HasValue ? textureProvider.GetIcon(content.IconId.Value) : null,
content.IconId.HasValue ? textureProvider.GetFromGameIcon(content.IconId.Value) : null,
content.EnglishName,
content.FrenchName,
content.GermanName,
Expand Down
4 changes: 2 additions & 2 deletions EasyTranslate.DalamudPlugin/Search/PresentableContent.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures;
using EasyTranslate.Domain.Entities;

namespace EasyTranslate.DalamudPlugin.Search;

public record PresentableContent(
ContentType Type,
uint? IconId,
IDalamudTextureWrap? IconTexture,
ISharedImmediateTexture? IconTexture,
string EnglishName,
string FrenchName,
string GermanName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private MenuItem CreateMenuItem()
};
}

private void SearchTranslations(MenuItemClickedArgs menuItemClickedArgs)
private void SearchTranslations(IMenuItemClickedArgs menuItemClickedArgs)
{
if (menuItemClickedArgs.MenuType != ContextMenuType.Inventory)
{
Expand Down
9 changes: 5 additions & 4 deletions EasyTranslate.DalamudPlugin/Search/SearchView.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Numerics;
using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.TextureWraps;

Check failure on line 4 in EasyTranslate.DalamudPlugin/Search/SearchView.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'TextureWraps' does not exist in the namespace 'Dalamud.Interface.Textures' (are you missing an assembly reference?)
using Dalamud.Interface.Windowing;
using EasyTranslate.DalamudPlugin.Localisation;
using EasyTranslate.DalamudPlugin.Resources;
Expand All @@ -13,14 +13,14 @@ public sealed class SearchView : Window, IDisposable
{
private const int MaxImageSize = 80;
private readonly SearchViewModel _searchViewModel;
private readonly UiBuilder _uiBuilder;
private readonly IUiBuilder _uiBuilder;
private readonly WindowSystem _windowSystem;

private bool _windowJustOpened;

public SearchView(
SearchViewModel searchViewModel,
UiBuilder uiBuilder,
IUiBuilder uiBuilder,
WindowSystem windowSystem,
LanguageSwitcher languageSwitcher
) : base(Strings.SearchWindowTitle)
Expand Down Expand Up @@ -126,7 +126,8 @@ private void DrawSearchResults()
ImGui.TableNextColumn();
if (searchResult.IconTexture is not null)
{
ImGui.Image(searchResult.IconTexture.ImGuiHandle, CalculateImageSize(searchResult.IconTexture));
IDalamudTextureWrap textureWrap = searchResult.IconTexture.GetWrapOrEmpty();
ImGui.Image(textureWrap.ImGuiHandle, CalculateImageSize(textureWrap));
}

ImGui.TableNextColumn();
Expand Down
4 changes: 2 additions & 2 deletions EasyTranslate.DalamudPlugin/Settings/SettingsView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ namespace EasyTranslate.DalamudPlugin.Settings;
public sealed class SettingsView : Window, IDisposable
{
private readonly SettingsViewModel _settingsViewModel;
private readonly UiBuilder _uiBuilder;
private readonly IUiBuilder _uiBuilder;
private readonly WindowSystem _windowSystem;

public SettingsView(
SettingsViewModel settingsViewModel,
UiBuilder uiBuilder,
IUiBuilder uiBuilder,
WindowSystem windowSystem,
LanguageSwitcher languageSwitcher
) : base(Strings.SettingsWindowTitle)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dalamud;
using Dalamud.Game;
using Dalamud.Game.Config;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
Expand All @@ -9,11 +9,11 @@ namespace EasyTranslate.DalamudPlugin.Settings;
public class UserSettingsRepository
{
private readonly IGameConfig _gameConfig;
private readonly DalamudPluginInterface _pluginInterface;
private readonly IDalamudPluginInterface _pluginInterface;

Check failure on line 12 in EasyTranslate.DalamudPlugin/Settings/UserSettingsRepository.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IDalamudPluginInterface' could not be found (are you missing a using directive or an assembly reference?)

private UserSettings _userSettings;

public UserSettingsRepository(DalamudPluginInterface pluginInterface, IGameConfig gameConfig)
public UserSettingsRepository(IDalamudPluginInterface pluginInterface, IGameConfig gameConfig)

Check failure on line 16 in EasyTranslate.DalamudPlugin/Settings/UserSettingsRepository.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IDalamudPluginInterface' could not be found (are you missing a using directive or an assembly reference?)
{
_gameConfig = gameConfig;
_pluginInterface = pluginInterface;
Expand Down
12 changes: 6 additions & 6 deletions EasyTranslate.DalamudPlugin/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"net8.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[2.1.12, )",
"resolved": "2.1.12",
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
"requested": "[2.1.13, )",
"resolved": "2.1.13",
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
},
"Microsoft.Extensions.DependencyInjection": {
"type": "Direct",
Expand All @@ -19,9 +19,9 @@
},
"SonarAnalyzer.CSharp": {
"type": "Direct",
"requested": "[9.25.1.91650, )",
"resolved": "9.25.1.91650",
"contentHash": "Z1/H8vGk2FZ8m6TK++A1Tn5npEw0L0ZNVAgf0aPI/nkq4mTER+enRZcgrkhdSo1mGbFDFgEh5ym/j3Onk6mROA=="
"requested": "[9.28.0.94264, )",
"resolved": "9.28.0.94264",
"contentHash": "P5ri/HgukP7KPoN/Lo0njq0d5IdUMpiqHoDVT3QRauwwCWXk0ACmC3FNtMR0l4X4TzfqmIZV+SeSLIDijNp6sQ=="
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
Expand Down
4 changes: 2 additions & 2 deletions EasyTranslate.Domain.Tests/EasyTranslate.Domain.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="xunit" Version="2.8.0"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<PackageReference Include="xunit" Version="2.8.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="Moq" Version="4.20.70"/>
<PackageReference Include="xunit" Version="2.8.0"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<PackageReference Include="xunit" Version="2.8.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="Snapshooter.Xunit" Version="0.14.1"/>
<PackageReference Include="xunit" Version="2.5.3"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/>
<PackageReference Include="xunit" Version="2.8.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
},
{
"Type": "Instance",
"IconId": 61806,
"IconId": 61846,
"EnglishName": "the Borderland Ruins (Secure)",
"FrenchName": "les Ruines frontalières (annexion)",
"GermanName": "Äußere Ruinen (Sicherung)",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"Type": "Instance",
"IconId": 61801,
"IconId": 61817,
"EnglishName": "Sastasha",
"FrenchName": "Sastasha",
"GermanName": "Sastasha",
Expand Down Expand Up @@ -41,7 +41,7 @@
},
{
"Type": "Instance",
"IconId": 61801,
"IconId": null,
"EnglishName": "Sastasha (Hard)",
"FrenchName": "Sastasha (brutal)",
"GermanName": "Sastasha (schwer)",
Expand Down
Loading

0 comments on commit 5c1322e

Please sign in to comment.