示例#1
0
 public SaveDataDirectory(SaveDataFileSystemCore fs, string path, SaveFindPosition position, OpenDirectoryMode mode)
 {
     ParentFileSystem = fs;
     InitialPosition  = position;
     FullPath         = path;
     Mode             = mode;
 }
示例#2
0
 public SaveDataDirectory(SaveDataFileSystemCore fs, string path, SaveDirectoryEntry dir, OpenDirectoryMode mode)
 {
     ParentFileSystem = fs;
     Directory        = dir;
     FullPath         = path;
     Mode             = mode;
 }
示例#3
0
 public long GetTotalSpaceSize(string path)
 {
     try
     {
         return(SaveDataFileSystemCore.GetTotalSpaceSize(path));
     }
     catch (HorizonResultException ex)
     {
         ConvertResultException(ex);
         throw;
     }
 }
示例#4
0
 public DirectoryEntryType GetEntryType(string path)
 {
     try
     {
         return(SaveDataFileSystemCore.GetEntryType(path));
     }
     catch (HorizonResultException ex)
     {
         ConvertResultException(ex);
         throw;
     }
 }
示例#5
0
 public void RenameFile(string srcPath, string dstPath)
 {
     try
     {
         SaveDataFileSystemCore.RenameFile(srcPath, dstPath);
     }
     catch (HorizonResultException ex)
     {
         ConvertResultException(ex);
         throw;
     }
 }
示例#6
0
 public IFile OpenFile(string path, OpenMode mode)
 {
     try
     {
         return(SaveDataFileSystemCore.OpenFile(path, mode));
     }
     catch (HorizonResultException ex)
     {
         ConvertResultException(ex);
         throw;
     }
 }
示例#7
0
 public void DeleteFile(string path)
 {
     try
     {
         SaveDataFileSystemCore.DeleteFile(path);
     }
     catch (HorizonResultException ex)
     {
         ConvertResultException(ex);
         throw;
     }
 }
示例#8
0
 public void CleanDirectoryRecursively(string path)
 {
     try
     {
         SaveDataFileSystemCore.CleanDirectoryRecursively(path);
     }
     catch (HorizonResultException ex)
     {
         ConvertResultException(ex);
         throw;
     }
 }
示例#9
0
 public void CreateFile(string path, long size, CreateFileOptions options)
 {
     try
     {
         SaveDataFileSystemCore.CreateFile(path, size, options);
     }
     catch (HorizonResultException ex)
     {
         ConvertResultException(ex);
         throw;
     }
 }
示例#10
0
        public SaveDataFileSystem(Keyset keyset, IStorage storage, IntegrityCheckLevel integrityCheckLevel, bool leaveOpen)
        {
            BaseStorage = storage;
            LeaveOpen   = leaveOpen;
            Keyset      = keyset;

            Header = new Header(BaseStorage, keyset);
            FsLayout layout = Header.Layout;

            IStorage dataRemapBase        = BaseStorage.Slice(layout.FileMapDataOffset, layout.FileMapDataSize);
            IStorage dataRemapEntries     = BaseStorage.Slice(layout.FileMapEntryOffset, layout.FileMapEntrySize);
            IStorage metadataRemapEntries = BaseStorage.Slice(layout.MetaMapEntryOffset, layout.MetaMapEntrySize);

            DataRemapStorage = new RemapStorage(dataRemapBase, Header.MainRemapHeader, dataRemapEntries, leaveOpen);

            DuplexStorage = InitDuplexStorage(DataRemapStorage, Header);

            MetaRemapStorage = new RemapStorage(DuplexStorage, Header.MetaDataRemapHeader, metadataRemapEntries, leaveOpen);

            var journalMapInfo = new JournalMapParams
            {
                MapStorage          = MetaRemapStorage.Slice(layout.JournalMapTableOffset, layout.JournalMapTableSize),
                PhysicalBlockBitmap = MetaRemapStorage.Slice(layout.JournalPhysicalBitmapOffset, layout.JournalPhysicalBitmapSize),
                VirtualBlockBitmap  = MetaRemapStorage.Slice(layout.JournalVirtualBitmapOffset, layout.JournalVirtualBitmapSize),
                FreeBlockBitmap     = MetaRemapStorage.Slice(layout.JournalFreeBitmapOffset, layout.JournalFreeBitmapSize),
            };

            IStorage journalData = DataRemapStorage.Slice(layout.JournalDataOffset,
                                                          layout.JournalDataSizeB + layout.JournalSize);

            JournalStorage = new JournalStorage(journalData, Header.JournalHeader, journalMapInfo, leaveOpen);

            IvfcStorage = InitJournalIvfcStorage(integrityCheckLevel);

            IStorage fatStorage = MetaRemapStorage.Slice(layout.FatOffset, layout.FatSize);

            if (Header.Layout.Version >= 0x50000)
            {
                fatStorage = InitFatIvfcStorage(integrityCheckLevel);
            }

            SaveDataFileSystemCore = new SaveDataFileSystemCore(IvfcStorage, fatStorage, Header.SaveHeader);
        }
示例#11
0
 public DirectoryEntryType GetEntryType(string path)
 {
     return(SaveDataFileSystemCore.GetEntryType(path));
 }
示例#12
0
 public bool FileExists(string filename) => SaveDataFileSystemCore.FileExists(filename);
示例#13
0
 public bool DirectoryExists(string path) => SaveDataFileSystemCore.DirectoryExists(path);
示例#14
0
 public IFile OpenFile(string path, OpenMode mode)
 {
     return(SaveDataFileSystemCore.OpenFile(path, mode));
 }
示例#15
0
 public IDirectory OpenDirectory(string path, OpenDirectoryMode mode)
 {
     return(SaveDataFileSystemCore.OpenDirectory(path, mode));
 }
示例#16
0
        public SaveDataFileSystem(Keyset keyset, IStorage storage, IntegrityCheckLevel integrityCheckLevel, bool leaveOpen)
        {
            BaseStorage = storage;
            LeaveOpen   = leaveOpen;
            Keyset      = keyset;

            var headerA = new Header(BaseStorage, keyset);
            var headerB = new Header(BaseStorage.Slice(0x4000), keyset);

            if (headerA.HeaderHashValidity == Validity.Valid)
            {
                IsFirstHeaderInUse = true;
            }
            else if (headerB.HeaderHashValidity == Validity.Valid)
            {
                IsFirstHeaderInUse = false;
            }
            else
            {
                ThrowHelper.ThrowResult(ResultFs.InvalidSaveDataHeader, "Savedata header is not valid.");
            }

            Header = IsFirstHeaderInUse ? headerA : headerB;

            FsLayout layout = Header.Layout;

            IStorage dataRemapBase        = BaseStorage.Slice(layout.FileMapDataOffset, layout.FileMapDataSize);
            IStorage dataRemapEntries     = BaseStorage.Slice(layout.FileMapEntryOffset, layout.FileMapEntrySize);
            IStorage metadataRemapEntries = BaseStorage.Slice(layout.MetaMapEntryOffset, layout.MetaMapEntrySize);

            DataRemapStorage = new RemapStorage(dataRemapBase, Header.MainRemapHeader, dataRemapEntries, leaveOpen);

            DuplexStorage = InitDuplexStorage(DataRemapStorage, Header);

            MetaRemapStorage = new RemapStorage(DuplexStorage, Header.MetaDataRemapHeader, metadataRemapEntries, leaveOpen);

            var journalMapInfo = new JournalMapParams
            {
                MapStorage          = MetaRemapStorage.Slice(layout.JournalMapTableOffset, layout.JournalMapTableSize),
                PhysicalBlockBitmap = MetaRemapStorage.Slice(layout.JournalPhysicalBitmapOffset, layout.JournalPhysicalBitmapSize),
                VirtualBlockBitmap  = MetaRemapStorage.Slice(layout.JournalVirtualBitmapOffset, layout.JournalVirtualBitmapSize),
                FreeBlockBitmap     = MetaRemapStorage.Slice(layout.JournalFreeBitmapOffset, layout.JournalFreeBitmapSize),
            };

            IStorage journalData = DataRemapStorage.Slice(layout.JournalDataOffset,
                                                          layout.JournalDataSizeB + layout.JournalSize);

            JournalStorage = new JournalStorage(journalData, Header.JournalHeader, journalMapInfo, leaveOpen);

            CoreDataIvfcStorage = InitJournalIvfcStorage(integrityCheckLevel);

            IStorage fatStorage = MetaRemapStorage.Slice(layout.FatOffset, layout.FatSize);

            if (Header.Layout.Version >= 0x50000)
            {
                FatIvfcStorage = InitFatIvfcStorage(integrityCheckLevel);
                fatStorage     = FatIvfcStorage;
            }

            SaveDataFileSystemCore = new SaveDataFileSystemCore(CoreDataIvfcStorage, fatStorage, Header.SaveHeader);
        }