private static Txm OpenTex(string filename, DelayedStreamCache streams) { Txm tex; if (File.Exists(filename)) { Stream stream = new CachedReadStream(new FileStream(filename, FileMode.Open, FileAccess.Read)); tex = Tex.Create(stream); streams.AddStream(stream); } else { Stream txmstream = new CachedReadStream(new FileStream(filename + ".txm", FileMode.Open, FileAccess.Read)); Stream txvstream = new CachedReadStream(new FileStream(filename + ".txv", FileMode.Open, FileAccess.Read)); tex = new Txm(txmstream, txvstream); streams.AddStream(txmstream); streams.AddStream(txvstream); } return(tex); }