Skip to content

Commit

Permalink
Version 1.3.8451
Browse files Browse the repository at this point in the history
Backend related changes
- Feature: Added internal variables
  + %EXIT will immediatly exit rfidgear
  + adding a question-mark to the REPORTOUTPUTPATH variable will add a counter
    to the resulting filename i.e.
	REPORTOUTPUTPATH="C:\Path\where\Report\is\placed-??.pdf" would be replaced to
	REPORTOUTPUTPATH="C:\Path\where\Report\is\placed-01.pdf" where always +1
	would be added to any existing filename matching.

	Notes: File must end with ".pdf"; The ?? must be the last character before
	the .pdf file extension. Available digits are: ?, ?? and ???
  • Loading branch information
c3rebro committed Feb 20, 2023
1 parent 5bb3f93 commit 9ffff72
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 74 deletions.
4 changes: 2 additions & 2 deletions RFiDGear/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[assembly: AssemblyConfiguration("x86")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RFiDGear")]
[assembly: AssemblyCopyright("Copyright 2022")]
[assembly: AssemblyCopyright("Copyright 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
Expand All @@ -25,6 +25,6 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyVersion("1.3.*")]
[assembly: Guid("a34bc413-e349-4fd1-8b90-2eb95a333436")]
[assembly: NeutralResourcesLanguage("")]
2 changes: 1 addition & 1 deletion RFiDGear/RFiDGear.csproj.user
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>REPORTTARGETPATH="C:\temp\test file.pdf" AUTORUN=0 %24JobNumber=1234 %24CardType=</StartArguments>
<StartArguments>REPORTTARGETPATH="C:\temp\test file-%3f%3f.pdf" AUTORUN=0 %24JobNumber=1234 %24CardType=</StartArguments>
<StartWorkingDirectory>D:\Seafile\Dokumente Privat\Steven\Projekte\Software\Windows\RFIDGear\RFiDGear\bin\Debug\</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion RFiDGear/Resources/Manifest.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ https://github.com/c3rebro/rfidgear</value>
<value>NTAG</value>
</data>
<data name="windowCaptionSaveReport" xml:space="preserve">
<value>PDF Speichern unter...</value>
<value>PDF Bericht Speichern unter...</value>
</data>
<data name="windowCaptionOpenReport" xml:space="preserve">
<value>PDF-Vorlage auswählen...</value>
Expand Down
45 changes: 39 additions & 6 deletions RFiDGear/ViewModel/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ private void OnNewNewCreateReportTaskCommand()
dialogs.Add(new CommonTaskViewModel(SelectedSetupViewModel, ChipTasks.TaskCollection, dialogs)
{
Caption = ResourceLoader.GetResource("windowCaptionAddEditGenericTask"),

OnOk = (sender) =>
{

Expand Down Expand Up @@ -1231,6 +1231,7 @@ private void OnNewWriteToChipOnceCommand()
{
Title = ResourceLoader.GetResource("windowCaptionSaveReport"),
Filter = ResourceLoader.GetResource("filterStringSaveReport"),
ParentWindow = this.mw,
InitialDirectory = reportTargetPathDirInfo != null ?
(reportTargetPathDirInfo.Exists ? reportTargetPathDirInfo.FullName : null) : null
};
Expand Down Expand Up @@ -1263,7 +1264,7 @@ private void OnNewWriteToChipOnceCommand()

var dlg = new SaveFileDialogViewModel
{
Title = ResourceLoader.GetResource("windowCaptionSaveTasks"),
Title = ResourceLoader.GetResource("windowCaptionSaveReport"),
Filter = ResourceLoader.GetResource("filterStringSaveReport"),
InitialDirectory = reportTargetPathDirInfo != null ?
(reportTargetPathDirInfo.Exists ? reportTargetPathDirInfo.FullName : null) : null
Expand Down Expand Up @@ -1752,6 +1753,7 @@ private void OnNewOpenFileDialog()
{
Title = ResourceLoader.GetResource("windowCaptionOpenProject"),
Filter = ResourceLoader.GetResource("filterStringSaveTasks"),
ParentWindow = this.mw,
Multiselect = false
};

Expand Down Expand Up @@ -2284,13 +2286,44 @@ private void LoadCompleted(object sender, EventArgs e)
{
case "REPORTTARGETPATH":

variablesFromArgs.Add(arg.Split('=')[0], arg.Split('=')[1]);
variablesFromArgs.Add(arg.Split('=')[0], arg.Split('=')[1]);

if (Directory.Exists(Path.GetDirectoryName(arg.Split('=')[1])))
{
reportOutputPath = arg.Split('=')[1];
var numbersInFileNames = new int[Directory.GetFiles(Path.GetDirectoryName(reportOutputPath)).Length];

if (Directory.Exists(Path.GetDirectoryName(arg.Split('=')[1])))
if (reportOutputPath.Contains("?"))
{
reportOutputPath = arg.Split('=')[1];
for (int i = 0; i < numbersInFileNames.Length; i++)
{
var fileName = Directory.GetFiles(Path.GetDirectoryName(reportOutputPath))[i];

if (fileName.Replace(".pdf",string.Empty).ToLower().Contains(reportOutputPath.ToLower().Replace("?",string.Empty).Replace(".pdf",string.Empty)))
{
_ = int.TryParse(fileName.ToLower().Replace(
reportOutputPath.ToLower().Replace("?", string.Empty).Replace(".pdf", string.Empty), string.Empty).Replace(".pdf", string.Empty), out int n);
numbersInFileNames[i] = n;
}
}
}
break;

if (reportOutputPath.Contains("???"))
{
reportOutputPath = reportOutputPath.Replace("???", string.Format("{0:D3}", numbersInFileNames.Max() + 1));
}

else if (reportOutputPath.Contains("??"))
{
reportOutputPath = reportOutputPath.Replace("??", string.Format("{0:D2}", numbersInFileNames.Max() + 1));
}

else if (reportOutputPath.Contains("?"))
{
reportOutputPath = reportOutputPath.Replace("?", string.Format("{0:D1}", numbersInFileNames.Max() + 1));
}
}
break;

case "AUTORUN":
if (arg.Split('=')[1] == "1")
Expand Down
22 changes: 14 additions & 8 deletions RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public CommonTaskViewModel(object _selectedSetupViewModel, ObservableCollection<
try
{
CurrentTaskErrorLevel = ERROR.Empty;

checkpoint = new Checkpoint();
Checkpoints = new ObservableCollection<Checkpoint>();
Args = new Dictionary<string, string>();
Expand Down Expand Up @@ -911,15 +911,21 @@ private void OnNewWriteReportCommand(ReportReaderWriter _reportReaderWriter)

if (temporaryContent.Contains("%SLAVECHIPTYPE"))
{
temporaryContent = temporaryContent.Replace("%SLAVECHIPTYPE", ResourceLoader.GetResource(
string.Format("ENUM.CARD_TYPE.{0}", Enum.GetName(typeof(CARD_TYPE), GenericChip?.Slave?.CardType))) ?? "");
hasVariable = true;
if (GenericChip?.Slave != null)
{
temporaryContent = temporaryContent.Replace("%SLAVECHIPTYPE", ResourceLoader.GetResource(
string.Format("ENUM.CARD_TYPE.{0}", Enum.GetName(typeof(CARD_TYPE), GenericChip?.Slave?.CardType))) ?? "");
hasVariable = true;
}
}

if (temporaryContent.Contains("%SLAVEUID"))
{
temporaryContent = temporaryContent.Replace("%SLAVEUID", GenericChip?.Slave?.UID ?? "");
hasVariable = true;
if (GenericChip?.Slave != null)
{
temporaryContent = temporaryContent.Replace("%SLAVEUID", GenericChip?.Slave?.UID ?? "");
hasVariable = true;
}
}

if (temporaryContent.Contains("%DATETIME"))
Expand Down Expand Up @@ -1553,7 +1559,7 @@ private void OnNewExecuteProgramCommand()
};
}

else if (ProgramToExecute.ToLower() == @"%exit%")
else if (ProgramToExecute.ToLower() == @"%exit")
{
info = null;

Expand Down Expand Up @@ -1765,7 +1771,7 @@ public void Show(IList<IDialogViewModel> collection)
{
collection.Add(this);
}

#endregion IUserDialogViewModel Implementation

#region Localization
Expand Down
64 changes: 8 additions & 56 deletions Setup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
-->
<Condition Message="!(loc.OS2Old)"><![CDATA[Installed OR (VersionNT >= 601)]]></Condition>
<Condition Message="!(loc.NetFramework452Required)"><![CDATA[Installed OR WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED]]></Condition>
<Condition Message="!(loc.LibLogicalAccessRequired)"><![CDATA[Installed OR SYSTEM_HAS_ISLOG]]></Condition>
<!--<Condition Message="!(loc.LibLogicalAccessRequired)"><![CDATA[Installed OR SYSTEM_HAS_ISLOG]]></Condition> -->
<!--
2. Check OS bitness
Unfortunately 32-bit MSI packages cannot write to 64-bit ProgramFiles directory. That is the only reason we need separate MSIs for 32-bit and 64-bit.
Expand Down Expand Up @@ -186,57 +186,18 @@
<Component Id="ByteArrayDll" Guid="0907B24F-F549-41D5-8222-645C550BB7E7" DiskId="1">
<File Id="ByteArray.dll" Name="ByteArray.dll" Source="..\RFiDGear\bin\Release\ByteArray.dll" KeyPath="yes" />
</Component>
<Component Id="CommonLoggingDll" Guid="5CA5CB50-8EA8-4EBF-AA40-6BC990B61AC7" DiskId="1">
<File Id="Common.Logging.dll" Name="Common.Logging.dll" Source="..\RFiDGear\bin\Release\Common.Logging.dll" KeyPath="yes" />
</Component>
<Component Id="CommonLoggingCoreDll" Guid="5CA5CB50-8EA8-4EBF-AA40-6BC120B6FEC7" DiskId="1">
<File Id="Common.Logging.Core.dll" Name="Common.Logging.Core.dll" Source="..\RFiDGear\bin\Release\Common.Logging.Core.dll" KeyPath="yes" />
</Component>
<Component Id="CommonServiceLocatorDll" Guid="5CA5CB50-8EA8-4EBF-AA40-6BC120B61AC7" DiskId="1">
<File Id="CommonServiceLocator.dll" Name="CommonServiceLocator.dll" Source="..\RFiDGear\bin\Release\CommonServiceLocator.dll" KeyPath="yes" />
</Component>
<Component Id="ElatecNetDll" Guid="40A4332E-04AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="Elatec.NET.dll" Name="Elatec.NET.dll" Source="..\RFiDGear\bin\Release\Elatec.NET.dll" KeyPath="yes" />
</Component>
<Component Id="CommunityToolkitMvvmDll" Guid="40A4382E-00AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="CommunityToolkit.Mvvm.dll" Name="CommunityToolkit.Mvvm.dll" Source="..\RFiDGear\bin\Release\CommunityToolkit.Mvvm.dll" KeyPath="yes" />
</Component>
<Component Id="InteropLibLogicalAccessDll" Guid="266E1A03-2C6B-444E-8017-1DBE01B19B24" DiskId="1">
<File Id="Interop.LibLogicalAccess.dll" Name="Interop.LibLogicalAccess.dll" Source="..\RFiDGear\bin\Release\Interop.LibLogicalAccess.dll" KeyPath="yes" />
<Component Id="GemBoxPDFDll" Guid="455F2A03-2C6B-444E-8017-1DBE01B19B24" DiskId="1">
<File Id="GemBox.Pdf.dll" Name="GemBox.Pdf.dll" Source="..\RFiDGear\bin\Release\GemBox.Pdf.dll" KeyPath="yes" />
</Component>
<Component Id="IonicZipDll" Guid="DC246BF8-25A3-42BF-A2A5-CEE429219381" DiskId="1">
<File Id="Ionic.Zip.dll" Name="Ionic.Zip.dll" Source="..\RFiDGear\bin\Release\Ionic.Zip.dll" KeyPath="yes" />
</Component>
<Component Id="ITextBarcodesDll" Guid="40A4382E-00AA-478A-923F-0B45401700BB" DiskId="1">
<File Id="itext.barcodes.dll" Name="itext.barcodes.dll" Source="..\RFiDGear\bin\Release\itext.barcodes.dll" KeyPath="yes" />
</Component>
<Component Id="ITextCommonsDll" Guid="40A4382E-02AA-479A-923F-0B454017ACBB" DiskId="1">
<File Id="itext.commons.dll" Name="itext.commons.dll" Source="..\RFiDGear\bin\Release\itext.commons.dll" KeyPath="yes" />
</Component>
<Component Id="ITextFormsDll" Guid="40A4382E-02AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="itext.forms.dll" Name="itext.forms.dll" Source="..\RFiDGear\bin\Release\itext.forms.dll" KeyPath="yes" />
</Component>
<Component Id="ITextIODll" Guid="40A4382E-04AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="itext.io.dll" Name="itext.io.dll" Source="..\RFiDGear\bin\Release\itext.io.dll" KeyPath="yes" />
</Component>
<Component Id="ITextKernelDll" Guid="40A4382E-06AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="itext.kernel.dll" Name="itext.kernel.dll" Source="..\RFiDGear\bin\Release\itext.kernel.dll" KeyPath="yes" />
</Component>
<Component Id="ITextLayoutDll" Guid="40A4382E-09AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="itext.layout.dll" Name="itext.layout.dll" Source="..\RFiDGear\bin\Release\itext.layout.dll" KeyPath="yes" />
</Component>
<Component Id="ITextPdfaDll" Guid="40FF382E-00AA-478A-923F-0B45401700BB" DiskId="1">
<File Id="itext.pdfa.dll" Name="itext.pdfa.dll" Source="..\RFiDGear\bin\Release\itext.pdfa.dll" KeyPath="yes" />
</Component>
<Component Id="ITextSignDll" Guid="40ABC82E-02AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="itext.sign.dll" Name="itext.sign.dll" Source="..\RFiDGear\bin\Release\itext.sign.dll" KeyPath="yes" />
</Component>
<Component Id="ITextStyledxmlparserDll" Guid="40ACC82E-04AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="itext.styledxmlparser.dll" Name="itext.styledxmlparser.dll" Source="..\RFiDGear\bin\Release\itext.styledxmlparser.dll" KeyPath="yes" />
</Component>
<Component Id="ITextSvgDll" Guid="40A438DD-06AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="itext.svg.dll" Name="itext.svg.dll" Source="..\RFiDGear\bin\Release\itext.svg.dll" KeyPath="yes" />
</Component>
<Component Id="Log4CSharpDll" Guid="40A4711D-06AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="Log4CSharp.dll" Name="Log4CSharp.dll" Source="..\RFiDGear\bin\Release\Log4CSharp.dll" KeyPath="yes" />
</Component>
Expand Down Expand Up @@ -267,6 +228,9 @@
<Component Id="NewtonsoftJsonDll" Guid="01BB711D-06AA-479A-923F-0B45401700BB" DiskId="1">
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="..\RFiDGear\bin\Release\Newtonsoft.Json.dll" KeyPath="yes" />
</Component>
<Component Id="Pkcs11InteropDll" Guid="B6782BE0-4826-F027-AAF0-5660ECAAE6AA" DiskId="1">
<File Id="Pkcs11Interop.dll" Name="Pkcs11Interop.dll" Source="..\RFiDGear\bin\Release\Pkcs11Interop.dll" KeyPath="yes" />
</Component>
<Component Id="PluginSystemDll" Guid="B6782BE0-4826-4FDD-AAF0-5660ECAAE6AA" DiskId="1">
<File Id="PluginSystem.dll" Name="PluginSystem.dll" Source="..\RFiDGear\bin\Release\PluginSystem.dll" KeyPath="yes" />
</Component>
Expand Down Expand Up @@ -389,23 +353,10 @@

<ComponentRef Id="BouncyCastleCryptoDll"/>
<ComponentRef Id="ByteArrayDll"/>
<ComponentRef Id="CommonLoggingCoreDll" />
<ComponentRef Id="CommonLoggingDll" />
<ComponentRef Id="CommonServiceLocatorDll" />
<ComponentRef Id="CommunityToolkitMvvmDll" />
<ComponentRef Id="GemBoxPDFDll" />
<ComponentRef Id="ElatecNetDll"/>
<ComponentRef Id="InteropLibLogicalAccessDll" />
<ComponentRef Id="IonicZipDll" />
<ComponentRef Id="ITextBarcodesDll" />
<ComponentRef Id="ITextCommonsDll" />
<ComponentRef Id="ITextFormsDll" />
<ComponentRef Id="ITextIODll" />
<ComponentRef Id="ITextKernelDll" />
<ComponentRef Id="ITextLayoutDll" />
<ComponentRef Id="ITextPdfaDll" />
<ComponentRef Id="ITextSignDll" />
<ComponentRef Id="ITextStyledxmlparserDll" />
<ComponentRef Id="ITextSvgDll" />
<ComponentRef Id="Log4CSharpDll" />
<ComponentRef Id="MicrosoftBclAsyncInterfacesDll" />
<ComponentRef Id="MicrosoftExtensionsDependencyInjectionAbstractionsDll" />
Expand All @@ -416,6 +367,7 @@
<ComponentRef Id="MicrosoftExtensionsPrimitivesDll" />
<ComponentRef Id="MVVMDialogsDll" />
<ComponentRef Id="NewtonsoftJsonDll" />
<ComponentRef Id="Pkcs11InteropDll" />
<ComponentRef Id="PluginSystemDll" />
<ComponentRef Id="SystemBuffersDll" />
<ComponentRef Id="SystemComponentModelAnnotationsDll" />
Expand Down

0 comments on commit 9ffff72

Please sign in to comment.