protected static HWResource GetOrCreateFromFile(HWContext context, string filename, HWResourceType expectedType = HWResourceType.None) { // Set the extension based on the resource type if the filename doesn't have one if (string.IsNullOrEmpty(Path.GetExtension(filename)) && TypeExtensions.TryGetValue(expectedType, out string defaultExtension)) { filename = Path.ChangeExtension(filename, defaultExtension); } var resource = CreateResource(context, filename); resource?.Load(File.ReadAllBytes(resource.AbsolutePath)); return(resource); }
public HWResourceTypeDefinition(HWResourceType type, Type resourceClass) { Type = type; Class = resourceClass; }