public override void ApplyChunk(ZiPatchConfig config)
        {
            TargetFile.ResolvePath(config.Platform);

            var file = config.Store == null?
                       TargetFile.OpenStream(config.GamePath, FileMode.OpenOrCreate) :
                           TargetFile.OpenStream(config.Store, config.GamePath, FileMode.OpenOrCreate);

            SqpackDatFile.WriteEmptyFileBlockAt(file, BlockOffset, BlockNumber);
        }
Пример #2
0
        public override void ApplyChunk(ZiPatchConfig config)
        {
            TargetFile.ResolvePath(config.Platform);

            var file = config.Store == null?
                       TargetFile.OpenStream(config.GamePath, FileMode.OpenOrCreate) :
                           TargetFile.OpenStream(config.Store, config.GamePath, FileMode.OpenOrCreate);

            file.WriteFromOffset(HeaderData, HeaderKind == TargetHeaderKind.Version ? 0 : HEADER_SIZE);
        }
Пример #3
0
        public override void ApplyChunk(ZiPatchConfig config)
        {
            TargetFile.ResolvePath(config.Platform);

            var file = config.Store == null?
                       TargetFile.OpenStream(config.GamePath, FileMode.OpenOrCreate) :
                           TargetFile.OpenStream(config.Store, config.GamePath, FileMode.OpenOrCreate);

            file.WriteFromOffset(BlockData, BlockOffset);
            file.Wipe(BlockDeleteNumber);
        }
Пример #4
0
        public override void ApplyChunk(ZiPatchConfig config)
        {
            switch (Operation)
            {
            // Default behaviour falls through to AddFile, though this shouldn't happen
            case OperationKind.AddFile:
            default:
                // TODO: Check this. I *think* boot usually creates all the folders like sqpack, movie, etc., so this might be kind of a hack
                TargetFile.CreateDirectoryTree(config.GamePath);

                var fileStream = config.Store == null?
                                 TargetFile.OpenStream(config.GamePath, FileMode.OpenOrCreate) :
                                     TargetFile.OpenStream(config.Store, config.GamePath, FileMode.OpenOrCreate);

                if (FileOffset == 0)
                {
                    fileStream.SetLength(0);
                }

                fileStream.Seek(FileOffset, SeekOrigin.Begin);
                foreach (var block in CompressedData)
                {
                    block.DecompressInto(fileStream);
                }

                break;

            case OperationKind.RemoveAll:
                foreach (var file in SqexFile.GetAllExpansionFiles(config.GamePath, ExpansionId).Where(RemoveAllFilter))
                {
                    File.Delete(file);
                }
                break;

            case OperationKind.DeleteFile:
                File.Delete(config.GamePath + "/" + TargetFile.RelativePath);
                break;

            case OperationKind.MakeDirTree:
                Directory.CreateDirectory(config.GamePath + "/" + TargetFile.RelativePath);
                break;
            }
        }