private void ReadFile(string formatPath, string filePath) { FileReadingDialog dialog = new FileReadingDialog(); FormattedReader reader = new FormattedReader(formatPath); dialog.ReadingDone += Dialog_ReadingDone; dialog.ReadFile(reader, filePath); dialog.Show(this); dialog.Focus(); }
public void FormattedReaderTest() { FormattedReader reader = new FormattedReader(TestsReference.FORMAT_PATH); SectionEntry root = reader.ReadFile(TestsReference.MIN_TEST_PATH); SectionEntry player = new SectionEntry("player", "Player", null); player.Root = root; player.Parent = root; player.Entries.Add(new ValueEntry("id", "Id", "number", "665369", null, player, root)); player.Entries.Add(new ValueEntry("type", "Type", "number", "66", null, player, root)); Assert.IsTrue(player.Equals(root.Entries[2])); Assert.AreEqual(12, root.Entries.Count); Entry start = root.Entries[0]; string refpath = ".."; Assert.AreEqual(start.Parent, FormattedReader.ParseRef(start, refpath)); }
internal void ReadFile(FormattedReader reader, string path) { this.reader = reader; this.path = path; bworker.RunWorkerAsync(); }
public void RecursiveSectionTest() { var reader = new FormattedReader(new MemoryStream(Encoding.UTF8.GetBytes(RECURSIVE_FORMAT))); SectionEntry file = reader.ReadFileFromString(RECURSIVE_FILE); var second = (SectionEntry)((SectionEntry)((SectionEntry)((SectionEntry)((SectionEntry)file.Entries[0]).Entries[0]).Entries[2]).Entries[3]).Entries[3]; Assert.AreEqual("Province", second.Entries[0].FriendlyName); //test that the second "from" was properly detected (by checking a value inside it) Assert.AreEqual("From", second.Entries[3].FriendlyName); //test that the third "from" was properly detected }