//read the line into a list and then enrich the list containing IFCRELASSIGNS private void Open_Click(object sender, EventArgs e) { filename = TextBox_Filename.Text; IFClines = new List <IFCparser>(); string lines; Boolean flag = true; if (filename != null) { try { if (System.IO.File.Exists(filename)) { using (System.IO.StreamReader InputStream = new System.IO.StreamReader(filename)) { while (InputStream.Peek() >= 0 && flag) { lines = null; lines = InputStream.ReadLine(); if (string.Compare(lines, "DATA;", true) == 0) { while ((InputStream.Peek() >= 0) && flag) { lines = null; lines = InputStream.ReadLine(); if (!(string.Compare(lines, "ENDSEC;", true) == 0)) { IFCparser component1 = new IFCparser(lines); IFClines.Add(component1); } else { flag = false; } } } } } Taskassignments = IFClines.EnrichIfCparser(); } else { messageboxopen("File doesnt exist", "Invalid file"); } } catch (Exception exception) { Console.WriteLine("Failed to read the lines. {0}", exception.ToString()); throw; } } else { messageboxopen("You did not enter a file name. ", "No file Name Specified"); } messageboxopen("end of file", "process complete"); }
public IFCrelassignstask(String InputData, IList <IFCparser> source, int lineno) { try { dataparser o = new dataparser(); string[] tempstringarray; tempstringarray = InputData.Split(','); IFCobject = source.Getobjectfromlineno(Int32.Parse(o.Getlinenodata(tempstringarray[4]))); IFCobject.task = new IFCtask(IFCobject.IFCdata, IFCobject.lineno); IFCtaskinstance = IFCobject.task; IFCobject = source.Getobjectfromlineno(Int32.Parse(o.Getlinenodata(tempstringarray[7]))); IFCobject.scheduleTimeControl = new IFCScheduleTimeControl(IFCobject.IFCdata, source, IFCobject.lineno); IfcScheduleTimeControlInstance = IFCobject.scheduleTimeControl; //foreach (var s in source) //{ // if (s.lineno == lineno) // s.taskassignment = new IFCrelassignstask(IFCtaskinstance, IfcScheduleTimeControlInstance); // else if (s.lineno == IFCtaskinstance.tasklinelineno ) // s.task = IFCtaskinstance; // else if (s.lineno == IfcScheduleTimeControlInstance.scheduletimecontrollineno ) // s.scheduleTimeControl = IfcScheduleTimeControlInstance; // else if (s.lineno == IfcScheduleTimeControlInstance.scheduledstartdate.dateandtimelineno) // s.dateandtime = IfcScheduleTimeControlInstance.scheduledstartdate; // else if (s.lineno == IfcScheduleTimeControlInstance.scheduledenddate.dateandtimelineno) // s.dateandtime = IfcScheduleTimeControlInstance.scheduledenddate; // else if (s.lineno == IfcScheduleTimeControlInstance.scheduledstartdate.date.datelineno ) // s.date = IfcScheduleTimeControlInstance.scheduledstartdate.date ; // else if (s.lineno == IfcScheduleTimeControlInstance.scheduledenddate.date.datelineno) // s.date = IfcScheduleTimeControlInstance.scheduledenddate.date; // else // { // } //} } catch (Exception e) { Console.WriteLine("Failed to parse the IFCRELASSIGNS. {0}", e.ToString()); throw; } }
public IFCDateAndTime(string inputdata, IList <IFCparser> source, int lineno) { try { dateandtimelineno = lineno; int datelineno; dataparser o = new dataparser(); string[] tempstringarray; tempstringarray = inputdata.Split(','); datelineno = Int32.Parse(o.Getlinenodata(tempstringarray[0])); ifcobject = source.Getobjectfromlineno(datelineno); ifcobject.date = new IFCdate(ifcobject.IFCdata, datelineno); date = ifcobject.date; } catch (Exception e) { Console.WriteLine("Failed to parse IFCDateandTime. {0}", e.ToString()); throw; } }
public IFCScheduleTimeControl(string inputdata, IList <IFCparser> source, int lineno) { try { scheduletimecontrollineno = lineno; dataparser o = new dataparser(); string[] tempstringarray; tempstringarray = inputdata.Split(','); // scheduledstartdate = Int32.Parse(o.Getlinenodata(tempstringarray[8])); IFCobject = source.Getobjectfromlineno(Int32.Parse(o.Getlinenodata(tempstringarray[8]))); IFCobject.dateandtime = new IFCDateAndTime(IFCobject.IFCdata, source, IFCobject.lineno); scheduledstartdate = IFCobject.dateandtime; IFCobject = source.Getobjectfromlineno(Int32.Parse(o.Getlinenodata(tempstringarray[12]))); IFCobject.dateandtime = new IFCDateAndTime(IFCobject.IFCdata, source, IFCobject.lineno); scheduledenddate = IFCobject.dateandtime; } catch (Exception e) { Console.WriteLine("Failed to parse IFCScheduletimecontrol. {0}", e.ToString()); throw; } }