public static SceIoStat GetStat(this IHleIoDriver HleIoDriver, string FileName)
 {
     var HleIoDrvFileArg = new HleIoDrvFileArg("none", HleIoDriver, 0, null);
     var SceIoStat = default(SceIoStat);
     HleIoDriver.IoGetstat(HleIoDrvFileArg, FileName, &SceIoStat);
     return SceIoStat;
 }
			public int IoOpen(HleIoDrvFileArg HleIoDrvFileArg, string FileName, HleIoFlags Flags, SceMode Mode)
			{
				//HleInterop.ExecuteFunctionNow(PspIoDrvFuncs->IoOpen);
				ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.Red, () => { Console.WriteLine("Not Implemented: GuestHleIoDriver.IoOpen"); });
				//throw new NotImplementedException();
				return 0;
			}
 public static IEnumerable<HleIoDirent> ListDir(this IHleIoDriver HleIoDriver, string Path)
 {
     var HleIoDrvFileArg = new HleIoDrvFileArg("none", HleIoDriver, 0, null);
     var HleIoDirent = default(HleIoDirent);
     var List = new List<HleIoDirent>();
     HleIoDriver.IoDopen(HleIoDrvFileArg, Path);
     while (HleIoDriver.IoDread(HleIoDrvFileArg, &HleIoDirent) > 0)
     {
         List.Add(HleIoDirent);
     }
     HleIoDriver.IoDclose(HleIoDrvFileArg);
     return List;
 }
		public static bool FileExists(this IHleIoDriver HleIoDriver, string FileName)
		{
			try
			{
				var HleIoDrvFileArg = new HleIoDrvFileArg("none", HleIoDriver, 0, null);
				var SceIoStat = default(SceIoStat);
				HleIoDriver.IoGetstat(HleIoDrvFileArg, FileName, &SceIoStat);
				return true;
			}
			catch
			{
				return false;
			}
		}
 public override int IoRename(HleIoDrvFileArg HleIoDrvFileArg, string OldFileName, string NewFileName)
 {
     throw (new NotImplementedException());
 }
 public override int IoChstat(HleIoDrvFileArg HleIoDrvFileArg, string FileName, SceIoStat *stat, int bits)
 {
     throw new NotImplementedException();
 }
 public unsafe int IoOpen(HleIoDrvFileArg HleIoDrvFileArg, string FileName, HleIoFlags Flags, SceMode Mode)
 {
     ReLocatePathHandle(ref HleIoDrvFileArg, ref FileName);
     return HleIoDrvFileArg.HleIoDriver.IoOpen(HleIoDrvFileArg, FileName, Flags, Mode);
 }
 public override int IoMkdir(HleIoDrvFileArg HleIoDrvFileArg, string Name, SceMode Mode)
 {
     Console.Error.WriteLine("Tried to create directory on a readonly filesystem '{0}'", Name);
     //throw(new NotImplementedException());
     return 0;
 }
 public unsafe int IoIoctl(HleIoDrvFileArg HleIoDrvFileArg, uint Command, byte* InputPointer, int InputLength, byte* OutputPointer, int OutputLength)
 {
     throw new NotImplementedException();
 }
 public unsafe int IoMkdir(HleIoDrvFileArg HleIoDrvFileArg, string Name, SceMode Mode)
 {
     ReLocatePathHandle(ref HleIoDrvFileArg, ref Name);
     return HleIoDrvFileArg.HleIoDriver.IoMkdir(HleIoDrvFileArg, Name, Mode);
 }
 public unsafe int IoClose(HleIoDrvFileArg HleIoDrvFileArg)
 {
     return HleIoDrvFileArg.HleIoDriver.IoClose(HleIoDrvFileArg);
     //throw new NotImplementedException();
 }
 public unsafe int IoDread(HleIoDrvFileArg HleIoDrvFileArg, HleIoDirent* dir)
 {
     throw new NotImplementedException();
 }
 public unsafe int IoRename(HleIoDrvFileArg HleIoDrvFileArg, string OldFileName, string NewFileName)
 {
     throw new NotImplementedException();
 }
        protected void ReLocatePathHandle(ref HleIoDrvFileArg HleIoDrvFileArg, ref string FileName)
        {
            foreach (var Mount in Mounts.OrderByDescending(Mount => Mount.Key.Length))
            {
                if (FileName.StartsWith(Mount.Key))
                {
                    HleIoDrvFileArg.HleIoDriver = Mount.Value;
                    FileName = FileName.Substring(Mount.Key.Length);
                    return;
                }

            }
            throw(new InvalidOperationException("Can't find mount point for '" + FileName + "'"));
        }
 public override int IoMkdir(HleIoDrvFileArg HleIoDrvFileArg, string Name, SceMode Mode)
 {
     Console.Error.WriteLine("Tried to create directory on a readonly filesystem '{0}'", Name);
     //throw(new NotImplementedException());
     return(0);
 }
 public override int IoRename(HleIoDrvFileArg HleIoDrvFileArg, string OldFileName, string NewFileName)
 {
     throw new NotImplementedException();
 }
Exemple #17
0
 virtual public int IoUmount(HleIoDrvFileArg HleIoDrvFileArg)
 {
     return(ParentDriver.IoUmount(HleIoDrvFileArg));
 }
Exemple #18
0
 virtual public int IoChdir(HleIoDrvFileArg HleIoDrvFileArg, string DirectoryName)
 {
     return(ParentDriver.IoChdir(HleIoDrvFileArg, DirectoryName));
 }
 public override int IoRemove(HleIoDrvFileArg HleIoDrvFileArg, string Name)
 {
     throw new NotImplementedException();
 }
 public unsafe int IoWrite(HleIoDrvFileArg HleIoDrvFileArg, byte* InputPointer, int InputLength)
 {
     throw new NotImplementedException();
 }
Exemple #21
0
 public virtual int IoIoctl(HleIoDrvFileArg HleIoDrvFileArg, uint Command, byte* InputPointer, int InputLength, byte* OutputPointer, int OutputLength)
 {
     return ParentDriver.IoIoctl(HleIoDrvFileArg, Command, InputPointer, InputLength, OutputPointer, OutputLength);
 }
 public unsafe int IoChdir(HleIoDrvFileArg HleIoDrvFileArg, string DirectoryName)
 {
     throw new NotImplementedException();
 }
Exemple #23
0
 public virtual long IoLseek(HleIoDrvFileArg HleIoDrvFileArg, long Offset, SeekAnchor Whence)
 {
     return ParentDriver.IoLseek(HleIoDrvFileArg, Offset, Whence);
 }
 public unsafe int IoDopen(HleIoDrvFileArg HleIoDrvFileArg, string Name)
 {
     ReLocatePathHandle(ref HleIoDrvFileArg, ref Name);
     return HleIoDrvFileArg.HleIoDriver.IoDopen(HleIoDrvFileArg, Name);
 }
Exemple #25
0
 public virtual int IoMkdir(HleIoDrvFileArg HleIoDrvFileArg, string Name, SceMode Mode)
 {
     return ParentDriver.IoMkdir(HleIoDrvFileArg, Name, Mode);
 }
 public unsafe int IoGetstat(HleIoDrvFileArg HleIoDrvFileArg, string FileName, SceIoStat* Stat)
 {
     ReLocatePathHandle(ref HleIoDrvFileArg, ref FileName);
     return HleIoDrvFileArg.HleIoDriver.IoGetstat(HleIoDrvFileArg, FileName, Stat);
 }
Exemple #27
0
 public virtual int IoMount(HleIoDrvFileArg HleIoDrvFileArg)
 {
     return ParentDriver.IoMount(HleIoDrvFileArg);
 }
 public unsafe long IoLseek(HleIoDrvFileArg HleIoDrvFileArg, long Offset, SeekAnchor Whence)
 {
     throw new NotImplementedException();
 }
Exemple #29
0
 public virtual int IoOpen(HleIoDrvFileArg HleIoDrvFileArg, string FileName, HleIoFlags Flags, SceMode Mode)
 {
     return ParentDriver.IoOpen(HleIoDrvFileArg, FileName, Flags, Mode);
 }
 public unsafe int IoMount(HleIoDrvFileArg HleIoDrvFileArg)
 {
     throw new NotImplementedException();
 }
		public static Stream OpenRead(this IHleIoDriver HleIoDriver, string FileName)
		{
			var HleIoDrvFileArg = new HleIoDrvFileArg("none", HleIoDriver, 0, null);
			HleIoDriver.IoOpen(HleIoDrvFileArg, FileName, HleIoFlags.Read, SceMode.All);
			return HleIoDrvFileArg.GetStream();
		}
 public override int IoChstat(HleIoDrvFileArg HleIoDrvFileArg, string FileName, SceIoStat* stat, int bits)
 {
     throw(new NotImplementedException());
 }
 public unsafe int IoRead(HleIoDrvFileArg HleIoDrvFileArg, byte* OutputPointer, int OutputLength)
 {
     throw new NotImplementedException();
 }
 public override int IoOpen(HleIoDrvFileArg HleIoDrvFileArg, string FileName, HleIoFlags Flags, SceMode Mode)
 {
     //if (Mode)
     // ...
     return base.IoOpen(HleIoDrvFileArg, FileName, Flags, Mode);
 }
 public unsafe int IoRemove(HleIoDrvFileArg HleIoDrvFileArg, string Name)
 {
     throw new NotImplementedException();
 }
 public override int IoRmdir(HleIoDrvFileArg HleIoDrvFileArg, string Name)
 {
     throw (new NotImplementedException());
 }
 public override int IoOpen(HleIoDrvFileArg HleIoDrvFileArg, string FileName, HleIoFlags Flags, SceMode Mode)
 {
     //if (Mode)
     // ...
     return(base.IoOpen(HleIoDrvFileArg, FileName, Flags, Mode));
 }