Example #1
0
        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();
        }
Example #2
0
        private static void ExportKey(string keyXml, string keyName)
        {
            Console.Clear();
            ConsoleEx.TitleBar(0, "Export Key:" + keyName, ConsoleColor.Yellow, ConsoleColor.DarkBlue);

            ConsoleEx.TitleBar(0, "Export " + keyName, ConsoleColor.Yellow, ConsoleColor.DarkBlue);
            var tmpFile = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), keyName + ".txt");

            File.WriteAllText(tmpFile, keyXml);
            int exitCode = -1;
            var rr       = ExecuteProgram.ExecProgram("notepad.exe", string.Format(@"""{0}""", tmpFile), true, ref exitCode, true, false);

            BinSerializer.OverwriteFile(tmpFile);
            File.Delete(tmpFile);

            ConsoleEx.WriteLine(0, 2, string.Format("The {0} file, has been overwritten & deleted from the disk", keyName), ConsoleColor.Cyan);
            Pause();
        }