private void ChangeProject(string path) { if (!RGSS.IsValidProject(path)) { Instance = null; RGSS.ShowReason(); return; } Instance = new RGSS(path); SuspendLayout(); Text = $"{OriginalText} - {Path.GetFileNameWithoutExtension(Instance.ProjectPath)}"; listView1.Items.Clear(); int limit = Clamp(Convert.ToInt32(numericUpDown1.Value), 1, 9999); foreach (RGSS.EventPage page in Instance.EventPages) { ListViewItem item = new ListViewItem(Instance.GetMapDisplayText(page)); item.SubItems.Add(Instance.GetEventDisplayText(page)); item.SubItems.Add(Instance.GetPageDisplayText(page)); item.SubItems.Add(Instance.GetLocationDisplayText(page)); listView1.Items.Add(item); if (--limit == 0) { break; } } SetSwitch(Instance.Switches.ContainsKey(1) ? 1 : 0); SetVariable(Instance.Variables.ContainsKey(1) ? 1 : 0); ResumeLayout(); }
private bool IsValidProject(string path) { if (PossibleCache.TryGetValue(path, out bool value)) { return(value); } else { return(PossibleCache[path] = RGSS.IsValidProject(path)); } }