Priprava projektu pro manipulaci ve VBA

This commit is contained in:
Michael Klein 2025-11-27 15:19:48 +01:00
parent 641e9bc2e6
commit 583a09838e
16 changed files with 457 additions and 60 deletions

37
.drone.yml Normal file
View File

@ -0,0 +1,37 @@
kind: pipeline
name: default
steps:
- name: build
image: mcr.microsoft.com/dotnet/sdk:9.0
commands:
- dotnet build --configuration Release SlucovaniRozpisek.csproj
- name: installer
image: git.ivasoft.cz/sw/docker-wine-dotnet
commands:
- wine tlbexp.exe bin/Release/net472/SlucovaniRozpisek.dll /out:bin/Release/net472/SlucovaniRozpisek.tlb
- wine Eazfuscator.NET.exe bin/Release/net9.0-windows/SlucovaniRozpisek.dll -k key.snk -n --newline-flush
# HACK Second build is success as first invocation fails
# dotnet exec <wix.dll> msi validate <path to SpravceDS.msi
# with error
# err:msidb:msi_commit_streams failed to write stream (hr = 0x80030102)
# err:msi:MsiDatabaseCommit Failed to commit streams!
# wix.exe : error WIX0216: An unexpected Win32 exception with error code 0x65B occurred: Function failed.
- echo wine cmd /c '"dotnet build --configuration Release --no-dependencies Setup.wixproj || dotnet build --configuration Release --no-dependencies Setup.wixproj"' > build.sh
# HACK Until dotnet 9 get released and have the bug https://github.com/dotnet/runtime/issues/98441 fixed
- apt update && apt install socat
- chmod +x build.sh
- socat -u EXEC:"./build.sh",pty,stderr,sigint,setsid,sane -
when:
event: tag
- name: gitea_release
image: plugins/gitea-release
settings:
api_key:
from_secret: drone_release
base_url: https://git.exprojekt.cz
files: 'bin/Release/**/*.msi'
when:
event: tag

View File

@ -1,7 +1,7 @@
<Application x:Class="Slučování_rozpisek.App"
<Application x:Class="SlucovaniRozpisek.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Slučování_rozpisek"
xmlns:local="clr-namespace:SlucovaniRozpisek"
StartupUri="MainWindow.xaml">
<Application.Resources>

View File

@ -2,7 +2,7 @@
using System.Data;
using System.Windows;
namespace Slučování_rozpisek
namespace SlucovaniRozpisek
{
/// <summary>
/// Interaction logic for App.xaml

View File

@ -1,5 +1,8 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
#if false // !NETFRAMEWORK
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
@ -8,3 +11,33 @@ using System.Windows;
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
#endif
[assembly: AssemblyTitle("Slucovani Rozpisek")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("EXprojekt s.r.o.")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © 2025 EXProjekt s.r.o.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("E8C102DB-4C3E-457F-A4FC-7A9BF6FBD105")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

22
ILRepack.targets Normal file
View File

@ -0,0 +1,22 @@
<Project>
<!--Target Name="ILRepackCustom" AfterTargets="Build" Condition="$(Configuration.Contains('Release'))">
<ItemGroup>
<AssembliesToMerge Include="$(OutputPath)PdfSharp.dll"/>
<InputAssemblies Include="$(OutputPath)$(TargetName)$(TargetExt)"/>
<InputAssemblies Include="@(AssembliesToMerge)"/>
</ItemGroup>
<ILRepack
Parallel="true"
DebugInfo="true"
AllowDuplicateResources="false"
Internalize="true"
InputAssemblies="@(InputAssemblies)"
TargetKind="SameAsPrimaryAssembly"
KeyFile="$(AssemblyOriginatorKeyFile)"
OutputFile="$(OutputPath)$(TargetName)$(TargetExt)"
/>
<Delete Files="@(AssembliesToMerge)"/>
</Target-->
</Project>

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlucovaniRozpisek"
mc:Ignorable="d"
Title="Slučování rozpisek" SizeToContent="WidthAndHeight" Background="WhiteSmoke" Icon=".\icopdf.ico"
Title="Slučování rozpisek" SizeToContent="WidthAndHeight" Background="WhiteSmoke" Icon=".\Logo.ico"
WindowStartupLocation="Manual" Left="200" Top="200"
>
<Grid Margin="10">

View File

@ -1,4 +1,6 @@
using Microsoft.Win32;
#if !NETFRAMEWORK
using Microsoft.Win32;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
@ -22,9 +24,9 @@ namespace SlucovaniRozpisek
// jen pro testování
#if (DEBUG)
ViewModel.CestaPrilohy = "d:\\Přesunuté\\.NET\\Csharp_výuka\\SlucovaniPDF\\Přílohy";
ViewModel.CestaRozpisky = "d:\\Přesunuté\\.NET\\Csharp_výuka\\SlucovaniPDF\\Rozpisky";
ViewModel.CestaVystup = "d:\\Přesunuté\\.NET\\Csharp_výuka\\SlucovaniPDF\\Výstup";
ViewModel.CestaPrilohy = "C:\\Users\\klein\\Code\\_sluc test\\Přílohy";
ViewModel.CestaRozpisky = "C:\\Users\\klein\\Code\\_sluc test\\Rozpisky";
ViewModel.CestaVystup = "C:\\Users\\klein\\Code\\_sluc test\\+Přílohy s rozpiskami";
#endif
}
@ -82,48 +84,32 @@ namespace SlucovaniRozpisek
return;
}
if (!PomocneMetody. ObsahujePdf(ViewModel.CestaPrilohy))
if (!PomocneMetody.ObsahujePdf(ViewModel.CestaPrilohy))
{
MessageBox.Show("Složka s přílohami neobsahuje žádná PDF,\nkterá by se mohla dát sloučit.", "Kontrola existence PDF",
MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
List<string> lstPrilohy = PomocneMetody.NactiPdfNazvyBezKoncovky(ViewModel.CestaPrilohy);
try {
SlucovacRozpisek slucRoz = new SlucovacRozpisek();
slucRoz.PripravaRozpisky(ViewModel.CestaPrilohy, ViewModel.CestaRozpisky, out int parovePrilohy, out int neparovePrilohy, out int neparoveRozpisky);
string zprava = $"Počet párových příloh: {parovePrilohy}\nPočet nepárových příloh: {neparovePrilohy}\nPočet nepárových rozpisek: {neparoveRozpisky}";
List<string> lstRozpisky = PomocneMetody.NactiPdfNazvyBezKoncovky(ViewModel.CestaRozpisky);
PdfRozdelovac pdfka = new PdfRozdelovac(lstPrilohy, lstRozpisky);
if (MessageBox.Show(pdfka.Zprava, "Přejete si pokračovat?",
if (MessageBox.Show(zprava, "Přejete si pokračovat?",
MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
{
return;
}
string cestaPrilohysLomitkem = PomocneMetody.NormalizujCestu(ViewModel.CestaPrilohy);
string cestaRozpiskysLomitkem = PomocneMetody.NormalizujCestu(ViewModel.CestaRozpisky);
string cestaVystupsLomitkem = PomocneMetody.NormalizujCestu(ViewModel.CestaVystup);
foreach (string pdf in pdfka.NeparovePrilohy)
{
PomocneMetody.KopirujSoubor(cestaPrilohysLomitkem + pdf + ".pdf", cestaVystupsLomitkem + pdf + ".pdf", true);
}
foreach (string pdf in pdfka.NeparoveRozpisky)
{
PomocneMetody.KopirujSoubor(cestaRozpiskysLomitkem + pdf + ".pdf", cestaVystupsLomitkem + pdf + ".pdf", true);
}
foreach (string pdf in pdfka.ParovePrilohy)
{
PomocneMetody.SloucitPdf(cestaPrilohysLomitkem + pdf + ".pdf", cestaRozpiskysLomitkem + pdf + "_rozpiska.pdf", cestaVystupsLomitkem + pdf + ".pdf", true);
}
slucRoz.SlucRozpisky(ViewModel.CestaPrilohy, ViewModel.CestaRozpisky, ViewModel.CestaVystup);
MessageBox.Show("Rozpisky byly úspěšně sloučeny.", "Hotovo",
MessageBoxButton.OK, MessageBoxImage.Information);
} catch (Exception ex)
{
MessageBox.Show($"Při slučování nastala chyba: {ex.Message}","Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private void btnNapoveda(object sender, RoutedEventArgs e)
@ -202,3 +188,5 @@ namespace SlucovaniRozpisek
}
}
}
#endif

View File

@ -5,14 +5,12 @@
public List<string> ParovePrilohy { get; private set; }
public List<string> NeparovePrilohy { get; private set; }
public List<string> NeparoveRozpisky { get; private set; }
public string Zprava { get; private set; }
public PdfRozdelovac(List<string> lstPrilohy, List<string> lstRozpisky)
{
ParovePrilohy = new List<string>();
NeparovePrilohy = new List<string>();
NeparoveRozpisky = new List<string>(lstRozpisky);
Zprava = string.Empty;
RozdelPdfSoubor(lstPrilohy, lstRozpisky);
}
@ -33,8 +31,6 @@
}
NeparoveRozpisky = NeparoveRozpisky.Where(r => !r.EndsWith("_rozpiska")).ToList();
Zprava = $"Počet párových příloh: {ParovePrilohy.Count}\nPočet nepárových příloh: {NeparovePrilohy.Count}\nPočet nepárových rozpisek: {NeparoveRozpisky.Count}";
}
}
}

View File

@ -3,8 +3,10 @@ using System.Windows;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
using PdfSharp.Drawing;
using System.Runtime.InteropServices;
public static class PomocneMetody
[ComVisible(false)]
static class PomocneMetody
{
public static bool ObsahujePdf(string cestaSlozky)
{
@ -42,16 +44,6 @@ public static class PomocneMetody
.ToList();
}
public static string NormalizujCestu(string cesta)
{
if (string.IsNullOrWhiteSpace(cesta))
{
throw new ArgumentException("Neplatná cesta ke složce.", nameof(cesta));
}
return cesta.EndsWith(Path.DirectorySeparatorChar) ? cesta : cesta + Path.DirectorySeparatorChar;
}
public static void KopirujSoubor(string zdrojovySoubor, string cilovySoubor, bool prepsatExistujici)
{
if (string.IsNullOrWhiteSpace(zdrojovySoubor) || string.IsNullOrWhiteSpace(cilovySoubor))
@ -80,7 +72,8 @@ public static class PomocneMetody
}
catch (IOException ex)
{
MessageBox.Show($"Chyba při kopírování souboru {zdrojovySoubor}: {ex.Message}", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
//MessageBox.Show($"Chyba při kopírování souboru {zdrojovySoubor}: {ex.Message}", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
throw new Exception($"Chyba při kopírování souboru {zdrojovySoubor}: {ex.Message}");
}
}
@ -125,14 +118,16 @@ public static class PomocneMetody
}
else
{
MessageBox.Show("Druhý PDF dokument neobsahuje žádné stránky.", "Chyba", MessageBoxButton.OK, MessageBoxImage.Warning);
//MessageBox.Show("Druhý PDF dokument neobsahuje žádné stránky.", "Chyba", MessageBoxButton.OK, MessageBoxImage.Warning);
throw new Exception("Druhý PDF dokument neobsahuje žádné stránky.");
}
}
}
}
catch (IOException ex)
{
MessageBox.Show($"Chyba při práci s PDF soubory: {ex.Message}", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
//MessageBox.Show($"Chyba při práci s PDF soubory: {ex.Message}", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
throw new Exception($"Chyba při práci s PDF soubory: {ex.Message}");
}
}
}

203
Product.wxs Normal file
View File

@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- The name of the product -->
<?define Name = "SlucovaniRozpisek" ?>
<!-- The Description of the product -->
<?define Description = "EXprojekt Slucovani Rozpisek." ?>
<!-- The manufacturer, for setup package publisher and folder info -->
<?define Manufacturer = "EXprojekt s.r.o" ?>
<!-- The version number of this setup package-->
<?define Version = "!(bind.FileVersion.SlucovaniRozpisek.dll)" ?>
<!-- UpgradeCode must be unique and not changed once the first version of the program is installed. -->
<?define UpgradeCode = "{73077CF7-2AB3-45E2-AB90-EB107C9DAA92}" ?>
<!-- The name of the Cabinet -->
<?define CabName = "SlucovaniRozpisek.cab" ?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<!--Variable for SlucovaniRozpisek Directory-->
<?define SlucovaniRozpisek_TargetDir=bin/Release/net9.0-windows/?>
<?define SlucovaniRozpisek_AdditionalTargetDir=bin/Release/net9.0-windows/de/?>
<?define SlucovaniRozpisek_tlbDir=bin/Release/net472/?>
<!-- Versions for binaries -->
<?define VerExe = "!(bind.FileVersion.SlucovaniRozpisek.dll)" ?>
<Package InstallerVersion="200" Compressed="yes" Name="$(var.Name)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)" Version="$(var.Version)" Language="1033" Codepage="1250" Scope="perMachine">
<!--Application logo-->
<Icon Id="Logo.ico" SourceFile="Logo.ico" />
<!--Application logo for Control Panel-->
<Property Id="ARPPRODUCTICON" Value="Logo.ico" />
<!--Embed Cabinet into single msi file-->
<Media Id="1" Cabinet="$(var.CabName)" EmbedCab="yes" />
<!-- Allow upgrades and prevent downgrades -->
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!--Main Feature for this Setup which can be found in Fragment Tag with ComponentGroupRef Id-->
<Feature Id="ProductFeature" Title="$(var.Name)" Level="1">
<!--Main application executable component-->
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="AdditionalProductComponents" />
<ComponentRef Id="Help" />
<!--Main application shortcut for Program Menu-->
<ComponentRef Id="ApplicationShortcut" />
<!--Desktop shortcut-->
<ComponentGroupRef Id="ComponentGroupDesktopShortcut" />
</Feature>
</Package>
<!--Fragment with details of installation directory-->
<Fragment>
<!-- Create a folder inside program files with Company Name-->
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
<Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
<Directory Id="de" Name="$(var.Name)\de" />
</Directory>
</StandardDirectory>
<!-- Create a folder inside Company Name folder with Product Name-->
<StandardDirectory Id="DesktopFolder" />
<!--Create application folder in Program Menu-->
<StandardDirectory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.Name)" />
</StandardDirectory>
</Fragment>
<!--Main Feature Fragment with the application -->
<Fragment>
<!--ComponentGroup refering to install component in INSTALLFOLDER Directory-->
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!--Main Component with SlucovaniRozpisekexecutable path-->
<Component Id="SlucovaniRozpisek.dll" Guid="{69C95469-59B7-4AD6-836F-28B092EBFB33}">
<File Id="SlucovaniRozpisek.dll" Name="SlucovaniRozpisek.dll" Source="$(var.SlucovaniRozpisek_TargetDir)SlucovaniRozpisek.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="SlucovaniRozpisek.dll" Checksum="yes" KeyPath="yes" />
<File Id="SlucovaniRozpisek.tlb" Name="SlucovaniRozpisek.tlb" Source="$(var.SlucovaniRozpisek_tlbDir)SlucovaniRozpisek.tlb" Checksum="no" CompanionFile="SlucovaniRozpisek.dll">
<TypeLib Id="{E8C102DB-4C3E-457F-A4FC-7A9BF6FBD105}" Description="Slucovani Rozpisek" MajorVersion="1" MinorVersion="0" Language="0">
<Interface Id="{6C356D2C-614C-4371-A11C-D93E40E096FB}" Name="ISlucovacRozpisek" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" />
</TypeLib>
</File>
<RegistryValue Root="HKCR" Key="SlucovaniRozpisek" Value="SlucovaniRozpisek" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="SlucovaniRozpisek\CLSID" Value="{ABD284DF-509C-4E0F-9D19-96A3416738D4}" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}" Value="Slucovani Rozpisek" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32" Value="mscoree.dll" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32" Name="Class" Value="SlucovaniRozpisek.SlucovacRozpisek" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32" Name="Assembly" Value="SlucovaniRozpisek, Version=$(var.VerExe), Culture=neutral, PublicKeyToken=c43628c899117157" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32" Name="ThreadingModel" Value="Apartment" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32" Name="CodeBase" Value="file:///[#SlucovaniRozpisek.dll]" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32\$(var.VerExe)" Value="mscoree.dll" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32\$(var.VerExe)" Name="Class" Value="SlucovaniRozpisek.SlucovacRozpisek" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32\$(var.VerExe)" Name="Assembly" Value="SlucovaniRozpisek, Version=$(var.VerExe), Culture=neutral, PublicKeyToken=c43628c899117157" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32\$(var.VerExe)" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32\$(var.VerExe)" Name="ThreadingModel" Value="Apartment" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{ABD284DF-509C-4E0F-9D19-96A3416738D4}\InprocServer32\$(var.VerExe)" Name="CodeBase" Value="file:///[#SlucovaniRozpisek.dll]" Type="string" Action="write" />
</Component>
<Component Id="SlucovaniRozpisek.exe" Guid="{BAB456E7-AD3C-4C26-836B-4B13A9AAE4C0}">
<File Id="SlucovaniRozpisek.exe" Name="SlucovaniRozpisek.exe" Source="$(var.SlucovaniRozpisek_TargetDir)SlucovaniRozpisek.exe" KeyPath="yes" />
</Component>
<Component Id="Help" Guid="{68C1E6BA-E2A3-45A2-A252-5FF23C8CCA36}">
<File Id="help.pdf" Name="help.pdf" Source="$(var.SlucovaniRozpisek_TargetDir)help.pdf" CompanionFile="SlucovaniRozpisek.dll"/>
</Component>
<Component Id="Microsoft.Extensions.DependencyInjection.Abstractions.dll" Guid="{3F6E7976-68E6-49F5-92E4-F3BB4DA244F3}">
<File Id="Microsoft.Extensions.DependencyInjection.Abstractions.dll" Name="Microsoft.Extensions.DependencyInjection.Abstractions.dll" Source="$(var.SlucovaniRozpisek_TargetDir)Microsoft.Extensions.DependencyInjection.Abstractions.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="Microsoft.Extensions.DependencyInjection.Abstractions.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="Microsoft.Extensions.DependencyInjection.dll" Guid="{726884FC-B871-4AE8-B8CE-F5B22EEE7083}">
<File Id="Microsoft.Extensions.DependencyInjection.dll" Name="Microsoft.Extensions.DependencyInjection.dll" Source="$(var.SlucovaniRozpisek_TargetDir)Microsoft.Extensions.DependencyInjection.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="Microsoft.Extensions.DependencyInjection.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="Microsoft.Extensions.Logging.Abstractions.dll" Guid="{B5D8EE5A-44CB-4CD9-B669-BFE7F4D93588}">
<File Id="Microsoft.Extensions.Logging.Abstractions.dll" Name="Microsoft.Extensions.Logging.Abstractions.dll" Source="$(var.SlucovaniRozpisek_TargetDir)Microsoft.Extensions.Logging.Abstractions.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="Microsoft.Extensions.Logging.Abstractions.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="Microsoft.Extensions.Logging.dll" Guid="{43F1442D-E7FD-4C3C-A477-744D1E0FF646}">
<File Id="Microsoft.Extensions.Logging.dll" Name="Microsoft.Extensions.Logging.dll" Source="$(var.SlucovaniRozpisek_TargetDir)Microsoft.Extensions.Logging.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="Microsoft.Extensions.Logging.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="Microsoft.Extensions.Options.dll" Guid="{6E8FB036-A1D9-41EF-88CB-560F498AD9A9}">
<File Id="Microsoft.Extensions.Options.dll" Name="Microsoft.Extensions.Options.dll" Source="$(var.SlucovaniRozpisek_TargetDir)Microsoft.Extensions.Options.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="Microsoft.Extensions.Options.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="Microsoft.Extensions.Primitives.dll" Guid="{FBDD76A6-5E35-409C-AA12-BD7A0263D1C1}">
<File Id="Microsoft.Extensions.Primitives.dll" Name="Microsoft.Extensions.Primitives.dll" Source="$(var.SlucovaniRozpisek_TargetDir)Microsoft.Extensions.Primitives.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="Microsoft.Extensions.Primitives.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="PdfSharp.dll" Guid="{704E2E0D-DE0B-432F-8121-F69D301F0639}">
<File Id="PdfSharp.dll" Name="PdfSharp.dll" Source="$(var.SlucovaniRozpisek_TargetDir)PdfSharp.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="PdfSharp.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="PdfSharp.Charting.dll" Guid="{E8AB7EEC-4405-4D10-96A8-9F81A0743A1F}">
<File Id="PdfSharp.Charting.dll" Name="PdfSharp.Charting.dll" Source="$(var.SlucovaniRozpisek_TargetDir)PdfSharp.Charting.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="PdfSharp.Charting.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="PdfSharp.Quality.dll" Guid="{8C9FA364-DBF6-4211-A5B3-B3DF0CBE1AB4}">
<File Id="PdfSharp.Quality.dll" Name="PdfSharp.Quality.dll" Source="$(var.SlucovaniRozpisek_TargetDir)PdfSharp.Quality.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="PdfSharp.Quality.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="PdfSharp.Snippets.dll" Guid="{3BD4BFDF-1B0F-4BB5-8BA1-2517FC047114}">
<File Id="PdfSharp.Snippets.dll" Name="PdfSharp.Snippets.dll" Source="$(var.SlucovaniRozpisek_TargetDir)PdfSharp.Snippets.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="PdfSharp.Snippets.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="PdfSharp.System.dll" Guid="{8B5BC229-EBB2-47B1-B47D-1D9B4930EB48}">
<File Id="PdfSharp.System.dll" Name="PdfSharp.System.dll" Source="$(var.SlucovaniRozpisek_TargetDir)PdfSharp.System.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="PdfSharp.System.dll" Checksum="yes" KeyPath="yes" />
</Component>
<Component Id="PdfSharp.WPFonts.dll" Guid="{C13C8598-5553-4CB2-88CE-CCFB9C1CE23E}">
<File Id="PdfSharp.WPFonts.dll" Name="PdfSharp.WPFonts.dll" Source="$(var.SlucovaniRozpisek_TargetDir)PdfSharp.WPFonts.dll"
ProcessorArchitecture="msil" Assembly=".net" AssemblyApplication="PdfSharp.WPFonts.dll" Checksum="yes" KeyPath="yes" />
</Component>
</ComponentGroup>
<ComponentGroup Id="AdditionalProductComponents" Directory="de">
<Component Id="PdfSharp.resources.dll" Guid="{4B306A6F-EF8F-43E5-B31A-16C3A215C2B8}">
<File Id="PdfSharp.resources.dll"
Name="PdfSharp.resources.dll"
Source="$(var.SlucovaniRozpisek_AdditionalTargetDir)PdfSharp.resources.dll"
KeyPath="yes" />
</Component>
<Component Id="PdfSharp.Charting.resources.dll" Guid="{0377A9D3-C7DE-4922-A891-2C0F4B9D5029}">
<File Id="PdfSharp.Charting.resources.dll"
Name="PdfSharp.Charting.resources.dll"
Source="$(var.SlucovaniRozpisek_AdditionalTargetDir)PdfSharp.Charting.resources.dll"
KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<!--Create application shortcut in Program Menu-->
<Component Id="ApplicationShortcut" Guid="{BC998AD1-4E67-45ED-8DB2-75ECE6BD174C}" Bitness="always64">
<Shortcut Id="ApplicationStartMenuShortcut" Name="$(var.Name) $(var.Version)" Description="$(var.Description)" Icon="Logo.ico" Target="[#SlucovaniRozpisek.exe]" WorkingDirectory="INSTALLFOLDER" />
<!--Remove application shortcut from Program Menu on uninstall-->
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<!--Desktop Shortcut-->
<ComponentGroup Id="ComponentGroupDesktopShortcut">
<Component Id="ComponentDesktopShortcut" Guid="{A3A9303A-D53A-4EB2-9045-22474D88012B}" Directory="DesktopFolder" Bitness="always64">
<Shortcut Id="AppDesktopShortcut"
Name="$(var.Name) $(var.Version)"
Description="$(var.Description)"
Directory="DesktopFolder"
Target="[#SlucovaniRozpisek.exe]"
Icon="Logo.ico"
WorkingDirectory="INSTALLFOLDER"/>
<!--Remove desktop shortcut on uninstall-->
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>

46
Setup.wixproj Normal file
View File

@ -0,0 +1,46 @@
<Project Sdk="WixToolset.Sdk/5.0.1">
<PropertyGroup>
<TargetFrameworks>net9.0-windows</TargetFrameworks>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Nullable>disable</Nullable>
<LangVersion>latest</LangVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform>x64</Platform>
<ProductVersion>3.0</ProductVersion>
<ProjectGuid>{8019CECD-859A-4755-8759-08F1BE8592C1}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>SlucovaniRozpisek</OutputName>
<OutputType>Package</OutputType>
<SuppressValidation>true</SuppressValidation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\net9.0-windows</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\net9.0-windows</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>
</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs">
<SubType>Designer</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
</Project>

62
Slucovac.cs Normal file
View File

@ -0,0 +1,62 @@
using System.IO;
using System.Runtime.InteropServices;
namespace SlucovaniRozpisek
{
/// <summary>
/// Creates the <see cref="IVbaSecureHost"/> on demand.
/// </summary>
[Guid("6C356D2C-614C-4371-A11C-D93E40E096FB")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[ComVisible(true)]
public interface ISlucovacRozpisek
{
[DispId(1)]
void PripravaRozpisky(string cestaPrilohy, string cestaRozpisky, out int parovePrilohy, out int neparovePrilohy, out int neparoveRozpisky);
[DispId(2)]
void SlucRozpisky(string cestaPrilohy, string cestaRozpisky, string cestaVystup);
}
/// <summary>
/// Implementation of the <see cref="ISlucovacRozpisek"/>.
/// </summary>
[ComVisible(true)]
[Guid("ABD284DF-509C-4E0F-9D19-96A3416738D4")]
[ClassInterface(ClassInterfaceType.None)]
public sealed class SlucovacRozpisek : StandardOleMarshalObject, ISlucovacRozpisek
{
public void PripravaRozpisky(string cestaPrilohy, string cestaRozpisky, out int parovePrilohy, out int neparovePrilohy, out int neparoveRozpisky)
{
List<string> lstPrilohy = PomocneMetody.NactiPdfNazvyBezKoncovky(cestaPrilohy);
List<string> lstRozpisky = PomocneMetody.NactiPdfNazvyBezKoncovky(cestaRozpisky);
PdfRozdelovac pdfka = new PdfRozdelovac(lstPrilohy, lstRozpisky);
parovePrilohy = pdfka.ParovePrilohy.Count;
neparovePrilohy = pdfka.NeparovePrilohy.Count;
neparoveRozpisky = pdfka.NeparoveRozpisky.Count;
}
public void SlucRozpisky(string cestaPrilohy, string cestaRozpisky, string cestaVystup)
{
List<string> lstPrilohy = PomocneMetody.NactiPdfNazvyBezKoncovky(cestaPrilohy);
List<string> lstRozpisky = PomocneMetody.NactiPdfNazvyBezKoncovky(cestaRozpisky);
PdfRozdelovac pdfka = new PdfRozdelovac(lstPrilohy, lstRozpisky);
foreach (string pdf in pdfka.NeparovePrilohy)
{
PomocneMetody.KopirujSoubor(Path.Combine(cestaPrilohy, pdf + ".pdf"), Path.Combine(cestaVystup, pdf + ".pdf"), true);
}
foreach (string pdf in pdfka.NeparoveRozpisky)
{
PomocneMetody.KopirujSoubor(Path.Combine(cestaRozpisky, pdf + ".pdf"), Path.Combine(cestaVystup, pdf + ".pdf"), true);
}
foreach (string pdf in pdfka.ParovePrilohy)
{
PomocneMetody.SloucitPdf(Path.Combine(cestaPrilohy, pdf + ".pdf"), Path.Combine(cestaRozpisky, pdf + "_rozpiska.pdf"), Path.Combine(cestaVystup, pdf + ".pdf"), true);
}
}
}
}

View File

@ -2,26 +2,41 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType Condition="$(TargetFramework.StartsWith('net4'))">Library</OutputType>
<TargetFrameworks>net9.0-windows;net472</TargetFrameworks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<RootNamespace>SlucovaniRozpisek</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<UseWPF Condition="$(TargetFramework.StartsWith('net4'))">false</UseWPF>
<UseWindowsForms>False</UseWindowsForms>
<ApplicationIcon>icopdf.ico</ApplicationIcon>
<ApplicationIcon>Logo.ico</ApplicationIcon>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>10.0</LangVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<None Remove="icopdf.ico" />
<None Remove="Logo.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="icopdf.ico">
<Content Include="Logo.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="MainWindow.xaml.cs" Condition="!$(TargetFramework.StartsWith('net4'))" />
<Compile Include="PdfRozdelovac.cs" />
<Compile Include="PomocneMetody.cs" />
<Compile Include="Slucovac.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.40" PrivateAssets="All" />
<PackageReference Include="PDFsharp" Version="6.1.1">
<PrivateAssets></PrivateAssets>
</PackageReference>

BIN
key.snk Normal file

Binary file not shown.