diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-10-14 17:27:30 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-10-14 17:27:30 +0300 |
commit | 218cf8f81301db41d32c044128553adaf6fa8ef0 (patch) | |
tree | 221cbf99315d6ac9de8f91fc3423801f4a11fff1 /WorkerForm.cs | |
parent | 9c2ef235f166989d96903d196dfe30fe47461f52 (diff) |
NAND-C partition write feature
Diffstat (limited to 'WorkerForm.cs')
-rw-r--r-- | WorkerForm.cs | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/WorkerForm.cs b/WorkerForm.cs index 06311acf..ef8038cc 100644 --- a/WorkerForm.cs +++ b/WorkerForm.cs @@ -19,7 +19,7 @@ namespace com.clusterrr.hakchi_gui {
public partial class WorkerForm : Form
{
- public enum Tasks { DumpKernel, FlashKernel, DumpNand, FlashNand, DumpNandB, DumpNandC, Memboot, UploadGames, DownloadCovers, AddGames, CompressGames, DecompressGames, DeleteGames };
+ public enum Tasks { DumpKernel, FlashKernel, DumpNand, FlashNand, DumpNandB, DumpNandC, FlashNandC, Memboot, UploadGames, DownloadCovers, AddGames, CompressGames, DecompressGames, DeleteGames };
public Tasks Task;
//public string UBootDump;
public static string KernelDumpPath
@@ -288,6 +288,7 @@ namespace com.clusterrr.hakchi_gui break;
case Tasks.DumpNandB:
case Tasks.DumpNandC:
+ case Tasks.FlashNandC:
DoPartitionDump(Task);
break;
case Tasks.UploadGames:
@@ -718,30 +719,48 @@ namespace com.clusterrr.hakchi_gui partitionSize = int.Parse(clovershell.ExecuteSimple("df /dev/mapper/root-crypt | tail -n 1 | awk '{ print $2 }'"));
break;
case Tasks.DumpNandC:
+ case Tasks.FlashNandC:
partitionSize = int.Parse(clovershell.ExecuteSimple("df /dev/nandc | tail -n 1 | awk '{ print $2 }'"));
break;
}
maxProgress = 5 + (int)Math.Ceiling(partitionSize / 1024.0 * 1.05);
SetProgress(progress, maxProgress);
- SetStatus(Resources.DumpingNand);
- using (var file = new TrackableFileStream(NandDump, FileMode.Create))
+ if (task != Tasks.FlashNandC)
{
- file.OnProgress += delegate (long Position, long Length)
+ SetStatus(Resources.DumpingNand);
+ using (var file = new TrackableFileStream(NandDump, FileMode.Create))
{
- progress = (int)(5 + Position / 1024 / 1024);
- SetProgress(progress, maxProgress);
- };
- switch (task)
+ file.OnProgress += delegate (long Position, long Length)
+ {
+ progress = (int)(5 + Position / 1024 / 1024);
+ SetProgress(progress, maxProgress);
+ };
+ switch (task)
+ {
+ case Tasks.DumpNandB:
+ clovershell.Execute("dd if=/dev/mapper/root-crypt", null, file);
+ break;
+ case Tasks.DumpNandC:
+ clovershell.Execute("dd if=/dev/nandc", null, file);
+ break;
+ }
+ file.Close();
+ }
+ }
+ else
+ {
+ SetStatus(Resources.FlashingNand);
+ using (var file = new TrackableFileStream(NandDump, FileMode.Open))
{
- case Tasks.DumpNandB:
- clovershell.Execute("dd if=/dev/mapper/root-crypt", null, file);
- break;
- case Tasks.DumpNandC:
- clovershell.Execute("dd if=/dev/nandc", null, file);
- break;
+ file.OnProgress += delegate (long Position, long Length)
+ {
+ progress = (int)(5 + Position / 1024 / 1024);
+ SetProgress(progress, maxProgress);
+ };
+ clovershell.Execute("dd of=/dev/nandc", file);
+ file.Close();
}
- file.Close();
}
SetStatus(Resources.Done);
|