private IHmeResource ResourceToHmeResource(Events.ResourceInfo resourceInfo, Resource resource) { IHmeResource hmeResource = null; lock (_resourceManager) { if (_resourceManager.TryGetHmeResource(resourceInfo.ResourceId, out hmeResource)) { return(hmeResource); } } if (resource.IsMusic) { hmeResource = new StreamedMusic(this, resource.Name, resourceInfo.ResourceId); } else if (resource.IsResourceType(ResourceType.Image)) { hmeResource = new ImageResource(this, resource.Name, resourceInfo.ResourceId); } else if (resource.IsResourceType(ResourceType.Sound)) { hmeResource = new Sound(this, resource.Name, resourceInfo.ResourceId); } else if (resource.IsResourceType(ResourceType.TrueTypeFont)) { hmeResource = new TrueTypeFontResource(this, resource.Name, resourceInfo.ResourceId); } else { hmeResource = new GenericResource(this, resource.Name, resourceInfo.ResourceId); } return(hmeResource); }
/// <summary> /// Tests equality between two resources. /// </summary> /// <param name="obj">Another resource</param> /// <returns>true if the two streams represent the same source audio; false otherwise</returns> public override bool Equals(object obj) { StreamedMusic streamedResource = obj as StreamedMusic; if (streamedResource != null) { return(_resourceId == streamedResource._resourceId); } else { return(false); } }