Ejemplo n.º 1
0
        /// <summary>
        /// Include a file.
        /// </summary>
        /// <param name="path">Path of the file to include</param>
        /// <returns>A stream for the included file</returns>
        public Stream IncludeFile(string path)
        {
            string fullPath;

            if (path[0] != '/')
            {
                fullPath = ((BasePath != null) ? BasePath + "/" : string.Empty) + path;
            }
            else
            {
                fullPath = path.Substring(1);
            }

            return(GameFs.OpenFile(fullPath));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initialize a new instance of this class.
 /// </summary>
 /// <param name="gameFs">Game filesystem instance to bind</param>
 /// <param name="basePath">Base path. Null to use the root folder.</param>
 internal GameFsIncludeProvider(GameFs gameFs, string basePath = null)
 {
     GameFs   = gameFs;
     BasePath = basePath?.TrimEnd('/');
 }