Beispiel #1
0
 private void CreateFiles()
 {
     if (!Directory.Exists(directoryPath))
     {
         Directory.CreateDirectory(directoryPath);
     }
     filename          = directoryPath + "/" + fileName.Text + ".txt";
     encryptedFileName = directoryPath + '/' + fileName.Text + "_Encrypted" + ".txt";
     passwordFileName  = directoryPath + '/' + fileName.Text + "_Password" + ".txt";
     file = new Encrypted(fileContent.Text, filename);
     file.CreateEmptyFiles(filename, encryptedFileName, passwordFileName);
     LoadFilesFromDirectory();
 }
Beispiel #2
0
 private void Save_File_Click(object sender, RoutedEventArgs e)
 {
     if (file == null)
     {
         file = new Encrypted(filename, fileContent.Text);
     }
     //Regex reg = new Regex("//");
     if (filename != null)
     {
         //filename = Regex.Replace(@"\w-");
         file.WriteTextToFiles(filename, fileContent.Text);
     }
     else
     {
         MessageBox.Show("Please, create file first");
         return;
     }
 }
Beispiel #3
0
 private void LoadFilesFromDirectory()
 {
     if (Directory.Exists(directoryPath))
     {
         filesinDirAll = Directory.GetFiles(directoryPath);
         foreach (var file in filesinDirAll)
         {
             if (file.EndsWith("_Encrypted.txt") || file.EndsWith("_Password.txt") || file.EndsWith("_Decrypted.txt"))
             {
                 XFiles.Add(file);
                 continue;
             }
             else
             {
                 files.Add(file);
             }
         }
         file             = new Encrypted();
         this.DataContext = this;
     }
 }