Skip to content

Commit

Permalink
fix: transition to .NET7 and API8
Browse files Browse the repository at this point in the history
  • Loading branch information
lokinmodar committed Jan 14, 2023
1 parent 03d6487 commit dca9570
Show file tree
Hide file tree
Showing 18 changed files with 270 additions and 358 deletions.
34 changes: 16 additions & 18 deletions AssetsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

using Dalamud.Interface.Internal.Notifications;
Expand All @@ -31,8 +29,8 @@ private void PluginAssetsChecker()
#if DEBUG
PluginLog.LogInformation("Checking Plugin assets!");
#endif
PluginInterface.UiBuilder.AddNotification(Resources.AssetsCheckingPopupMsg, "Echoglossian",
NotificationType.Warning, 3000);
PluginInterface.UiBuilder.AddNotification(Resources.AssetsCheckingPopupMsg, Resources.Name,
NotificationType.Warning);

foreach (string f in this.AssetFiles)
{
Expand All @@ -55,8 +53,8 @@ private void PluginAssetsChecker()
{
this.PluginAssetsState = true;
this.configuration.PluginAssetsDownloaded = true;
PluginInterface.UiBuilder.AddNotification(Resources.AssetsPresentPopupMsg, "Echoglossian",
NotificationType.Success, 3000);
PluginInterface.UiBuilder.AddNotification(Resources.AssetsPresentPopupMsg, Resources.Name,
NotificationType.Success);
this.SaveConfig();
return;
}
Expand All @@ -66,8 +64,8 @@ private void PluginAssetsChecker()
this.DownloadPluginAssets(this.MissingAssetFiles.IndexOf(f));
}

PluginInterface.UiBuilder.AddNotification(Resources.DownloadingAssetsPopupMsg, "Echoglossian",
NotificationType.Warning, 3000);
PluginInterface.UiBuilder.AddNotification(Resources.DownloadingAssetsPopupMsg, Resources.Name,
NotificationType.Warning);
}

private void DownloadPluginAssets(int missingAssetIndex)
Expand All @@ -81,16 +79,18 @@ private void DownloadPluginAssets(int missingAssetIndex)
this.PluginAssetsState = true;
this.configuration.PluginAssetsDownloaded = true;
this.SaveConfig();
PluginInterface.UiBuilder.AddNotification(Resources.AssetsPresentPopupMsg, "Echoglossian",
NotificationType.Success, 3000);
PluginInterface.UiBuilder.AddNotification(Resources.AssetsPresentPopupMsg, Resources.Name,
NotificationType.Success);
this.config = true;
}
}
}

private void DownloadAssets(int index)
{
#pragma warning disable SYSLIB0014
using WebClient client = new WebClient();
#pragma warning restore SYSLIB0014
try
{
string path = this.AssetsPath;
Expand Down Expand Up @@ -139,9 +139,8 @@ private void DownloadAssets(int index)
PluginLog.LogError($"Error downloading plugin assets: {e}");
PluginInterface.UiBuilder.AddNotification(
$"{Resources.AssetsDownloadError1stPart} {this.AssetFiles[index]}{Resources.AssetsDownloadError2ndPart}",
"Echoglossian",
NotificationType.Error,
3000);
Resources.Name,
NotificationType.Error);
}
}

Expand All @@ -159,16 +158,15 @@ private void WebClientDownloadCompleted(object sender, DownloadDataCompletedEven
#endif
PluginInterface.UiBuilder.AddNotification(
Resources.AssetsDownloadComplete,
"Echoglossian",
NotificationType.Success,
3000);
Resources.Name,
NotificationType.Success);

if (this.MissingAssetFiles?.Any() != true)
{
this.PluginAssetsState = true;
this.configuration.PluginAssetsDownloaded = true;
PluginInterface.UiBuilder.AddNotification(Resources.AssetsPresentPopupMsg, "Echoglossian",
NotificationType.Success, 3000);
PluginInterface.UiBuilder.AddNotification(Resources.AssetsPresentPopupMsg, Resources.Name,
NotificationType.Success);
this.SaveConfig();
this.config = true;
}
Expand Down
6 changes: 0 additions & 6 deletions CharacterSetsUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// Licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License license.
// </copyright>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Echoglossian
{
public partial class Echoglossian
Expand Down
19 changes: 9 additions & 10 deletions DeepLTranslator.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;

using Dalamud.Logging;
using DeepL;
using DeepL.Model;

namespace Echoglossian
{
public partial class Echoglossian
{
public static async Task DeeplTranslateAsync(string[] arguments)
{
using DeepLClient client = new("<authentication key>", useFreeApi: false);
using Translator client = new("<authentication key>");
try
{
Translation translation = await client.TranslateAsync(
"This is a test sentence.",
Language.German);
PluginLog.LogWarning(translation.DetectedSourceLanguage);
var translation = client.TranslateTextAsync(
arguments[0],
"EN",
"JP"
).Result;
PluginLog.LogWarning(translation.DetectedSourceLanguageCode);
PluginLog.LogWarning(translation.Text);
}
catch (DeepLException exception)
Expand Down
9 changes: 6 additions & 3 deletions Echoglossian.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Dalamud.Data;
using Dalamud.Game;
using Dalamud.Game.ClientState;
Expand All @@ -22,9 +21,10 @@
using Dalamud.Plugin;
using Echoglossian.EFCoreSqlite.Models;
using Echoglossian.Properties;

using FFXIVClientStructs;
using FFXIVClientStructs.Interop;
using ImGuiScene;
using Newtonsoft.Json;
using XivCommon;

namespace Echoglossian
Expand Down Expand Up @@ -110,7 +110,10 @@ public Echoglossian()

sanitizer = PluginInterface.Sanitizer as Sanitizer;

Resolver.Initialize();
// Resolver.Initialize();
// Resolver.GetInstance.SetupSearchSpace();
// Resolver.GetInstance.Resolve();

langDict = this.LanguagesDictionary;
identifier = Factory.Load($"{PluginInterface.AssemblyLocation.DirectoryName}{Path.DirectorySeparatorChar}Wiki82.profile.xml");

Expand Down
45 changes: 31 additions & 14 deletions Echoglossian.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<SuppressPseudoWarning Condition="'$(Configuration)' == 'Debug'">true</SuppressPseudoWarning>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<AssemblyName>Echoglossian</AssemblyName>
<Platforms>x64</Platforms>
<Authors>lokinmodar</Authors>
<NeutralLanguage>en</NeutralLanguage>
<VersionMajor>2</VersionMajor>
<VersionMinor>100</VersionMinor>
<VersionMinor>101</VersionMinor>
<VersionPatch Condition="'$(VersionPatch)' == ''">$([System.DateTime]::UtcNow.ToString("yyMM"))</VersionPatch>
<VersionRevision Condition="'$(VersionRevision)' == ''">$([System.DateTime]::UtcNow.TimeOfDay.TotalMinutes.ToString("0"))</VersionRevision>
<Version>$(VersionMajor).$(VersionMinor).$(VersionPatch).$(VersionRevision)</Version>
Expand Down Expand Up @@ -216,27 +216,27 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.Translate" Version="3.7.5.19" />
<PackageReference Include="DalamudPackager" Version="2.1.8" />
<PackageReference Include="DeepL" Version="0.4.1" />
<PackageReference Include="AWSSDK.Translate" Version="3.7.101.15" />
<PackageReference Include="DalamudPackager" Version="2.1.10" />
<PackageReference Include="DeepL.net" Version="1.5.0" />
<PackageReference Include="GTranslate" Version="2.1.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.45" />
<PackageReference Include="Lumina.Excel" Version="6.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.8">
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
<PackageReference Include="Lumina.Excel" Version="6.3.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.2">
<PrivateAssets>all</PrivateAssets>
<!--<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NTextCat" Version="0.3.65" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>all</PrivateAssets>
<!--<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
</PackageReference>
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
<PackageReference Include="XivCommon" Version="6.0.1" />
<PackageReference Include="XivCommon" Version="7.0.0-alpha.1" />
</ItemGroup>
<ItemGroup>
<Content Include="Font\NotoSans-Regular.ttf">
Expand All @@ -249,13 +249,23 @@
</EmbeddedResource>
<EmbeddedResource Include="Resources\pix.png" />
<EmbeddedResource Include="Resources\minfilia.ico" />
<None Include="cu.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>cu.targets</DependentUpon>
</None>
<XliffResource Include="MultilingualResources\Echoglossian.da.xlf" />
<XliffResource Include="MultilingualResources\Echoglossian.de.xlf" />
<XliffResource Include="MultilingualResources\Echoglossian.es.xlf" />
<XliffResource Include="MultilingualResources\Echoglossian.fr.xlf" />
<XliffResource Include="MultilingualResources\Echoglossian.pt-BR.xlf" />
</ItemGroup>
<ItemGroup>
<Compile Update="cu.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>cu.targets</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
Expand Down Expand Up @@ -302,6 +312,13 @@
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Update="cu.targets">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>cu.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions Echoglossian.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"RepoUrl": "https://github.com/lokinmodar/Echoglossian",
"Tags": [ "ffxiv", "Dalamud", "plugin", "translation", "UI", "Utility" ],
"Disabled": false,
"Testing": false,
"Testing": true,
"Punchline": "Dialogue and other in-game text translations? Yes we have!\nKnown Issues at: https://github.com/lokinmodar/Echoglossian/issues/12",
"IsHide": false,
"TestingAssemblyVersion": null,
"IsTestingExclusive": false,
"IsTestingExclusive": true,
"LoadPriority": 0,
"ImageUrls": [
""
],
"DevSupportState": "ACTIVE",
"IconUrl": "https://raw.githubusercontent.com/lokinmodar/Echoglossian/APIv4/images/icon.png"
}
4 changes: 2 additions & 2 deletions Echoglossian.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Echoglossian", "Echoglossian.csproj", "{517A4352-7F10-48B9-B332-BB592157E377}"
EndProject
Expand Down
10 changes: 1 addition & 9 deletions GameUIhelpers.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Dalamud.Data;
using Dalamud.Logging;
using FFXIVClientStructs;
using FFXIVClientStructs.FFXIV.Client.UI;
using Lumina.Excel;
using Lumina.Excel.GeneratedSheets;

Expand Down
3 changes: 0 additions & 3 deletions Glossian.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
// </copyright>

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Web;
using Dalamud.Logging;
using Dalamud.Utility;
using Echoglossian.Properties;
using GTranslate.Translators;
using Newtonsoft.Json.Linq;
using NTextCat;

Expand Down
1 change: 0 additions & 1 deletion UiBattleTalkHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

using Dalamud.Game.Text.SeStringHandling;
Expand Down
3 changes: 2 additions & 1 deletion UiFontHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ private unsafe void LoadFont()

private unsafe void LoadLanguageComboFont()
{
string fontDir = $@"{PluginInterface.AssemblyLocation.DirectoryName}{Path.DirectorySeparatorChar}Font{Path.DirectorySeparatorChar}";
#if DEBUG
PluginLog.LogVerbose("Inside LoadLanguageComboFont method");
string fontDir = $@"{PluginInterface.AssemblyLocation.DirectoryName}{Path.DirectorySeparatorChar}Font{Path.DirectorySeparatorChar}";

string fontFile = $@"{fontDir}NotoSans-Medium-Custom2.otf";
string dummyFontFilePath = $@"{fontDir}NotoSans-SemiBold.ttf";
string symbolsFontFilePath = $@"{fontDir}symbols.ttf";
Expand Down
2 changes: 0 additions & 2 deletions UiTalkHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Logging;
using Dalamud.Utility;
Expand Down
8 changes: 0 additions & 8 deletions UiTalkSubtitleHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@
// </copyright>

using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Logging;
using Dalamud.Utility;
using Echoglossian.EFCoreSqlite.Models;
using Echoglossian.Properties;
using FFXIVClientStructs.FFXIV.Component.GUI;
using XivCommon.Functions;

namespace Echoglossian
{
Expand Down
1 change: 0 additions & 1 deletion UiToastsHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

using Dalamud.Game.Gui.Toast;
Expand Down
Loading

0 comments on commit dca9570

Please sign in to comment.