public IResourceFile FindResourceFile(string resName)
        {
            string fixedName = FilenameUtils.FixResourcePath(resName);

            if (m_resources.TryGetValue(fixedName, out ResourceFile file))
            {
                return(file);
            }

            string resPath = m_resourceCallback?.Invoke(fixedName);

            if (resPath == null)
            {
                Logger.Log(LogType.Warning, LogCategory.Import, $"Resource file '{resName}' hasn't been found");
                m_resources.Add(fixedName, null);
                return(null);
            }

            using (ResourceFileScheme scheme = ResourceFile.LoadScheme(resPath, fixedName))
            {
                ResourceFile resourceFile = scheme.ReadFile();
                AddResourceFile(resourceFile);
            }
            Logger.Log(LogType.Info, LogCategory.Import, $"Resource file '{resName}' has been loaded");
            return(m_resources[fixedName]);
        }
Esempio n. 2
0
        public IResourceFile FindResourceFile(string resName)
        {
            string fixedName = FilenameUtils.FixResourcePath(resName);

            if (m_resources.TryGetValue(fixedName, out ResourceFile file))
            {
                return(file);
            }

            string resPath = m_resourceCallback?.Invoke(fixedName);

            if (resPath == null)
            {
                m_resources.Add(fixedName, null);
                return(null);
            }

            using (ResourceFileScheme scheme = ResourceFile.LoadScheme(resPath, fixedName))
            {
                AddFile(scheme, this, AssemblyManager);
            }
            return(m_resources[fixedName]);
        }