Compare commits

...

5 Commits

Author SHA1 Message Date
LotP1
d83d80de73 here we go 2024-12-25 23:22:38 +01:00
LotP1
097836bfac NO-BREAK SPACE is now escaped 2024-12-25 22:14:20 +01:00
LotP1
695f9e277d v3 2024-12-25 22:13:54 +01:00
LotP1
b19ee23c6b this won't work 2024-12-25 20:48:28 +01:00
LotP1
748e93ba65 lets give this another shot
moved from netstandard to netframework
2024-12-25 17:09:57 +01:00
4 changed files with 53 additions and 47 deletions

View File

@@ -11,6 +11,7 @@
<PackageVersion Include="Avalonia.Svg" Version="11.0.0.18" />
<PackageVersion Include="Avalonia.Svg.Skia" Version="11.0.0.18" />
<PackageVersion Include="Microsoft.Build.Framework" Version="17.12.6" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.12.6" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.12.6" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Projektanker.Icons.Avalonia" Version="9.4.0" />
@@ -54,6 +55,9 @@
<PackageVersion Include="SPB" Version="0.0.4-build32" />
<PackageVersion Include="System.IO.Hashing" Version="9.0.0" />
<PackageVersion Include="System.Management" Version="9.0.0" />
<PackageVersion Include="System.Memory" Version="4.6.0" />
<PackageVersion Include="System.Text.Encodings.Web" Version="9.0.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
</ItemGroup>
</Project>

View File

@@ -3,27 +3,19 @@ using Microsoft.Build.Utilities;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Newtonsoft.Json;
using System.Text.Json;
using Microsoft.Build.Framework;
using System.Text.Encodings.Web;
namespace Ryujinx.BuildValidationTasks
{
public class LocalesValidationTask : Task
{
public string Path { get; set; }
public override bool Execute()
{
string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
if (path.Split(["src"], StringSplitOptions.None).Length == 1)
{
//i assume that we are in a build directory in the solution dir
path = new FileInfo(path).Directory!.Parent!.GetDirectories("src")[0].GetDirectories("Ryujinx")[0].GetDirectories("Assets")[0].GetFiles("locales.json")[0].FullName;
}
else
{
path = path.Split(["src"], StringSplitOptions.None)[0];
path = new FileInfo(path).Directory!.GetDirectories("src")[0].GetDirectories("Ryujinx")[0].GetDirectories("Assets")[0].GetFiles("locales.json")[0].FullName;
}
string path = Path;
string data;
@@ -32,8 +24,20 @@ namespace Ryujinx.BuildValidationTasks
data = sr.ReadToEnd();
}
LocalesJson json;
LocalesJson json = JsonConvert.DeserializeObject<LocalesJson>(data);
try
{
json = JsonSerializer.Deserialize<LocalesJson>(data);
}
catch (Exception e)
{
Log.LogError($"Json Validation failed! {e.Message}");
return false;
}
for (int i = 0; i < json.Locales.Count; i++)
@@ -50,7 +54,13 @@ namespace Ryujinx.BuildValidationTasks
json.Locales[i] = locale;
}
string jsonString = JsonConvert.SerializeObject(json, Formatting.Indented);
JsonSerializerOptions jsonOptions = new JsonSerializerOptions()
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
string jsonString = JsonSerializer.Serialize(json, jsonOptions);
using (StreamWriter sw = new(path))
{

View File

@@ -1,21 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<temp_assemblies>$(MSBuildThisFileDirectory)temp_assemblies/</temp_assemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Build.Framework" GeneratePathProperty="true" />
<PackageReference Include="Newtonsoft.Json" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Build.Tasks.Core" />
<PackageReference Include="Microsoft.Build.Utilities.Core" />
<PackageReference Include="Microsoft.Build.Framework" />
<PackageReference Include="System.Text.Json" GeneratePathProperty="true" />
<PackageReference Include="System.Text.Encodings.Web" GeneratePathProperty="true" />
<PackageReference Include="System.Memory" GeneratePathProperty="true" />
</ItemGroup>
<Target Name="ValidationTask">
<Message Text="dir $(FrameworkDir)" Importance="high" />
<Message Text="Running Validations..." Importance="high" />
<!--Run Validation Targets Here-->
@@ -24,40 +25,31 @@
<Message Text="Validations Succeeded!" Importance="high" />
</Target>
<!--__________________________________________________LocalesValidation Task__________________________________________________-->
<!--__________________________________________________Start LocalesValidation Task__________________________________________________-->
<PropertyGroup>
<!--Name of Validation Task. <Name> refers to this name-->
<Name>LocalesValidation</Name>
<!--Dll should be "<Name>Task.dll"-->
<Dll>LocalesValidationTask.dll</Dll>
</PropertyGroup>
<!--Name should be "Build<Name>TaskDll"-->
<Target Name="BuildLocalesValidationTaskDll">
<Message Text="Building $(Name)Task..." Importance="high" />
<!--Remember to include References!-->
<Csc Sources="$(MSBuildThisFileDirectory)$(Name)Task*.cs"
AdditionalLibPaths="$(ProgramFiles)/dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0/ref/net9.0/"
References="
System.dll;
System.Runtime.dll;
netstandard.dll;
System.Collections.dll;
System.Linq.dll;
$(PkgMicrosoft_Build_Framework)/ref/netstandard2.0/Microsoft.Build.Framework.dll;
$(PkgMicrosoft_Build_Utilities_Core)/ref/netstandard2.0/Microsoft.Build.Utilities.Core.dll;
$(PkgNewtonsoft_Json)/lib/netstandard2.0/Newtonsoft.Json.dll"
TargetType="Library" OutputAssembly="$(MSBuildThisFileDirectory)temp_assemblies/$(Dll)"/>
</Target>
<UsingTask TaskName="Ryujinx.BuildValidationTasks.$(Name)Task" TaskFactory="TaskHostFactory" AssemblyFile="temp_assemblies/$(Dll)"/>
<UsingTask TaskName="Ryujinx.BuildValidationTasks.$(Name)Task" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<Path Required="true" />
</ParameterGroup>
<Task>
<Reference Include="$(PkgSystem_Text_Json)/lib/netstandard2.0/System.Text.Json.dll" />
<Reference Include="$(PkgSystem_Text_Encodings_Web)/lib/netstandard2.0/System.Text.Encodings.Web.dll" />
<Reference Include="$(PkgSystem_Memory)/lib/netstandard2.0/System.Memory.dll" Version="4.6.0" />
<Code Language="cs" Source="$(MSBuildThisFileDirectory)$(Name)Task.cs" />
</Task>
</UsingTask>
<!--Name should be "Master<Name>Task"-->
<Target Name="MasterLocalesValidationTask" DependsOnTargets="Build$(Name)TaskDll">
<Target Name="MasterLocalesValidationTask">
<Message Text="Running $(Name)Task... " Importance="high" />
<!--Should call "Ryujinx.BuildValidationTasks.<Name>Task"-->
<Ryujinx.BuildValidationTasks.LocalesValidationTask />
<Ryujinx.BuildValidationTasks.LocalesValidationTask Path="$(MSBuildThisFileDirectory)../Ryujinx/Assets/locales.json" />
<Message Text="$(Name)Task finished!" Importance="high" />
</Target>

View File

@@ -3797,7 +3797,7 @@
"el_GR": "Ζώνη Ώρας Συστήματος:",
"en_US": "System Time Zone:",
"es_ES": "Zona horaria del sistema:",
"fr_FR": "Fuseau horaire du système :",
"fr_FR": "Fuseau horaire du système\u00A0:",
"he_IL": "אזור זמן מערכת:",
"it_IT": "Fuso orario del sistema:",
"ja_JP": "タイムゾーン:",
@@ -15125,7 +15125,7 @@
"el_GR": "",
"en_US": "Aspect Ratio applied to the renderer window.\n\nOnly change this if you're using an aspect ratio mod for your game, otherwise the graphics will be stretched.\n\nLeave on 16:9 if unsure.",
"es_ES": "Relación de aspecto aplicada a la ventana del renderizador.\n\nSolamente modificar esto si estás utilizando un mod de relación de aspecto para su juego, en cualquier otro caso los gráficos se estirarán.\n\nDejar en 16:9 si no sabe que hacer.",
"fr_FR": "Format d'affichage appliqué à la fenêtre du moteur de rendu.\n\nChangez cela uniquement si vous utilisez un mod changeant le format d'affichage pour votre jeu, sinon les graphismes seront étirés.\n\nLaissez sur 16:9 si vous n'êtes pas sûr.",
"fr_FR": "Format\u00A0d'affichage appliqué à la fenêtre du moteur de rendu.\n\nChangez cela uniquement si vous utilisez un mod changeant le format\u00A0d'affichage pour votre jeu, sinon les graphismes seront étirés.\n\nLaissez sur 16:9 si vous n'êtes pas sûr.",
"he_IL": "",
"it_IT": "Proporzioni dello schermo applicate alla finestra di renderizzazione.\n\nCambialo solo se stai usando una mod di proporzioni per il tuo gioco, altrimenti la grafica verrà allungata.\n\nLasciare il 16:9 se incerto.",
"ja_JP": "レンダリングウインドウに適用するアスペクト比です.\n\nゲームにアスペクト比を変更する mod を使用している場合のみ変更してください.\n\nわからない場合は16:9のままにしておいてください.\n",
@@ -20213,7 +20213,7 @@
"el_GR": "Όνομα",
"en_US": "Name",
"es_ES": "Nombre",
"fr_FR": "Nom ",
"fr_FR": "Nom\u00A0",
"he_IL": "שם",
"it_IT": "Nome",
"ja_JP": "名称",