private void SetEntityParameter() { if (_currentInstance.Entity != null) { //CurrentInstance.SetPropertyValue(PropertyValue); try { _currentInstance.ParameterSetter(_currentInstance.CurrentParamIndex, _propertyValue, NestedIndex); } catch (Exception e) { if (_logger != null) { _logger.ErrorFormat("Parser error, the Attribute {0} of {1} is incorrectly specified and has been ignored. {2}", _currentInstance.CurrentParamIndex, _currentInstance.Entity.GetType().Name, e.Message); } } } if (_listNestLevel == 0) { _currentInstance.CurrentParamIndex++; } }
internal void EndNestedType() { _propertyValue.Init(_processStack.Pop().Entity); _currentInstance = _processStack.Peek(); if (_currentInstance.Entity != null) _currentInstance.ParameterSetter(_currentInstance.CurrentParamIndex, _propertyValue); if (_listNestLevel == 0) _currentInstance.CurrentParamIndex++; }
private void SetEntityParameter(string value) { try { if (CurrentInstance.Entity != null) { CurrentInstance.ParameterSetter(CurrentInstance.CurrentParamIndex, PropertyValue, NestedIndex); } } catch (Exception) { if (ErrorCount > MaxErrorCount) { throw new XbimParserException("Too many errors in file, parser execution terminated"); } ErrorCount++; var mainEntity = _processStack.Last(); if (mainEntity != null) { var expressType = Metadata?.ExpressType(mainEntity.Entity); if (expressType != null) { var propertyName = mainEntity.CurrentParamIndex + 1 > expressType.Properties.Count ? "[UnknownProperty]" : expressType.Properties[mainEntity.CurrentParamIndex + 1].PropertyInfo.Name; Logger.ErrorFormat("Entity #{0,-5} {1}, error at parameter {2}-{3} value = {4}", mainEntity.EntityLabel, mainEntity.Entity.GetType().Name.ToUpper(), mainEntity.CurrentParamIndex + 1, propertyName, value); } else { Logger.ErrorFormat("Entity #{0,-5} {1}, error at parameter {2} value = {3}", mainEntity.EntityLabel, mainEntity.Entity.GetType().Name.ToUpper(), mainEntity.CurrentParamIndex + 1, value); } } else { Logger.Error("Unhandled Parser error, in Parser.cs SetEntityParameter"); } } if (ListNestLevel == 0) { CurrentInstance.CurrentParamIndex++; _deferListItems = false; } }
internal void EndNestedType() { _propertyValue.Init(_processStack.Pop().Entity); _currentInstance = _processStack.Peek(); if (_currentInstance.Entity != null) { _currentInstance.ParameterSetter(_currentInstance.CurrentParamIndex, _propertyValue); } if (_listNestLevel == 0) { _currentInstance.CurrentParamIndex++; } }
protected override void EndNestedType(string value) { try { PropertyValue.Init(_processStack.Pop().Entity); CurrentInstance = _processStack.Peek(); if (CurrentInstance.Entity != null) { CurrentInstance.ParameterSetter(CurrentInstance.CurrentParamIndex, PropertyValue, NestedIndex); } } catch (Exception) { if (ErrorCount > MaxErrorCount) { throw new XbimParserException("Too many errors in file, parser execution terminated"); } ErrorCount++; var mainEntity = _processStack.Last(); if (mainEntity != null) { var expressType = Metadata.ExpressType(mainEntity.Entity); Logger.ErrorFormat("Entity #{0,-5} {1}, error at parameter {2}-{3} value = {4}", mainEntity.EntityLabel, mainEntity.Entity.GetType().Name.ToUpper(), mainEntity.CurrentParamIndex + 1, expressType.Properties[mainEntity.CurrentParamIndex + 1].PropertyInfo.Name, value); } else { Logger.Error("Unhandled Parser error, in Parser.cs EndNestedType"); } } if (ListNestLevel == 0) { CurrentInstance.CurrentParamIndex++; _deferListItems = false; } }
protected override void SetIntegerValue(string value) { if (InHeader) { _propertyValue.Init(value, StepParserType.Integer); if (_currentInstance.Entity != null) { _currentInstance.ParameterSetter(_currentInstance.CurrentParamIndex, _propertyValue, NestedIndex); } } else { _binaryWriter.Write((byte)P21ParseAction.SetIntegerValue); _binaryWriter.Write(Convert.ToInt64(value)); } if (_listNestLevel == 0) { _currentInstance.CurrentParamIndex++; } }
internal override void EndNestedType(string value) { try { _propertyValue.Init(_processStack.Pop().Entity); _currentInstance = _processStack.Peek(); if (_currentInstance.Entity != null) _currentInstance.ParameterSetter(_currentInstance.CurrentParamIndex, _propertyValue); } catch (Exception ) { if (_errorCount > MaxErrorCount) throw new Exception("Too many errors in file, parser execution terminated"); _errorCount++; Part21Entity mainEntity = _processStack.Last(); if (mainEntity != null) { IfcType ifcType = IfcMetaData.IfcType(mainEntity.Entity); Logger.ErrorFormat("Entity #{0,-5} {1}, error at parameter {2}-{3} value = {4}", mainEntity.EntityLabel, mainEntity.Entity.GetType().Name.ToUpper(), mainEntity.CurrentParamIndex + 1, ifcType.IfcProperties[mainEntity.CurrentParamIndex + 1].PropertyInfo.Name, value); } else { Logger.Error("Unhandled Parser error, in Parser.cs EndNestedType"); } } if (_listNestLevel == 0) { _currentInstance.CurrentParamIndex++; _deferListItems = false; } }