-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7cd9ecd
commit a431df6
Showing
2 changed files
with
38 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
...ool/UniversalAssetTool/src/games/professor_layton_vs_phoenix_wright/XcArchiveExtractor.cs
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,30 @@ | ||
using fin.data.dictionaries; | ||
using fin.io; | ||
|
||
using level5.schema; | ||
|
||
using schema.binary; | ||
|
||
|
||
namespace uni.games.professor_layton_vs_phoenix_wright; | ||
|
||
internal class XcArchiveExtractor { | ||
public void ExtractIntoDirectory(IReadOnlyTreeFile xcFile, | ||
ISystemDirectory dstDirectory) { | ||
dstDirectory = new FinDirectory( | ||
Path.Join(dstDirectory.FullPath, xcFile.NameWithoutExtension)); | ||
if (dstDirectory is {Exists: true, IsEmpty: false}) { | ||
return; | ||
} | ||
|
||
dstDirectory.Create(); | ||
|
||
var xc = xcFile.ReadNew<Xc>(Endianness.LittleEndian); | ||
foreach (var (extension, files) in xc.FilesByExtension.GetPairs()) { | ||
foreach (var file in files) { | ||
var dstFile = new FinFile(Path.Join(dstDirectory.FullPath, file.Name)); | ||
dstFile.WriteAllBytes(file.Data); | ||
} | ||
} | ||
} | ||
} |