CreachoPedia/Program.cs

69 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using Newtonsoft.Json;
using System.IO;
namespace creachopedia {
class Program {
static void Main(string[] args) {
var creacherdict = JsonConvert.DeserializeObject<Dictionary<string, Creacher>>(File.ReadAllText("creachopedia.json"));
// creacherdict.Add("paca", new GroundCreacher("paca", 4));
// creacherdict.Add("llama", new GroundCreacher("llama", 4));
// creacherdict.Add("stingray", new WaterCreacher("stingray", 0));
// var jsonsettings = new JsonSerializerSettings{
// TypeNameHandling = TypeNameHandling.Auto
// };
// string jsonstring = JsonConvert.SerializeObject(creacherdict, Formatting.Indented, jsonsettings);
// File.WriteAllText("creachopedia.json", jsonstring);
while (true) {
var status = "base";
Console.WriteLine("Please input a creacher name, or (q) to quit 0u0");
string userin = Console.ReadLine();
string luserin = userin.ToLower();
if(userin == "q"){
Console.WriteLine("Thank you for using the CreachoPedia, please come again!!!!");
status = "quit";
}
if (status == "base"){
if (creacherdict.ContainsKey(userin)) {
creacherdict[userin].Introduce();
creacherdict[userin].Step();
}
else if(luserin == "heenlo!" || luserin == "henlo" || luserin == "heenlo" || luserin == "henlo!"){
Console.WriteLine("Well heenlo to you too! 0u0");
}
else if(userin == "*pats*"){
Console.WriteLine("Oh! Thank you!");
}
else if(userin == "a"){
Console.WriteLine("Please enter a new creacher! Or type (b) for previous category, or (q) to cancel addition entirely.");
status = "add";
}
}
else if (status == "add") {
} else if (status == "quit") {
return;
}
else {
Console.WriteLine($"I don't know what {userin} is! What on boo Earth?!!?!?!?");
}
Console.WriteLine("");
Thread.Sleep(1000);
}
}
}
}