Helio left nut

This commit is contained in:
Heli-o 2022-04-18 16:53:21 +02:00
parent d4c829fcc3
commit 3a4d617933
7 changed files with 58 additions and 13 deletions

BIN
cce.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

39
cce/App.cs Normal file
View file

@ -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<string, byte> ToDict () {
//Add properties and finish this method
return new Dictionary<string, byte> ();
}
static internal void Update() {
var settings = JsonConvert.DeserializeObject<Dictionary<string, byte>>(File.ReadAllText(Path.Settings));
}
}
}

View file

@ -12,7 +12,7 @@ using static System.Threading.Thread;
namespace cce { namespace cce {
class Program { class Program {
static internal string title = "Corpus Cypher Executable (CCE)"; static internal string title = "Corpus Cypher Executable (CCE)";
[STAThreadAttribute] [STAThread]
static void Main(string[] args) { static void Main(string[] args) {
byte choice = 255; byte choice = 255;
while (true) { while (true) {
@ -58,7 +58,9 @@ namespace cce {
+"\n-------------------------" +"\n-------------------------"
+"\n[5] Teach new words" +"\n[5] Teach new words"
+"\n-------------------------" +"\n-------------------------"
+"\n[8] Settings"
+"\n[9] DEV: Update JSON files using sorted files from python" +"\n[9] DEV: Update JSON files using sorted files from python"
+"\n[?] Help"
+"\n[0] Exit" +"\n[0] Exit"
+"\n>>> "); +"\n>>> ");
/*Write(@"Options? /*Write(@"Options?
@ -78,6 +80,7 @@ namespace cce {
case '2': case '2':
case '5': case '5':
case '9': case '9':
case '8':
case '0': case '0':
case '?': case '?':
case '/': case '/':
@ -119,7 +122,7 @@ namespace cce {
CursorLeft = WindowWidth - crypto[i].Length - 2; CursorLeft = WindowWidth - crypto[i].Length - 2;
foreach (char c in crypto[i]) { foreach (char c in crypto[i]) {
Write(c); Write(c);
if (c != ' ') Sleep(1); if (Utils.rng.NextDouble()>0.8 && c != ' ') Sleep(1);
} }
} }
SetCursorPosition(pos.CursorLeft, pos.CursorTop); SetCursorPosition(pos.CursorLeft, pos.CursorTop);

View file

@ -58,10 +58,6 @@ namespace cce {
{'b',"z" } {'b',"z" }
}; };
static private Dictionary<string, string> path = new Dictionary<string, string>{
{"common","common_dict.json" },
{"extended","extended_dict.json"}
};
static internal void Teacher() { static internal void Teacher() {
var pos = CursorTop; var pos = CursorTop;
Write("Please enter the encrypted word: "); Write("Please enter the encrypted word: ");
@ -213,8 +209,8 @@ namespace cce {
} }
static private void update() { static private void update() {
uniquire(); uniquire();
File.WriteAllText(path["extended"], JsonConvert.SerializeObject(extended_dict)); File.WriteAllText(App.path["extended"], JsonConvert.SerializeObject(extended_dict));
File.WriteAllText(path["common"], JsonConvert.SerializeObject(common_dict)); File.WriteAllText(App.path["common"], JsonConvert.SerializeObject(common_dict));
} }
static private string raw_encode(string entry) { static private string raw_encode(string entry) {
var sentence = entry.ToLower(); var sentence = entry.ToLower();
@ -231,9 +227,9 @@ namespace cce {
static private void init() { static private void init() {
if (common_dict != null && extended_dict != null) return; if (common_dict != null && extended_dict != null) return;
WriteLine("[Loading Dictionary]"); WriteLine("[Loading Dictionary]");
if (File.Exists(path["extended"])) extended_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(path["extended"])); if (File.Exists(App.path["extended"])) extended_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(App.path["extended"]));
else WriteLine("File missing"); else WriteLine("File missing");
if (File.Exists(path["common"])) common_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(path["common"])); if (File.Exists(App.path["common"])) common_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(App.path["common"]));
else WriteLine("File missing"); else WriteLine("File missing");
} }
static private void uniquire() { static private void uniquire() {

View file

@ -11,7 +11,7 @@ using static System.Threading.Thread;
namespace cce { namespace cce {
class Utils { 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, static internal void VarSleep(int adj, int low = 0, int high = 300, int step = 10,
decimal chance = 0.25m) { decimal chance = 0.25m) {
var del = rng.Next(Math.Abs(adj)); var del = rng.Next(Math.Abs(adj));

View file

@ -6,8 +6,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F8D0AB76-7AC7-4F50-8556-58A2C2255D40}</ProjectGuid> <ProjectGuid>{F8D0AB76-7AC7-4F50-8556-58A2C2255D40}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>corpus_decoder</RootNamespace> <RootNamespace>cce</RootNamespace>
<AssemblyName>corpus decoder</AssemblyName> <AssemblyName>corpus-cypher</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@ -32,6 +32,9 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>cce.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -47,6 +50,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App.cs" />
<Compile Include="Transcoder.cs" /> <Compile Include="Transcoder.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@ -56,5 +60,8 @@
<None Include="App.config" /> <None Include="App.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="cce.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

BIN
cce/cce.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB