示例#1
0
        private void SetEntityParameter(string value)
        {
            try
            {
                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);

                    string propertyName = mainEntity.CurrentParamIndex + 1 > ifcType.IfcProperties.Count ? "[UnknownProperty]" :
                                          ifcType.IfcProperties[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.Error("Unhandled Parser error, in Parser.cs SetEntityParameter");
                }
            }
            if (_listNestLevel == 0)
            {
                _currentInstance.CurrentParamIndex++;
                _deferListItems = false;
            }
        }
示例#2
0
 internal override void SetIntegerValue(string value)
 {
     if (InHeader)
     {
         _propertyValue.Init(value, IfcParserType.Integer);
         if (_currentInstance.Entity != null)
         {
             _currentInstance.ParameterSetter(_currentInstance.CurrentParamIndex, _propertyValue);
         }
     }
     else
     {
         _binaryWriter.Write((byte)P21ParseAction.SetIntegerValue);
         _binaryWriter.Write(Convert.ToInt64(value));
     }
     if (_listNestLevel == 0)
     {
         _currentInstance.CurrentParamIndex++;
     }
 }