private void Decrypt_Click(object sender, RoutedEventArgs e) { foreach (string item in File2.GetDirectories(root: "", path, rootDir + Global.DownloadFolder)) { if (File.Exists($"{path}/info.json")) { JObject j = JObject.Parse(File.ReadAllText($"{path}/info.json")); j["encrypted"] = false; File.WriteAllText($"{path}/info.json", j.ToString()); } string[] files = Directory.GetFiles(item); foreach (string file in files) { try { byte[] org = File.ReadAllBytes(file); byte[] enc = FileDecrypt.Default(org); File.Delete(file); File.WriteAllBytes(Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file)), enc); } catch { } } } MessageBox.Show("전체 복호화 완료"); }
private void Encrypt_Click(object sender, RoutedEventArgs e) { foreach (string item in File2.GetDirectories(root: "", path, rootDir + Global.DownloadFolder)) { if (File.Exists($"{item}/info.json")) { JObject j = JObject.Parse(File.ReadAllText($"{item}/info.json")); j["encrypted"] = true; File.WriteAllText($"{item}/info.json", j.ToString()); } string[] files = Directory.GetFiles(item); foreach (string file in files) { if (Path.GetFileName(file) == "info.json") { continue; } if (Path.GetFileName(file) == "info.txt") { continue; } if (Path.GetExtension(file) == ".lock") { continue; } byte[] org = File.ReadAllBytes(file); byte[] enc = FileEncrypt.Default(org); File.Delete(file); File.WriteAllBytes(file + ".lock", enc); } } MessageBox.Show("전체 암호화 완료"); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { LabelSetup(); this.Background = new SolidColorBrush(Global.background); MainPanel.Children.Clear(); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } int pages = Directory.GetDirectories(path).Length / 25 + 1; for (int i = 0; i < pages; i++) { Page_Index.Items.Add(i + 1); } Page_Index.SelectedIndex = 0; Page_ItemCount.SelectedIndex = 3; SearchMode2.SelectedIndex = 0; DelayRegistEvents(); if (Global.DownloadFolder != "hitomi_downloaded") { new TaskFactory().StartNew(() => LoadHitomi(File2.GetDirectories(root: "", path, rootDir + Global.DownloadFolder))); } else { new TaskFactory().StartNew(() => LoadHitomi(path)); } }
private void LoadBtn_Click(object sender, RoutedEventArgs e) { if (Global.DownloadFolder != "hitomi_downloaded") { new TaskFactory().StartNew(() => LoadHitomi(File2.GetDirectories(root: "", path, rootDir + Global.DownloadFolder))); } else { new TaskFactory().StartNew(() => LoadHitomi(path)); } }