Beispiel #1
0
        public Result CreateSaveDataMetaFile(ulong saveDataId, SaveDataSpaceId spaceId, SaveDataMetaType type, long size)
        {
            string metaDirPath = $"/saveMeta/{saveDataId:x16}";

            Result rc = OpenSaveDataDirectoryImpl(out IFileSystem tmpMetaDirFs, spaceId, metaDirPath, true);

            using IFileSystem metaDirFs = tmpMetaDirFs;
            if (rc.IsFailure())
            {
                return(rc);
            }

            string metaFilePath = $"/{(int)type:x8}.meta";

            if (size < 0)
            {
                return(ResultFs.OutOfRange.Log());
            }

            return(metaDirFs.CreateFile(metaFilePath.ToU8Span(), size, CreateFileOptions.None));
        }
Beispiel #2
0
        public Result OpenSaveDataMetaFile(out IFile file, ulong saveDataId, SaveDataSpaceId spaceId, SaveDataMetaType type)
        {
            file = default;

            string metaDirPath = $"/saveMeta/{saveDataId:x16}";

            Result rc = OpenSaveDataDirectoryImpl(out IFileSystem tmpMetaDirFs, spaceId, metaDirPath, true);

            using IFileSystem metaDirFs = tmpMetaDirFs;
            if (rc.IsFailure())
            {
                return(rc);
            }

            string metaFilePath = $"/{(int)type:x8}.meta";

            return(metaDirFs.OpenFile(out file, metaFilePath.ToU8Span(), OpenMode.ReadWrite));
        }