static void Main(string[] args) { /*if (File.Exists("states.json")) // Check if states.json exists and if so, read from it and parse JSON data for savestates * { * using (StreamReader reader = File.OpenText("states.json")) * using (JsonTextReader treader = new JsonTextReader(reader)) * { * JObject jsonObj = (JObject)JToken.ReadFrom(treader); * //jsonObj.Value<string>("Version"); //SaveState file version, useful for later when there's gonna be updates to the savestates themselves * * saveStates = jsonObj["SaveStates"]?.ToObject<SaveState[]>(); * } * }*/ if (File.Exists("save.states")) { saveStates = SaveStateSerialization.DeserializeStates(); } if (File.Exists("DInput.txt")) // If DInput is configured (DInput file exists) then use the DInput code { string json = File.ReadAllText("DInput.txt"); DCONTROLLER = JsonConvert.DeserializeObject <DController>(json); isDInput = true; DCONTROLLER.InitializeController(); } else { ConnectController(); } Hook(); Run(); }
static void Main(string[] args) { if (File.Exists("file.txt")) { using (StreamReader reader = File.OpenText("file.txt")) using (JsonTextReader treader = new JsonTextReader(reader)) { JObject jsonObj = (JObject)JToken.ReadFrom(treader); //jsonObj.Value<string>("Version"); //SaveState file version, useful for later when there's gonna be updates to the savestates themselves saveStates = jsonObj["SaveStates"].ToObject <SaveState[]>(); } } if (File.Exists("DInput.txt")) { string json = File.ReadAllText("DInput.txt"); DCONTROLLER = JsonConvert.DeserializeObject <DController>(json); isDInput = true; DCONTROLLER.InitializeController(); } else { ConnectController(); } Hook(); Run(); }