public static void CopyConfigXml(IWorkspace pWks, string Settingname, string SettingPath) { try { SysGisTable mSystable = new Fan.Common.Gis.SysGisTable(pWks); Exception err = null; Dictionary <string, object> pDic = mSystable.GetRow("SYSSETTING", "SETTINGNAME='" + Settingname + "'", out err); if (pDic != null) { if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) //这里仅能成功导出当初以文件类型导入的BLOB字段 { object tempObj = pDic["SETTINGVALUE2"]; IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant; IMemoryBlobStream pMemoryBlobStream = pMemoryBlobStreamVariant as IMemoryBlobStream; if (pMemoryBlobStream != null) { pMemoryBlobStream.SaveToFile(SettingPath); } } } } mSystable = null; if (pDic != null) { pDic.Clear(); pDic = null; } } catch (Exception err2) { } }
public static bool CopySelectedMap(IWorkspace pWorkspace, string strCondition, out IMap pMap) { pMap = null; if (pWorkspace != null) { try { //读取数据库表内容 Fan.Common.Gis.SysGisTable sysTable = new Fan.Common.Gis.SysGisTable(pWorkspace); Exception err = null; Dictionary <string, object> pDic = sysTable.GetRow(_MxdListTable, strCondition, out err); if (pDic != null) { if (pDic.ContainsKey(_MxdListTable_MapField)) { if (pDic[_MxdListTable_MapField] != null) //这里仅能成功导出当初以文件类型导入的BLOB字段 { object tempObj = pDic[_MxdListTable_MapField]; IMemoryBlobStreamVariant pMemoryValue; pMemoryValue = (IMemoryBlobStreamVariant)tempObj; object objValue; pMemoryValue.ExportToVariant(out objValue); byte[] pbyte = objValue as byte[]; IXMLStream pXMLStream = new XMLStream(); pXMLStream.LoadFromBytes(ref pbyte); IStream pStream = pXMLStream as IStream; IPersistStream pPersistStream = new MapClass(); pPersistStream.Load(pStream); pMap = pPersistStream as IMap; sysTable = null; return(true); } } } sysTable = null; } catch (Exception err) { } } return(false); }
public static bool CopySysSettingtoFile(IWorkspace pWorkspace, string strSettingName, string strPath) { Exception eError = null; if (pWorkspace != null) { try { //读取数据库表内容 Fan.Common.Gis.SysGisTable sysTable = new Fan.Common.Gis.SysGisTable(pWorkspace); Exception err = null; Dictionary <string, object> pDic = sysTable.GetRow("SYSSETTING", "SETTINGNAME='" + strSettingName + "'", out err); if (pDic != null) { if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) //这里仅能成功导出当初以文件类型导入的BLOB字段 { object tempObj = pDic["SETTINGVALUE2"]; IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant; IMemoryBlobStream pMemoryBlobStream = pMemoryBlobStreamVariant as IMemoryBlobStream; if (pMemoryBlobStream != null) { pMemoryBlobStream.SaveToFile(strPath); } sysTable = null; return(true); } } } sysTable = null; } catch (Exception err) {} } return(false); }