diff --git a/cce.ico b/cce.ico new file mode 100644 index 0000000..ef2c93e Binary files /dev/null and b/cce.ico differ diff --git a/cce/App.cs b/cce/App.cs new file mode 100644 index 0000000..e041c48 --- /dev/null +++ b/cce/App.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using System.IO; +using System.Windows.Forms; +using static System.Console; +using static System.Threading.Thread; + +namespace cce { + internal class App { + + static internal void Settings() { + // Finish Settings screen, make it interactable + + + } + } + internal class Path { + static internal string Common = "common.json"; + static internal string Extended = "extended.json"; + static internal string Settings = "settings.json"; + } + internal class AppSettings { + static internal byte Check() { + if (!File.Exists(Path.Settings)) { File.WriteAllText(Path.Settings, JsonConvert.SerializeObject(AppSettings.ToDict())); return 1; } + else { return 0; } + } + static internal Dictionary ToDict () { + //Add properties and finish this method + return new Dictionary (); + } + static internal void Update() { + var settings = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Settings)); + } + } +} diff --git a/cce/Program.cs b/cce/Program.cs index 7b3e87a..980d301 100644 --- a/cce/Program.cs +++ b/cce/Program.cs @@ -12,7 +12,7 @@ using static System.Threading.Thread; namespace cce { class Program { static internal string title = "Corpus Cypher Executable (CCE)"; - [STAThreadAttribute] + [STAThread] static void Main(string[] args) { byte choice = 255; while (true) { @@ -58,7 +58,9 @@ namespace cce { +"\n-------------------------" +"\n[5] Teach new words" +"\n-------------------------" ++"\n[8] Settings" +"\n[9] DEV: Update JSON files using sorted files from python" ++"\n[?] Help" +"\n[0] Exit" +"\n>>> "); /*Write(@"Options? @@ -78,6 +80,7 @@ namespace cce { case '2': case '5': case '9': + case '8': case '0': case '?': case '/': @@ -119,7 +122,7 @@ namespace cce { CursorLeft = WindowWidth - crypto[i].Length - 2; foreach (char c in crypto[i]) { Write(c); - if (c != ' ') Sleep(1); + if (Utils.rng.NextDouble()>0.8 && c != ' ') Sleep(1); } } SetCursorPosition(pos.CursorLeft, pos.CursorTop); diff --git a/cce/Transcoder.cs b/cce/Transcoder.cs index 9c0b402..47a9606 100644 --- a/cce/Transcoder.cs +++ b/cce/Transcoder.cs @@ -58,10 +58,6 @@ namespace cce { {'b',"z" } }; - static private Dictionary path = new Dictionary{ - {"common","common_dict.json" }, - {"extended","extended_dict.json"} - }; static internal void Teacher() { var pos = CursorTop; Write("Please enter the encrypted word: "); @@ -213,8 +209,8 @@ namespace cce { } static private void update() { uniquire(); - File.WriteAllText(path["extended"], JsonConvert.SerializeObject(extended_dict)); - File.WriteAllText(path["common"], JsonConvert.SerializeObject(common_dict)); + File.WriteAllText(App.path["extended"], JsonConvert.SerializeObject(extended_dict)); + File.WriteAllText(App.path["common"], JsonConvert.SerializeObject(common_dict)); } static private string raw_encode(string entry) { var sentence = entry.ToLower(); @@ -231,9 +227,9 @@ namespace cce { static private void init() { if (common_dict != null && extended_dict != null) return; WriteLine("[Loading Dictionary]"); - if (File.Exists(path["extended"])) extended_dict = JsonConvert.DeserializeObject>(File.ReadAllText(path["extended"])); + if (File.Exists(App.path["extended"])) extended_dict = JsonConvert.DeserializeObject>(File.ReadAllText(App.path["extended"])); else WriteLine("File missing"); - if (File.Exists(path["common"])) common_dict = JsonConvert.DeserializeObject>(File.ReadAllText(path["common"])); + if (File.Exists(App.path["common"])) common_dict = JsonConvert.DeserializeObject>(File.ReadAllText(App.path["common"])); else WriteLine("File missing"); } static private void uniquire() { diff --git a/cce/Utils.cs b/cce/Utils.cs index 698fd15..06869e4 100644 --- a/cce/Utils.cs +++ b/cce/Utils.cs @@ -11,7 +11,7 @@ using static System.Threading.Thread; namespace cce { class Utils { - static private Random rng = new Random(); + static internal Random rng = new Random(); static internal void VarSleep(int adj, int low = 0, int high = 300, int step = 10, decimal chance = 0.25m) { var del = rng.Next(Math.Abs(adj)); diff --git a/cce/cce.csproj b/cce/cce.csproj index 356b8a4..f090c39 100644 --- a/cce/cce.csproj +++ b/cce/cce.csproj @@ -6,8 +6,8 @@ AnyCPU {F8D0AB76-7AC7-4F50-8556-58A2C2255D40} Exe - corpus_decoder - corpus decoder + cce + corpus-cypher v4.7.2 512 true @@ -32,6 +32,9 @@ prompt 4 + + cce.ico + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll @@ -47,6 +50,7 @@ + @@ -56,5 +60,8 @@ + + + \ No newline at end of file diff --git a/cce/cce.ico b/cce/cce.ico new file mode 100644 index 0000000..ef2c93e Binary files /dev/null and b/cce/cce.ico differ