static void Main(string[] args) { Console.Title = "Get Lumia BSP Command Line Interface"; CLIOptions baseOptions = new CLIOptions(); if (!Parser.Default.ParseArguments(args, baseOptions, (s, o) => { OptionVerb = s; Options = o; })) { Environment.Exit(Parser.DefaultExitCodeFail); } Assembly ass = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(ass.Location); Console.WriteLine(""); Console.WriteLine(fvi.FileDescription + " " + ass.GetName().Version.ToString()); Console.WriteLine(fvi.LegalCopyright); Console.WriteLine(""); switch (OptionVerb) { case "secwim2wim": { var arg = (secwim2wimOptions)Options; if (File.Exists(arg.path)) { ENOSWPackageDownloader.ConvertSECWIM2WIM(arg.path, arg.output); } break; } case "enoswdl": { var arg = (enoswdlOptions)Options; ENOSWPackageDownloader.DownloadENOSWPackage(arg.rmcode, arg.path + "\\"); break; } case "unbsp": { var arg = (unbspOptions)Options; UnBSP(arg.path); break; } case "reg_enosw": { var arg = (RegOptions)Options; RegWIM(arg.path, !arg.patcherno, !arg.dxcareno, !arg.wlancareno, !arg.mbbcareno, !arg.uartcareno, !arg.rtcareno, arg.signingcert, !arg.mergeno); break; } case "reg_mountedfs": { var arg = (RegOptions)Options; RegMounted(arg.path, !arg.patcherno, !arg.dxcareno, !arg.wlancareno, !arg.mbbcareno, !arg.uartcareno, !arg.rtcareno, arg.signingcert, !arg.mergeno); break; } case "reg_hybrid": { var arg = (RegOptions2)Options; Console.WriteLine("Comming soon!"); break; } case "inf_enosw": { var arg = (InfOptions)Options; Console.WriteLine("Comming soon!"); break; } case "inf_mountedfs": { var arg = (InfOptions)Options; Console.WriteLine("Comming soon!"); break; } } Console.ReadKey(); }
public static void RegWIM(string file, bool PatchCare, bool DXCareRT, bool WlanCareRT, bool MbbCareRT, bool UartCareRT, bool RTCare, string cert, bool merge) { ENOSWPackageDownloader.ConvertSECWIM2WIM(file, file + ".wim"); Console.WriteLine("(preProcessing) Mounting ENOSW..."); Directory.CreateDirectory("mount"); System.Diagnostics.Process.Start("cmd.exe", "/c dism.exe /Mount-Image /ImageFile:" + file + ".wim /Index:1 /Mountdir:mount").WaitForExit(); BSPExtractor.Program.HandlePackages("mount", "out"); Console.WriteLine("(preProcessing) Unmounting ENOSW..."); System.Diagnostics.Process.Start("cmd.exe", "/c dism.exe /Unmount-Image /Mountdir:mount /discard").WaitForExit(); Directory.Delete("mount"); File.Delete(file + ".wim"); Console.WriteLine("(preProcessing) Done."); // // Patches // string regcontent = "Windows Registry Editor Version 5.00\r\n\r\n"; if (PatchCare) { Console.WriteLine("(patcher) Starting enumeration..."); var filesall = Directory.EnumerateFiles(@"out\Files", "*.*", SearchOption.AllDirectories); foreach (var stuff in filesall) { bool patched; var read = RTInstaller.HandleFile.GetProperBytes(stuff, out patched); if (patched) { File.WriteAllBytes(stuff, read); } } Console.WriteLine("(patcher) Adding AnotherSuite patches to Registry..."); regcontent += @"[HKEY_LOCAL_MACHINE\RTSYSTEM\ControlSet001\Control\ProductOptions]"; regcontent += "\r\n"; regcontent += "\"AnotherSuite\"=hex(7):50,00,68,00,6f,00,6e,00,65,00,4e,00,54,00,00,00,00,00"; regcontent += "\r\n\r\n"; } // // DXCare section // if (DXCareRT) { DXCare(); } // // WlanCare section // if (WlanCareRT) { WlanCare(); } // // MbbCare section // if (MbbCareRT) { MbbCare(); } // // UartCare section // if (UartCareRT) { UartCare(); } // // Merging section // if (merge) { var dirsfi = Directory.EnumerateDirectories(@"out\Files"); foreach (var dir in dirsfi) { Console.WriteLine("(processing) Merging " + dir + "..."); CopyDir(dir, "root"); Directory.Delete(dir, true); } Directory.Delete(@"out\Files", true); var regsfi = Directory.EnumerateFiles(@"out\Registry"); foreach (var reg in regsfi) { Console.WriteLine("(processing) Merging " + reg + "..."); var lines = String.Join("\r\n", File.ReadLines(reg).Skip(1).ToArray()) + "\r\n"; regcontent += lines; File.Delete(reg); } Console.WriteLine("(processing) Committing Registry file..."); File.WriteAllText("import.reg", regcontent); Directory.Delete(@"out", true); } Console.WriteLine("(processing) Done."); // Prepackage RT missing drivers (RTCare) // Presign files }