private void RestoreInput() { ArchExec ae = arch == EArch.x64 ? exec64 : exec86; tboxPath.Text = ae.Path; tboxCmd.Text = ae.Args; }
private void StoreInput() { ArchExec ae = arch == EArch.x64 ? exec64 : exec86; ae.Path = tboxPath.Text; ae.Args = tboxCmd.Text; }
public SetupForm() { InitializeComponent(); exec86 = new ArchExec { Arch = EArch.x86, Path = string.Empty, Args = string.Empty }; exec64 = new ArchExec { Arch = EArch.x64, Path = string.Empty, Args = string.Empty }; SetArch(EArch.x64); UpdateReady(); }
private bool Launch(string password) { byte[] inBytes = Crypto.Decrypt(this.bytes, password); if (inBytes == null) // Invalid password { return(false); } List <ArchExec> execs = new List <ArchExec>(); byte[] lbytes, bytes; int size, length; ArchExec launch = null; using (MemoryStream ms = new MemoryStream(inBytes)) { lbytes = ms.ReadAllCount(4); size = BitConverter.ToInt32(lbytes, 0); if (size > 2) { size = 0; } for (int i = 0; i < size; i++) { lbytes = ms.ReadAllCount(4); length = BitConverter.ToInt32(lbytes, 0); bytes = ms.ReadAllCount(length); ArchExec exec = new ArchExec(bytes); execs.Add(exec); } EArch arch = Environment.Is64BitOperatingSystem ? EArch.x64 : EArch.x86; launch = execs.Where(p => p.Arch == arch).FirstOrDefault(); } if (launch != null) { ProcessStartInfo psi = new ProcessStartInfo(launch.Path, launch.Args); psi.UseShellExecute = true; Process.Start(psi); return(true); } else { MessageBox.Show("Password correct, but data is corrupted!"); return(true); } }
private bool ReadyToEncryptArch(ArchExec ae) => !string.IsNullOrWhiteSpace(ae.Path);