using System; using System.IO; using Robust.Shared.Utility; namespace Robust.Shared.ContentPack { public static class ResourceManagerExt { /// /// Read a file from the mounted content roots, if it exists. /// /// The resource manager. /// The path to the file in the VFS. Must be rooted. /// The memory stream of the file, or null if the file does not exist. /// Thrown if is not rooted. /// Thrown if is null. /// /// public static Stream? ContentFileReadOrNull(this IResourceManager res, ResPath path) { if (res.TryContentFileRead(path, out var stream)) { return stream; } return null; } } }