예제 #1
0
 public void GetSanitizedPathTest()
 {
     Assert.Equal("/test/1/2", HleIoDriverLocalFileSystem.GetSanitizedPath("/test/1/2"));
     Assert.Equal("/test/1/2", HleIoDriverLocalFileSystem.GetSanitizedPath("/test///1//2"));
     Assert.Equal("/test/1/2", HleIoDriverLocalFileSystem.GetSanitizedPath("/test/\\/1\\\\2"));
     Assert.Equal("1/2/3", HleIoDriverLocalFileSystem.GetSanitizedPath("1/2/3"));
     Assert.Equal("1/3", HleIoDriverLocalFileSystem.GetSanitizedPath("1/2/../3"));
     Assert.Equal("1/3", HleIoDriverLocalFileSystem.GetSanitizedPath("1/2/.././././3"));
     Assert.Equal("3", HleIoDriverLocalFileSystem.GetSanitizedPath("1/2/../../../../../3"));
     Assert.Equal("1/2/3/4", HleIoDriverLocalFileSystem.GetSanitizedPath("1/2/3/4/////"));
 }
예제 #2
0
        public void ParsePathTest()
        {
            var PspEmulatorContext = new PspEmulatorContext(new PspConfig());
            var HleIoManager       = PspEmulatorContext.GetInstance <HleIoManager>();
            var DriverName         = "ms:";
            var Driver             = new HleIoDriverLocalFileSystem("C:/$INVALID$PATH$");

            HleIoManager.SetDriver(DriverName, Driver);

            var Parts = HleIoManager.ParsePath("ms3:/path/to/file.txt");

            Assert.AreEqual(Driver, Parts.HleIoDrvFileArg.HleIoDriver);
            Assert.AreEqual(3, Parts.HleIoDrvFileArg.FileSystemNumber);
            Assert.AreEqual("/path/to/file.txt", Parts.LocalPath);
        }
        public void ParsePathTest()
        {
            var injectContext = new InjectContext();
            var hleIoManager  = injectContext.GetInstance <HleIoManager>();
            var driverName    = "ms:";
            var driver        = new HleIoDriverLocalFileSystem("C:/$INVALID$PATH$");

            hleIoManager.SetDriver(driverName, driver);

            var parts = hleIoManager.ParsePath("ms3:/path/to/file.txt");

            Assert.Equal(driver, parts.HleIoDrvFileArg.HleIoDriver);
            Assert.Equal(3, parts.HleIoDrvFileArg.FileSystemNumber);
            Assert.Equal("/path/to/file.txt", parts.LocalPath);
        }