diff --git a/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs b/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs index f0cb4f1..d2f1490 100644 --- a/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs +++ b/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs @@ -58,10 +58,7 @@ public override ERROR ReadChipPublic() if(!IsConnected) { Instance.Connect(); - } - - readerDevice.GreenLED(true); - readerDevice.RedLED(true); + } card = readerDevice.GetSingleChip(); @@ -72,7 +69,8 @@ public override ERROR ReadChipPublic() readerDevice.Beep(1, 50, 1000, 100); GenericChip = new GenericChipModel(card.ChipIdentifier, (CARD_TYPE)card.CardType); - + readerDevice.GreenLED(true); + readerDevice.RedLED(false); return ERROR.NoError; } catch (Exception e) @@ -84,6 +82,8 @@ public override ERROR ReadChipPublic() else { readerDevice.Beep(3, 25, 600, 100); + readerDevice.GreenLED(false); + readerDevice.RedLED(true); GenericChip = null; return ERROR.NotReadyError; @@ -275,7 +275,11 @@ public override ERROR AuthToMifareDesfireApplication(string _applicationMasterKe { ReadChipPublic(); - return readerDevice.DesfireAuthenticate(_applicationMasterKey, (byte)_keyNumber, 0, 0) == true ? ERROR.NoError : ERROR.NotAllowed; + return readerDevice.DesfireAuthenticate( + _applicationMasterKey, + (byte)_keyNumber, + (byte)Enum.Parse(typeof(Elatec.NET.DESfireKeyType), Enum.GetName(typeof(RFiDGear.DataAccessLayer.DESFireKeyType), _keyType)), + 1) == true ? ERROR.NoError : ERROR.NotAllowed; } public override ERROR GetMifareDesfireAppSettings(string _applicationMasterKey, DESFireKeyType _keyType, int _keyNumberCurrent, int _appID) @@ -286,7 +290,7 @@ public override ERROR CreateMifareDesfireApplication(string _piccMasterKey, DESF DESFireKeyType _keyTypePiccMasterKey, DESFireKeyType _keyTypeTargetApplication, int _maxNbKeys, int _appID, bool authenticateToPICCFirst = true) { - throw new NotImplementedException(); + return readerDevice.DesfireCreateApplication((Elatec.NET.DESFireKeySettings)_keySettingsTarget, (Elatec.NET.DESFireKeyType)_keyTypeTargetApplication, _maxNbKeys, _appID) == true ? ERROR.NoError : ERROR.NotAllowed; } public override ERROR ChangeMifareDesfireApplicationKey(string _applicationMasterKeyCurrent, int _keyNumberCurrent, DESFireKeyType _keyTypeCurrent, string _applicationMasterKeyTarget, int _keyNumberTarget, int selectedDesfireAppKeyVersionTargetAsIntint, diff --git a/RFiDGear/RFiDGear.csproj.user b/RFiDGear/RFiDGear.csproj.user index 5dc4cda..e3a899a 100644 --- a/RFiDGear/RFiDGear.csproj.user +++ b/RFiDGear/RFiDGear.csproj.user @@ -1,7 +1,7 @@  - REPORTTARGETPATH="C:\temp\test file.pdf" AUTORUN=1 %24JobNumber=1234 %24CardType=MifareDesfire + REPORTTARGETPATH="C:\temp\test file.pdf" AUTORUN=0 %24JobNumber=1234 %24CardType= D:\Seafile\Dokumente Privat\Steven\Projekte\Software\Windows\RFIDGear\RFiDGear\bin\Debug\ diff --git a/RFiDGear/ViewModel/MainWindowViewModel.cs b/RFiDGear/ViewModel/MainWindowViewModel.cs index 5ccc039..56bddaa 100644 --- a/RFiDGear/ViewModel/MainWindowViewModel.cs +++ b/RFiDGear/ViewModel/MainWindowViewModel.cs @@ -79,12 +79,12 @@ public class MainWindowViewModel : ObservableObject private protected bool _runSelectedOnly; private int currentTaskIndex = 0; - //set if task was completed; indicates greenlight to continue execution - //if programming takes too long; quit the process + // set if task was completed; indicates greenlight to continue execution + // if programming takes too long; quit the process private bool firstRun = true; private bool updateAvailable = false; private protected Mutex mutex; - //one reader, one instance - only + // one reader, one instance - only #region Events / Delegates @@ -697,17 +697,17 @@ private void OnNewCreateDesfireTaskCommand() } if (sender.SelectedTaskType == TaskType_MifareDesfireTask.FormatDesfireCard || - sender.SelectedTaskType == TaskType_MifareDesfireTask.PICCMasterKeyChangeover || - sender.SelectedTaskType == TaskType_MifareDesfireTask.ReadAppSettings || - sender.SelectedTaskType == TaskType_MifareDesfireTask.AppExistCheck || - sender.SelectedTaskType == TaskType_MifareDesfireTask.AuthenticateApplication || - sender.SelectedTaskType == TaskType_MifareDesfireTask.ApplicationKeyChangeover || - sender.SelectedTaskType == TaskType_MifareDesfireTask.DeleteApplication || - sender.SelectedTaskType == TaskType_MifareDesfireTask.CreateApplication || - sender.SelectedTaskType == TaskType_MifareDesfireTask.DeleteFile || - sender.SelectedTaskType == TaskType_MifareDesfireTask.CreateFile || - sender.SelectedTaskType == TaskType_MifareDesfireTask.ReadData || - sender.SelectedTaskType == TaskType_MifareDesfireTask.WriteData) + sender.SelectedTaskType == TaskType_MifareDesfireTask.PICCMasterKeyChangeover || + sender.SelectedTaskType == TaskType_MifareDesfireTask.ReadAppSettings || + sender.SelectedTaskType == TaskType_MifareDesfireTask.AppExistCheck || + sender.SelectedTaskType == TaskType_MifareDesfireTask.AuthenticateApplication || + sender.SelectedTaskType == TaskType_MifareDesfireTask.ApplicationKeyChangeover || + sender.SelectedTaskType == TaskType_MifareDesfireTask.DeleteApplication || + sender.SelectedTaskType == TaskType_MifareDesfireTask.CreateApplication || + sender.SelectedTaskType == TaskType_MifareDesfireTask.DeleteFile || + sender.SelectedTaskType == TaskType_MifareDesfireTask.CreateFile || + sender.SelectedTaskType == TaskType_MifareDesfireTask.ReadData || + sender.SelectedTaskType == TaskType_MifareDesfireTask.WriteData) { if (ChipTasks.TaskCollection.OfType().Any(x => (x as MifareDesfireSetupViewModel).SelectedTaskIndexAsInt == sender.SelectedTaskIndexAsInt)) { @@ -1132,7 +1132,7 @@ private void OnNewWriteToChipOnceCommand() if (GenericChip != null) { - if (GenericChip.CardType == CARD_TYPE.DESFire || GenericChip.CardType == CARD_TYPE.DESFireEV1 || GenericChip.CardType == CARD_TYPE.DESFireEV2) + if (GenericChip.CardType.ToString().ToLower(CultureInfo.CurrentCulture).Contains("desfire")) { device.GetMiFareDESFireChipAppIDs(); } @@ -2077,12 +2077,14 @@ private void AskForUpdateNow() { updater.AllowUpdate = false; updateAction.Close(); + mw.Activate(); }, OnCloseRequest = (updateAction) => { updater.AllowUpdate = false; updateAction.Close(); + mw.Activate(); } }); }