FSO.Content.Content.GetResource C# (CSharp) Method

GetResource() public method

Gets a resource using a path and ID.
public GetResource ( string path, ulong assetID ) : Stream
path string The path to the file. If this path is to an archive, assetID can be null.
assetID ulong The ID for the resource. Can be null if path doesn't point to an archive.
return Stream
        public Stream GetResource(string path, ulong assetID)
        {
            if (path.EndsWith(".dat"))
            {
                /** Archive **/
                if (!Archives.ContainsKey(path))
                {
                    FAR3Archive newArchive = new FAR3Archive(GetPath(path));
                    Archives.Add(path, newArchive);
                }

                var archive = Archives[path];
                var bytes = archive.GetItemByID(assetID);
                return new MemoryStream(bytes, false);
            }

            if (path.EndsWith(".bmp") || path.EndsWith(".png") || path.EndsWith(".tga")) path = "uigraphics/" + path;

            return File.OpenRead(GetPath(path));
        }