private void ImportButton_Click(object sender, EventArgs e) { string Path = string.Empty; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Text File|*.txt"; ofd.ShowDialog(); if (ofd.FileName == string.Empty) { return; } Path = ofd.FileName; string data; using (var sr = new StreamReader(Path)) { data = sr.ReadToEnd(); } var npcs = data.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (var m in npcs) { try { NPCInfo.FromText(m); } catch { } } UpdateInterface(); MessageBox.Show("NPC Import complete"); }