public new IEnumerator <T> GetEnumerator() { using (DbDictionaryEnumerator enumerator = base.GetEnumerator()) { if (enumerator.MoveNext()) { do { yield return((T)trans.GetObject(enumerator.Current.Value, OpenMode.ForRead, m_includingErased, false)); } while (enumerator.MoveNext()); } } }
public static ArrayList GetLayoutIdList(Database db) { ArrayList layoutList = new ArrayList(); Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager; using (Transaction myT = tm.StartTransaction()) { DBDictionary dic = (DBDictionary)tm.GetObject(db.LayoutDictionaryId, OpenMode.ForRead, false); DbDictionaryEnumerator index = dic.GetEnumerator(); while (index.MoveNext()) { Layout acLayout = tm.GetObject(index.Current.Value, OpenMode.ForRead) as Layout; if (acLayout.LayoutName.Equals("model", StringComparison.InvariantCultureIgnoreCase) || acLayout.LayoutName.Equals("modal", StringComparison.InvariantCultureIgnoreCase)) { layoutList.Add(index.Current.Value); } } myT.Commit(); } return(layoutList); }
public void ReadMapLayer(Transaction t, ObjectId lyrDictionaryID) { DBDictionary dBDictionary = (DBDictionary)t.GetObject(lyrDictionaryID, 0); this.ID = (int)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)90, "ID"); this.ParentLayerID = (int)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)90, "ParentID"); this.Visible = false; if (dBDictionary.Contains("MapLayerName")) { Xrecord xrecord = (Xrecord)t.GetObject(dBDictionary.GetAt("MapLayerName"), 0); TypedValue[] array = xrecord.Data.AsArray(); for (int i = 0; i < array.Length; i++) { TypedValue typedValue = array[i]; if (typedValue.TypeCode == 1) { this.Name = typedValue.Value.ToString(); break; } } } if (dBDictionary.Contains("Visible")) { Xrecord xrecord2 = (Xrecord)t.GetObject(dBDictionary.GetAt("Visible"), 0); TypedValue[] array2 = xrecord2.Data.AsArray(); for (int j = 0; j < array2.Length; j++) { TypedValue typedValue2 = array2[j]; if (typedValue2.TypeCode == 290) { this.Visible = (0 != Convert.ToInt16(typedValue2.Value)); break; } } } this.Layers = new List <MSCMapLayer>(); if (dBDictionary.Contains("ChildLayers")) { DBDictionary dBDictionary2 = (DBDictionary)t.GetObject(dBDictionary.GetAt("ChildLayers"), 0); using (DbDictionaryEnumerator enumerator = dBDictionary2.GetEnumerator()) { while (enumerator.MoveNext()) { DBDictionaryEntry current = enumerator.Current; MSCMapLayer item = new MSCMapLayer(t, current.Key, current.Value); this.Layers.Add(item); } } } }
protected void Read(ObjectId id, Transaction t) { try { DBDictionary dBDictionary = (DBDictionary)t.GetObject(this.AcadDictionaryID, 0); base.RasterObjectId = (ObjectId)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)330, "AutoCADID"); this.ServiceFullName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ServiceFullName"); base.ConnectionName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ConnectionName"); base.ConnectionURL = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ConnectionURL"); base.UserName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "UserName"); base.BoundaryExtent = DocUtil.ReadBoundingBox(t, dBDictionary); base.ExportOptions = new AGSExportOptions(); this.InitExportOptions(); base.ExportOptions.Format = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ImageFormat"); base.ExportOptions.BoundingBox = new Extent(base.BoundaryExtent); base.ExportOptions.OutputWKT = MSCPrj.ReadWKT(base.ParentDataset.ParentDocument); try { base.Dynamic = false; if (dBDictionary.Contains("Dynamic")) { Xrecord xrecord = (Xrecord)t.GetObject(dBDictionary.GetAt("Dynamic"), 0); TypedValue[] array = xrecord.Data.AsArray(); for (int i = 0; i < array.Length; i++) { TypedValue typedValue = array[i]; if (typedValue.TypeCode == 290) { base.Dynamic = (0 != Convert.ToInt16(typedValue.Value)); } } } base.ExportOptions.Dynamic = base.Dynamic; } catch { base.ExportOptions.Dynamic = false; } if (dBDictionary.Contains("ESRI_Layers")) { DBDictionary dBDictionary2 = (DBDictionary)t.GetObject(dBDictionary.GetAt("ESRI_Layers"), 0); using (DbDictionaryEnumerator enumerator = dBDictionary2.GetEnumerator()) { while (enumerator.MoveNext()) { DBDictionaryEntry current = enumerator.Current; MSCMapLayer mSCMapLayer = new MSCMapLayer(t, current.Key, current.Value); mSCMapLayer.ParentMap = this; if (mSCMapLayer.Layers != null) { foreach (MSCMapLayer current2 in mSCMapLayer.Layers) { current2.ParentMap = this; } } this.Layers.Add(mSCMapLayer); } } } if (this.ReconnectService()) { base.RefreshConnectedService(); } } catch { } }