private void Main_Load(object sender, EventArgs e) { KS = KeySize.Aes256; CheckFolder(); Update.Start(); }
private void CheckCommand(string Command) { DirectoryInfo DI = new DirectoryInfo(FilePath); if (Command.Contains("-HideFolder()")) { if (!DI.Attributes.HasFlag(FileAttributes.Hidden)) { DI.Attributes = FileAttributes.Directory | FileAttributes.Hidden; WriteToConsole("XLOCKFiles set to hidden"); } else { DI.Attributes = FileAttributes.Directory | FileAttributes.Normal; WriteToConsole("XLOCKFiles set to normal"); } } else if (Command.Contains("-ViewFile") && Command.Contains("(") && Command.Contains(")")) { foreach (var item in lbFiles.Items) { string Item = item.ToString(); if (txtShell.Text.Contains(Item)) { Process.Start(FilePath + Item); WriteToConsole("Opened " + Path.GetFileName(Item)); txtShell.Text = ""; } } } else if (Command.Contains("-GetMD5") && Command.Contains("(") && Command.Contains(")")) { foreach (var item in lbFiles.Items) { string Item = item.ToString(); if (txtShell.Text.Contains(Item)) { using (var MD5Calc = MD5.Create()) { using (var Stream = File.OpenRead(FilePath + Item)) { WriteToConsole("MD5 Checksum: " + BitConverter.ToString(MD5Calc.ComputeHash(Stream)).Replace("-", "").ToLowerInvariant()); txtShell.Text = ""; Stream.Close(); } MD5Calc.Clear(); } } } } else if (Command.Contains("-DeleteFile") && Command.Contains("(") && Command.Contains(")")) { foreach (var item in lbFiles.Items) { string Item = item.ToString(); if (txtShell.Text.Contains(Item)) { File.Delete(FilePath + Item); WriteToConsole("Deleted " + Item); txtShell.Text = ""; } } } else if (Command.Contains("-SetKeySize")) { if (Command.Contains("(256)")) { KS = KeySize.Aes256; WriteToConsole("KeySize set to 256 bits"); txtShell.Text = ""; return; } if (Command.Contains("(192)")) { KS = KeySize.Aes192; WriteToConsole("KeySize set to 192 bits"); txtShell.Text = ""; return; } if (Command.Contains("(128)")) { KS = KeySize.Aes128; WriteToConsole("KeySize set to 128 bits"); txtShell.Text = ""; return; } else { MessageBox.Show("Key size must be 256, 192, or 128!", "Error"); return; } } else if (Command.Equals("-ClearConsole()")) { txtConsole.Clear(); txtShell.Text = ""; } else if (Command.Equals("-DeleteAllFiles()")) { DirectoryInfo Files = new DirectoryInfo(FilePath); foreach (var file in Files.GetFiles()) { WriteToConsole("Deleted " + Path.GetFileName(file.FullName).ToString()); File.Delete(file.FullName); } txtShell.Text = ""; } else if (Command.Equals("-RickRoll()")) { WriteToConsole("Never Gonna Give You Up"); Process.Start("https://www.youtube.com/watch?v=dQw4w9WgXcQ"); txtShell.Text = ""; } else { MessageBox.Show("Invalid Command", "Error"); return; } }