ContentType GetContentType(const ea::string& resourcePath) { auto extension = GetExtension(resourcePath).to_lower(); if (extension == ".xml") { auto systemUI = (SystemUI*)ui::GetIO().UserData; ea::shared_ptr<XMLFile> xml(systemUI->GetCache()->GetResource<XMLFile>(resourcePath)); if (!xml) return CTYPE_UNKNOWN; auto rootElementName = xml->GetRoot().GetName(); if (rootElementName == "scene") return CTYPE_SCENE; if (rootElementName == "node") return CTYPE_SCENEOBJECT; if (rootElementName == "elements") return CTYPE_UISTYLE; if (rootElementName == "element") return CTYPE_UILAYOUT; if (rootElementName == "material") return CTYPE_MATERIAL; if (rootElementName == "particleeffect") return CTYPE_PARTICLE; if (rootElementName == "renderpath") return CTYPE_RENDERPATH; if (rootElementName == "texture") return CTYPE_TEXTUREXML; } if (extension == ".mdl") return CTYPE_MODEL; if (extension == ".ani") return CTYPE_ANIMATION; if (extension == ".scene") return CTYPE_SCENE; if (extension == ".ui") return CTYPE_UILAYOUT; if (extension == ".style") return CTYPE_UISTYLE; if (extension == ".material") return CTYPE_MATERIAL; if (extension == ".particle") return CTYPE_PARTICLE; if (extension == ".node") return CTYPE_SCENEOBJECT; if (audioExtensions_.contains(extension)) return CTYPE_SOUND; if (imagesExtensions_.contains(extension)) return CTYPE_TEXTURE; return CTYPE_UNKNOWN; }
FileType GetFileType(const ea::string& fileName) { auto extension = GetExtension(fileName).to_lower(); if (archiveExtensions_.contains(extension)) return FTYPE_ARCHIVE; if (wordExtensions_.contains(extension)) return FTYPE_WORD; if (codeExtensions_.contains(extension)) return FTYPE_CODE; if (imagesExtensions_.contains(extension)) return FTYPE_IMAGE; if (textExtensions_.contains(extension)) return FTYPE_TEXT; if (audioExtensions_.contains(extension)) return FTYPE_AUDIO; if (extension == "pdf") return FTYPE_PDF; return FTYPE_FILE; }