public static void LoadLayerFromStream(ILayer paramLayer, byte[] paramLayerContent) { if (((paramLayer != null) && (paramLayerContent != null)) && (paramLayerContent.Length != 0)) { IPersistStream stream = paramLayer as IPersistStream; XMLStream class2 = new XMLStream(); class2.LoadFromBytes(ref paramLayerContent); stream.Load((IStream)class2); } }
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); }