示例#1
0
        public void DoEntryPointBAll(String path, string secDomainAID, string masterKey, string packageAid, string execModuleAid, string instanceAid)
        {
            Task.Run(() =>
            {
                try
                {
                    ProtocolActivation_B().ContinueWith((parentTask) =>
                    {
                        try
                        {
                            if (cancellationTokenForPreProcessing.Token.IsCancellationRequested)
                            {
                                cancellationTokenForPreProcessing.Dispose();
                                return;
                            }

                            PersoProcessing pxml = new PersoProcessing(cardQProcessor);
                            pxml.RemoveApp(secDomainAID, masterKey, packageAid);

                            using (MemoryStream capFile = new MemoryStream())
                            {
                                using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
                                {
                                    byte[] data = new byte[fs.Length];
                                    fs.Read(data, 0, (int)fs.Length);
                                    capFile.Write(data, 0, (int)fs.Length);
                                }
                                pxml.LoadCapFile(capFile, secDomainAID, masterKey);
                            }

                            pxml.InstallAndMakeSelectable(secDomainAID, masterKey, packageAid, execModuleAid, instanceAid);

                            PersoProcessingOutcome processingOutcome = new PersoProcessingOutcome()
                            {
                                NextProcessState          = EMVPersoPreProcessingStateEnum.EndProcess,
                                UIRequestOnOutcomePresent = true,
                                UserInterfaceRequest      = new UserInterfaceRequest()
                                {
                                    MessageIdentifier = MessageIdentifiersEnum.ClearDisplay, Status = StatusEnum.ReadyToRead
                                },
                                UIRequestOnRestartPresent = false,
                            };

                            OnProcessCompleted(processingOutcome);
                        }
                        catch (Exception ex)
                        {
                            OnExceptionOccured(ex);
                        }
                    }, TaskContinuationOptions.OnlyOnRanToCompletion);
                }
                catch (Exception ex)
                {
                    OnExceptionOccured(ex);
                }
            });
        }
示例#2
0
        private void DoEntryPointBRemoveApp(string secDomainAID, string masterKey, string instanceAid)
        {
            Task.Run(() =>
            {
                try
                {
                    ProtocolActivation_B().ContinueWith((parentTask) =>
                    {
                        try
                        {
                            if (cancellationTokenForPreProcessing.Token.IsCancellationRequested)
                            {
                                cancellationTokenForPreProcessing.Dispose();
                                return;
                            }

                            PersoProcessing pxml = new PersoProcessing(cardQProcessor);
                            pxml.RemoveApp(secDomainAID, masterKey, instanceAid);

                            PersoProcessingOutcome processingOutcome = new PersoProcessingOutcome()
                            {
                                NextProcessState          = EMVPersoPreProcessingStateEnum.EndProcess,
                                UIRequestOnOutcomePresent = true,
                                UserInterfaceRequest      = new UserInterfaceRequest()
                                {
                                    MessageIdentifier = MessageIdentifiersEnum.ClearDisplay, Status = StatusEnum.ReadyToRead
                                },
                                UIRequestOnRestartPresent = false,
                            };

                            OnProcessCompleted(processingOutcome);
                        }
                        catch (Exception ex)
                        {
                            OnExceptionOccured(ex);
                        }
                    }, TaskContinuationOptions.OnlyOnRanToCompletion);
                }
                catch (Exception ex)
                {
                    OnExceptionOccured(ex);
                }
            });
        }