public void Connect() { this.idataServerManager_0.Connect(); IEnumBSTR geodatabaseNames = (this.idataServerManager_0 as IDataServerManagerAdmin).GetGeodatabaseNames(); geodatabaseNames.Reset(); for (string str = geodatabaseNames.Next(); str != null; str = geodatabaseNames.Next()) { IGxObject obj2 = new GxGDSGeodatabase(str, this.idataServerManager_0); obj2.Attach(this, this.igxCatalog_0); } }
/// <summary> /// 保存发生更新变化的所有的要素信息 /// </summary> /// <param name="eError"></param> /// <returns></returns> public Dictionary <string, Dictionary <int, List <IRow> > > GetModifyClsInfo(out Exception eError) { eError = null; Dictionary <string, Dictionary <int, List <IRow> > > feaChangeDic = null; //获得命名空间下发生变化的信息 IWorkspaceEdit2 pWSEdit2 = v_WSEdit as IWorkspaceEdit2; if (pWSEdit2 == null) { eError = new Exception("编辑工作空间为空!"); return(null); } //获取在一个编辑会话中发生更新变化数据 IDataChangesEx pDataChangeEx = pWSEdit2.get_EditDataChanges(esriEditDataChangesType.esriEditDataChangesWithinSession); if (pDataChangeEx == null) { eError = new Exception("未发现更新变化数据!"); return(null); } feaChangeDic = new Dictionary <string, Dictionary <int, List <IRow> > >(); //获取发生更新变化的要素类集合 IEnumBSTR pEnumString = pDataChangeEx.ModifiedClasses; //发生变化的要素类 pEnumString.Reset(); string pModifyClsName = "";//发生更新变化的要素类名称 pModifyClsName = pEnumString.Next(); //遍历发生更新变化的要素类,并将相关信息保存下来 while (pModifyClsName != null) { IDifferenceCursorEx pDifCusorEx = null; //游标 int pFeaOid = -1; //要素OID IRow pSourceRow = null; //正在编辑的冲突要素行 IRow pDifRow = null; //上一编辑版本的冲突要素行 ILongArray pDifIndices = null; //字段索引 if (pModifyClsName.Contains(".")) { pModifyClsName = pModifyClsName.Substring(pModifyClsName.IndexOf('.') + 1); } Dictionary <int, List <IRow> > stateRowDic = new Dictionary <int, List <IRow> >(); List <IRow> rowLst = null; #region 保存新增加的要素信息 rowLst = new List <IRow>(); //新增数据游标 pDifCusorEx = pDataChangeEx.ExtractEx(pModifyClsName, esriDifferenceType.esriDifferenceTypeInsert); if (pDifCusorEx == null) { eError = new Exception("获取新增数据的游标发生错误!"); return(null); } pDifCusorEx.Next(out pFeaOid, out pSourceRow, out pDifRow, out pDifIndices);//pDifRow=null //遍历新增加的要素oid,并将其保存起来 while (pFeaOid != -1) { //将新增数据保存起来 if (!rowLst.Contains(pSourceRow)) { rowLst.Add(pSourceRow); } pDifCusorEx.Next(out pFeaOid, out pSourceRow, out pDifRow, out pDifIndices); } if (rowLst != null) { if (rowLst.Count > 0) { stateRowDic.Add(1, rowLst); } } #endregion #region 保存修改后的要素信息 rowLst = new List <IRow>(); //修改数据游标 pDifCusorEx = pDataChangeEx.ExtractEx(pModifyClsName, esriDifferenceType.esriDifferenceTypeUpdateNoChange); if (pDifCusorEx == null) { eError = new Exception("获取修改数据的游标发生错误!"); return(null); } pDifCusorEx.Next(out pFeaOid, out pSourceRow, out pDifRow, out pDifIndices); //遍历修改后的要素OID,并将其保存起来 while (pFeaOid != -1) { //将修改后的数据保存起来 if (!rowLst.Contains(pSourceRow)) { rowLst.Add(pSourceRow); } pDifCusorEx.Next(out pFeaOid, out pSourceRow, out pDifRow, out pDifIndices); } if (rowLst != null) { if (rowLst.Count > 0) { stateRowDic.Add(2, rowLst); } } #endregion #region 保存删除的要素信息 rowLst = new List <IRow>(); //删除数据游标 pDifCusorEx = pDataChangeEx.ExtractEx(pModifyClsName, esriDifferenceType.esriDifferenceTypeDeleteNoChange); if (pDifCusorEx == null) { eError = new Exception("获取删除数据的游标发生错误!"); return(null); } pDifCusorEx.Next(out pFeaOid, out pSourceRow, out pDifRow, out pDifIndices);//pSourceRow //遍历删除的要素OID,并将其保存起来 while (pFeaOid != -1) { //将删除的数据保存起来(数据库版本数据) if (!rowLst.Contains(pDifRow)) { rowLst.Add(pDifRow); } pDifCusorEx.Next(out pFeaOid, out pSourceRow, out pDifRow, out pDifIndices); } if (rowLst != null) { if (rowLst.Count > 0) { stateRowDic.Add(3, rowLst); } } #endregion if (!feaChangeDic.ContainsKey(pModifyClsName)) { feaChangeDic.Add(pModifyClsName, stateRowDic); } pModifyClsName = pEnumString.Next(); } return(feaChangeDic); }
private void method_1() { try { object obj2; object obj3; IGxObject obj4; this.ipropertySet_0.GetAllProperties(out obj2, out obj3); string[] strArray = (string[])obj2; if ((strArray.Length == 6) && (strArray[1] == "MANAGERURL")) { obj4 = new GxAddAGSObject(); obj4.Attach(this, this.igxCatalog_0); } if (this.iagsserverConnection2_0 != null) { IEnumBSTR folders = this.iagsserverConnection2_0.GetFolders(""); folders.Reset(); for (string str = folders.Next(); str != null; str = folders.Next()) { IGxServersFolder folder = new GxServersFolder { AGSServerConnection = this.iagsserverConnection2_0, FolderName = str }; (folder as IGxObject).Attach(this, this.igxCatalog_0); } IAGSEnumServerObjectName name = this.iagsserverConnection2_0.get_ServerObjectNamesEx(""); name.Reset(); for (IAGSServerObjectName name2 = name.Next(); name2 != null; name2 = name.Next()) { bool flag; if (name2.Type.ToLower() == "mapserver") { if (this.method_0(name2.Name)) { obj4 = new GxAGSMap(); (obj4 as IGxAGSObject).AGSServerObjectName = name2; flag = true; if ((this.ConnectionMode == 0) && ((obj4 as IGxAGSObject).Status != "Started")) { flag = false; } if (flag) { obj4.Attach(this, this.igxCatalog_0); } } } else if (name2.Type.ToLower() == "gpserver") { if (this.method_0(name2.Name)) { obj4 = new GxGPServer(); (obj4 as IGxAGSObject).AGSServerObjectName = name2; flag = true; if ((this.ConnectionMode == 0) && ((obj4 as IGxAGSObject).Status != "Started")) { flag = false; } if (flag) { obj4.Attach(this, this.igxCatalog_0); } } } else if (name2.Type.ToLower() == "featureserver") { if (this.ConnectionMode == 0) { obj4 = new GxFeatureService(); (obj4 as IGxAGSObject).AGSServerObjectName = name2; if ((obj4 as IGxAGSObject).Status == "Started") { obj4.Attach(this, this.igxCatalog_0); } } } else if ((name2.Type.ToLower() == "geometryserver") && (this.ConnectionMode > 0)) { obj4 = new GxGeometryServer(); (obj4 as IGxAGSObject).AGSServerObjectName = name2; obj4.Attach(this, this.igxCatalog_0); } } } } catch (Exception exception) { MessageBox.Show(exception.Message); Logger.Current.Error("", exception, ""); } }