This commit is contained in:
Helio 2022-04-19 15:02:35 +02:00
parent 0a0943b223
commit 803cd30070
4 changed files with 22 additions and 5 deletions

View file

@ -16,8 +16,17 @@ namespace cce {
// Finish Settings screen, make it interactable // Finish Settings screen, make it interactable
bool saved = false; bool saved = false;
byte reset = 0; byte reset = 0;
(int, int) since = (0,0);
while (true) { while (true) {
Title = Title + " >>> Settings"; Title = Title + " >>> Settings";
if (since.Item1 >= 4) {
saved = false;
since.Item1 = 0;
}
if (since.Item2 >= 4) {
reset = 0;
since.Item2 = 0;
}
Clear(); Clear();
AppSettings.Screen(saved, reset); AppSettings.Screen(saved, reset);
ConsoleKeyInfo cki; ConsoleKeyInfo cki;
@ -43,6 +52,8 @@ namespace cce {
default: default:
break; break;
} }
since.Item1++;
since.Item2++;
} }
} }
} }

View file

@ -119,7 +119,11 @@ namespace cce {
if (sentence.Length >= 120) { BufferWidth = sentence.Length * 2; WindowWidth = sentence.Length + 20; } if (sentence.Length >= 120) { BufferWidth = sentence.Length * 2; WindowWidth = sentence.Length + 20; }
Clear(); Clear();
CursorVisible = false; CursorVisible = false;
if (extended_dict == null || common_dict == null) init(); var checker = init();
if (!checker) {
WriteLine("Unable to load dictionaries");
return;
}
var cleaned = new char[sentence.Length]; var cleaned = new char[sentence.Length];
var symbols = new char[sentence.Length]; var symbols = new char[sentence.Length];
var writeout = new char[sentence.Length]; var writeout = new char[sentence.Length];
@ -224,13 +228,15 @@ namespace cce {
} }
return String.Join("", encoded); return String.Join("", encoded);
} }
static private void init() { static internal bool init() {
if (common_dict != null && extended_dict != null) return; if (common_dict != null && extended_dict != null) return true;
var checker = true;
WriteLine("[Loading Dictionary]"); WriteLine("[Loading Dictionary]");
if (File.Exists(AppSettings.Extended)) extended_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(AppSettings.Extended)); if (File.Exists(AppSettings.Extended)) extended_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(AppSettings.Extended));
else WriteLine("File missing"); else { WriteLine("File missing"); checker = false; }
if (File.Exists(AppSettings.Common)) common_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(AppSettings.Common)); if (File.Exists(AppSettings.Common)) common_dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(AppSettings.Common));
else WriteLine("File missing"); else { WriteLine("File missing"); checker = false; }
return checker;
} }
static private void uniquire() { static private void uniquire() {
init(); init();