// -------------------------------------------------------------------- #region Settings access public void ResetSettings() { patches.Clear(); calls.Clear(); KnownCallCountChanged?.Invoke(); }
public void SetSetting(string commandLine) { // Trim spaces commandLine = commandLine.Trim(); // What type of line is it? if (commandLine.StartsWith("[")) { // Patch foreach (var line in commandLine.Split(';')) { var patch = new Patch(line); patches[patch.GetAddressString()] = patch; } } else if (commandLine.ToLowerInvariant().StartsWith("calls:")) { // Calls var colon = commandLine.IndexOf(':'); var addresses = commandLine.Substring(colon + 1).Split(','); foreach (var address in addresses) { int addr = address.ReadInt(); if (!calls.Contains(addr)) { calls.Add(addr); } } KnownCallCountChanged?.Invoke(); } else { // Setting int equalSign = commandLine.IndexOf('='); if (equalSign >= 0) { if (!SetSetting(commandLine.Substring(0, equalSign), commandLine.Substring(equalSign + 1))) { unknownSettings.Add(commandLine); } } } }