public ResourceMapValue(string valueType, object entry) { // check that the mapping type is valid if (!ResourceMap.IsResourceMapType(valueType)) throw new ArgumentException("Agrument \"" + type + "\" is an illegal resource mapping type", "type"); type = ResourceMap.GetResourceMapType(valueType); // check that the mapping entry is of the appropriate type if (!((type.Equals(ResourceMap.ResourceType.GROUP) && entry is int) || (type.Equals(ResourceMap.ResourceType.PROCESS_AGENT) && entry is int)|| (type.Equals(ResourceMap.ResourceType.CLIENT) && entry is int) || (type.Equals(ResourceMap.ResourceType.RESOURCE_MAPPING) && entry is int) || (type.Equals(ResourceMap.ResourceType.TICKET_TYPE) && entry is TicketType) || (type.Equals(ResourceMap.ResourceType.RESOURCE_TYPE) && entry is string) || (type.Equals(ResourceMap.ResourceType.STRING) && entry is string))) throw new ArgumentException("Agrument \"entry\" is not of the correct type", "entry"); this.value = entry; }
/// <summary> /// Redefined to disallow mapping keys that are Resource mappings /// </summary> /// <param name="type"></param> /// <param name="entry"></param> public ResourceMapKey(ResourceMap.ResourceType type, int key) { // check that the mapping type is valid if (!ResourceMap.IsResourceMapType(type)) throw new ArgumentException("Agrument \"" + type + "\" is an illegal resource mapping type", "type"); // check that the mapping entry is of the appropriate type if (!( (type.Equals(ResourceMap.ResourceType.CLIENT) && value is int) || (type.Equals(ResourceMap.ResourceType.PROCESS_AGENT) && value is int) || (type.Equals(ResourceMap.ResourceType.STRING) && value is string) || (type.Equals(ResourceMap.ResourceType.TICKET_TYPE) && value is TicketType) || (type.Equals(ResourceMap.ResourceType.GROUP) && value is int) || (type.Equals(ResourceMap.ResourceType.RESOURCE_TYPE) && value is string))) { throw new ArgumentException("Agrument \"entry\" is not of the correct type", "entry"); } this.type = type; value = key; }