public string GetProp(DriverModuleName mn, DriverPropName pn) { this.propsLock.EnterReadLock(); try { foreach (Dictionary <DriverPropName, string> driverPropDict in this.allDriversPropDicts ) { if (driverPropDict[DPNs.ModuleName] == mn.ToString()) { if (driverPropDict.ContainsKey(pn) == false) { throw new InvalidDriverPropName(pn.ToString()); } return(driverPropDict[pn]); } } throw new InvalidDriverModuleName(mn.ToString()); } finally { this.propsLock.ExitReadLock(); } }
protected string GetPropString( DriverModuleName moduleName, DriverPropName propName ) { if (moduleName == null) { throw new InvalidDriverModuleName("null"); } if (propName == null) { throw new InvalidDriverPropName("null"); } List <Dictionary <DriverPropName, string> > allDriversPropDicts = this.driversSource.GetPropDictionariesCopy(); foreach (Dictionary <DriverPropName, string> driverPropDict in allDriversPropDicts ) { if (driverPropDict[DPNs.ModuleName] == moduleName.ToString()) { return(driverPropDict[propName]); } } throw new InvalidOperationException( string.Format("Could not get prop string for driver " + "'{0}' prop '{1}'", moduleName, propName)); }
public void SetProp( DriverModuleName mn, DriverPropName pn, string value ) { this.propsLock.EnterWriteLock(); try { foreach (Dictionary <DriverPropName, string> driverPropDict in this.allDriversPropDicts ) { if (driverPropDict[DPNs.ModuleName] == mn.ToString()) { if (driverPropDict.ContainsKey(pn) == false) { throw new InvalidDriverPropName(pn.ToString()); } driverPropDict[pn] = value; } } throw new InvalidDriverModuleName(mn.ToString()); } finally { this.propsLock.ExitWriteLock(); } }