Exemple #1
0
        public Ifc4.IfcXML CreateIfcXmlFromStream(Stream stream)
        {
            try
            {
                Ifc4.IfcXML externalIfcXML = JV.XmlProcessing <Ifc4.IfcXML> .Read(stream);

                return(externalIfcXML);
            }
            catch (Exception exc)
            {
                return(null);
            }
        }
Exemple #2
0
        public bool SerializeTest(string ifcFullName)
        {
            if (String.IsNullOrEmpty(ifcFullName))
            {
                throw new ArgumentNullException("ifcFullName", "SerializeTest()");
                return(false);
            }

            System.IO.FileInfo fileInfo = new System.IO.FileInfo(ifcFullName);
            if (!fileInfo.Exists)
            {
                RaiseMessageLogged(String.Format("{0} - File '{0}' not found!", "SerializeTest()", ifcFullName));
                return(false);
            }

            try
            {
                string f0_Org = fileInfo.FullName;
                string f0     = System.IO.Path.ChangeExtension(f0_Org, ".tmp" + fileInfo.Extension);

                // bool validate = this.Validate(f0_Org);
                System.IO.File.Copy(f0_Org, f0, true);

                Ifc4.Document document = Ifc4.Workspace.CurrentWorkspace.OpenDocument(f0);
                Ifc4.IfcXML   ifcXML   = document.IfcXmlDocument;

                document.SaveAs(f0 + ".0", new SaveOptions());

                //Correction(f0 + ".0");
                //validate = this.Validate(f0 + ".0");

                RaiseMessageLogged(String.Format("Serialized file '{0}'", f0 + ".0"));
                RaiseMessageLogged("End");

                return(true);
            }
            catch (Exception exc)
            {
                System.Diagnostics.Debug.WriteLine(exc.Message);
                Exception innerException = exc.InnerException;
                while (innerException != null)
                {
                    RaiseMessageLogged(innerException.Message);
                    innerException = innerException.InnerException;
                }
                return(false);
            }
        }