public virtual bool Update(CDriver.Progress progress) { if (!progress(0)) { return(false); } base.Clear(); foreach (CSource cSource in this) { cSource._Online = false; } int sourceCount = this.MedApplication.SourceCount; for (int i = 1; i <= sourceCount; i++) { IMedDataSource medDataSource = (IMedDataSource)this.MedApplication.GetSource(i); bool flag = true; foreach (CSource cSource2 in this) { if (cSource2.UniqueIdentifier == medDataSource.UniqueId) { cSource2._Online = true; flag = false; } } if (flag) { switch (medDataSource.Type) { case 0: case 3: case 4: case 5: case 6: IL_FD: base.AddLast(new CSource(this, medDataSource)); goto IL_128; case 1: base.AddLast(new CSource.CMobilePhone(this, medDataSource)); goto IL_128; case 2: base.AddLast(new CSource.CSIMCard(this, medDataSource)); goto IL_128; } //goto IL_FD; } IL_128: if (!progress(i * 999 / sourceCount)) { return(false); } } return(progress(1000)); }
internal CSource(CItem parent, IMedDataSource medDataSource) : base(parent) { if (!(parent is CSources)) { throw new Exception("Internal error"); } this._Online = true; this.MedDataSource = medDataSource; this.Label = this.MedDataSource.Label; this.Manufacturer = this.MedDataSource.Manufacturer; this.Model = this.MedDataSource.Product; this.Id = this.MedDataSource.Session; this.UniqueIdentifier = this.MedDataSource.UniqueId; this.DeviceType = (CSource.EDeviceType) this.MedDataSource.Type; this.SourceId = ++CSource.counter; }
internal CSmartCardReader(CItem parent, IMedDataSource dataSource) : base(parent, dataSource) { this.MedSmartCardReader = (ISmartCardReader)dataSource; IReaderState readerState; try { readerState = (IReaderState)this.MedSmartCardReader.State; } catch (Exception ex) { throw new Exception(this.ToString() + " : Cannot query IReaderState interface [ " + ex.Message + " ]"); } this.Empty = (readerState.Empty != 0); this.Exclusive = (readerState.Exclusive != 0); this.InUse = (readerState.InUse != 0); this.Mute = (readerState.Mute != 0); this.Present = (readerState.Present != 0); this.Powered = (readerState.Unpowered == 0); this.SIMState = (CSource.CSmartCardReader.ESIMState)readerState.SIMState; }
internal CSIMCard(CItem parent, IMedDataSource dataSource) : base(parent, dataSource) { }
internal CMobilePhone(CItem parent, IMedDataSource dataSource) : base(parent, dataSource) { this.MobilePhone = (IMobilePhone)dataSource; }