Cleanup
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
|
||||
namespace CLI.Monitor;
|
||||
namespace Ocr.Cli.Monitor;
|
||||
|
||||
public class CliTaskMonitor : TaskMonitor
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
|
||||
namespace CLI.Monitor;
|
||||
namespace Ocr.Cli.Monitor;
|
||||
|
||||
public class CompactCliTaskMonitor : TaskMonitor
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace CLI.Monitor;
|
||||
namespace Ocr.Cli.Monitor;
|
||||
|
||||
public interface ITaskMonitor
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace CLI.Monitor;
|
||||
namespace Ocr.Cli.Monitor;
|
||||
|
||||
public abstract class TaskMonitor : ITaskMonitor
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ using Process.Interface;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace CLI.Processor;
|
||||
namespace Ocr.Cli.Processor;
|
||||
|
||||
internal class EvaluationProcessor
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Process.Interface;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace CLI.Processor;
|
||||
namespace Ocr.Cli.Processor;
|
||||
|
||||
public class StopwatchProcessor<TInput, TOutput> : Processor<TInput, TOutput>
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using CLI.Monitor;
|
||||
using CLI.Processor;
|
||||
using Common.Extensions;
|
||||
using Common.Extensions;
|
||||
using ImageMagick;
|
||||
using Ocr.Cli.Monitor;
|
||||
using Ocr.Cli.Processor;
|
||||
using Ocr.Tesseract.Screenshots.Threshold;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace CLI;
|
||||
namespace Ocr.Cli;
|
||||
|
||||
public class Program
|
||||
{
|
||||
|
||||
+27
-3
@@ -23,9 +23,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lookup.Database", "..\Looku
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lookup.Abstract", "..\Lookup\Lookup.Abstract\Lookup.Abstract.csproj", "{D14DA0B8-5EAE-4C77-992E-3527DC84CE6D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CLI", "CLI\CLI.csproj", "{2856493F-EF1C-42A1-8EE5-6C0387D08F95}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocr.Cli", "CLI\Ocr.Cli.csproj", "{2856493F-EF1C-42A1-8EE5-6C0387D08F95}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GUI", "GUI\GUI.csproj", "{DA447F14-1B1D-4733-99F3-6EF8225DCBAB}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocr.Gui", "GUI\Ocr.Gui.csproj", "{DA447F14-1B1D-4733-99F3-6EF8225DCBAB}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "Common\Common.csproj", "{A6C738AC-DCD7-4024-A92D-3FC3CDCD7229}"
|
||||
EndProject
|
||||
@@ -35,7 +35,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocr.Tesseract", "..\Ocr\Ocr
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocr.Tesseract.Screenshots", "..\Ocr\Ocr.Tesseract.Screenshots\Ocr.Tesseract.Screenshots.csproj", "{251F9AC9-3765-498C-83FD-DB3539A19CB3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportGenerator", "ReportGenerator\ReportGenerator.csproj", "{729CB7AA-AB0D-4C39-AA17-7435E61FA0A6}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocr.Report", "ReportGenerator\Ocr.Report.csproj", "{729CB7AA-AB0D-4C39-AA17-7435E61FA0A6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReportGeneration", "ReportGeneration", "{8E08DA62-584B-4E26-AEB7-2B35742EF7A5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportGeneration.Interface", "..\ReportGeneration\ReportGeneration.Interface\ReportGeneration.Interface.csproj", "{A0760AFE-5CB7-4603-8861-285F62BE510F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportGeneration.Generators", "..\ReportGeneration\ReportGeneration.Generators\ReportGeneration.Generators.csproj", "{F291F2D4-5BC5-4576-A210-BE8D447276FC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportGeneration.Abstract", "..\ReportGeneration\ReportGeneration.Abstract\ReportGeneration.Abstract.csproj", "{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -95,6 +103,18 @@ Global
|
||||
{729CB7AA-AB0D-4C39-AA17-7435E61FA0A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{729CB7AA-AB0D-4C39-AA17-7435E61FA0A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{729CB7AA-AB0D-4C39-AA17-7435E61FA0A6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A0760AFE-5CB7-4603-8861-285F62BE510F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A0760AFE-5CB7-4603-8861-285F62BE510F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A0760AFE-5CB7-4603-8861-285F62BE510F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A0760AFE-5CB7-4603-8861-285F62BE510F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F291F2D4-5BC5-4576-A210-BE8D447276FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F291F2D4-5BC5-4576-A210-BE8D447276FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F291F2D4-5BC5-4576-A210-BE8D447276FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F291F2D4-5BC5-4576-A210-BE8D447276FC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -112,6 +132,10 @@ Global
|
||||
{E55F78E4-09F1-4D79-A9A2-460562C96DAB} = {CF65AA6A-2F25-4FEE-BDC1-AD96E1FFFA49}
|
||||
{D9B70035-0159-4D75-8ED6-2461F060F683} = {E55F78E4-09F1-4D79-A9A2-460562C96DAB}
|
||||
{251F9AC9-3765-498C-83FD-DB3539A19CB3} = {E55F78E4-09F1-4D79-A9A2-460562C96DAB}
|
||||
{8E08DA62-584B-4E26-AEB7-2B35742EF7A5} = {CF65AA6A-2F25-4FEE-BDC1-AD96E1FFFA49}
|
||||
{A0760AFE-5CB7-4603-8861-285F62BE510F} = {8E08DA62-584B-4E26-AEB7-2B35742EF7A5}
|
||||
{F291F2D4-5BC5-4576-A210-BE8D447276FC} = {8E08DA62-584B-4E26-AEB7-2B35742EF7A5}
|
||||
{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74} = {8E08DA62-584B-4E26-AEB7-2B35742EF7A5}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DFA659EE-FE78-4BD9-888B-78984354093E}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Application x:Class="GUI.App"
|
||||
<Application x:Class="Ocr.Gui.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources/>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using GUI.ViewModels;
|
||||
using GUI.Views;
|
||||
using Serilog;
|
||||
using Ocr.Gui.Views;
|
||||
using System.Windows;
|
||||
|
||||
namespace GUI;
|
||||
namespace Ocr.Gui;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
@@ -14,13 +12,6 @@ public partial class App : Application
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
|
||||
var loggingCollection = new LoggingCollection(100);
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.WriteTo.Sink(loggingCollection)
|
||||
.CreateLogger();
|
||||
|
||||
new LogView(loggingCollection).Show();
|
||||
new ImageView().Show();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
<UserControl
|
||||
x:Class="GUI.Controls.ImageControl"
|
||||
x:Class="Ocr.Gui.Controls.ImageControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:converters="clr-namespace:GUI.Converters"
|
||||
xmlns:controls="clr-namespace:GUI.Controls"
|
||||
xmlns:converters="clr-namespace:Ocr.Gui.Converters"
|
||||
xmlns:controls="clr-namespace:Ocr.Gui.Controls"
|
||||
d:DataContext="{d:DesignInstance controls:ImageControl}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace GUI.Controls;
|
||||
namespace Ocr.Gui.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for ImageControl.xaml
|
||||
|
||||
@@ -6,12 +6,10 @@ using System.IO;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GUI.Converters;
|
||||
namespace Ocr.Gui.Converters;
|
||||
|
||||
internal class ImageConverter : IValueConverter
|
||||
{
|
||||
#region Implementation of IValueConverter
|
||||
|
||||
/// <inheritdoc />
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
@@ -48,6 +46,4 @@ internal class ImageConverter : IValueConverter
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GUI.Model;
|
||||
namespace Ocr.Gui.Model;
|
||||
|
||||
public class Command : ICommand
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.2.0" />
|
||||
<PackageReference Include="Serilog" Version="3.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GUI.ViewModels;
|
||||
|
||||
public class LogMessage
|
||||
{
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace GUI.ViewModels;
|
||||
|
||||
public class LogViewModel
|
||||
{
|
||||
public LoggingCollection LoggingCollection { get; }
|
||||
|
||||
public LogViewModel(LoggingCollection loggingCollection)
|
||||
{
|
||||
LoggingCollection = loggingCollection;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using Serilog.Core;
|
||||
using Serilog.Events;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace GUI.ViewModels;
|
||||
|
||||
public class LoggingCollection : ILogEventSink
|
||||
{
|
||||
public int Capacity { get; }
|
||||
|
||||
public ObservableCollection<LogMessage> Items { get; }
|
||||
|
||||
public LoggingCollection(int capacity)
|
||||
{
|
||||
Capacity = capacity;
|
||||
Items = new ObservableCollection<LogMessage>(new List<LogMessage>(capacity));
|
||||
}
|
||||
|
||||
public void Trim(int offset = 0)
|
||||
{
|
||||
for (int i = Items.Count - Capacity - offset; i >= 0; i--)
|
||||
{
|
||||
Items.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
#region Implementation of ILogEventSink
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Emit(LogEvent logEvent)
|
||||
{
|
||||
Trim(1);
|
||||
|
||||
Items.Add(new LogMessage
|
||||
{
|
||||
Timestamp = logEvent.Timestamp.DateTime,
|
||||
Message = logEvent.RenderMessage()
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
<Window
|
||||
x:Class="GUI.Views.ImageView"
|
||||
x:Class="Ocr.Gui.Views.ImageView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:GUI.Controls"
|
||||
xmlns:viewModels="clr-namespace:GUI.ViewModels"
|
||||
xmlns:views="clr-namespace:Ocr.Gui.Views"
|
||||
xmlns:controls="clr-namespace:Ocr.Gui.Controls"
|
||||
Title="OcrView"
|
||||
Width="800"
|
||||
Height="450"
|
||||
d:DataContext="{d:DesignInstance viewModels:ImageViewModel}"
|
||||
d:DataContext="{d:DesignInstance views:ImageViewModel}"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<CollectionViewSource
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using GUI.ViewModels;
|
||||
using ImageMagick;
|
||||
using ImageMagick;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
namespace GUI.Views;
|
||||
namespace Ocr.Gui.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Common;
|
||||
using GUI.Model;
|
||||
using ImageMagick;
|
||||
using Microsoft.Win32;
|
||||
using Ocr.Gui.Model;
|
||||
using Ocr.Tesseract;
|
||||
using Ocr.Tesseract.Configuration;
|
||||
using Ocr.Tesseract.Models;
|
||||
@@ -23,7 +23,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GUI.ViewModels;
|
||||
namespace Ocr.Gui.Views;
|
||||
|
||||
internal class ImageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
@@ -1,41 +0,0 @@
|
||||
<Window
|
||||
x:Class="GUI.Views.LogView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:GUI.ViewModels"
|
||||
Title="LogView"
|
||||
Width="800"
|
||||
Height="450"
|
||||
d:DataContext="{d:DesignInstance viewModels:LogViewModel}"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<DataGrid
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding LoggingCollection.Items}"
|
||||
VirtualizingPanel.ScrollUnit="Pixel">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="Auto"
|
||||
MinWidth="120"
|
||||
Binding="{Binding Timestamp}"
|
||||
Header="Timestamp" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
MinWidth="120"
|
||||
MaxWidth="300"
|
||||
Binding="{Binding Message}"
|
||||
Header="Message">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Left" />
|
||||
<Setter Property="TextBlock.TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,16 +0,0 @@
|
||||
using GUI.ViewModels;
|
||||
using System.Windows;
|
||||
|
||||
namespace GUI.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for LogView.xaml
|
||||
/// </summary>
|
||||
public partial class LogView : Window
|
||||
{
|
||||
public LogView(LoggingCollection loggingCollection)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new LogViewModel(loggingCollection);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace ReportGenerator.Generator.Interface;
|
||||
|
||||
public interface IBounds
|
||||
{
|
||||
public string Unit { get; }
|
||||
public int? MinWidth { get; }
|
||||
public int? MinHeight { get; }
|
||||
public int? MaxWidth { get; }
|
||||
public int? MaxHeight { get; }
|
||||
public int? Width { get; }
|
||||
public int? Height { get; }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReportGenerator.Models;
|
||||
namespace Ocr.Report.Models;
|
||||
|
||||
public readonly struct ImageStats
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Common.Distance;
|
||||
|
||||
namespace ReportGenerator.Models;
|
||||
namespace Ocr.Report.Models;
|
||||
|
||||
public readonly struct ProcessorStat : IDistanceComparer<IEnumerable<string>>
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ReportGenerator.Models;
|
||||
namespace Ocr.Report.Models;
|
||||
|
||||
public struct ScanFileInfo
|
||||
{
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ReportGenerator.Models;
|
||||
namespace Ocr.Report.Models;
|
||||
|
||||
internal struct TagFileInfo
|
||||
{
|
||||
public string Path { get; private init; }
|
||||
public string Path { get; private init; }
|
||||
|
||||
public string ImageName { get; set; }
|
||||
public string ImageName { get; set; }
|
||||
|
||||
public ICollection<string> GetWords()
|
||||
{
|
||||
using var file = File.OpenRead(Path);
|
||||
return JsonDocument
|
||||
.Parse(file)
|
||||
.RootElement
|
||||
.GetProperty("words")
|
||||
.EnumerateArray()
|
||||
.Select(w => w.GetString() ?? throw new Exception("Cannot parse null words"))
|
||||
.ToArray();
|
||||
}
|
||||
public ICollection<string> GetWords()
|
||||
{
|
||||
using var file = File.OpenRead(Path);
|
||||
return JsonDocument
|
||||
.Parse(file)
|
||||
.RootElement
|
||||
.GetProperty("words")
|
||||
.EnumerateArray()
|
||||
.Select(w => w.GetString() ?? throw new Exception("Cannot parse null words"))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public static TagFileInfo FromPath(string path) => new()
|
||||
{
|
||||
Path = path,
|
||||
ImageName = System.IO.Path.GetFileNameWithoutExtension(path),
|
||||
};
|
||||
public static TagFileInfo FromPath(string path) => new()
|
||||
{
|
||||
Path = path,
|
||||
ImageName = System.IO.Path.GetFileNameWithoutExtension(path),
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => ImageName;
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => ImageName;
|
||||
}
|
||||
|
||||
+2
-4
@@ -11,15 +11,13 @@
|
||||
<None Remove="Properties\htmldocument-style.css" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Generator\Generator\Resources\Style.css" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ReportGeneration\ReportGeneration.Generators\ReportGeneration.Generators.csproj" />
|
||||
<ProjectReference Include="..\..\ReportGeneration\ReportGeneration.Interface\ReportGeneration.Interface.csproj" />
|
||||
<ProjectReference Include="..\Common\Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Common.Extensions;
|
||||
using ReportGenerator.Generator.Generator;
|
||||
using ReportGenerator.Models;
|
||||
using Ocr.Report.Models;
|
||||
using ReportGeneration.Generators;
|
||||
|
||||
namespace ReportGenerator;
|
||||
namespace Ocr.Report;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGenerator.Generator.Model;
|
||||
using ReportGenerator.Models;
|
||||
using Ocr.Report.Models;
|
||||
using ReportGeneration.Abstract.Model;
|
||||
using ReportGeneration.Interface;
|
||||
|
||||
namespace ReportGenerator;
|
||||
namespace Ocr.Report;
|
||||
|
||||
public class ReportGenerator : IDisposable
|
||||
{
|
||||
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Interface;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ReportGenerator.Generator.Abstract;
|
||||
namespace ReportGeneration.Abstract;
|
||||
|
||||
public abstract class DocumentGeneratorBase : StreamWriterBase, IDocumentGenerator
|
||||
{
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Interface;
|
||||
|
||||
namespace ReportGenerator.Generator.Model;
|
||||
namespace ReportGeneration.Abstract.Model;
|
||||
|
||||
public struct Bounds : IBounds
|
||||
{
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<IncludeSymbols>True</IncludeSymbols>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReportGeneration.Interface\ReportGeneration.Interface.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Interface;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ReportGenerator.Generator.Abstract;
|
||||
namespace ReportGeneration.Abstract;
|
||||
|
||||
public abstract class StreamWriterBase : IStreamWriter
|
||||
{
|
||||
+5
-2
@@ -1,7 +1,10 @@
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Interface;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ReportGenerator.Generator.Abstract;
|
||||
namespace ReportGeneration.Abstract;
|
||||
|
||||
public abstract class TableGeneratorBase : StreamWriterBase, ITableGenerator
|
||||
{
|
||||
@@ -0,0 +1,42 @@
|
||||
using ReportGeneration.Abstract;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ReportGeneration.Generators;
|
||||
|
||||
internal class CollapsibleHtmlTableGenerator : HtmlTableGenerator
|
||||
{
|
||||
public string DetailsClass { get; init; }
|
||||
public string Summary { get; init; } = "Show table";
|
||||
|
||||
/// <inheritdoc />
|
||||
public CollapsibleHtmlTableGenerator(int columns)
|
||||
: base(columns) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public CollapsibleHtmlTableGenerator(int columns, Stream stream)
|
||||
: base(columns, stream) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public CollapsibleHtmlTableGenerator(int columns, Stream stream, Encoding encoding)
|
||||
: base(columns, stream, encoding) { }
|
||||
|
||||
#region Overrides of HtmlTableGenerator
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnOpen()
|
||||
{
|
||||
Writer.Write($"<details class=\"{DetailsClass}\" open>");
|
||||
Writer.Write(HtmlTools.Wrap("summary", Summary));
|
||||
base.OnOpen();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnClose()
|
||||
{
|
||||
base.OnClose();
|
||||
Writer.Write($"</details>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
+4
-3
@@ -1,9 +1,10 @@
|
||||
using ReportGenerator.Generator.Abstract;
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Abstract;
|
||||
using ReportGeneration.Interface;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace ReportGenerator.Generator.Generator;
|
||||
namespace ReportGeneration.Generators;
|
||||
|
||||
public class HtmlDocumentGenerator : DocumentGeneratorBase
|
||||
{
|
||||
+6
-40
@@ -1,45 +1,11 @@
|
||||
using ReportGenerator.Generator.Abstract;
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Abstract;
|
||||
using ReportGeneration.Interface;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ReportGenerator.Generator.Generator;
|
||||
namespace ReportGeneration.Generators;
|
||||
|
||||
internal class CollapsibleHtmlTableGenerator : HtmlTableGenerator
|
||||
{
|
||||
public string DetailsClass { get; init; }
|
||||
public string Summary { get; init; } = "Show table";
|
||||
|
||||
/// <inheritdoc />
|
||||
public CollapsibleHtmlTableGenerator(int columns)
|
||||
: base(columns) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public CollapsibleHtmlTableGenerator(int columns, Stream stream)
|
||||
: base(columns, stream) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public CollapsibleHtmlTableGenerator(int columns, Stream stream, Encoding encoding)
|
||||
: base(columns, stream, encoding) { }
|
||||
|
||||
#region Overrides of HtmlTableGenerator
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnOpen()
|
||||
{
|
||||
Writer.Write($"<details class=\"{DetailsClass}\" open>");
|
||||
Writer.Write(HtmlTools.Wrap("summary", Summary));
|
||||
base.OnOpen();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnClose()
|
||||
{
|
||||
base.OnClose();
|
||||
Writer.Write($"</details>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
internal class HtmlTableGenerator : TableGeneratorBase
|
||||
{
|
||||
@@ -108,4 +74,4 @@ internal class HtmlTableGenerator : TableGeneratorBase
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Interface;
|
||||
|
||||
namespace ReportGenerator.Generator;
|
||||
namespace ReportGeneration.Generators;
|
||||
|
||||
internal static class HtmlTools
|
||||
{
|
||||
+4
-3
@@ -1,8 +1,9 @@
|
||||
using ReportGenerator.Generator.Abstract;
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Abstract;
|
||||
using ReportGeneration.Interface;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ReportGenerator.Generator.Generator;
|
||||
namespace ReportGeneration.Generators;
|
||||
|
||||
public class MarkdownDocumentGenerator : DocumentGeneratorBase
|
||||
{
|
||||
+5
-3
@@ -1,8 +1,10 @@
|
||||
using ReportGenerator.Generator.Abstract;
|
||||
using ReportGenerator.Generator.Interface;
|
||||
using ReportGeneration.Abstract;
|
||||
using ReportGeneration.Interface;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ReportGenerator.Generator.Generator;
|
||||
namespace ReportGeneration.Generators;
|
||||
|
||||
internal class MarkdownTableGenerator : TableGeneratorBase
|
||||
{
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<IncludeSymbols>True</IncludeSymbols>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReportGeneration.Abstract\ReportGeneration.Abstract.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace ReportGeneration.Interface;
|
||||
|
||||
public interface IBounds
|
||||
{
|
||||
public string Unit { get; }
|
||||
public int? MinWidth { get; }
|
||||
public int? MinHeight { get; }
|
||||
public int? MaxWidth { get; }
|
||||
public int? MaxHeight { get; }
|
||||
public int? Width { get; }
|
||||
public int? Height { get; }
|
||||
}
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
namespace ReportGenerator.Generator.Interface;
|
||||
using System;
|
||||
|
||||
namespace ReportGeneration.Interface;
|
||||
|
||||
public interface IDocumentGenerator : IStreamWriter
|
||||
{
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
namespace ReportGenerator.Generator.Interface;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ReportGeneration.Interface;
|
||||
|
||||
public interface IStreamWriter : IDisposable
|
||||
{
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
namespace ReportGenerator.Generator.Interface;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ReportGeneration.Interface;
|
||||
|
||||
public interface ITableGenerator : IStreamWriter
|
||||
{
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<IncludeSymbols>True</IncludeSymbols>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportGeneration.Abstract", "ReportGeneration.Abstract\ReportGeneration.Abstract.csproj", "{CE8FC7DA-E4DB-4A28-99CC-82D9EE72A290}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportGeneration.Generators", "ReportGeneration.Generators\ReportGeneration.Generators.csproj", "{82729833-58A0-4694-AD41-EE41A659B413}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportGeneration.Interface", "ReportGeneration.Interface\ReportGeneration.Interface.csproj", "{2C6CA0F6-0656-4C0A-8B3D-039C37EE5021}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CE8FC7DA-E4DB-4A28-99CC-82D9EE72A290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CE8FC7DA-E4DB-4A28-99CC-82D9EE72A290}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CE8FC7DA-E4DB-4A28-99CC-82D9EE72A290}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CE8FC7DA-E4DB-4A28-99CC-82D9EE72A290}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{82729833-58A0-4694-AD41-EE41A659B413}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{82729833-58A0-4694-AD41-EE41A659B413}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{82729833-58A0-4694-AD41-EE41A659B413}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{82729833-58A0-4694-AD41-EE41A659B413}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2C6CA0F6-0656-4C0A-8B3D-039C37EE5021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2C6CA0F6-0656-4C0A-8B3D-039C37EE5021}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C6CA0F6-0656-4C0A-8B3D-039C37EE5021}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C6CA0F6-0656-4C0A-8B3D-039C37EE5021}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user