-
Notifications
You must be signed in to change notification settings - Fork 1
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
8c8402c
commit 46a2921
Showing
5 changed files
with
70 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace NyaFs.ImageFormat.Elements.Dtb.Reader | ||
{ | ||
class ArchiveReader : Reader | ||
{ | ||
byte[] Data = null; | ||
Types.CompressionType Compression; | ||
|
||
public ArchiveReader(string Filename, Types.CompressionType Compression) | ||
{ | ||
Data = System.IO.File.ReadAllBytes(Filename); | ||
this.Compression = Compression; | ||
} | ||
|
||
public ArchiveReader(byte[] Data) | ||
{ | ||
this.Data = Data; | ||
} | ||
|
||
public override void ReadToDevTree(DeviceTree Dst) | ||
{ | ||
byte[] Raw = Helper.FitHelper.GetDecompressedData(Data, Compression); | ||
|
||
var Dtb = new FlattenedDeviceTree.Reader.FDTReader(Raw); | ||
if (Dtb.Correct) | ||
{ | ||
var Reader = new DtbReader(Raw); | ||
Reader.ReadToDevTree(Dst); | ||
} | ||
else | ||
Log.Error(0, $"Unknown device tree format in compressed image."); | ||
} | ||
} | ||
} |
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