Skip to content

Commit

Permalink
Added Feature Request: List Existing Apps as Variable
Browse files Browse the repository at this point in the history
+ add Variable: %LISTAPPS = list all existing apps in desfire when accessible
  • Loading branch information
c3rebro committed May 27, 2022
1 parent 876c00a commit f43c660
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
16 changes: 13 additions & 3 deletions RFiDGear/ViewModel/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,8 @@ private void OnNewWriteToChipOnceCommand(bool _runSelectedOnly = false)

Task thread = new Task(() =>
{
GenericChipModel GenericChip;
GenericChipModel GenericChip = new GenericChipModel("", CARD_TYPE.Unspecified);
MifareDesfireChipModel DesfireChip = new MifareDesfireChipModel("", CARD_TYPE.Unspecified); ;

try
{
Expand All @@ -1066,9 +1067,16 @@ private void OnNewWriteToChipOnceCommand(bool _runSelectedOnly = false)
device.ReadChipPublic();

GenericChip = new GenericChipModel(device.GenericChip.UID, device.GenericChip.CardType);

if(GenericChip != null)
{
if(GenericChip.CardType == CARD_TYPE.DESFireEV1 || GenericChip.CardType == CARD_TYPE.DESFireEV2)
{
DesfireChip = new MifareDesfireChipModel(GenericChip.UID, GenericChip.CardType);
device.GetMiFareDESFireChipAppIDs();
}
}
}
else
GenericChip = new GenericChipModel("", CARD_TYPE.Unspecified);
}

if (treeViewParentNodes.Any(x => x.IsSelected))
Expand Down Expand Up @@ -1202,6 +1210,7 @@ private void OnNewWriteToChipOnceCommand(bool _runSelectedOnly = false)
reportReaderWriter.ReportOutputPath = reportOutputPath;

(taskHandler.TaskCollection[taskIndex] as CommonTaskViewModel).GenericChip = GenericChip;
(taskHandler.TaskCollection[taskIndex] as CommonTaskViewModel).DesfireChip = DesfireChip;
(taskHandler.TaskCollection[taskIndex] as CommonTaskViewModel).AvailableTasks = taskHandler.TaskCollection;
(taskHandler.TaskCollection[taskIndex] as CommonTaskViewModel).WriteReportCommand.Execute(reportReaderWriter);
}
Expand Down Expand Up @@ -1239,6 +1248,7 @@ private void OnNewWriteToChipOnceCommand(bool _runSelectedOnly = false)
reportReaderWriter.ReportOutputPath = reportOutputPath;

(taskHandler.TaskCollection[taskIndex] as CommonTaskViewModel).GenericChip = GenericChip;
(taskHandler.TaskCollection[taskIndex] as CommonTaskViewModel).DesfireChip = DesfireChip;
(taskHandler.TaskCollection[taskIndex] as CommonTaskViewModel).AvailableTasks = taskHandler.TaskCollection;
(taskHandler.TaskCollection[taskIndex] as CommonTaskViewModel).WriteReportCommand.Execute(reportReaderWriter);
}
Expand Down
9 changes: 9 additions & 0 deletions RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class CommonTaskViewModel : ViewModelBase, IUserDialogViewModel
[XmlIgnore]
public GenericChipModel GenericChip { get; set; }

[XmlIgnore]
public MifareDesfireChipModel DesfireChip { get; set; }

#endregion

#region Constructors
Expand Down Expand Up @@ -888,6 +891,12 @@ private void OnNewWriteReportCommand(ReportReaderWriter _reportReaderWriter)
hasVariable = true;
}

if (temporaryContent.Contains("%LISTAPPS"))
{
temporaryContent = temporaryContent.Replace("%LISTAPPS", string.Join(", ", DesfireChip.AppList) ?? "");
hasVariable = true;
}

if (temporaryContent.Contains("%CONCAT"))
{
temporaryContent = temporaryContent.Replace("%CONCAT ", string.Empty);
Expand Down

0 comments on commit f43c660

Please sign in to comment.