private bool CopyDirectly()//ref IWorkspace wsSource) { // VCT数据不允许直接复制 if (m_DataType == enumDataType.VCT) { SendMessage(enumMessageType.Exception, "导入VCT数据不允许直接复制"); return(false); } // MDB使用文件复制 if (m_DataType == enumDataType.PGDB) { try { string strDBPath = this.m_TargetPath + "\\" + this.m_TargetName; System.IO.File.Copy(this.m_Datasource, strDBPath); //if (!Hy.Common.Utility.Esri.AEAccessFactory.OpenPGDB(ref wsSource, strDBPath)) //{ // SendMessage(enumMessageType.Exception, "导入数据(复制文件)后打开出错,请确认数据源为正确的PGDB文件"); // return false; //} } catch { SendMessage(enumMessageType.Exception, "导入数据(复制文件)出错"); return(false); } } else // Shp和FileGDB使用文件夹复制 { try { if (m_DataType == enumDataType.SHP) { CopyDirectory(this.m_Datasource, this.m_TargetPath, this.m_TargetName); } else { Hy.Common.Utility.Esri.GPTool gpTool = new Hy.Common.Utility.Esri.GPTool(); gpTool.Copy(this.m_Datasource, this.m_TargetPath + "\\" + this.m_TargetName); } //wsSource = AEAccessFactory.OpenWorkspace(m_DataType, this.m_TargetPath + "\\" + this.m_TargetName); } catch { SendMessage(enumMessageType.Exception, "导入数据(复制文件夹)出错"); return(false); } } return(true); }
private bool CopyToBase(ref IWorkspace wsBase) { // VCT数据不允许直接复制 if (m_DataType == enumDataType.VCT) { SendMessage(enumMessageType.Exception, "导入VCT数据不允许直接复制"); return(false); } //if (ImportingObjectChanged != null) //{ // ImportingObjectChanged("数据复制"); //} // MDB使用文件复制 if (m_DataType == enumDataType.PGDB) { try { string strDBPath = this.m_TargetPath + "\\Base.MDB"; System.IO.File.Copy(this.m_Datasource, strDBPath);//+ COMMONCONST.DB_Name_Base); if (!Hy.Common.Utility.Esri.AEAccessFactory.OpenPGDB(ref wsBase, strDBPath)) { SendMessage(enumMessageType.Exception, "导入数据(复制文件)后打开出错,请确认数据源为正确的PGDB文件"); return(false); } } catch { SendMessage(enumMessageType.Exception, "导入数据(复制文件)出错"); return(false); } } else // Shp和FileGDB使用文件夹复制 { try { string strFolderName = "Base"; if (m_DataType == enumDataType.SHP) { strFolderName = "Base"; CopyDirectory(this.m_Datasource, this.m_TargetPath, strFolderName); } else { strFolderName = COMMONCONST.DB_Name_Base; Hy.Common.Utility.Esri.GPTool gpTool = new Hy.Common.Utility.Esri.GPTool(); gpTool.Copy(this.m_Datasource, this.m_TargetPath + "\\" + strFolderName); } wsBase = AEAccessFactory.OpenWorkspace(m_DataType, this.m_TargetPath + "\\" + strFolderName); } catch { SendMessage(enumMessageType.Exception, "导入数据(复制文件夹)出错"); return(false); } } return(true); }
//ref IWorkspace wsSource) private bool CopyDirectly() { // VCT数据不允许直接复制 if (m_DataType == enumDataType.VCT) { SendMessage(enumMessageType.Exception, "导入VCT数据不允许直接复制"); return false; } // MDB使用文件复制 if (m_DataType == enumDataType.PGDB) { try { string strDBPath = this.m_TargetPath + "\\"+this.m_TargetName; System.IO.File.Copy(this.m_Datasource, strDBPath); //if (!Hy.Common.Utility.Esri.AEAccessFactory.OpenPGDB(ref wsSource, strDBPath)) //{ // SendMessage(enumMessageType.Exception, "导入数据(复制文件)后打开出错,请确认数据源为正确的PGDB文件"); // return false; //} } catch { SendMessage(enumMessageType.Exception, "导入数据(复制文件)出错"); return false; } } else // Shp和FileGDB使用文件夹复制 { try { if (m_DataType == enumDataType.SHP) { CopyDirectory(this.m_Datasource, this.m_TargetPath, this.m_TargetName); } else { Hy.Common.Utility.Esri.GPTool gpTool = new Hy.Common.Utility.Esri.GPTool(); gpTool.Copy(this.m_Datasource, this.m_TargetPath + "\\" + this.m_TargetName); } //wsSource = AEAccessFactory.OpenWorkspace(m_DataType, this.m_TargetPath + "\\" + this.m_TargetName); } catch { SendMessage(enumMessageType.Exception, "导入数据(复制文件夹)出错"); return false; } } return true; }
private bool CopyToBase(ref IWorkspace wsBase) { // VCT数据不允许直接复制 if (m_DataType == enumDataType.VCT) { SendMessage(enumMessageType.Exception, "导入VCT数据不允许直接复制"); return false; } //if (ImportingObjectChanged != null) //{ // ImportingObjectChanged("数据复制"); //} // MDB使用文件复制 if (m_DataType == enumDataType.PGDB) { try { string strDBPath = this.m_TargetPath + "\\Base.MDB"; System.IO.File.Copy(this.m_Datasource, strDBPath);//+ COMMONCONST.DB_Name_Base); if (!Hy.Common.Utility.Esri.AEAccessFactory.OpenPGDB(ref wsBase, strDBPath)) { SendMessage(enumMessageType.Exception, "导入数据(复制文件)后打开出错,请确认数据源为正确的PGDB文件"); return false; } } catch { SendMessage(enumMessageType.Exception, "导入数据(复制文件)出错"); return false; } } else // Shp和FileGDB使用文件夹复制 { try { string strFolderName = "Base"; if (m_DataType == enumDataType.SHP) { strFolderName = "Base"; CopyDirectory(this.m_Datasource, this.m_TargetPath, strFolderName); } else { strFolderName = COMMONCONST.DB_Name_Base; Hy.Common.Utility.Esri.GPTool gpTool = new Hy.Common.Utility.Esri.GPTool(); gpTool.Copy(this.m_Datasource, this.m_TargetPath + "\\" + strFolderName); } wsBase =AEAccessFactory.OpenWorkspace(m_DataType, this.m_TargetPath + "\\" + strFolderName); } catch { SendMessage(enumMessageType.Exception, "导入数据(复制文件夹)出错"); return false; } } return true; }