public static void Main(string[] args) { string inputFile = "../../../IfcDotNet_UnitTests/sampleData/NIST_TrainingStructure_param.ifc"; if(!File.Exists(inputFile)){ Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "File does not exist at : {0}", inputFile)); }else{ Console.WriteLine("Running..."); StreamReader sr = new StreamReader(inputFile); IStepReader reader = new StepReader( sr ); IfcStepSerializer serializer = new IfcStepSerializer(); iso_10303 iso10303 = serializer.Deserialize( reader ); uos1 uos1 = iso10303.uos as uos1; Entity[] entities = uos1.Items; Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "Have deserialized {0} entities", entities.Length)); } Console.WriteLine("Press any key to quit"); Console.ReadKey(); Console.WriteLine("Exiting"); }
private Entity[] DeserializeAssertISO10303AndExtractItems(StringReader stringReaderToDeserialize){ StepReader reader = new StepReader( stringReaderToDeserialize ); iso_10303 iso10303 = Deserialize( reader ); AssertIso10303( iso10303 ); return extractItems( iso10303 ); }
/// <summary> /// /// </summary> /// <param name="reader"></param> /// <returns></returns> public iso_10303 Deserialize(TextReader reader){ if(reader == null) throw new ArgumentNullException("reader"); StepReader sr = new StepReader(reader); return this.Deserialize( sr ); }
private void AssertCanSerialize(String itemToEqual){ IStepReader itemToDeserialize = new StepReader( new StringReader( itemToEqual ) ); iso_10303 iso10303 = serializer.Deserialize( itemToDeserialize ); StringBuilder sb = new StringBuilder(); StepWriter stepwriter = new StepWriter( new StringWriter( sb ) ); serializer.Serialize( stepwriter, iso10303 ); logger.Debug(sb.ToString()); Assert.AreEqual( itemToEqual, sb.ToString() ); }