public void DictionaryRoundTripTest1() { // dictionary with DICTIONARYVAR values var dict = new DxfDictionary(); dict["key-1"] = new DxfDictionaryVariable() { Value = "value-1" }; dict["key-2"] = new DxfDictionaryVariable() { Value = "value-2" }; var file = new DxfFile(); file.Clear(); file.Header.Version = DxfAcadVersion.R2000; file.Objects.Add(dict); var text = ToString(file); var parsedFile = Parse(text); var roundTrippedDict = parsedFile.Objects.OfType <DxfDictionary>().Single(d => d.Keys.Count == 2); Assert.Equal("value-1", ((DxfDictionaryVariable)roundTrippedDict["key-1"]).Value); Assert.Equal("value-2", ((DxfDictionaryVariable)roundTrippedDict["key-2"]).Value); }
internal static DxfAnnotationScaleObjectContextData smethod_5( DxfHandledObject obj, bool returnAny = false) { if (obj.ExtensionDictionary == null) { return((DxfAnnotationScaleObjectContextData)null); } DxfDictionary valueByName1 = obj.ExtensionDictionary.GetValueByName("AcDbContextDataManager") as DxfDictionary; if (valueByName1 == null) { return((DxfAnnotationScaleObjectContextData)null); } DxfDictionary valueByName2 = valueByName1.GetValueByName("ACDB_ANNOTATIONSCALES") as DxfDictionary; if (valueByName2 == null) { return((DxfAnnotationScaleObjectContextData)null); } DxfAnnotationScaleObjectContextData objectContextData = valueByName2.Entries.Select <IDictionaryEntry, DxfAnnotationScaleObjectContextData>((Func <IDictionaryEntry, DxfAnnotationScaleObjectContextData>)(ctxDataEntry => (DxfAnnotationScaleObjectContextData)ctxDataEntry.Value)).FirstOrDefault <DxfAnnotationScaleObjectContextData>((Func <DxfAnnotationScaleObjectContextData, bool>)(ctx => ctx.IsDefault)); if (objectContextData == null && returnAny && valueByName2.Entries.Count != 0) { return((DxfAnnotationScaleObjectContextData)valueByName2.Entries[0].Value); } return(objectContextData); }
public void DictionaryRoundTripTest2() { // dictionary with sub-dictionary wit DICTIONARYVAR value var dict1 = new DxfDictionary(); var dict2 = new DxfDictionary(); dict1["key-1"] = dict2; dict2["key-2"] = new DxfDictionaryVariable() { Value = "value-2" }; var file = new DxfFile(); file.Clear(); file.Header.Version = DxfAcadVersion.R2000; file.Objects.Add(dict1); var text = ToString(file); var parsedFile = Parse(text); var roundTrippedDict1 = parsedFile.Objects.OfType <DxfDictionary>().First(d => d.ContainsKey("key-1")); var roundTrippedDict2 = (DxfDictionary)roundTrippedDict1["key-1"]; Assert.Equal("value-2", ((DxfDictionaryVariable)roundTrippedDict2["key-2"]).Value); }
public virtual void ResolveReferences(Class374 modelBuilder) { if (this.ulong_0 != 0UL && this.dxfHandledObject_0.OwnerObjectSoftReference == null) { DxfHandledObject dxfHandledObject = modelBuilder.method_3(this.ulong_0); if (dxfHandledObject != null) { this.dxfHandledObject_0.vmethod_2((IDxfHandledObject)dxfHandledObject); } } if (this.ulong_1 != 0UL) { DxfDictionary dxfDictionary = modelBuilder.method_4 <DxfDictionary>(this.ulong_1); if (dxfDictionary != null) { this.dxfHandledObject_0.ExtensionDictionary = dxfDictionary; } } modelBuilder.ResolveReferences((ICollection <Interface10>) this.linkedList_0); if (this.list_0 == null) { return; } foreach (ulong handle in this.list_0) { DxfHandledObject reactor = modelBuilder.method_3(handle); if (reactor != null) { this.dxfHandledObject_0.AddPersistentReactor(reactor); } } }
public void WriteDictionaryTest1() { // dictionary with simple DICTIONARYVAR values var dict = new DxfDictionary(); dict["key-1"] = new DxfDictionaryVariable() { Value = "value-1" }; dict["key-2"] = new DxfDictionaryVariable() { Value = "value-2" }; EnsureFileContainsObject(dict, @" 0 DICTIONARY 5 # 100 AcDbDictionary 281 0 3 key-1 350 # 3 key-2 350 # 0 DICTIONARYVAR 5 # 330 # 100 DictionaryVariables 280 0 1 value-1 0 DICTIONARYVAR 5 # 330 # 100 DictionaryVariables 280 0 1 value-2 ", DxfAcadVersion.R2000); }
public void WriteDictionaryWithNullValueTest() { var dict = new DxfDictionary(); dict["key"] = null; var file = new DxfFile(); file.Header.Version = DxfAcadVersion.R2000; file.Objects.Add(dict); var _text = ToString(file); }
public void WriteDictionaryTest2() { // dictionary with sub-dictionary with DICTIONARYVAR value var dict1 = new DxfDictionary(); var dict2 = new DxfDictionary(); dict1["key-1"] = dict2; dict2["key-2"] = new DxfDictionaryVariable() { Value = "value-2" }; EnsureFileContainsObject(dict1, @" 0 DICTIONARY 5 # 100 AcDbDictionary 281 0 3 key-1 350 # 0 DICTIONARY 5 # 330 # 100 AcDbDictionary 281 0 3 key-2 350 # 0 DICTIONARYVAR 5 # 330 # 100 DictionaryVariables 280 0 1 value-2 ", DxfAcadVersion.R2000); }
internal void Normalize() { if (Objects.FirstOrDefault()?.ObjectType != DxfObjectType.Dictionary) { // first object must be a dictionary Objects.Insert(0, new DxfDictionary()); } // now ensure that dictionary contains the expected values var dict = (DxfDictionary)Objects.First(); if (!dict.ContainsKey("ACAD_GROUP") || !(dict["ACAD_GROUP"] is DxfDictionary)) { dict["ACAD_GROUP"] = new DxfDictionary(); } }
internal override void vmethod_10(DxfModel model) { base.vmethod_10(model); DxfAnnotationScaleObjectContextData.smethod_8((DxfEntity)this); this.bool_2 = Class1064.smethod_0((DxfHandledObject)this.Block, model); if (!this.bool_2 || DxfAnnotationScaleObjectContextData.smethod_5((DxfHandledObject)this, true) != null) { return; } DxfScale currentAnnotationScale = model.Header.CurrentAnnotationScale; DxfInsert dxfInsert = this; dxfInsert.scaleFactor = dxfInsert.scaleFactor / currentAnnotationScale.ScaleFactor; DxfDictionary dxfDictionary = DxfAnnotationScaleObjectContextData.smethod_6((DxfHandledObject)this); DxfAnnotationScaleObjectContextData contextData = this.CreateContextData(currentAnnotationScale); contextData.IsDefault = true; dxfDictionary.Entries.Add((IDictionaryEntry) new DxfDictionaryEntry("*A", (DxfObject)contextData)); }
public void WriteSelfReferencingObjectRoundTripTest() { var dict = new DxfDictionary(); dict["key"] = dict; var file = new DxfFile(); file.Clear(); file.Header.Version = DxfAcadVersion.R14; file.Objects.Add(dict); var text = ToString(file); file = Parse(text); dict = file.Objects.OfType <DxfDictionary>().Single(d => d.ContainsKey("key")); Assert.Equal(((IDxfItemInternal)dict).Handle, ((IDxfItemInternal)dict).OwnerHandle); Assert.Equal(((IDxfItemInternal)dict).Handle, ((IDxfItemInternal)dict["key"]).OwnerHandle); }
internal static void smethod_8(DxfEntity obj) { if (DxfScale.smethod_2(obj.Layer) == null) { return; } DxfLayer oldLayer; DxfScale scale = DxfScale.smethod_4(obj.Layer, out oldLayer); if (scale == null) { return; } DxfAnnotationScaleObjectContextData contextData = ((IAnnotative)obj).CreateContextData(scale); obj.Layer = oldLayer; DxfDictionary dxfDictionary = DxfAnnotationScaleObjectContextData.smethod_6((DxfHandledObject)obj); dxfDictionary.Entries.Clear(); dxfDictionary.Entries.Add((IDictionaryEntry) new DxfDictionaryEntry("*A", (DxfObject)contextData)); }
internal static double smethod_9(DxfEntity obj, DxfScale scale) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type DxfAnnotationScaleObjectContextData.Class357 class357 = new DxfAnnotationScaleObjectContextData.Class357(); // ISSUE: reference to a compiler-generated field class357.dxfScale_0 = scale; if (obj.ExtensionDictionary == null) { return(1.0); } DxfDictionary valueByName1 = obj.ExtensionDictionary.GetValueByName("AcDbContextDataManager") as DxfDictionary; if (valueByName1 == null) { return(1.0); } DxfDictionary valueByName2 = valueByName1.GetValueByName("ACDB_ANNOTATIONSCALES") as DxfDictionary; if (valueByName2 == null) { return(1.0); } // ISSUE: reference to a compiler-generated method DxfAnnotationScaleObjectContextData objectContextData1 = valueByName2.Entries.Select <IDictionaryEntry, DxfAnnotationScaleObjectContextData>((Func <IDictionaryEntry, DxfAnnotationScaleObjectContextData>)(ctxDataEntry => (DxfAnnotationScaleObjectContextData)ctxDataEntry.Value)).FirstOrDefault <DxfAnnotationScaleObjectContextData>(new Func <DxfAnnotationScaleObjectContextData, bool>(class357.method_0)); if (objectContextData1 == null || objectContextData1.IsDefault) { return(1.0); } DxfAnnotationScaleObjectContextData objectContextData2 = valueByName2.Entries.Select <IDictionaryEntry, DxfAnnotationScaleObjectContextData>((Func <IDictionaryEntry, DxfAnnotationScaleObjectContextData>)(ctxDataEntry => (DxfAnnotationScaleObjectContextData)ctxDataEntry.Value)).FirstOrDefault <DxfAnnotationScaleObjectContextData>((Func <DxfAnnotationScaleObjectContextData, bool>)(ctx => ctx.IsDefault)); if (objectContextData2 == null) { return(1.0); } return(objectContextData1.Scale.ScaleFactor / objectContextData2.Scale.ScaleFactor); }
internal static DxfAnnotationScaleObjectContextData smethod_4( DxfHandledObject obj, DxfScale scale, bool ignoreDefault) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type DxfAnnotationScaleObjectContextData.Class356 class356 = new DxfAnnotationScaleObjectContextData.Class356(); // ISSUE: reference to a compiler-generated field class356.dxfScale_0 = scale; // ISSUE: reference to a compiler-generated field if (obj.ExtensionDictionary == null || class356.dxfScale_0 == null) { return((DxfAnnotationScaleObjectContextData)null); } DxfDictionary valueByName1 = obj.ExtensionDictionary.GetValueByName("AcDbContextDataManager") as DxfDictionary; if (valueByName1 == null) { return((DxfAnnotationScaleObjectContextData)null); } DxfDictionary valueByName2 = valueByName1.GetValueByName("ACDB_ANNOTATIONSCALES") as DxfDictionary; if (valueByName2 == null) { return((DxfAnnotationScaleObjectContextData)null); } // ISSUE: reference to a compiler-generated method DxfAnnotationScaleObjectContextData objectContextData = valueByName2.Entries.Select <IDictionaryEntry, DxfAnnotationScaleObjectContextData>((Func <IDictionaryEntry, DxfAnnotationScaleObjectContextData>)(ctxDataEntry => (DxfAnnotationScaleObjectContextData)ctxDataEntry.Value)).FirstOrDefault <DxfAnnotationScaleObjectContextData>(new Func <DxfAnnotationScaleObjectContextData, bool>(class356.method_0)); if (ignoreDefault && objectContextData != null && objectContextData.IsDefault) { return((DxfAnnotationScaleObjectContextData)null); } return(objectContextData); }
internal static DxfDictionary smethod_7( DxfHandledObject obj, bool createIfNotFound) { if (obj.ExtensionDictionary == null) { if (!createIfNotFound) { return((DxfDictionary)null); } obj.ExtensionDictionary = new DxfDictionary(); } DxfDictionary dxfDictionary1 = obj.ExtensionDictionary.GetValueByName("AcDbContextDataManager") as DxfDictionary; if (dxfDictionary1 == null) { if (!createIfNotFound) { return((DxfDictionary)null); } dxfDictionary1 = new DxfDictionary(); obj.ExtensionDictionary.Entries.Add((IDictionaryEntry) new DxfDictionaryEntry("AcDbContextDataManager", (DxfObject)dxfDictionary1)); } DxfDictionary dxfDictionary2 = dxfDictionary1.GetValueByName("ACDB_ANNOTATIONSCALES") as DxfDictionary; if (dxfDictionary2 == null) { if (!createIfNotFound) { return((DxfDictionary)null); } dxfDictionary2 = new DxfDictionary(); dxfDictionary1.Entries.Add((IDictionaryEntry) new DxfDictionaryEntry("ACDB_ANNOTATIONSCALES", (DxfObject)dxfDictionary2)); } return(dxfDictionary2); }
public override void ResolveReferences(Class374 modelBuilder) { base.ResolveReferences(modelBuilder); foreach (Class567 class567 in this.list_1) { class567.ResolveReferences(modelBuilder); } bool flag = false; DxfDictionary extensionDictionary = this.dxfTableStyle_0.ExtensionDictionary; if (extensionDictionary != null && extensionDictionary.Entries.Count > 0) { IDictionaryEntry first = extensionDictionary.Entries.GetFirst("ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP"); if (first != null) { DxfCellStyleMap key = first.Value as DxfCellStyleMap; Class264 class264; if (key != null && modelBuilder.CellStyleMapBuilders.TryGetValue(key, out class264)) { class264.ResolveReferences(modelBuilder, this.dxfTableStyle_0); flag = true; } } } if (flag) { return; } if (this.dxfTableStyle_0.DataCellStyle == null && this.list_1.Count > 0) { DxfTableCellStyle cellStyle = this.list_1[0].CellStyle; if (string.IsNullOrEmpty(cellStyle.Name)) { cellStyle.Name = "_DATA"; } this.dxfTableStyle_0.method_8(cellStyle); } if (this.dxfTableStyle_0.TitleCellStyle == null && this.list_1.Count > 1) { DxfTableCellStyle cellStyle = this.list_1[1].CellStyle; if (string.IsNullOrEmpty(cellStyle.Name)) { cellStyle.Name = "_TITLE"; } this.dxfTableStyle_0.method_10(cellStyle); } if (this.dxfTableStyle_0.HeaderCellStyle == null && this.list_1.Count > 2) { DxfTableCellStyle cellStyle = this.list_1[2].CellStyle; if (string.IsNullOrEmpty(cellStyle.Name)) { cellStyle.Name = "_HEADER"; } this.dxfTableStyle_0.method_9(cellStyle); } foreach (Class567 class567 in this.list_1) { if (class567.CellStyle != this.dxfTableStyle_0.TableCellStyle) { DxfTableCellStyle cellStyle = class567.CellStyle; DxfTableCellStyle dxfTableCellStyle; if (this.dxfTableStyle_0.CellStyles.TryGetValue(cellStyle.Name, out dxfTableCellStyle)) { this.dxfTableStyle_0.CellStyles[this.dxfTableStyle_0.CellStyles.IndexOf(dxfTableCellStyle)] = cellStyle; } else { this.dxfTableStyle_0.CellStyles.Add(cellStyle); } } } }
internal DxfMText method_21() { if (this.ExtensionDictionary != null) { DxfObject valueByName = this.ExtensionDictionary.GetValueByName("ACAD_MLATT"); if (valueByName is DxfXRecord) { DxfXRecord dxfXrecord = (DxfXRecord)valueByName; int num = 0; DxfXRecordValueCollection values = dxfXrecord.Values; while (num < values.Count) { DxfXRecordValue dxfXrecordValue = values[num++]; if (dxfXrecordValue.Code == (short)1 && "Embedded Object".Equals(dxfXrecordValue.Value.ToString())) { break; } } if (num < values.Count) { DxfXRecordValueCollection xrecordValueCollection = new DxfXRecordValueCollection(); xrecordValueCollection.AddRange((IEnumerable <DxfXRecordValue>) new DxfXRecordValue[5] { new DxfXRecordValue((short)0, (object)"MTEXT"), new DxfXRecordValue((short)100, (object)"AcDbEntity"), new DxfXRecordValue((short)8, (object)this.Layer.Name), new DxfXRecordValue((short)67, (object)(short)(this.PaperSpace ? 1 : 0)), new DxfXRecordValue((short)100, (object)"AcDbMText") }); while (num < values.Count) { xrecordValueCollection.Add(values[num++]); } Struct18 endGroup = new Struct18(0, (object)"ENDSIM"); DxfModel model = this.Model; if (model == null) { throw new Exception("Cannot get MTEXT substitute when attribute has no parent object."); } DxfMText dxfMtext = DxfReader.smethod_1(model, (Interface33) new Class720(endGroup, (IEnumerable <DxfXRecordValue>)xrecordValueCollection), endGroup) as DxfMText; if (dxfMtext != null) { dxfMtext.method_12((DxfEntity)this); dxfMtext.Style = this.Style; if (this.IsAnnotative) { dxfMtext.IsAnnotative = true; dxfMtext.vmethod_2((IDxfHandledObject)this); DxfDictionary dxfDictionary1 = DxfAnnotationScaleObjectContextData.smethod_7((DxfHandledObject)this, true); DxfDictionary dxfDictionary2 = DxfAnnotationScaleObjectContextData.smethod_7((DxfHandledObject)dxfMtext, true); foreach (IDictionaryEntry entry in (ActiveList <IDictionaryEntry>)dxfDictionary1.Entries) { dxfDictionary2.Entries.Add((IDictionaryEntry) new DxfDictionaryEntry("*A", (DxfObject)((DxfAttributeObjectContextData)entry.Value).Mtext)); } } return(dxfMtext); } } } } return((DxfMText)null); }
public Class332(DxfDictionary dictionary, DxfDictionaryEntry dictionaryEntry, ulong itemHandle) { this.dxfDictionary_0 = dictionary; this.dxfDictionaryEntry_0 = dictionaryEntry; this.ulong_0 = itemHandle; }
public Class332(DxfDictionary dictionary, DxfDictionaryEntry dictionaryEntry) { this.dxfDictionary_0 = dictionary; this.dxfDictionaryEntry_0 = dictionaryEntry; }
public void Visit(DxfDictionary dictionary) { }
public Class262(DxfDictionary dictionary) : base((DxfObject)dictionary) { }
public void Visit(DxfDictionary dictionary) { this.bool_0 = true; }