-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: CSO/ZSO/DAX support (#1253)
- Loading branch information
Showing
30 changed files
with
294 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Archive from '../archive.js'; | ||
import Maxcso from './maxcso.js'; | ||
|
||
export default class Cso extends Maxcso { | ||
// eslint-disable-next-line class-methods-use-this | ||
protected new(filePath: string): Archive { | ||
return new Cso(filePath); | ||
} | ||
|
||
static getExtensions(): string[] { | ||
return ['.cso']; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getExtension(): string { | ||
return Cso.getExtensions()[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Archive from '../archive.js'; | ||
import Maxcso from './maxcso.js'; | ||
|
||
export default class Dax extends Maxcso { | ||
// eslint-disable-next-line class-methods-use-this | ||
protected new(filePath: string): Archive { | ||
return new Dax(filePath); | ||
} | ||
|
||
static getExtensions(): string[] { | ||
return ['.dax']; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getExtension(): string { | ||
return Dax.getExtensions()[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import path from 'node:path'; | ||
|
||
import maxcso from 'maxcso'; | ||
|
||
import Archive from '../archive.js'; | ||
import ArchiveEntry from '../archiveEntry.js'; | ||
|
||
export default abstract class Maxcso extends Archive { | ||
async getArchiveEntries(checksumBitmask: number): Promise<ArchiveEntry<Archive>[]> { | ||
const entryPath = `${path.parse(this.getFilePath()).name}.iso`; | ||
const size = (await maxcso.header(this.getFilePath())).uncompressedSize; | ||
const crc32 = await maxcso.uncompressedCrc32(this.getFilePath()); | ||
|
||
return [await ArchiveEntry.entryOf({ | ||
archive: this, | ||
entryPath, | ||
size: Number(size), | ||
crc32, | ||
}, checksumBitmask)]; | ||
} | ||
|
||
async extractEntryToFile(entryPath: string, extractedFilePath: string): Promise<void> { | ||
return maxcso.decompress({ | ||
inputFilename: this.getFilePath(), | ||
outputFilename: extractedFilePath, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Archive from '../archive.js'; | ||
import Maxcso from './maxcso.js'; | ||
|
||
export default class Zso extends Maxcso { | ||
// eslint-disable-next-line class-methods-use-this | ||
protected new(filePath: string): Archive { | ||
return new Zso(filePath); | ||
} | ||
|
||
static getExtensions(): string[] { | ||
return ['.zso']; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getExtension(): string { | ||
return Zso.getExtensions()[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.