Beispiel #1
0
 public void CopyFromShallow(DxfValue from)
 {
     this.dxfValueFormat_0 = from.dxfValueFormat_0;
     this.object_0         = from.object_0;
     this.string_0         = from.string_0;
     this.int_0            = from.int_0;
 }
Beispiel #2
0
        internal void Write(DxfXRecord xrecord)
        {
            xrecord.Values.Add((short)93, (object)this.int_0);
            xrecord.Values.Add((short)90, (object)(int)this.Format.DataType);
            switch (this.Format.DataType)
            {
            case ValueDataType.None:
                xrecord.Values.Add((short)91, (object)0);
                break;

            case ValueDataType.Int:
                xrecord.Values.Add((short)91, (object)Convert.ToInt32(this.Value));
                break;

            case ValueDataType.Double:
                xrecord.Values.Add((short)140, (object)Convert.ToDouble(this.Value));
                break;

            case ValueDataType.String:
                xrecord.Values.Add((short)1, (object)(string)this.Value);
                break;

            case ValueDataType.Date:
                xrecord.Values.Add((short)92, (object)16);
                byte[] numArray = DxfValue.smethod_2((DateTime)this.Value);
                xrecord.Values.Add((short)310, (object)numArray);
                break;

            case ValueDataType.Point2D:
            case ValueDataType.Point3D:
                WW.Math.Point3D point3D = (WW.Math.Point3D) this.Value;
                xrecord.Values.Add((short)11, (object)point3D);
                break;

            case ValueDataType.ObjectHandle:
                DxfHandledObject dxfHandledObject = (DxfHandledObject)this.Value;
                if (dxfHandledObject != null)
                {
                    xrecord.Values.Add((short)330, (object)dxfHandledObject);
                    break;
                }
                break;

            case ValueDataType.Buffer:
                throw new NotImplementedException("Not yet implemented: Export of value data type 'Buffer'!");

            case ValueDataType.ResultBuffer:
                throw new NotImplementedException("Not yet implemented: Export of value data type 'ResultBuffer'!");

            case ValueDataType.General:
                xrecord.Values.Add((short)1, this.Value == null ? (object)string.Empty : (object)(string)this.Value);
                break;
            }
            xrecord.Values.Add((short)94, (object)(int)this.Format.UnitType);
            xrecord.Values.Add((short)300, (object)this.Format._FormatString);
            xrecord.Values.Add((short)302, (object)this.GetValueString(this.Format));
        }
Beispiel #3
0
        public DxfValue Clone(CloneContext cloneContext)
        {
            DxfValue           dxfValue = new DxfValue();
            DxfObjectReference object0  = this.object_0 as DxfObjectReference;

            dxfValue.object_0         = object0 == null ? this.object_0 : (object)((DxfHandledObject)((DxfHandledObject)object0.Value).Clone(cloneContext)).Reference;
            dxfValue.string_0         = this.string_0;
            dxfValue.dxfValueFormat_0 = this.dxfValueFormat_0 == null ? (DxfValueFormat)null : this.dxfValueFormat_0.Clone();
            dxfValue.int_0            = this.int_0;
            return(dxfValue);
        }
Beispiel #4
0
        internal void Read(DxfXRecord xrecord)
        {
            ValueDataType?nullable1    = new ValueDataType?();
            ValueUnitType?nullable2    = new ValueUnitType?();
            string        formatString = (string)null;

            foreach (DxfXRecordValue dxfXrecordValue in (List <DxfXRecordValue>)xrecord.Values)
            {
                switch (dxfXrecordValue.Code)
                {
                case 1:
                case 11:
                case 91:
                case 140:
                case 330:
                    this.method_1(dxfXrecordValue.Value);
                    continue;

                case 90:
                    nullable1 = new ValueDataType?((ValueDataType)dxfXrecordValue.Value);
                    continue;

                case 93:
                    this.int_0 = (int)dxfXrecordValue.Value;
                    continue;

                case 94:
                    nullable2 = new ValueUnitType?((ValueUnitType)dxfXrecordValue.Value);
                    continue;

                case 300:
                    formatString = (string)dxfXrecordValue.Value;
                    continue;

                case 310:
                    this.object_0 = (object)DxfValue.smethod_3((byte[])dxfXrecordValue.Value);
                    continue;

                default:
                    continue;
                }
            }
            if (!nullable1.HasValue || !nullable2.HasValue)
            {
                return;
            }
            this.dxfValueFormat_0 = DxfValueFormat.Create(nullable1.Value, nullable2.Value, formatString);
        }
Beispiel #5
0
 internal static byte[] smethod_0(DxfVersion version, DateTime dateTime)
 {
     byte[] bytes;
     if (version >= DxfVersion.Dxf21)
     {
         bytes = new byte[16];
         DxfValue.smethod_4(bytes, 0, dateTime.Year);
         DxfValue.smethod_4(bytes, 2, dateTime.Month);
         DxfValue.smethod_4(bytes, 4, (int)dateTime.DayOfWeek);
         DxfValue.smethod_4(bytes, 6, dateTime.Day);
         DxfValue.smethod_4(bytes, 8, dateTime.Hour);
         DxfValue.smethod_4(bytes, 10, dateTime.Minute);
         DxfValue.smethod_4(bytes, 12, dateTime.Second);
         DxfValue.smethod_4(bytes, 14, dateTime.Millisecond);
     }
     else
     {
         bytes = DxfValue.smethod_2(dateTime);
     }
     return(bytes);
 }
Beispiel #6
0
        internal void Write(DxfWriter w)
        {
            DxfModel model = w.Model;

            if (model.Header.Dxf19OrHigher)
            {
                w.Write(93, (object)this.int_0);
            }
            w.Write(90, (object)(int)this.Format.DataType);
            switch (this.Format.DataType)
            {
            case ValueDataType.None:
                if (!model.Header.Dxf19OrHigher)
                {
                    w.Write(91, (object)0);
                    break;
                }
                break;

            case ValueDataType.Int:
                w.Write(91, (object)Convert.ToInt32(this.object_0));
                break;

            case ValueDataType.Double:
                w.Write(140, (object)Convert.ToDouble(this.object_0));
                break;

            case ValueDataType.String:
                w.method_142(1, 2, (string)this.object_0, true);
                break;

            case ValueDataType.Date:
                w.Write(92, (object)16);
                DateTime object0_1 = (DateTime)this.object_0;
                byte[]   numArray  = DxfValue.smethod_0(w.Model.Header.AcadVersion, object0_1);
                w.Write(310, (object)numArray);
                break;

            case ValueDataType.Point2D:
            case ValueDataType.Point3D:
                WW.Math.Point3D object0_2 = (WW.Math.Point3D) this.object_0;
                w.Write(11, object0_2);
                break;

            case ValueDataType.ObjectHandle:
                DxfHandledObject dxfHandledObject = (DxfHandledObject)this.Value;
                if (dxfHandledObject != null)
                {
                    w.method_218(330, dxfHandledObject);
                    break;
                }
                break;

            case ValueDataType.Buffer:
                throw new NotImplementedException("Not yet implemented: Export of value data type 'Buffer'!");

            case ValueDataType.ResultBuffer:
                throw new NotImplementedException("Not yet implemented: Export of value data type 'ResultBuffer'!");

            case ValueDataType.General:
                w.method_142(1, 2, (string)this.object_0, true);
                break;
            }
            if (!model.Header.Dxf19OrHigher)
            {
                return;
            }
            w.Write(94, (object)(int)this.Format.UnitType);
            w.Write(300, (object)this.Format._FormatString);
            w.method_142(302, 303, this.GetValueString(this.Format), true);
            w.Write(304, (object)"ACVALUE_END");
        }