From b765543e1c0115d3f6751f548b8c2ce9e97ae34b Mon Sep 17 00:00:00 2001 From: Ricardo Carneiro Date: Fri, 15 May 2026 14:32:40 -0300 Subject: [PATCH] refactor: renomeia VideoStudy.Linux -> VideoStudy.App (cross-platform) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - OutputType WinExe -> Exe (funciona em Windows, Linux e macOS) - Namespace VideoStudy.Linux -> VideoStudy.App - Remove IPdfSaver (nunca injetado, PDF salvo pelo PersistenceService) - Remove Platforms AnyCPU;x64 (desnecessário para Photino cross-platform) - Simplifica Program.cs removendo código morto Co-Authored-By: Claude Sonnet 4.6 --- VideoStudy.App/Program.cs | 33 ++++++++++ .../VideoStudy.App.csproj | 5 +- .../wwwroot/index.html | 0 VideoStudy.Linux/Program.cs | 65 ------------------- VideoStudy.sln | 2 +- 5 files changed, 37 insertions(+), 68 deletions(-) create mode 100644 VideoStudy.App/Program.cs rename VideoStudy.Linux/VideoStudy.Linux.csproj => VideoStudy.App/VideoStudy.App.csproj (75%) rename {VideoStudy.Linux => VideoStudy.App}/wwwroot/index.html (100%) delete mode 100644 VideoStudy.Linux/Program.cs diff --git a/VideoStudy.App/Program.cs b/VideoStudy.App/Program.cs new file mode 100644 index 0000000..1a8c140 --- /dev/null +++ b/VideoStudy.App/Program.cs @@ -0,0 +1,33 @@ +using Microsoft.Extensions.DependencyInjection; +using Photino.Blazor; +using VideoStudy.UI; + +namespace VideoStudy.App; + +class Program +{ + [STAThread] + static void Main(string[] args) + { + var builder = PhotinoBlazorAppBuilder.CreateDefault(args); + + builder.Services.AddVideoStudyUI(); + + builder.Services.AddScoped(sp => new HttpClient + { + BaseAddress = new Uri("http://localhost:5000"), + Timeout = TimeSpan.FromMinutes(10) + }); + + builder.RootComponents.Add("#app"); + + var app = builder.Build(); + + app.MainWindow + .SetTitle("VideoStudy") + .SetSize(1280, 800) + .Center(); + + app.Run(); + } +} diff --git a/VideoStudy.Linux/VideoStudy.Linux.csproj b/VideoStudy.App/VideoStudy.App.csproj similarity index 75% rename from VideoStudy.Linux/VideoStudy.Linux.csproj rename to VideoStudy.App/VideoStudy.App.csproj index d9b84a9..bac8456 100644 --- a/VideoStudy.Linux/VideoStudy.Linux.csproj +++ b/VideoStudy.App/VideoStudy.App.csproj @@ -1,11 +1,12 @@ - WinExe + Exe net8.0 enable enable - AnyCPU;x64 + VideoStudy.App + diff --git a/VideoStudy.Linux/wwwroot/index.html b/VideoStudy.App/wwwroot/index.html similarity index 100% rename from VideoStudy.Linux/wwwroot/index.html rename to VideoStudy.App/wwwroot/index.html diff --git a/VideoStudy.Linux/Program.cs b/VideoStudy.Linux/Program.cs deleted file mode 100644 index df30367..0000000 --- a/VideoStudy.Linux/Program.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Photino.Blazor; -using VideoStudy.UI; -using VideoStudy.Shared; - -namespace VideoStudy.Linux; - -class Program -{ - [STAThread] - static void Main(string[] args) - { - var ComponentsApp = typeof(VideoStudy.UI.App); - - var builder = PhotinoBlazorAppBuilder.CreateDefault(args); - - // Registro de serviços da UI Unificada - builder.Services.AddVideoStudyUI(); - - // Configurar HttpClient para a API - builder.Services.AddScoped(sp => new HttpClient - { - BaseAddress = new Uri("http://localhost:5000"), - Timeout = TimeSpan.FromMinutes(10) - }); - - // Registrar um IPdfSaver dummy ou específico para Linux se necessário - // No Linux, o Photino pode usar o explorador de arquivos nativo ou salvar direto na pasta Downloads - builder.Services.AddSingleton(); - - builder.RootComponents.Add(ComponentsApp, "#app"); - - var app = builder.Build(); - - app.MainWindow - .SetTitle("VideoStudy - Study Smarter with AI") - .SetSize(1200, 800) - .SetIconFile("wwwroot/favicon.ico") // Se houver - .Center(); - - app.Run(); - } -} - -// Implementação básica de salvamento para Linux -public class LinuxPdfSaver : IPdfSaver -{ - public async Task SavePdfAsync(byte[] pdfData, string suggestedFileName) - { - // No Linux, por simplicidade inicial, vamos salvar na pasta Downloads do usuário - var downloadsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"); - var filePath = Path.Combine(downloadsPath, suggestedFileName); - - await File.WriteAllBytesAsync(filePath, pdfData); - - // No Linux, podemos tentar abrir o arquivo usando 'xdg-open' - try - { - System.Diagnostics.Process.Start("xdg-open", filePath); - } - catch { } - - return filePath; - } -} diff --git a/VideoStudy.sln b/VideoStudy.sln index 379f129..f6141a9 100644 --- a/VideoStudy.sln +++ b/VideoStudy.sln @@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoStudy.API", "VideoStud EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoStudy.UI", "VideoStudy.UI\VideoStudy.UI.csproj", "{CE82389C-E484-4EAC-8F78-0FB5C6EB63A4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoStudy.Linux", "VideoStudy.Linux\VideoStudy.Linux.csproj", "{D6ABA32E-D5C0-4E94-8E1C-2E6B2C83519E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoStudy.App", "VideoStudy.App\VideoStudy.App.csproj", "{D6ABA32E-D5C0-4E94-8E1C-2E6B2C83519E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution