private void TextBox_WADFile_TextChanged(object sender, EventArgs e) { try { var tb = (TextBox)sender; var filePath = tb.Text; if (string.IsNullOrWhiteSpace(filePath)) { return; } var file = new FileInfo(filePath); if (!file.Exists) { return; } using (var fs = file.OpenRead()) { this.CurrentFile = WADFileFactory.FromStream(fs).FirstOrDefault(); } } catch (Exception ex) { this.ShowError(ex); } }
private static int Main(string[] args) { int result; try { result = 0; using (var fs = File.OpenRead("./files/mitnal.WAD")) { foreach (var wad in WADFileFactory.FromStream(fs)) { foreach (var lump in wad.EnumerateLumps()) { using (var lumpStream = lump.GetStream()) { if (lump is IThingsLump) { foreach (var thing in ((IThingsLump)lump).EnumerateThings()) { if (thing is IDOOMThing) { var doomThing = (IDOOMThing)thing; if (doomThing != null) { } } } } else if (lump is IVertexesLump) { foreach (var vertex in ((IVertexesLump)lump).EnumerateVertexes()) { if (vertex != null) { } } } } } } } } catch (Exception ex) { result = 1; Console.WriteLine("[FATAL ERROR!]: {0}", ex.GetBaseException()); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine("===== ENTER ====="); Console.ReadLine(); return(result); }