Skip to content

Commit

Permalink
Version 1.6.8657
Browse files Browse the repository at this point in the history
Version 1.6.8657
-----------------------------------------------------------------
Frontend related changes

Backend related changes
- BugFix: Detection of lfTags in Task: "Detect MultiType Chip"
  • Loading branch information
c3rebro committed Sep 14, 2023
1 parent 81bead5 commit 0b83dd5
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 51 deletions.
12 changes: 6 additions & 6 deletions RFiDGear/DataAccessLayer/Remote/FromFile/ReportReaderWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ReportReaderWriter : IDisposable
private const string reportTemplateTempFileName = "temptemplate.pdf";
private readonly string appDataPath;
public string ReportOutputPath { get; set; }
public string ReportTemplatePath { get; set; }
public string ReportTemplateFile { get; set; }

#endregion fields

Expand Down Expand Up @@ -62,7 +62,7 @@ public ObservableCollection<string> GetReportFields()
{
var temp = new ObservableCollection<string>();

using (var pdfDoc = PdfDocument.Load(ReportTemplatePath))
using (var pdfDoc = PdfDocument.Load(ReportTemplateFile))
{
var form = pdfDoc.Form;

Expand Down Expand Up @@ -98,11 +98,11 @@ public void SetReportField(string _field, string _value)
{
try
{
using (var pdfDoc = PdfDocument.Load(ReportTemplatePath)) // (new PdfReader(ReportTemplatePath), new PdfWriter(ReportOutputPath)))
using (var pdfDoc = PdfDocument.Load(ReportTemplateFile)) // (new PdfReader(ReportTemplateFile), new PdfWriter(ReportOutputPath)))
{
try
{
ReportTemplatePath = System.IO.Path.Combine(appDataPath, reportTemplateTempFileName);
ReportTemplateFile = System.IO.Path.Combine(appDataPath, reportTemplateTempFileName);

var form = pdfDoc.Form;
pdfDoc.Info.Title = "RFiDGear Report";
Expand Down Expand Up @@ -137,9 +137,9 @@ public void ConcatReportField(string _field, string _value)
{
try
{
ReportTemplatePath = System.IO.Path.Combine(appDataPath, reportTemplateTempFileName);
ReportTemplateFile = System.IO.Path.Combine(appDataPath, reportTemplateTempFileName);

using (var pdfDoc = PdfDocument.Load(ReportTemplatePath))
using (var pdfDoc = PdfDocument.Load(ReportTemplateFile))
{
try
{
Expand Down
30 changes: 22 additions & 8 deletions RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,28 @@ public override ERROR ReadChipPublic()
hfTag.VersionL4
);

if (lfTag != null && lfTag?.CardType != CARD_TYPE.NOTAG)
{
GenericChip.Child = new GenericChipModel(lfTag.UID, (RFiDGear.DataAccessLayer.CARD_TYPE)lfTag.CardType);
}
else if(legicTag != null && legicTag?.CardType != CARD_TYPE.NOTAG)
{
GenericChip.Child = new GenericChipModel(legicTag.UID, (RFiDGear.DataAccessLayer.CARD_TYPE)legicTag.CardType);
}
if (lfTag != null && lfTag?.CardType != CARD_TYPE.NOTAG)
{
if(GenericChip != null && GenericChip.CardType != CARD_TYPE.NOTAG)
{
GenericChip.Child = new GenericChipModel(lfTag.UID, lfTag.CardType);
}
else
{
GenericChip = new GenericChipModel(lfTag.UID, lfTag.CardType);
}
}
else if (legicTag != null && legicTag?.CardType != CARD_TYPE.NOTAG)
{
if (GenericChip != null && GenericChip.CardType != CARD_TYPE.NOTAG)
{
GenericChip.Child = new GenericChipModel(legicTag.UID, legicTag.CardType);
}
else
{
GenericChip = new GenericChipModel(legicTag.UID, legicTag.CardType);
}
}
//readerDevice.GetSingleChip(true);

return ERROR.NoError;
Expand Down
2 changes: 1 addition & 1 deletion RFiDGear/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.*")]
[assembly: AssemblyVersion("1.6.*")]
[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-%3f%3f.pdf" AUTORUN=0 %24JobNumber=1234 CUSTOMPROJECTFILE="D:\CardCheck_Data\KPruefung_Vorlagen\00_RFID_Gear_Vorlage\CardCheckAssistant.rfPrj"</StartArguments>
<StartArguments>REPORTTARGETPATH="C:\temp\test file_final.pdf" REPORTTEMPLATEFILE="C:\temp\test file.pdf" CUSTOMPROJECTFILE="D:\CardCheck_Data\KPruefung_Vorlagen\00_RFID_Gear_Vorlage\CardCheckAssistant.rfPrj" AUTORUN=0 %24JobNumber=1234</StartArguments>
<StartWorkingDirectory>D:\Seafile\Dokumente Privat\Steven\Projekte\Software\Windows\RFIDGear\RFiDGear\bin\Debug\</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
Expand Down
78 changes: 49 additions & 29 deletions RFiDGear/ViewModel/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class MainWindowViewModel : ObservableObject
private protected DispatcherTimer triggerReadChip;
private protected DispatcherTimer taskTimeout;
private protected string reportOutputPath;
private protected string reportTemplateFile;
private protected ChipTaskHandlerModel taskHandler;
private protected List<MifareClassicChipModel> mifareClassicUidModels = new List<MifareClassicChipModel>();
private protected List<MifareDesfireChipModel> mifareDesfireViewModels = new List<MifareDesfireChipModel>();
Expand Down Expand Up @@ -1030,7 +1031,7 @@ private void OnNewResetReportTaskDirectoryCommand()
ssVM.IsTaskCompletedSuccessfully = null;
reportOutputPath = null;
reportReaderWriter.ReportOutputPath = null;
reportReaderWriter.ReportTemplatePath = null;
reportReaderWriter.ReportTemplateFile = null;
ssVM.CurrentTaskErrorLevel = ERROR.Empty;
break;
}
Expand Down Expand Up @@ -1224,8 +1225,9 @@ private void OnNewWriteToChipOnceCommand()

try
{
var initDir = variablesFromArgs["REPORTTARGETPATH"];
reportTargetPathDirInfo = new DirectoryInfo(Path.GetDirectoryName(initDir));
var targetReportDir = variablesFromArgs["REPORTTARGETPATH"];
var sourceTemplateFile = variablesFromArgs["REPORTTEMPLATEFILE"];
reportTargetPathDirInfo = new DirectoryInfo(Path.GetDirectoryName(targetReportDir));

}
catch
Expand Down Expand Up @@ -1258,6 +1260,10 @@ private void OnNewWriteToChipOnceCommand()
}

reportReaderWriter.ReportOutputPath = reportOutputPath;
if (!string.IsNullOrEmpty(reportTemplateFile))
{
reportReaderWriter.ReportTemplateFile = reportTemplateFile;
}

(taskHandler.TaskCollection[currentTaskIndex] as CommonTaskViewModel).WriteReportCommand.Execute(reportReaderWriter);
}
Expand Down Expand Up @@ -1292,6 +1298,10 @@ private void OnNewWriteToChipOnceCommand()
}

reportReaderWriter.ReportOutputPath = reportOutputPath;
if (!string.IsNullOrEmpty(reportTemplateFile))
{
reportReaderWriter.ReportTemplateFile = reportTemplateFile;
}

(taskHandler.TaskCollection[currentTaskIndex] as CommonTaskViewModel).WriteReportCommand.Execute(reportReaderWriter);
}
Expand Down Expand Up @@ -2320,44 +2330,54 @@ 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 (reportOutputPath.Contains("?"))
if (Directory.Exists(Path.GetDirectoryName(arg.Split('=')[1])))
{
for (int i = 0; i < numbersInFileNames.Length; i++)
{
var fileName = Directory.GetFiles(Path.GetDirectoryName(reportOutputPath))[i];
reportOutputPath = arg.Split('=')[1];
var numbersInFileNames = new int[Directory.GetFiles(Path.GetDirectoryName(reportOutputPath)).Length];

if (fileName.Replace(".pdf",string.Empty).ToLower().Contains(reportOutputPath.ToLower().Replace("?",string.Empty).Replace(".pdf",string.Empty)))
if (reportOutputPath.Contains("?"))
{
for (int i = 0; i < numbersInFileNames.Length; i++)
{
_ = 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;
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;
}
}
}
}

if (reportOutputPath.Contains("???"))
{
reportOutputPath = reportOutputPath.Replace("???", string.Format("{0:D3}", numbersInFileNames.Max() + 1));
}
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:D2}", numbersInFileNames.Max() + 1));
}

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

case "REPORTTEMPLATEFILE":

else if (reportOutputPath.Contains("?"))
variablesFromArgs.Add(arg.Split('=')[0], arg.Split('=')[1]);

if (File.Exists(arg.Split('=')[1]))
{
reportOutputPath = reportOutputPath.Replace("?", string.Format("{0:D1}", numbersInFileNames.Max() + 1));
reportTemplateFile = arg.Split('=')[1];
}
}
break;
break;

case "AUTORUN":
if (arg.Split('=')[1] == "1")
Expand Down
12 changes: 6 additions & 6 deletions RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public CommonTaskViewModel(object _selectedSetupViewModel, ObservableCollection<
{
if (!string.IsNullOrEmpty(reportTemplatePath))
{
reader.ReportTemplatePath = reportTemplatePath;
reader.ReportTemplateFile = reportTemplatePath;

TemplateFields = new ObservableCollection<string>(reader.GetReportFields().OrderBy(x => x));
}
Expand Down Expand Up @@ -835,7 +835,7 @@ private void OnNewOpenReportTemplateCommand()
ReportTemplatePath = path;
reportReaderWriter = new ReportReaderWriter
{
ReportTemplatePath = ReportTemplatePath
ReportTemplateFile = ReportTemplatePath
};

TemplateFields = new ObservableCollection<string>(reportReaderWriter.GetReportFields().OrderBy(x => x));
Expand All @@ -848,7 +848,7 @@ private void OnNewOpenReportTemplateCommand()

else
{
//ReportTemplatePath = string.Empty;
//ReportTemplateFile = string.Empty;
}
}

Expand Down Expand Up @@ -880,12 +880,12 @@ private void OnNewWriteReportCommand(ReportReaderWriter _reportReaderWriter)
try
{
reportReaderWriter = _reportReaderWriter;
if (string.IsNullOrEmpty(reportReaderWriter.ReportTemplatePath))
if (string.IsNullOrEmpty(reportReaderWriter.ReportTemplateFile))
{
reportReaderWriter.ReportTemplatePath = ReportTemplatePath;
reportReaderWriter.ReportTemplateFile = ReportTemplatePath;
}

if (!String.IsNullOrWhiteSpace(reportReaderWriter.ReportTemplatePath))
if (!String.IsNullOrWhiteSpace(reportReaderWriter.ReportTemplateFile))
{

foreach (var checkpoint in Checkpoints)
Expand Down

0 comments on commit 0b83dd5

Please sign in to comment.