Esempio n. 1
0
        internal static DxfClass FromBuffer(DxfCodePairBufferReader buffer, DxfAcadVersion version)
        {
            var cls = new DxfClass();

            // version R13 has varying values for the leading 0 code pair
            var pair = buffer.Peek();

            Debug.Assert(pair.Code == 0);
            if (version <= DxfAcadVersion.R13)
            {
                cls.ClassDxfRecordName = pair.StringValue;
            }
            else
            {
                // swallow (0, CLASS)
                Debug.Assert(pair.StringValue == ClassText);
            }

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

                buffer.Advance();
                switch (pair.Code)
                {
                case 1:
                    if (version <= DxfAcadVersion.R13)
                    {
                        cls.CppClassName = pair.StringValue;
                    }
                    else
                    {
                        cls.ClassDxfRecordName = pair.StringValue;
                    }
                    break;

                case 2:
                    if (version <= DxfAcadVersion.R13)
                    {
                        cls.ApplicationName = pair.StringValue;
                    }
                    else
                    {
                        cls.CppClassName = pair.StringValue;
                    }
                    break;

                case 3:
                    if (version >= DxfAcadVersion.R14)
                    {
                        cls.ApplicationName = pair.StringValue;
                    }
                    break;

                case 90:
                    if (version <= DxfAcadVersion.R13)
                    {
                        cls.ClassVersionNumber = pair.IntegerValue;
                    }
                    else
                    {
                        cls.ProxyCapabilities = new DxfProxyCapabilities(pair.IntegerValue);
                    }
                    break;

                case 91:
                    cls.InstanceCount = pair.IntegerValue;
                    break;

                case 280:
                    cls.WasClassLoadedWithFile = !DxfCommonConverters.BoolShort(pair.ShortValue);
                    break;

                case 281:
                    cls.IsEntity = DxfCommonConverters.BoolShort(pair.ShortValue);
                    break;
                }
            }

            return(cls);
        }
Esempio n. 2
0
        internal static DxfClass FromBuffer(DxfCodePairBufferReader buffer, DxfAcadVersion version)
        {
            var cls = new DxfClass();

            // version R13 has varying values for the leading 0 code pair
            var pair = buffer.Peek();
            Debug.Assert(pair.Code == 0);
            if (version <= DxfAcadVersion.R13)
            {
                cls.ClassDxfRecordName = pair.StringValue;
            }
            else
            {
                // swallow (0, CLASS)
                Debug.Assert(pair.StringValue == ClassText);
            }

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

                buffer.Advance();
                switch (pair.Code)
                {
                    case 1:
                        if (version <= DxfAcadVersion.R13)
                            cls.CppClassName = pair.StringValue;
                        else
                            cls.ClassDxfRecordName = pair.StringValue;
                        break;
                    case 2:
                        if (version <= DxfAcadVersion.R13)
                            cls.ApplicationName = pair.StringValue;
                        else
                            cls.CppClassName = pair.StringValue;
                        break;
                    case 3:
                        if (version >= DxfAcadVersion.R14)
                            cls.ApplicationName = pair.StringValue;
                        break;
                    case 90:
                        if (version <= DxfAcadVersion.R13)
                            cls.ClassVersionNumber = pair.IntegerValue;
                        else
                            cls.ProxyCapabilities = new DxfProxyCapabilities(pair.IntegerValue);
                        break;
                    case 91:
                        cls.InstanceCount = pair.IntegerValue;
                        break;
                    case 280:
                        cls.WasClassLoadedWithFile = !DxfCommonConverters.BoolShort(pair.ShortValue);
                        break;
                    case 281:
                        cls.IsEntity = DxfCommonConverters.BoolShort(pair.ShortValue);
                        break;
                }
            }

            return cls;
        }