private static bool ReloadFileSystem(string pw, PrivatePublicKeyHelper ppk) { Console.WriteLine("Reading FAT and loading files"); var ok = _sfsManager.ReadFileSystem(); if (ok) { ppk.PrivateKey = _sfsManager.LoadFileContent("PrivateKey").GetBufferAsUnicodeString(); ppk.PublicKey = _sfsManager.LoadFileContent("PublicKey").GetBufferAsUnicodeString(); } return(true); }
static void ShowFile(int fileIndex) { var fi = _sfsManager.FileInfos[fileIndex]; Console.Clear(); ConsoleEx.TitleBar(0, "Loading:" + fi.FileName, ConsoleColor.Yellow, ConsoleColor.DarkBlue); fi = _sfsManager.LoadFileContent(fi); Console.Clear(); ConsoleEx.TitleBar(0, "Viewing:" + fi.FileName, ConsoleColor.Yellow, ConsoleColor.DarkBlue); ConsoleEx.Gotoxy(0, 1); if (fi.IsImage) { int exitCode = -1; var rr = ExecuteProgram.ExecProgram("mspaint.exe", string.Format(@"""{0}""", fi.GetAsLocalTempFile()), true, ref exitCode, true, false); if (rr && exitCode == 0) { } else { ConsoleEx.WriteLine(0, 3, "Cannot open the file", ConsoleColor.Red); Pause(); } } else { var text = fi.GetBufferAsUnicodeString(); Console.WriteLine(text); Pause(); } _sfsManager.Clean(); }
private byte[] LoadFileInMemory(string f) { if (IsFileFromWindowsFileSystem(f)) { return(File.ReadAllBytes(f)); } else { var fi = _sFsManager[f]; if (fi == null) { return(null); } else { _sFsManager.LoadFileContent(fi); return(fi.Buffer); } } }