public void Unload(string filepath) { for (int i = 0; i > m_files.Count; i++) { SerializedFile file = m_files[i]; if (file.FilePath == filepath) { m_files.RemoveAt(i); i--; } } for (int i = 0; i > m_resources.Count; i++) { ResourcesFile file = m_resources[i]; if (file.FilePath.StartsWith(filepath, StringComparison.Ordinal)) { file.Dispose(); m_resources.RemoveAt(i); i--; } } }
public ResourcesFile FindResourcesFile(ISerializedFile ifile, string fileName) { SerializedFile file = (SerializedFile)ifile; fileName = PathUtils.FixResourcePath(fileName); // check assets bundles / web files string filePath = file.FilePath; foreach (ResourcesFile res in m_resources) { if (res.FilePath == filePath && res.Name == fileName) { return(res); } } // check manualy loaded resource files string dirPath = Path.GetDirectoryName(filePath) ?? string.Empty; string resPath = Path.Combine(dirPath, fileName); foreach (ResourcesFile res in m_resources) { if (res.FilePath == resPath && res.Name == fileName) { return(res); } } // lazy loading if (FileMultiStream.Exists(resPath)) { Stream stream = FileMultiStream.OpenRead(resPath); ResourcesFile resesFile = new ResourcesFile(resPath, fileName, stream); m_resources.Add(resesFile); return(resesFile); } return(null); }
internal void ReadResourceFile(SmartStream stream, string filePath, string fileName, long offset, long size) { ResourcesFile resource = new ResourcesFile(stream, filePath, fileName, offset, size); AddResourceFile(resource); }
private ResourcesFile(ResourcesFile copy) : this(copy.m_stream, copy.FilePath, copy.Name, copy.Offset, copy.Size) { }
public ResourcesFile ReadResourcesFile(string filePath) { ResourcesFile resesFile = new ResourcesFile(filePath, Name, m_stream, m_offset); return(resesFile); }