private Navisworks.batchtest ReadReport(string fileName) { Navisworks.exchange exchange = new Navisworks.exchange(); try { using (Stream objStream = new FileStream(fileName, FileMode.Open)) { XmlSerializer serializer = new XmlSerializer(typeof(Navisworks.exchange)); StreamReader sr = new StreamReader(objStream); //TODO //display a warning when the selected file is not a Navisworks clash report using (XmlReader reader = XmlReader.Create(sr)) { exchange = (Navisworks.exchange)serializer.Deserialize(reader); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(fileName + ex.Message); return(null); } Navisworks.batchtest returnValue = exchange.Items.First() as Navisworks.batchtest; return(returnValue); }
public ClashReport(FileInfo file) { fileInfo = file; reportName = file.Name; reportCreationDate = file.CreationTime; reportModificationDate = file.LastWriteTime; batchtest = ReadReport(file.FullName); if (batchtest != null) { parameters = AddParameters(this); } }