Ejemplo n.º 1
0
        internal override DxfObject PopulateFromBuffer(DxfCodePairBufferReader buffer)
        {
            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                while (this.TrySetExtensionData(pair, buffer))
                {
                    pair = buffer.Peek();
                }

                if (pair.Code == 0)
                {
                    break;
                }

                switch (pair.Code)
                {
                case 1:
                    Debug.Assert(pair.StringValue == "SectionTypeSettings");
                    buffer.Advance();
                    for (var sectionSettings = DxfSectionTypeSettings.FromBuffer(buffer); sectionSettings != null; sectionSettings = DxfSectionTypeSettings.FromBuffer(buffer))
                    {
                        SectionTypeSettings.Add(sectionSettings);
                    }
                    break;

                case 90:
                    SectionType = pair.IntegerValue;
                    buffer.Advance();
                    break;

                case 91:
                    var generationSettingsCount = pair.IntegerValue;
                    buffer.Advance();
                    break;

                default:
                    if (!base.TrySetPair(pair))
                    {
                        ExcessCodePairs.Add(pair);
                    }

                    buffer.Advance();
                    break;
                }
            }

            return(PostParse());
        }
Ejemplo n.º 2
0
        internal static DxfSectionTypeSettings FromBuffer(DxfCodePairBufferReader buffer)
        {
            if (buffer.Peek()?.Code == 0)
            {
                return(null);
            }

            var settings = new DxfSectionTypeSettings();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                switch (pair.Code)
                {
                case 1:
                    settings.DestinationFileName = pair.StringValue;
                    buffer.Advance();
                    break;

                case 2:
                    Debug.Assert(pair.StringValue == "SectionGeometrySettings");
                    buffer.Advance();
                    for (var geometry = DxfSectionGeometrySettings.FromBuffer(buffer); geometry != null; geometry = DxfSectionGeometrySettings.FromBuffer(buffer))
                    {
                        settings.GeometrySettings.Add(geometry);
                    }
                    break;

                case 3:
                    Debug.Assert(pair.StringValue == "SectionTypeSettingsEnd");
                    buffer.Advance();
                    break;

                case 90:
                    settings.SectionType = pair.IntegerValue;
                    buffer.Advance();
                    break;

                case 91:
                    settings.IsGenerationOption = pair.IntegerValue != 0;
                    buffer.Advance();
                    break;

                case 92:
                    var sourceObjectsCount = pair.IntegerValue;
                    buffer.Advance();
                    break;

                case 93:
                    var generationSettingsCount = pair.IntegerValue;
                    buffer.Advance();
                    break;

                case 330:
                    settings.SourceObjectHandles.Add(DxfCommonConverters.UIntHandle(pair.StringValue));
                    buffer.Advance();
                    break;

                case 331:
                    settings.DestinationObjectHandle = DxfCommonConverters.UIntHandle(pair.StringValue);
                    buffer.Advance();
                    break;

                default:
                    return(settings);
                }
            }

            return(settings);
        }