public int sceIoGetstat(string FileName, SceIoStat *SceIoStat)
        {
            var Info = HleIoManager.ParsePath(FileName);

            try
            {
                Info.HleIoDriver.IoGetstat(Info.HleIoDrvFileArg, Info.LocalPath, SceIoStat);
                return(0);
            }
            catch (FileNotFoundException FileNotFoundException)
            {
                Console.Error.WriteLine("Can't find file '{0}'", FileName);
                Console.Error.WriteLine(FileNotFoundException);
                return((int)SceKernelErrors.ERROR_ERRNO_FILE_NOT_FOUND);
            }
            catch (Exception Exception)
            {
                Console.Error.WriteLine(Exception);
                return(-1);
            }
            finally
            {
                _DelayIo(IoDelayType.GetStat);
            }
        }
 public SceUID sceIoDopen(string DirectoryPath)
 {
     try
     {
         var Info = HleIoManager.ParsePath(DirectoryPath);
         Info.HleIoDrvFileArg.HleIoDriver.IoDopen(Info.HleIoDrvFileArg, Info.LocalPath);
         return(HleIoManager.HleIoDrvFileArgPool.Create(Info.HleIoDrvFileArg));
     }
     catch (DirectoryNotFoundException)
     {
         throw new SceKernelException(SceKernelErrors.ERROR_ERRNO_FILE_NOT_FOUND);
     }
     catch (FileNotFoundException)
     {
         throw new SceKernelException(SceKernelErrors.ERROR_ERRNO_FILE_NOT_FOUND);
     }
     catch (InvalidOperationException InvalidOperationException)
     {
         Console.Error.WriteLine(InvalidOperationException);
     }
     finally
     {
         _DelayIo(IoDelayType.Dopen);
     }
     throw new SceKernelException(SceKernelErrors.ERROR_ERRNO_NOT_A_DIRECTORY);
 }
 public int sceIoChstat(string FileName, SceIoStat *SceIoStat, int Bitmask)
 {
     try
     {
         var Info = HleIoManager.ParsePath(FileName);
         return(Info.HleIoDriver.IoChstat(Info.HleIoDrvFileArg, FileName, SceIoStat, Bitmask));
     }
     finally
     {
         _DelayIo(IoDelayType.ChStat);
     }
 }
 public int sceIoRmdir(string DirectoryPath)
 {
     try
     {
         var Info = HleIoManager.ParsePath(DirectoryPath);
         Info.HleIoDrvFileArg.HleIoDriver.IoRmdir(Info.HleIoDrvFileArg, Info.LocalPath);
         return(0);
     }
     finally
     {
         _DelayIo(IoDelayType.Rmdir);
     }
 }
 public int sceIoRename(string OldFileName, string NewFileName)
 {
     try
     {
         var Info1 = HleIoManager.ParsePath(OldFileName);
         var Info2 = HleIoManager.ParsePath(NewFileName);
         if (!Info1.Equals(Info2))
         {
             throw new NotImplementedException("Rename from different filesystems");
         }
         return(Info1.HleIoDriver.IoRename(Info1.HleIoDrvFileArg, OldFileName, NewFileName));
     }
     finally
     {
         _DelayIo(IoDelayType.Rename);
     }
 }
 public int sceIoRemove(string FileName)
 {
     try
     {
         var Info = HleIoManager.ParsePath(FileName);
         return(Info.HleIoDriver.IoRemove(Info.HleIoDrvFileArg, FileName));
     }
     catch (Exception Exception)
     {
         Console.Error.WriteLine(Exception);
         return(-1);
     }
     finally
     {
         _DelayIo(IoDelayType.Remove);
     }
 }
        public SceUID _sceIoOpen(string FileName, HleIoFlags Flags, SceMode Mode, bool Async)
        {
            var Info = HleIoManager.ParsePath(FileName);

            try
            {
                ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.DarkGreen,
                                                     () => { Console.WriteLine("Opened ({0}): '{1}'", Async ? "Async" : "NO Async", FileName); });
                Info.HleIoDrvFileArg.HleIoDriver.IoOpen(Info.HleIoDrvFileArg, Info.LocalPath, Flags, Mode);
                Info.HleIoDrvFileArg.FullFileName = FileName;
                var Uid = HleIoManager.HleIoDrvFileArgPool.Create(Info.HleIoDrvFileArg);
                if (Async)
                {
                    Info.HleIoDrvFileArg.AsyncLastResult = (long)Uid;
                }
                return(Uid);
            }
            catch (IOException IOException)
            {
                Logger.Error("IOException: {0}", IOException);
            }
            catch (InvalidOperationException InvalidOperationException)
            {
                Logger.Error("InvalidOperationException: {0}", InvalidOperationException);
            }
            finally
            {
                if (!Async)
                {
                    _DelayIo(IoDelayType.Open);
                }
            }

            if (Async)
            {
                Info.HleIoDrvFileArg.AsyncLastResult = (long)SceKernelErrors.ERROR_ERRNO_FILE_NOT_FOUND;
                return(HleIoManager.HleIoDrvFileArgPool.Create(Info.HleIoDrvFileArg));
            }
            else
            {
                //Console.Error.WriteLine("Didn't find file '{0}'", FileName);
                throw new SceKernelException(SceKernelErrors.ERROR_ERRNO_FILE_NOT_FOUND,
                                             $"Didn't find file '{FileName}'");
            }
        }