commit 90b57d887e4e5b8b57e6528980164a4b5995e2bf
parent abe5232624957ee72a0034d916f9935f307230f7
Author: Minerva-Juppiter <ryouturn@gmail.com>
Date: Mon, 29 Aug 2022 23:22:57 +0900
Diffstat:
3 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/Encrypt.cs b/Encrypt.cs
@@ -58,7 +58,10 @@ namespace Cypher
}
catch (Exception e)
{
- Console.WriteLine(e.Message + "was occurd");
+ Console.WriteLine(e + "was happend.");
+ Console.WriteLine("try again.");
+ Task.Delay(10000);
+ Environment.Exit(0);
}
@@ -155,8 +158,19 @@ namespace Cypher
Directory.CreateDirectory(whereEncryptedFile);
//ハッシュ値を別ファイルに保存する
- File.WriteAllBytes(whereEncryptedFile + @"\" + "Date", hashdate);
- File.WriteAllBytes(whereEncryptedFile + @"\" + "Number", hashLength);
+ try
+ {
+ File.WriteAllBytes(whereEncryptedFile + @"\" + "Date", hashdate);
+ File.WriteAllBytes(whereEncryptedFile + @"\" + "Number", hashLength);
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e + "was happend.");
+ Console.WriteLine("try again.");
+ Task.Delay(10000);
+ Environment.Exit(0);
+ }
+
//書きこ
File.WriteAllBytes(whereEncryptedFile + @"\" + "Encrypted", encrypted);
diff --git a/README.md b/README.md
@@ -24,6 +24,8 @@ We hope it will be one of the Post-Quantum Cryptography.
→You have to answer the folder fullPath with encrypted file's extension.
ex.If you encrypted C:\Users\minerva\Document\data.txt, you have to type "anywhere you want + filename you want + .txt"
+・tipe "end" to end this program.
+
*****warning*****
You have to answer 'fullPath' apart from encrypted file's folderName.
diff --git a/SortProgram.cs b/SortProgram.cs
@@ -92,7 +92,10 @@ namespace Cypher
}
catch (Exception e)
{
- Console.WriteLine(e.Message + "was occurd");
+ Console.WriteLine(e + "was happend.");
+ Console.WriteLine("try again.");
+ Task.Delay(10000);
+ Environment.Exit(0);
}
@@ -100,13 +103,22 @@ namespace Cypher
inNumber = 0;
FileStream fs = new FileStream(whereEncrypted + @"\" + "Encrypted", FileMode.Open);
byte[] encrypted = new byte[fs.Length];
- fs.Read(encrypted, 0, encrypted.Length);
- fs.Close();
+ try
+ {
+ fs.Read(encrypted, 0, encrypted.Length);
+ fs.Close();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(e + "was happend.");
+ Console.WriteLine("try again.");
+ Task.Delay(10000);
+ Environment.Exit(0);
+ }
Console.WriteLine("Encrypted date was readed");
-
//sort
inNumber = 0;
int arreyNumber = 0;