static InterpretedAtrAdapter() { IPropertyAdapterFactory <InterpretedAtrAdapter> PropertyFactory = ObservableObject.GetPropertyAdapterFactory <InterpretedAtrAdapter>(); InterpretedAtrAdapter.globalInterfaceBytesAdapter = PropertyFactory.Create( nameof(InterpretedAtrAdapter.GlobalInterfaceBytes), instance => new GlobalInterfaceBytesAdapter(instance.atr.GlobalInterfaceBytes) ); InterpretedAtrAdapter.protocolParametersAdapter = PropertyFactory.Create( nameof(InterpretedAtrAdapter.ProtocolParameters), instance => instance.atr.ProtocolParameters, (instance, parameter) => ProtocolParameterAdapterBase.GetObject(parameter) ); InterpretedAtrAdapter.historicalCharactersAdapter = PropertyFactory.Create( nameof(InterpretedAtrAdapter.HistoricalCharacters), instance => AtrHistoricalBytesAdapterBase.GetObject(instance.atr.HistoricalCharacters, instance) ); InterpretedAtrAdapter.possibleTypesToIndicateAdditionallyAdapter = PropertyFactory.Create( nameof(InterpretedAtrAdapter.PossibleTypesToIndicateAdditionally), instance => EnumerationAdapter <ProtocolType> .Items.Where( type => type != ProtocolType.RfuF && instance.atr.ProtocolParameters.Any(_ => _.ProtocolType == type) == false ) ); }
public AtrHistoricalBytesAdapterBase(AtrHistoricalCharactersBase historicalCharacters, InterpretedAtrAdapter interpretedAtr) { this.interpretedAtr = interpretedAtr; this.historicalCharactersAdapter = this.CreatePropertyAdapter( nameof(this.HistoricalCharacters), () => historicalCharacters.HistoricalCharacters.ToHexString(" ") ); this.historicalCharacterTypesAdapter = this.CreatePropertyAdapter( nameof(this.HistoricalCharacterTypes), () => AtrHistoricalBytesAdapterBase.GetHistoricalCharacterTypes(this.interpretedAtr.HistoricalCharacters) ); this.PropertyChanged += this.AtrHistoricalBytesAdapterBase_PropertyChanged; this.setHistoricalCharacterTypeCommand = new DelegateCommand <EnumerationAdapter <HistoricalCharacterTypes> >(this.SetHistoricalCharacterType); }
private static IEnumerable <EnumerationAdapter <HistoricalCharacterTypes> > GetHistoricalCharacterTypes(AtrHistoricalBytesAdapterBase currentHistoricalCharacters) { if (currentHistoricalCharacters is AtrCompactTlvHistoricalBytesAdapter == false) { yield return(Classes.ATR.HistoricalCharacterTypes.CompactTlv); } if (currentHistoricalCharacters is AtrDirDataReferenceHistoricalBytesAdapter == false) { yield return(Classes.ATR.HistoricalCharacterTypes.DirDataReference); } if (currentHistoricalCharacters is AtrProprietaryHistoricalBytesAdapter == false) { yield return(Classes.ATR.HistoricalCharacterTypes.Proprietary); } if (currentHistoricalCharacters is AtrRfuHistoricalBytesAdapter == false) { yield return(Classes.ATR.HistoricalCharacterTypes.Rfu); } if (currentHistoricalCharacters is AtrNoHistoricalBytesAdapter == false) { yield return(Classes.ATR.HistoricalCharacterTypes.No); } }