CSPspEmu.Hle.Managers.HleIoManager.ParsePath C# (CSharp) Method

ParsePath() public method

Returns a tuple of Driver/Index/path.
public ParsePath ( string FullPath ) : ParsePathInfo
FullPath string
return ParsePathInfo
        public ParsePathInfo ParsePath(string FullPath)
        {
            //FullPath = FullPath.Replace('\\', '/');

            //Console.Error.WriteLine("FullPath: {0}", FullPath);
            if (FullPath.IndexOf(':') == -1)
            {
                FullPath = CurrentDirectoryPath + "/" + FullPath;
            }

            //Console.Error.WriteLine("FullPath: {0}", FullPath);
            var Match = new Regex(@"^([a-zA-Z]+)(\d*):(.*)$").Match(FullPath);
            var DriverName = Match.Groups[1].Value.ToLower() + ":";
            int FileSystemNumber = 0;
            IHleIoDriver HleIoDriver = null;
            Int32.TryParse(Match.Groups[2].Value, out FileSystemNumber);
            if (!Drivers.TryGetValue(DriverName, out HleIoDriver))
            {
                foreach (var Driver in Drivers)
                {
                    Console.WriteLine("Available Driver: '{0}'", Driver.Key);
                }
                throw(new KeyNotFoundException("Can't find HleIoDriver '" + DriverName + "'"));
            }

            return new ParsePathInfo()
            {
                HleIoDrvFileArg = new HleIoDrvFileArg(DriverName, HleIoDriver, FileSystemNumber, null),
                LocalPath = Match.Groups[3].Value.Replace('\\', '/'),
            };
        }

Usage Example

Example #1
0
        public void Mkdir(string path, SceMode sceMode)
        {
            var pathInfo = _hleIoManager.ParsePath(path);

            pathInfo.HleIoDriver.IoMkdir(pathInfo.HleIoDrvFileArg, pathInfo.LocalPath, sceMode);
        }