public void WriteToFile(string fileName) { if (fileName.ToLower().EndsWith("egm")) { FileStream stream = new FileStream(fileName, FileMode.Create); this.egm.WriteToFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "tri"), FileMode.Create); this.tri.WriteToFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "nif"), FileMode.Create); this.nif.WriteToFile(stream); stream.Close(); } if (fileName.ToLower().EndsWith("tri")) { FileStream stream = new FileStream(fileName, FileMode.Create); this.tri.WriteToFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "egm"), FileMode.Create); this.egm.WriteToFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "nif"), FileMode.Create); this.nif.WriteToFile(stream); stream.Close(); } if (fileName.ToLower().EndsWith("nif")) { FileStream stream = new FileStream(fileName, FileMode.Create); this.nif.WriteToFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "egm"), FileMode.Create); this.egm.WriteToFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "tri"), FileMode.Create); this.tri.WriteToFile(stream); stream.Close(); } }
public HeadFile(string fileName) { if (fileName.ToLower().EndsWith("egm")) { FileStream stream = new FileStream(fileName, FileMode.Open); this.egm = new EGMFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "tri"), FileMode.Open); this.tri = new TRIFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "nif"), FileMode.Open); this.nif = new NifFile(stream); stream.Close(); } if (fileName.ToLower().EndsWith("tri")) { FileStream stream = new FileStream(fileName, FileMode.Open); this.tri = new TRIFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "egm"), FileMode.Open); this.egm = new EGMFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "nif"), FileMode.Open); this.nif = new NifFile(stream); stream.Close(); } if (fileName.ToLower().EndsWith("nif")) { FileStream stream = new FileStream(fileName, FileMode.Open); this.nif = new NifFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "egm"), FileMode.Open); this.egm = new EGMFile(stream); stream.Close(); stream = new FileStream(HeadFile.ReplaceExtention(fileName, "tri"), FileMode.Open); this.tri = new TRIFile(stream); stream.Close(); } }