CCE Init
This commit is contained in:
parent
155e3bf24e
commit
d4c829fcc3
25
cce.sln
Normal file
25
cce.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31729.503
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cce", "cce\cce.csproj", "{F8D0AB76-7AC7-4F50-8556-58A2C2255D40}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F8D0AB76-7AC7-4F50-8556-58A2C2255D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F8D0AB76-7AC7-4F50-8556-58A2C2255D40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F8D0AB76-7AC7-4F50-8556-58A2C2255D40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F8D0AB76-7AC7-4F50-8556-58A2C2255D40}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A99DD7F3-A6FD-4246-A7B7-0A9829779930}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
6
cce/App.config
Normal file
6
cce/App.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
144
cce/Program.cs
Normal file
144
cce/Program.cs
Normal file
|
@ -0,0 +1,144 @@
|
|||
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 {
|
||||
class Program {
|
||||
static internal string title = "Corpus Cypher Executable (CCE)";
|
||||
[STAThreadAttribute]
|
||||
static void Main(string[] args) {
|
||||
byte choice = 255;
|
||||
while (true) {
|
||||
SetBufferSize(240, 60);
|
||||
SetWindowSize(120, 30);
|
||||
Clear();
|
||||
CursorVisible = false;
|
||||
Utils.LagWrite("Welcome to the " + title, true);
|
||||
//WriteLine("Welcome to the Corpus cypher executable.");
|
||||
WriteCrypto();
|
||||
if (choice == 255) choice = Chooser();
|
||||
CursorVisible = false;
|
||||
var entry = "";
|
||||
if ((new int[] {1,2}).Contains(choice)) {
|
||||
Utils.LagWrite("Please enter the sentence: ");
|
||||
CursorVisible = true;
|
||||
//Write("Please enter the sentence: ");
|
||||
entry = ReadLine();
|
||||
CursorVisible = false;
|
||||
}
|
||||
|
||||
if (choice == 1) { Transcoder.Encode(entry); Utils.Clip(Transcoder.result); }
|
||||
else if (choice == 2) Transcoder.Decode(entry);
|
||||
else if (choice == 5) Transcoder.Teacher();
|
||||
else if (choice == 9) Transcoder.head_transcribe();
|
||||
else if (choice == 255) Help();
|
||||
else if (choice == 0) { Beep(4000, 200); return; }
|
||||
|
||||
SetCursorPosition(0, WindowHeight - 2);
|
||||
Utils.LagWrite("\nPress enter to continue, press any other key to exit"); CursorVisible = false;
|
||||
var cki = ReadKey();
|
||||
choice = 255;
|
||||
var options = new char[] { '0','1','2','3','4','9'};
|
||||
if (options.Contains(cki.KeyChar)) choice = byte.Parse(cki.KeyChar.ToString());
|
||||
else if (cki.Key != ConsoleKey.Enter) break;
|
||||
}
|
||||
}
|
||||
|
||||
static byte Chooser() {
|
||||
while (true) {
|
||||
Utils.LagWrite("[1] Encode"
|
||||
+"\n[2] Decode"
|
||||
+"\n-------------------------"
|
||||
+"\n[5] Teach new words"
|
||||
+"\n-------------------------"
|
||||
+"\n[9] DEV: Update JSON files using sorted files from python"
|
||||
+"\n[0] Exit"
|
||||
+"\n>>> ");
|
||||
/*Write(@"Options?
|
||||
[1] Encode
|
||||
[2] Decode
|
||||
-------------------------
|
||||
[5] Teach new words
|
||||
-------------------------
|
||||
[9] DEV: Update JSON files using sorted files from python
|
||||
[0] Exit
|
||||
>> ");*/
|
||||
CursorVisible = true;
|
||||
var choice = ReadKey().KeyChar;
|
||||
WriteLine();
|
||||
switch (choice) {
|
||||
case '1':
|
||||
case '2':
|
||||
case '5':
|
||||
case '9':
|
||||
case '0':
|
||||
case '?':
|
||||
case '/':
|
||||
case '-':
|
||||
case ',':
|
||||
if ((new char[] { '?','/','-',','}).Contains(choice)) return 255;
|
||||
return byte.Parse(choice.ToString());
|
||||
default:
|
||||
WriteLine("Not a valid option");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
static void WriteCrypto()
|
||||
{
|
||||
var pos = (CursorLeft, CursorTop);
|
||||
var crypto = new string[] {"###########################",
|
||||
"# #",
|
||||
"# Corpus Cypher #",
|
||||
"# #",
|
||||
"###########################",
|
||||
"# ENG = COR #",
|
||||
"# A = A G = J M = S #",
|
||||
"# B = T H = K N = T #",
|
||||
"# C = Y I = I O = O #",
|
||||
"# D = P J = T P = K #",
|
||||
"# E = E K = K Q = R #",
|
||||
"# F = T L = P R = T #",
|
||||
"# #",
|
||||
"# S = Y W = J #",
|
||||
"# T = P X = K #",
|
||||
"# U = U Y = Y #",
|
||||
"# V = T Z = B #",
|
||||
"# #",
|
||||
"###########################"};
|
||||
for (int i = 0; i < crypto.Length; i++)
|
||||
{
|
||||
CursorTop = i + 2;
|
||||
CursorLeft = WindowWidth - crypto[i].Length - 2;
|
||||
foreach (char c in crypto[i]) {
|
||||
Write(c);
|
||||
if (c != ' ') Sleep(1);
|
||||
}
|
||||
}
|
||||
SetCursorPosition(pos.CursorLeft, pos.CursorTop);
|
||||
}
|
||||
static void Help() {
|
||||
Clear();
|
||||
var help = $@"Welcome to help for {title}
|
||||
This executable was made to help you encrypt something into the Corpus Cypher
|
||||
and to give you idea of what the person on the other end was trying to say.
|
||||
This executable isn't fool proof and some mistakes in the code might've slipped
|
||||
through my fingers. Still I hope it is atleast somewhat useful.
|
||||
|
||||
Encoding: Encoded text takes on the capitalization of the entered text.
|
||||
Decoding: Decoded text takes on the capitalization of the entered text.
|
||||
|
||||
Teaching: First you enter in the encrypted word and then you give it the translation. It will remember the word.";
|
||||
help = help.Replace("\r\n", "\n");
|
||||
Utils.LagWrite(help);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
cce/Properties/AssemblyInfo.cs
Normal file
36
cce/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("cce")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("cce")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f8d0ab76-7ac7-4f50-8556-58a2c2255d40")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
286
cce/Transcoder.cs
Normal file
286
cce/Transcoder.cs
Normal file
|
@ -0,0 +1,286 @@
|
|||
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 {
|
||||
class Transcoder {
|
||||
static internal string result = "";
|
||||
static private Dictionary<string, string> extended_dict = null;
|
||||
static private Dictionary<string, string> common_dict = null;
|
||||
static private Dictionary<char, char> substitution = new Dictionary<char, char>{
|
||||
{'a','a' },
|
||||
{'b','t' },
|
||||
{'c','y' },
|
||||
{'d','p' },
|
||||
{'e','e' },
|
||||
{'f','t' },
|
||||
{'g','j' },
|
||||
{'h','k' },
|
||||
{'i','i' },
|
||||
{'j','t' },
|
||||
{'k','k' },
|
||||
{'l','p' },
|
||||
{'m','s' },
|
||||
{'n','t' },
|
||||
{'o','o' },
|
||||
{'p','k' },
|
||||
{'q','r' },
|
||||
{'r','t' },
|
||||
{'s','y' },
|
||||
{'t','p' },
|
||||
{'u','u' },
|
||||
{'v','t' },
|
||||
{'w','j' },
|
||||
{'x','k' },
|
||||
{'y','y' },
|
||||
{'z','b' }
|
||||
};
|
||||
static private Dictionary<char, string> decode_key = new Dictionary<char, string>{
|
||||
{'a',"a" },
|
||||
{'t',"bfjnrv"},
|
||||
{'y',"csy" },
|
||||
{'p',"dlt" },
|
||||
{'e',"e" },
|
||||
{'j',"gw" },
|
||||
{'k',"hkpx" },
|
||||
{'i',"i" },
|
||||
{'s',"m" },
|
||||
{'o',"o" },
|
||||
{'r',"q" },
|
||||
{'u',"u" },
|
||||
{'b',"z" }
|
||||
|
||||
};
|
||||
static private Dictionary<string, string> path = new Dictionary<string, string>{
|
||||
{"common","common_dict.json" },
|
||||
{"extended","extended_dict.json"}
|
||||
};
|
||||
static internal void Teacher() {
|
||||
var pos = CursorTop;
|
||||
Write("Please enter the encrypted word: ");
|
||||
var cyphered = Console.ReadLine().ToLower();
|
||||
if (cyphered == "") return;
|
||||
CursorTop = pos;
|
||||
string translation = "";
|
||||
while (true) {
|
||||
Write($"Please enter a translation for \"{cyphered}\": ");
|
||||
translation = ReadLine().ToLower();
|
||||
if (raw_encode(cyphered).ToLower() == cyphered) {
|
||||
Console.BackgroundColor = ConsoleColor.Green; Console.ForegroundColor = ConsoleColor.Black;
|
||||
WriteLine("Cypher Match!"); ResetColor(); break;
|
||||
}
|
||||
Console.BackgroundColor = ConsoleColor.Red;
|
||||
WriteLine("Words don't match");
|
||||
ResetColor();
|
||||
}
|
||||
var entered = false;
|
||||
char cki;
|
||||
do {
|
||||
Utils.LagWrite(@"Where do you want to save the translation?
|
||||
[1] Common words dictionary
|
||||
[2] Extended words dictionary
|
||||
>>> ".Replace("\r\n", "\n"));
|
||||
cki = ReadKey().KeyChar;
|
||||
WriteLine();
|
||||
if (extended_dict == null || common_dict == null) init();
|
||||
switch (cki) {
|
||||
case '1':
|
||||
if (common_dict.ContainsKey(translation)) {
|
||||
WriteLine("Error: Unable to add a new translation. Translation already present.");
|
||||
} else common_dict.Add(translation, cyphered);
|
||||
entered = true;
|
||||
break;
|
||||
case '2':
|
||||
if (extended_dict.ContainsKey(translation)) {
|
||||
WriteLine("Error: Unable to add a new translation. Translation already present.");
|
||||
} else extended_dict.Add(translation, cyphered);
|
||||
entered = true;
|
||||
break;
|
||||
default:
|
||||
CursorLeft--; WriteLine("Not a valid option");
|
||||
break;
|
||||
}
|
||||
} while (!entered);
|
||||
Console.BackgroundColor = cki == '1' ? ConsoleColor.Green : ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.Black;
|
||||
WriteLine("Translation Added"); ResetColor();
|
||||
update();
|
||||
}
|
||||
static internal void Encode(string entry) {
|
||||
result = raw_encode(entry);
|
||||
WriteLine("Transcoding:\n{0}\n", entry);
|
||||
Utils.LagWrite(result);
|
||||
}
|
||||
static internal void Decode(string entry) {
|
||||
var sentence = entry.ToLower();
|
||||
//120x30, buffer 240x60
|
||||
if (sentence.Length >= 120) { BufferWidth = sentence.Length * 2; WindowWidth = sentence.Length + 20; }
|
||||
Clear();
|
||||
CursorVisible = false;
|
||||
if (extended_dict == null || common_dict == null) init();
|
||||
var cleaned = new char[sentence.Length];
|
||||
var symbols = new char[sentence.Length];
|
||||
var writeout = new char[sentence.Length];
|
||||
for (int i = 0; i < sentence.Length; i++) {
|
||||
if (sentence[i] >= 'a' && sentence[i] <= 'z') { cleaned[i] = sentence[i]; symbols[i] = 'x'; writeout[i] = '_'; } else { writeout[i] = symbols[i] = sentence[i]; cleaned[i] = ' '; }
|
||||
}
|
||||
var decode = string.Join("", cleaned).ToLower().Split(' ');
|
||||
//var decoded = new List<List<string>>();
|
||||
Console.BackgroundColor = ConsoleColor.Green;
|
||||
Console.Write(" "); ResetColor(); Console.WriteLine(" Frequent Words");
|
||||
Console.BackgroundColor = ConsoleColor.Blue;
|
||||
Console.Write(" "); ResetColor(); Console.WriteLine(" Infrequent Words");
|
||||
Console.BackgroundColor = ConsoleColor.Red;
|
||||
Console.Write(" "); ResetColor(); Console.WriteLine(" Letter decypher");
|
||||
WriteLine("Transcoding:\n{0}\n", entry);
|
||||
int memTop = CursorTop;
|
||||
int left = 0;
|
||||
Write(string.Join("", writeout));
|
||||
for (int i = 0; i < decode.Length; i++) {
|
||||
if (symbols[left] != 'x') left++;
|
||||
//var options = new List<string>();
|
||||
CursorTop = memTop;
|
||||
Console.BackgroundColor = ConsoleColor.Green;
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
wordwrite(common_dict, decode[i], entry, left, i);
|
||||
/*foreach (var item in common_dict) {
|
||||
if (item.Value == decode[i]) {
|
||||
CursorLeft = left;
|
||||
//options.Add(item.Key);
|
||||
for (int j = 0; j < item.Key.Length; j++) {
|
||||
Write(Char.IsUpper(entry[i]) ? char.Parse(item.Key[j].ToString().ToUpper()) : char.Parse(item.Key[j].ToString().ToLower()));
|
||||
}
|
||||
Write(item.Key.ToUpper());
|
||||
Sleep(100);
|
||||
CursorTop++;
|
||||
}
|
||||
}*/
|
||||
Console.BackgroundColor = ConsoleColor.Blue;
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
wordwrite(extended_dict, decode[i], entry, left, i);
|
||||
ResetColor();
|
||||
List<List<char>> letter_decode = new List<List<char>>();
|
||||
for (int j = 0; j < decode[i].Length; j++) {
|
||||
if (decode_key.TryGetValue(decode[i][j], out string substituted)) {
|
||||
var letterlist = new List<char>();
|
||||
for (int h = 0; h < substituted.Length; h++) {
|
||||
letterlist.Add(substituted[h]);
|
||||
}
|
||||
letter_decode.Add(letterlist);
|
||||
} else {
|
||||
letter_decode.Add(new List<char> { sentence[j] });
|
||||
}
|
||||
}
|
||||
int top = CursorTop;
|
||||
int letterleft = left;
|
||||
Console.BackgroundColor = ConsoleColor.Red;
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
for (int j = 0; j < letter_decode.Count; j++) {
|
||||
for (int h = 0; h < letter_decode[j].Count; h++) {
|
||||
CursorLeft = letterleft;
|
||||
Write(Char.IsUpper(entry[CursorLeft]) ? Char.ToUpper(letter_decode[j][h]) : Char.ToLower(letter_decode[j][h]));
|
||||
Sleep(10);
|
||||
CursorTop++;
|
||||
}
|
||||
CursorTop = top;
|
||||
letterleft++;
|
||||
}
|
||||
Sleep(80);
|
||||
left += decode[i].Length;
|
||||
}
|
||||
ResetColor();
|
||||
//return string.Join(" ", decoded);
|
||||
}
|
||||
static internal void head_transcribe() {
|
||||
if(!File.Exists("dev")) {
|
||||
Clear();
|
||||
BackgroundColor = ConsoleColor.Red;
|
||||
Utils.LagWrite(" \n" +
|
||||
" Unable to comply. Not a dev version \n"+
|
||||
" ", true);
|
||||
ResetColor();
|
||||
return;
|
||||
}
|
||||
raw_transcribe("common_dict.txt", "common_dict.json");
|
||||
raw_transcribe("extended_dict.txt", "extended_dict.json");
|
||||
uniquire();
|
||||
}
|
||||
static private void update() {
|
||||
uniquire();
|
||||
File.WriteAllText(path["extended"], JsonConvert.SerializeObject(extended_dict));
|
||||
File.WriteAllText(path["common"], JsonConvert.SerializeObject(common_dict));
|
||||
}
|
||||
static private string raw_encode(string entry) {
|
||||
var sentence = entry.ToLower();
|
||||
char[] encoded = new char[entry.Length];
|
||||
for (int i = 0; i < sentence.Length; i++) {
|
||||
if (substitution.TryGetValue(sentence[i], out char substituted)) {
|
||||
encoded[i] = Char.IsUpper(entry[i]) ? Char.ToUpper(substituted) : Char.ToLower(substituted);
|
||||
} else {
|
||||
encoded[i] = entry[i];
|
||||
}
|
||||
}
|
||||
return String.Join("", encoded);
|
||||
}
|
||||
static private void init() {
|
||||
if (common_dict != null && extended_dict != null) return;
|
||||
WriteLine("[Loading Dictionary]");
|
||||
if (File.Exists(path["extended"])) extended_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(path["extended"]));
|
||||
else WriteLine("File missing");
|
||||
if (File.Exists(path["common"])) common_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(path["common"]));
|
||||
else WriteLine("File missing");
|
||||
}
|
||||
static private void uniquire() {
|
||||
init();
|
||||
foreach (var item in common_dict) {
|
||||
if (extended_dict.ContainsKey(item.Key)) extended_dict.Remove(item.Key);
|
||||
}
|
||||
}
|
||||
static private void raw_transcribe(string input, string output) {
|
||||
var lines = File.ReadAllLines(input);
|
||||
for (int i = 0; i < lines.Length; i++) {
|
||||
lines[i] = lines[i].ToLower();
|
||||
}
|
||||
var English = new string[lines.Length];
|
||||
lines.CopyTo(English, 0);
|
||||
for (int i = 0; i < English.Length; i++) {
|
||||
var word = new char[English[i].Length];
|
||||
for (int j = 0; j < English[i].Length; j++) {
|
||||
if (substitution.TryGetValue(English[i][j], out char substituted)) {
|
||||
word[j] = substituted;
|
||||
}
|
||||
else {
|
||||
word[j] = English[i][j];
|
||||
}
|
||||
}
|
||||
lines[i] = String.Join("", word);
|
||||
WriteLine($"{English[i]}:{lines[i]}");
|
||||
}
|
||||
Dictionary<string, string> vals = new Dictionary<string, string>();
|
||||
for (int i = 0; i < English.Length; i++) {
|
||||
if (vals.ContainsKey(English[i])) continue;
|
||||
vals.Add(English[i], lines[i]);
|
||||
}
|
||||
File.WriteAllText(output, JsonConvert.SerializeObject(vals));
|
||||
}
|
||||
static private void wordwrite(Dictionary<string, string> collection, string decode, string entry,int left, int i) {
|
||||
foreach (var item in collection) {
|
||||
if (item.Value == decode) {
|
||||
CursorLeft = left;
|
||||
//options.Add(item.Key);
|
||||
for (int j = 0; j < item.Key.Length; j++) {
|
||||
Write(Char.IsUpper(entry[CursorLeft]) ? Char.ToUpper(item.Key[j]) : Char.ToLower(item.Key[j]));
|
||||
}
|
||||
Utils.VarSleep(10, low: 20,high:100);
|
||||
CursorTop++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
58
cce/Utils.cs
Normal file
58
cce/Utils.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
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 {
|
||||
class Utils {
|
||||
static private 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));
|
||||
if (del <= (int)(adj * chance)) del = low;
|
||||
else if (del >= adj - (int)(adj * chance)) del = high;
|
||||
else del = del * step;
|
||||
Sleep(del);
|
||||
}
|
||||
static internal void Clip(string clip) {
|
||||
WriteLine();
|
||||
LagWrite("Do you want to copy the result to the Clipboard? [Y/n]: ");
|
||||
var cki = ReadKey().KeyChar;
|
||||
WriteLine();
|
||||
if (Char.ToLower(cki) == 'y') { Clipboard.SetText(clip); WriteLine("Writing to Clipboard: Done!"); } else WriteLine("Writing to Clipboard: Canceled by User");
|
||||
}
|
||||
internal static void LagWrite(string input, bool newline = false) {
|
||||
var phrases = new List<List<string>>();
|
||||
var lines = input.Split(new char[] { '\n' });
|
||||
for (int i = 0; i < lines.Length; i++) {
|
||||
var line = new List<string>();
|
||||
var split = lines[i].Split(' ');
|
||||
int min = 4;
|
||||
int selector = rng.Next(min, split.Length > min + 1 ? split.Length : min + 1);
|
||||
var selected = new List<string>();
|
||||
for (int j = 0; j < split.Length; j++) {
|
||||
selected.Add(split[j]);
|
||||
if (j != 0 && j % selector == 0) {
|
||||
line.Add(String.Join(" ", selected));
|
||||
selected.Clear();
|
||||
}
|
||||
}
|
||||
if (selected.Count > 0) line.Add(String.Join(" ", selected));
|
||||
phrases.Add(line);
|
||||
}
|
||||
for (int i = 0; i < phrases.Count; i++) {
|
||||
for (int j = 0; j < phrases[i].Count; j++) {
|
||||
Write(j != phrases[i].Count - 1 ? phrases[i][j] + " " : phrases[i][j]);
|
||||
VarSleep(22);
|
||||
}
|
||||
if (newline || i < phrases.Count - 1) WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
cce/cce.csproj
Normal file
60
cce/cce.csproj
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F8D0AB76-7AC7-4F50-8556-58A2C2255D40}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>corpus_decoder</RootNamespace>
|
||||
<AssemblyName>corpus decoder</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Transcoder.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
4
cce/packages.config
Normal file
4
cce/packages.config
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
||||
</packages>
|
Loading…
Reference in a new issue