/// <summary> /// Gets a value of of the property specified by name from ConfigDictionary. /// </summary> /// <param name="propertyId">Name of the property to retrieve.</param> /// <param name="md">Dictionary (data source) containing the data for the property.</param> /// <exception cref="PropertyRetrievalException">Thrown when either data source is null or when the data source does not contain the string value for the specified property name.</exception> private static Property GetConfigDictionaryProperty(LocResource.LocResourceProps propertyId, ConfigDictionary md) { if (md == null) { throw new PropertyRetrievalException(String.Format(CultureInfo.CurrentCulture, "DataSource must not be null. DataSource name: {0}", md.GetType().Name)); } string value; md.TryGetValue(propertyId.ToString(), out value); switch (propertyId) { case LocResource.LocResourceProps.ResourceId: return(new StringProperty((byte)propertyId, value)); case LocResource.LocResourceProps.SourceString: return(new StringProperty((byte)propertyId, value)); case LocResource.LocResourceProps.Comments: return(new StringProperty((byte)propertyId, value)); case LocResource.LocResourceProps.FilePath: return(new StringProperty((byte)propertyId, value)); default: throw new PropertyRetrievalException(String.Format(CultureInfo.CurrentCulture, "Cannot provide property {0} from datasource of type {1}.", propertyId.ToString(), md.GetType().Name)); } }