From 9a533d877abecfcfc2457d00f97c0b7e8e43a2b5 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 18 Aug 2026 12:41:16 +0200 Subject: [PATCH] Modifica per traduzioni --- WebWindowComplex/TableComp.razor.cs | 29 +++++++++++-------- WebWindowComplex/WebWindowComplex.csproj | 11 +++++-- .../WebWindowConfigurator.csproj | 16 +++++++++- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index ec5d2b9..8966e3a 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -2,8 +2,7 @@ using Microsoft.AspNetCore.Components; using Newtonsoft.Json; using NLog; -using System.Diagnostics; -using System.Text.Json; +using System.Reflection; using WebWindowComplex.Compo; using WebWindowComplex.DTO; using WebWindowComplex.Json; @@ -161,23 +160,29 @@ namespace WebWindowComplex protected override async Task OnInitializedAsync() { - string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"Data", "Lemmi.json"); - - if (File.Exists(filePath)) + var assembly = Assembly.GetExecutingAssembly(); + string? resourceName = assembly.GetManifestResourceNames() + .FirstOrDefault(r => r.EndsWith("Lemmi.json", StringComparison.OrdinalIgnoreCase)); + using Stream? stream = assembly.GetManifestResourceStream(resourceName); + if (stream == null) { - string jsonText = await File.ReadAllTextAsync(filePath); - List? tradList = JsonConvert.DeserializeObject>(jsonText); - if(tradList != null) + Log.Info("File Json non trovato"); + } + else + { + using StreamReader reader = new StreamReader(stream); + string jsonContent = await reader.ReadToEndAsync(); + + List? tradList = JsonConvert.DeserializeObject>(jsonContent); + + if (tradList != null) { Log.Info("Richiesta Traduzione"); prevReqTrad = true; await EC_ReqTraduzione.InvokeAsync(tradList); } } - else - { - Log.Info("File Json non trovato"); - } + } /// diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 3b24013..ee340f9 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.8.1811 + 3.1.8.1812 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -14,13 +14,13 @@ - + true content\Data true PreserveNewest PreserveNewest - + @@ -46,3 +46,8 @@ + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index e41f60e..d6e7fa4 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.8.1811 + 3.1.8.1812 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -38,3 +38,17 @@ + + + + + + + + + + + + + +