浏览代码

PRS Avalonia 1.7
Standardised Frameworks and project settings to make App Store work
Moved MobileDocument.ConvertToPDF functionality to platform-specific PdfToImage interface
Implemented iOS native PDF Renderer

Frank van den Bos 6 月之前
父节点
当前提交
4c6da001f2
共有 25 个文件被更改,包括 269 次插入154 次删除
  1. 55 47
      InABox.Avalonia.Platform.iOS/ImageTools.iOS.cs
  2. 3 4
      InABox.Avalonia.Platform.iOS/InABox.Avalonia.Platform.iOS.csproj
  3. 88 5
      InABox.Avalonia.Platform.iOS/PDFRenderer.iOS.cs
  4. 34 0
      InABox.Avalonia.Platform.iOS/ViewControllerHelper.cs
  5. 3 5
      InABox.Avalonia.Platform/InABox.Avalonia.Platform.csproj
  6. 9 3
      InABox.Avalonia.Platform/PDFRenderer/DefaultPdfRenderer.cs
  7. 7 2
      InABox.Avalonia.Platform/PDFRenderer/IPdfRenderer.cs
  8. 0 4
      InABox.Avalonia/Components/AvaloniaDataGrid/AvaloniaDataGrid.axaml.cs
  9. 1 5
      InABox.Avalonia/Components/DateSelector/DateSelectorButton.cs
  10. 0 6
      InABox.Avalonia/Components/DateSelector/DateSelectorViewModel.cs
  11. 1 1
      InABox.Avalonia/Components/Modules/ModuleList/AvaloniaModuleCollection.cs
  12. 1 2
      InABox.Avalonia/Components/TimeSelector/TimeSelectorButton.cs
  13. 0 6
      InABox.Avalonia/Components/TimeSelector/TimeSelectorViewModel.cs
  14. 1 4
      InABox.Avalonia/Images/Images.cs
  15. 15 10
      InABox.Avalonia/InABox.Avalonia.csproj
  16. 3 3
      InABox.Avalonia/MobileDocument/MobileDocument.cs
  17. 28 23
      InABox.Avalonia/MobileDocument/MobileDocumentExtensions.cs
  18. 1 3
      InABox.Avalonia/Navigation/Navigation.cs
  19. 2 3
      InABox.Client.RPC/InABox.Client.RPC.csproj
  20. 1 1
      InABox.Core/Client/ClientFactory.cs
  21. 4 7
      InABox.Core/InABox.Core.csproj
  22. 3 1
      InABox.Integration/InABox.Integration.csproj
  23. 2 2
      InABox.RPC.Shared/InABox.RPC.Shared.csproj
  24. 6 6
      inabox.logging.shared/InABox.Logging.Shared.csproj
  25. 1 1
      inabox.logging.shared/Log.cs

+ 55 - 47
InABox.Avalonia.Platform.iOS/ImageTools.iOS.cs

@@ -1,13 +1,21 @@
+using System;
 using System.Drawing;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
 using Avalonia.Controls;
 using AVFoundation;
+using CoreGraphics;
 using CoreMedia;
+using Foundation;
 using InABox.Core;
 using Microsoft.Maui.ApplicationModel;
+using Microsoft.Maui.Storage;
+using MobileCoreServices;
+using UIKit;
 
 namespace InABox.Avalonia.Platform.iOS
 {
-    
     public class iOS_ImageTools : IImageTools
     {
         public Logger Logger { get; set; }
@@ -70,58 +78,58 @@ namespace InABox.Avalonia.Platform.iOS
             return await MainThread.InvokeOnMainThreadAsync(async () =>
                 await InternalGetPhotoAsync<Permissions.Camera>(UIImagePickerControllerSourceType.Camera, null, null));
         }
-
+        
         private async Task<ImageFile> InternalGetPhotoAsync<TPermission>(UIImagePickerControllerSourceType source, int? compression, Size? constraints)
             where TPermission : Permissions.BasePermission, new()
         {
             var taskCompletionSource = new TaskCompletionSource<ImageFile>();
-            // if (await Permissions.RequestAsync<TPermission>() == PermissionStatus.Granted)
-            // {
-            //     var imagePicker = new UIImagePickerController
-            //     {
-            //         SourceType = source,
-            //         MediaTypes = new string[] { UTType.Image }
-            //     };
-            //
-            //     // Struggling to get IOS define to enable Platform shared code, which is a bit shitty
-            //     var viewController = WindowStateManager.Default.GetCurrentUIViewController(true); // Platform.getCurrentUIViewController();
-            //
-            //     imagePicker.AllowsEditing = false;
-            //     imagePicker.FinishedPickingMedia += async (sender, e) =>
-            //     {
-            //         var jpegFilename = Path.Combine(FileSystem.CacheDirectory, $"{Guid.NewGuid()}.jpg");
-            //         var source = e.Info[UIImagePickerController.OriginalImage] as UIImage;
-            //         var rotated = AutoRotateImage(source);
-            //         var scaled = ScaleImage(rotated, constraints);
-            //         var result = scaled.AsJPEG(new NFloat(compression ?? 100)/100);
-            //         await viewController.DismissViewControllerAsync(true);
-            //         if (result.Save(jpegFilename, false, out var error))
-            //         {
-            //             taskCompletionSource.TrySetResult(new FileResult(jpegFilename));
-            //         }
-            //         else
-            //         {
-            //             taskCompletionSource.TrySetException(new Exception($"Error saving the image: {error}"));
-            //         }
-            //         imagePicker?.Dispose();
-            //         imagePicker = null;
-            //     };
-            //
-            //     imagePicker.Canceled += async (sender, e) =>
-            //     {
-            //         await viewController.DismissViewControllerAsync(true);
-            //         taskCompletionSource.TrySetResult(null);
-            //         imagePicker?.Dispose();
-            //         imagePicker = null;
-            //     };
-            //
-            //     await viewController.PresentViewControllerAsync(imagePicker, true);
-            // }
-            // else
-            // {
+            if (await Permissions.RequestAsync<TPermission>() == PermissionStatus.Granted)
+            {
+                var imagePicker = new UIImagePickerController
+                {
+                    SourceType = source,
+                    MediaTypes = new string[] { UTType.Image }
+                };
+            
+                // Struggling to get IOS define to enable Platform shared code, which is a bit shitty
+                var viewController = ViewControllerHelper.GetVisibleViewController(); 
+            
+                imagePicker.AllowsEditing = false;
+                imagePicker.FinishedPickingMedia += async (sender, e) =>
+                {
+                    var jpegFilename = Path.Combine(FileSystem.CacheDirectory, $"{Guid.NewGuid()}.jpg");
+                    var source = e.Info[UIImagePickerController.OriginalImage] as UIImage;
+                    var rotated = AutoRotateImage(source);
+                    var scaled = ScaleImage(rotated, constraints);
+                    var result = scaled.AsJPEG(new NFloat(compression ?? 100)/100);
+                    await viewController.DismissViewControllerAsync(true);
+                    if (result.Save(jpegFilename, false, out var error))
+                    {
+                        taskCompletionSource.TrySetResult(new ImageFile(jpegFilename, result.ToArray()));
+                    }
+                    else
+                    {
+                        taskCompletionSource.TrySetException(new Exception($"Error saving the image: {error}"));
+                    }
+                    imagePicker?.Dispose();
+                    imagePicker = null;
+                };
+            
+                imagePicker.Canceled += async (sender, e) =>
+                {
+                    await viewController.DismissViewControllerAsync(true);
+                    taskCompletionSource.TrySetResult(null);
+                    imagePicker?.Dispose();
+                    imagePicker = null;
+                };
+            
+                await viewController.PresentViewControllerAsync(imagePicker, true);
+            }
+            else
+            {                
                 taskCompletionSource.TrySetResult(null);
                 taskCompletionSource.TrySetException(new PermissionException("Camera permission not granted"));
-            //}
+            }
 
             return await taskCompletionSource.Task;
         }

+ 3 - 4
InABox.Avalonia.Platform.iOS/InABox.Avalonia.Platform.iOS.csproj

@@ -1,12 +1,10 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFramework>net8.0-ios</TargetFramework>
+        <TargetFrameworks>net8.0-ios;net9.0-ios</TargetFrameworks>
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
         <RootNamespace>InABox.Avalonia.Platform.iOS</RootNamespace>
-        <LangVersion>default</LangVersion>
-        <SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
@@ -22,7 +20,8 @@
     </ItemGroup>
 
     <ItemGroup>
-      <PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.70" />
+      <PackageReference Include="Avalonia" Version="11.2.2" />
+      <PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.71" />
       <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
       <PackageReference Include="Plugin.BLE" Version="3.1.0" />
     </ItemGroup>

+ 88 - 5
InABox.Avalonia.Platform.iOS/PDFRenderer.iOS.cs

@@ -1,4 +1,4 @@
-using InABox.Core;
+using InABox.Core; 
 
 namespace InABox.Avalonia.Platform.iOS;
 
@@ -7,9 +7,92 @@ public class iOS_PdfRenderer : IPdfRenderer
 
     public Logger? Logger { get; set; }
 
-    public byte[]? RenderPdf(byte[]? pdf, int page, int dpi)
-        => null;
+    public byte[]? PdfToImage(byte[]? pdf, int pageIndex, int dpi)
+    {
+
+        float scale = 2F;
+
+        // Step 1: Load the PDF document from byte array
+        using var data = NSData.FromArray(pdf);
+        using var provider = new CGDataProvider(data);
+        using var pdfDoc = new CGPDFDocument(provider);
+
+        // Validate page index
+        int pageCount = (int)pdfDoc.Pages;
+        if (pageIndex < 0 || pageIndex >= pageCount)
+            throw new ArgumentOutOfRangeException(nameof(pageIndex), "Invalid PDF page index.");
+
+        using var page = pdfDoc.GetPage(pageIndex + 1); // Pages are 1-indexed
+        var pageRect = page.GetBoxRect(CGPDFBox.Media);
+        var scaledSize = new CGSize(pageRect.Width * scale, pageRect.Height * scale);
+
+        // Step 2: Render the page to an image
+        UIGraphics.BeginImageContextWithOptions(scaledSize, false, 1.0f);
+        using (var context = UIGraphics.GetCurrentContext())
+        {
+            context.SaveState();
+            context.TranslateCTM(0, scaledSize.Height);
+            context.ScaleCTM(scale, -scale); // Flip and scale
+            context.DrawPDFPage(page);
+            context.RestoreState();
+        }
+
+        using var image = UIGraphics.GetImageFromCurrentImageContext();
+        UIGraphics.EndImageContext();
+
+        // Step 3: Convert UIImage to PNG byte array
+        using var pngData = image.AsPNG();
+        return pngData.ToArray();
+
+    }
+
+    public Task<byte[]?> PdfToImageAsync(byte[]? pdf, int page, int dpi)
+    {
+
+        var tcs = new TaskCompletionSource<byte[]>();
+
+        UIApplication.SharedApplication.BeginInvokeOnMainThread(() =>
+        {
+            try
+            {
+                var result = PdfToImage(pdf, page, dpi);
+                tcs.SetResult(result);
+            }
+            catch (Exception ex)
+            {
+                tcs.SetException(ex);
+            }
+        });
+
+        return tcs.Task;
+
+
+    }
+
+    public byte[]? ImageToPdf(byte[]? image)
+    {
+        return null;
+    }
+
+    public Task<byte[]?> ImageToPdfAsync(byte[]? image)
+    {
+        var tcs = new TaskCompletionSource<byte[]>();
+
+        UIApplication.SharedApplication.BeginInvokeOnMainThread(() =>
+        {
+            try
+            {
+                var result = ImageToPdf(image);
+                tcs.SetResult(result);
+            }
+            catch (Exception ex)
+            {
+                tcs.SetException(ex);
+            }
+        });
+
+        return tcs.Task;
+    }
+
 
-    public Task<byte[]?> RenderPdfAsync(byte[]? pdf, int page, int dpi)
-        => Task.Run(() => RenderPdf(pdf, page, dpi));
 }

+ 34 - 0
InABox.Avalonia.Platform.iOS/ViewControllerHelper.cs

@@ -0,0 +1,34 @@
+using UIKit;
+
+public static class ViewControllerHelper
+{
+    public static UIViewController GetVisibleViewController()
+    {
+        var rootController = UIApplication.SharedApplication.KeyWindow?.RootViewController;
+
+        if (rootController == null)
+            return null;
+
+        return GetTopViewController(rootController);
+    }
+
+    private static UIViewController GetTopViewController(UIViewController rootController)
+    {
+        if (rootController.PresentedViewController != null)
+        {
+            return GetTopViewController(rootController.PresentedViewController);
+        }
+
+        if (rootController is UINavigationController navigationController)
+        {
+            return GetTopViewController(navigationController.VisibleViewController);
+        }
+
+        if (rootController is UITabBarController tabBarController)
+        {
+            return GetTopViewController(tabBarController.SelectedViewController);
+        }
+
+        return rootController;
+    }
+}

+ 3 - 5
InABox.Avalonia.Platform/InABox.Avalonia.Platform.csproj

@@ -1,22 +1,20 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFramework>net8.0</TargetFramework>
+        <TargetFrameworks>net8.0;net9.0</TargetFrameworks>
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
         <RootNamespace>InABox.Avalonia.Platform</RootNamespace>
-        <LangVersion>default</LangVersion>
     </PropertyGroup>
 
     <ItemGroup>
-      <PackageReference Include="Autofac" Version="8.2.0" />
+      <PackageReference Include="Autofac" Version="8.3.0" />
       <PackageReference Include="Avalonia" Version="11.2.2" />
-      <PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.70" />
+      <PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.71" />
     </ItemGroup>
 
     <ItemGroup>
       <ProjectReference Include="..\InABox.Core\InABox.Core.csproj" />
-      <ProjectReference Include="..\inabox.logging.shared\InABox.Logging.Shared.csproj" />
     </ItemGroup>
 
 </Project>

+ 9 - 3
InABox.Avalonia.Platform/PDFRenderer/DefaultPdfRenderer.cs

@@ -6,10 +6,16 @@ public class DefaultPdfRenderer : IPdfRenderer
 {
     public Logger? Logger { get; set; }
  
-    public byte[]? RenderPdf(byte[]? pdf, int page, int dpi) 
+    public byte[]? PdfToImage(byte[]? pdf, int page, int dpi) 
         => null;
 
-    public Task<byte[]?> RenderPdfAsync(byte[]? pdf, int page, int dpi)
-        => Task.Run(() => RenderPdf(pdf, page, dpi));
+    public Task<byte[]?> PdfToImageAsync(byte[]? pdf, int page, int dpi)
+        => Task.Run(() => PdfToImage(pdf, page, dpi));
+
+    public byte[]? ImageToPdf(byte[]? image) 
+        => null;
+
+    public Task<byte[]?> ImageToPdfAsync(byte[]? image)
+        => Task.Run(() => ImageToPdf(image));
 
 }

+ 7 - 2
InABox.Avalonia.Platform/PDFRenderer/IPdfRenderer.cs

@@ -2,6 +2,11 @@
 
 public interface IPdfRenderer : ILoggable
 {
-    byte[]? RenderPdf(byte[]? pdf, int page, int dpi);
-    Task<byte[]?> RenderPdfAsync(byte[]? pdf, int page, int dpi);
+    byte[]? PdfToImage(byte[]? pdf, int page, int dpi);
+    Task<byte[]?> PdfToImageAsync(byte[]? pdf, int page, int dpi);
+
+    byte[]? ImageToPdf(byte[]? image);
+    Task<byte[]?> ImageToPdfAsync(byte[]? image);
+
+
 }

+ 0 - 4
InABox.Avalonia/Components/AvaloniaDataGrid/AvaloniaDataGrid.axaml.cs

@@ -5,14 +5,10 @@ using Avalonia.Controls.Primitives;
 using Avalonia.Data;
 using Avalonia.Data.Converters;
 using Avalonia.Input;
-using Avalonia.Markup.Xaml;
-using Avalonia.Media;
-using Avalonia.Styling;
 using Avalonia.VisualTree;
 using CommunityToolkit.Mvvm.Input;
 using InABox.Core;
 using System.Collections;
-using System.Collections.Specialized;
 using System.ComponentModel;
 
 namespace InABox.Avalonia.Components;

+ 1 - 5
InABox.Avalonia/Components/DateSelector/DateSelectorButton.cs

@@ -1,14 +1,10 @@
 using Avalonia;
-using Avalonia.Controls;
 using Avalonia.Controls.Primitives;
 using Avalonia.Data.Converters;
-using CommunityToolkit.Mvvm.Input;
-using ExCSS;
+using CommunityToolkit.Mvvm.Input; 
 using InABox.Avalonia.Components.DateSelector;
-using InABox.Avalonia.Converters;
 using InABox.Core;
 using System.Globalization;
-using System.Windows.Input;
 
 namespace InABox.Avalonia.Components;
 

+ 0 - 6
InABox.Avalonia/Components/DateSelector/DateSelectorViewModel.cs

@@ -1,11 +1,5 @@
 using CommunityToolkit.Mvvm.ComponentModel;
 using CommunityToolkit.Mvvm.Input;
-using DialogHostAvalonia;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace InABox.Avalonia.Components.DateSelector;
 

+ 1 - 1
InABox.Avalonia/Components/Modules/ModuleList/AvaloniaModuleCollection.cs

@@ -81,7 +81,7 @@ public partial class AvaloniaModuleCollection : ObservableObject
         where TToken : ISecurityDescriptor, new()
         where TViewModel : IViewModelBase
     {
-        if (Security.IsAllowed<TToken>())
+        if (InABox.Core.Security.IsAllowed<TToken>())
             return Add<TViewModel>(title, description, image, configure, isVisible);
         return null;
     }

+ 1 - 2
InABox.Avalonia/Components/TimeSelector/TimeSelectorButton.cs

@@ -2,8 +2,7 @@ using Avalonia;
 using Avalonia.Controls;
 using Avalonia.Controls.Primitives;
 using Avalonia.Data.Converters;
-using CommunityToolkit.Mvvm.Input;
-using ExCSS;
+using CommunityToolkit.Mvvm.Input; 
 using InABox.Avalonia.Components.TimeSelector;
 using InABox.Avalonia.Converters;
 using InABox.Core;

+ 0 - 6
InABox.Avalonia/Components/TimeSelector/TimeSelectorViewModel.cs

@@ -1,11 +1,5 @@
 using CommunityToolkit.Mvvm.ComponentModel;
 using CommunityToolkit.Mvvm.Input;
-using DialogHostAvalonia;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace InABox.Avalonia.Components.TimeSelector;
 

+ 1 - 4
InABox.Avalonia/Images/Images.cs

@@ -1,8 +1,5 @@
-using System;
-using System.Reflection;
+using System.Reflection;
 using Avalonia.Svg.Skia;
-using InABox.Avalonia.Components;
-using Syncfusion.Pdf.Parsing;
 
 namespace InABox.Avalonia;
 

+ 15 - 10
InABox.Avalonia/InABox.Avalonia.csproj

@@ -1,11 +1,10 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFramework>net8.0</TargetFramework>
+        <TargetFrameworks>net8.0;net9.0</TargetFrameworks>
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
         <RootNamespace>InABox.Avalonia</RootNamespace>
-        <LangVersion>default</LangVersion>
         <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
         <Configurations>Debug;Release</Configurations>
     </PropertyGroup>
@@ -23,20 +22,26 @@
     </ItemGroup>
 
     <ItemGroup>
-      <PackageReference Include="Autofac" Version="8.2.0" />
+      <PackageReference Include="Autofac" Version="8.3.0" />
+      <PackageReference Include="Avalonia" Version="11.2.2" />
       <PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.2" />
-      <PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.2" />
-      <PackageReference Include="Avalonia.Svg.Skia" Version="11.2.0.2" />
       <PackageReference Include="AvaloniaDialogs" Version="3.6.1" />
-      <PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
-      <PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.70" />
-      <PackageReference Include="Serilog" Version="4.2.0" />
+      <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
+      <PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.71" />
+      <PackageReference Include="Serilog" Version="4.3.0" />
       <PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
-      <PackageReference Include="Syncfusion.Licensing" Version="29.2.7" />
-      <PackageReference Include="Syncfusion.Pdf.Net.Core" Version="29.2.7" />
+      <PackageReference Include="SkiaSharp" Version="2.88.9" />
+      <PackageReference Include="Svg.Model" Version="2.0.0.4" />
+      <PackageReference Include="Syncfusion.Licensing" Version="29.2.10" />
     </ItemGroup>
 
     <ItemGroup>
+      <Reference Include="Avalonia.Controls.DataGrid">
+        <HintPath>..\..\..\.nuget\packages\avalonia.controls.datagrid\11.2.5\lib\net8.0\Avalonia.Controls.DataGrid.dll</HintPath>
+      </Reference>
+      <Reference Include="Avalonia.Svg.Skia">
+        <HintPath>..\..\..\.nuget\packages\avalonia.svg.skia\11.2.0.2\lib\net8.0\Avalonia.Svg.Skia.dll</HintPath>
+      </Reference>
       <Reference Include="SkiaSharp">
         <HintPath>..\..\prs\InABox.Avalonia\InABox.Avalonia.Desktop\bin\Debug\net8.0-windows10.0.19041.0\SkiaSharp.dll</HintPath>
       </Reference>

+ 3 - 3
InABox.Avalonia/MobileDocument/MobileDocument.cs

@@ -1,6 +1,6 @@
-using Avalonia.Controls;
-using Syncfusion.Pdf;
-using Syncfusion.Pdf.Graphics;
+using System;
+using System.Threading.Tasks;
+using Avalonia.Controls; 
 
 namespace InABox.Avalonia
 {

+ 28 - 23
InABox.Avalonia/MobileDocument/MobileDocumentExtensions.cs

@@ -1,5 +1,7 @@
-using Syncfusion.Pdf;
-using Syncfusion.Pdf.Graphics;
+
+
+using System.IO;
+using InABox.Avalonia.Platform;
 
 namespace InABox.Avalonia
 {
@@ -7,27 +9,30 @@ namespace InABox.Avalonia
     {
         public static void ConvertToPDF(this MobileDocument document)
         {
-            using (var img = new MemoryStream(document.Data))
-            {
-                var image = new PdfBitmap(img);
-
-                var pdfDoc = new PdfDocument();
-
-                var section = pdfDoc.Sections.Add();
-                section.PageSettings.Margins.All = 0;
-                section.PageSettings.Width = image.Width;
-                section.PageSettings.Height = image.Height;
-
-                var page = section.Pages.Add();
-                page.Graphics.DrawImage(image, 0, 0, page.Size.Width, page.Size.Height);
-
-                using (var ms = new MemoryStream())
-                {
-                    pdfDoc.Save(ms);
-                    document.Data = ms.GetBuffer();
-                    document.FileName = Path.ChangeExtension(document.FileName, "pdf");                
-                }
-            }
+            document.Data = PlatformTools.PdfRenderer.ImageToPdf(document.Data);
+            document.FileName = Path.ChangeExtension(document.FileName, "pdf");    
+            
+            // using (var img = new MemoryStream(document.Data))
+            // {
+            //     var image = new PdfBitmap(img);
+            //
+            //     var pdfDoc = new PdfDocument();
+            //
+            //     var section = pdfDoc.Sections.Add();
+            //     section.PageSettings.Margins.All = 0;
+            //     section.PageSettings.Width = image.Width;
+            //     section.PageSettings.Height = image.Height;
+            //
+            //     var page = section.Pages.Add();
+            //     page.Graphics.DrawImage(image, 0, 0, page.Size.Width, page.Size.Height);
+            //
+            //     using (var ms = new MemoryStream())
+            //     {
+            //         pdfDoc.Save(ms);
+            //         document.Data = ms.GetBuffer();
+            //         document.FileName = Path.ChangeExtension(document.FileName, "pdf");                
+            //     }
+            // }
 
         }
         

+ 1 - 3
InABox.Avalonia/Navigation/Navigation.cs

@@ -1,6 +1,4 @@
-using System;
-using System.Diagnostics.Tracing;
-using Avalonia.Layout;
+using Avalonia.Layout;
 using CommunityToolkit.Mvvm.ComponentModel;
 using DialogHostAvalonia;
 using InABox.Avalonia.Components;

+ 2 - 3
InABox.Client.RPC/InABox.Client.RPC.csproj

@@ -1,10 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFrameworks>net8.0;netstandard2.1</TargetFrameworks>
-        <ImplicitUsings>disable</ImplicitUsings>
+        <OutputType>Library</OutputType>
         <Nullable>enable</Nullable>
-        <RootNamespace>InABox.RPC.Client</RootNamespace>
+        <TargetFramework>netstandard2.1</TargetFramework>
     </PropertyGroup>
 
     <ItemGroup>

+ 1 - 1
InABox.Core/Client/ClientFactory.cs

@@ -311,7 +311,7 @@ namespace InABox.Clients
             UserID = "";
             UserSecurityID = Guid.Empty;
             SessionID = Guid.Empty;
-            Security.Reset();
+            InABox.Core.Security.Reset();
         }
 
         public static event LogEvent? OnLog;

+ 4 - 7
InABox.Core/InABox.Core.csproj

@@ -1,13 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <ReleaseVersion>1.00</ReleaseVersion>
-        <SynchReleaseVersion>false</SynchReleaseVersion>
         <OutputType>Library</OutputType>
-        <TargetFrameworks>net8.0;netstandard2.1</TargetFrameworks>
 		<Nullable>enable</Nullable>
-        <IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">false</IsTrimmable>
-        <PublishTrimmed Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">false</PublishTrimmed>
+        <TargetFramework>netstandard2.1</TargetFramework>
 	</PropertyGroup>
 
 	<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -36,11 +32,12 @@
         <PackageReference Include="Inflector.NetStandard" Version="1.2.2" />
         <PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
         <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
-        <PackageReference Include="System.Collections.Immutable" Version="9.0.4" />
+        <PackageReference Include="System.Collections.Immutable" Version="9.0.6" />
         <PackageReference Include="TextFieldParserStandard" Version="1.0.0" />
     </ItemGroup>
     <ItemGroup>
-        <ProjectReference Include="..\inabox.logging.shared\InABox.Logging.Shared.csproj" />
+      <ProjectReference Include="..\InABox.Integration\InABox.Integration.csproj" />
+      <ProjectReference Include="..\inabox.logging.shared\InABox.Logging.Shared.csproj" />
     </ItemGroup>
 
 </Project>

+ 3 - 1
InABox.Integration/InABox.Integration.csproj

@@ -1,7 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFramework>netstandard2.0</TargetFramework>
+        <OutputType>Library</OutputType>
+        <Nullable>enable</Nullable>
+        <TargetFramework>netstandard2.1</TargetFramework>
     </PropertyGroup>
 
 </Project>

+ 2 - 2
InABox.RPC.Shared/InABox.RPC.Shared.csproj

@@ -1,9 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
-        <ImplicitUsings>disable</ImplicitUsings>
+        <OutputType>Library</OutputType>
         <Nullable>enable</Nullable>
+        <TargetFramework>netstandard2.1</TargetFramework>
     </PropertyGroup>
 
     <ItemGroup>

+ 6 - 6
inabox.logging.shared/InABox.Logging.Shared.csproj

@@ -1,17 +1,17 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFrameworks>netcoreapp3.1;netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
-        <IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">false</IsTrimmable>
-        <PublishTrimmed Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">false</PublishTrimmed>
+        <OutputType>Library</OutputType>
+        <Nullable>enable</Nullable>
+        <TargetFramework>netstandard2.1</TargetFramework>
     </PropertyGroup>
 
     <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
-        <Optimize>False</Optimize>
+        <DefineConstants>TRACE</DefineConstants>
     </PropertyGroup>
 
-    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
-        <Optimize>True</Optimize>
+    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+        <DefineConstants>$(DefineConstants)TRACE;PURGE</DefineConstants>
     </PropertyGroup>
 
 </Project>

+ 1 - 1
inabox.logging.shared/Log.cs

@@ -18,7 +18,7 @@ namespace InABox.Core
 
     public class Logger
     {
-        public static event LogEvent OnLog;
+        public static event LogEvent? OnLog;
 
         public static Logger Main = new Logger(Guid.Empty);