コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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();
            }
        }