// 准备可选的缺省绑定内容 int PrepareDefaultBindings(string strTail, out string [] default_urls, out string strError) { default_urls = null; strError = ""; // 无法检查 if (this.VerifyBindings == null) { default_urls = new string[] { "net.tcp://localhost:8002/dp2library/" + strTail, "net.pipe://localhost/dp2library/" + strTail, "http://localhost:8001/dp2library/" + strTail, "rest.http://localhost:8001/dp2library/" + strTail, "basic.http://localhost:8001/dp2library/" + strTail }; return 0; } string strTcpUrl = ""; for (int nPort = 8002; ; nPort++) { strTcpUrl = "net.tcp://localhost:" + nPort.ToString() + "/dp2library/" + strTail; VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = strTcpUrl; this.VerifyBindings(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == true) { break; } } string strPipeUrl = ""; for (int nNumber = 0; ; nNumber++) { strPipeUrl = "net.pipe://localhost/dp2library/" + strTail; if (nNumber > 0) strPipeUrl += nNumber.ToString() + "/"; VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = strPipeUrl; this.VerifyBindings(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == true) { break; } } string strHttpUrl = ""; for (int nPort = 8001; ; nPort++) { strHttpUrl = "http://localhost:" + nPort.ToString() + "/dp2library/" + strTail; VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = strHttpUrl; this.VerifyBindings(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == true) { break; } } string strRestUrl = ""; for (int nPort = 8001; ; nPort++) { strRestUrl = "rest.http://localhost:" + nPort.ToString() + "/dp2library/rest/" + strTail; VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = strRestUrl; this.VerifyBindings(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == true) { break; } } string strBasicUrl = ""; for (int nPort = 8001; ; nPort++) { strBasicUrl = "basic.http://localhost:" + nPort.ToString() + "/dp2library/basic/" + strTail; VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = strBasicUrl; this.VerifyBindings(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == true) { break; } } default_urls = new string[] { strTcpUrl, strPipeUrl, strHttpUrl, strRestUrl, strBasicUrl, }; return 0; }
// 检测目录是否已经存在 private void textBox_dataDir_Leave(object sender, EventArgs e) { // 已经准备Cancel,就不检查了 if (IsMouseOnCancelButton() == true) return; // 新建时 if (IsNew == true && String.IsNullOrEmpty(this.textBox_dataDir.Text) == false && this.LoadedDataDir != this.textBox_dataDir.Text) { // 注意检查,不能是别的instance的数据目录 if (this.VerifyDataDir != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.textBox_dataDir.Text; this.VerifyDataDir(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { MessageBox.Show(this, e1.ErrorInfo); return; } } string strXmlFilename = PathUtil.MergePath(this.textBox_dataDir.Text, "library.xml"); if (File.Exists(strXmlFilename) == true) { DialogResult result = MessageBox.Show(ForegroundWindow.Instance, "您指定的数据目录 '" + this.textBox_dataDir.Text + "' 中已经存在 library.xml 文件。\r\n\r\n是否要直接利用其中的配置信息?", "安装 dp2Library", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.No) { this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复询问 return; } if (this.LoadXmlFileInfo != null) { LoadXmlFileInfoEventArgs e1 = new LoadXmlFileInfoEventArgs(); e1.DataDir = this.textBox_dataDir.Text; this.LoadXmlFileInfo(this, e1); if (string.IsNullOrEmpty(e1.ErrorInfo) == false) { MessageBox.Show(this, e1.ErrorInfo); return; } // refresh this.LineInfo = (LineInfo)e1.LineInfo; Refreshdp2KernelDef(); RefreshSupervisorUserInfo(); RefreshLibraryName(); RefreshUpdateCfgsDir(); this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复装载 this.m_bDataDirExist = true; // 防止OK时不合适的检查警告 } } return; } // 修改时 if (IsNew == false && String.IsNullOrEmpty(this.textBox_dataDir.Text) == false && this.LoadedDataDir != this.textBox_dataDir.Text) { // 注意检查,不能是别的instance的数据目录 if (this.VerifyDataDir != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.textBox_dataDir.Text; this.VerifyDataDir(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { MessageBox.Show(this, e1.ErrorInfo); return; } } string strXmlFilename = PathUtil.MergePath(this.textBox_dataDir.Text, "library.xml"); if (File.Exists(strXmlFilename) == true) { DialogResult result = MessageBox.Show(ForegroundWindow.Instance, "您指定的数据目录 '" + this.textBox_dataDir.Text + "' 中已经存在 library.xml 文件。\r\n\r\n是否要直接利用其中的配置信息?\r\n\r\n是:直接利用其中的信息,也即将其中的配置信息装入当前对话框\r\n否:利用这个数据目录,但其中xml文件的相关信息即将被当前对话框中的值覆盖\r\n\r\n(提示:无论您选“是”“否”,原有目录 '" + this.LoadedDataDir + "' 都会被闲置)", "安装 dp2Library", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.No) { this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复询问 return; } if (this.LoadXmlFileInfo != null) { LoadXmlFileInfoEventArgs e1 = new LoadXmlFileInfoEventArgs(); e1.DataDir = this.textBox_dataDir.Text; this.LoadXmlFileInfo(this, e1); if (string.IsNullOrEmpty(e1.ErrorInfo) == false) { MessageBox.Show(this, e1.ErrorInfo); return; } // refresh this.LineInfo = (LineInfo)e1.LineInfo; Refreshdp2KernelDef(); RefreshSupervisorUserInfo(); RefreshLibraryName(); RefreshUpdateCfgsDir(); this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复装载 this.m_bDataDirExist = true; // 防止OK时不合适的检查警告 } } else if (String.IsNullOrEmpty(this.LoadedDataDir) == false) { // 修改目录名 DialogResult result = MessageBox.Show(ForegroundWindow.Instance, "要将已经存在的数据目录 '" + this.LoadedDataDir + "' 更名为 '"+this.textBox_dataDir.Text+"' 么?\r\n\r\n(如果选择“否”,则安装程序在稍后将新创建一个数据目录,并复制进初始内容)", "安装 dp2Library", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.No) { this.m_bDataDirExist = false; return; } try { // TODO: 需要测试当数据目录中内容尺寸太大,而目标盘无妨容纳时的报错情况 Directory.Move(this.LoadedDataDir, this.textBox_dataDir.Text); this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复装载 } catch (Exception ex) { MessageBox.Show(this, "将已经存在的数据目录 '" + this.LoadedDataDir + "' 更名为 '"+this.textBox_dataDir.Text+"' 时发生错误: " + ex.Message); } } return; } }
void modify_instance_dlg_VerifyInstanceName(object sender, VerifyEventArgs e) { bool bRet = IsInstanceNameDup(e.Value, this.m_currentEditItem); if (bRet == true) e.ErrorInfo = "实例名 '" + e.Value + "' 和已存在的其他实例发生了重复"; }
private void button_OK_Click(object sender, EventArgs e) { string strError = ""; // 检查 // 数据目录 if (String.IsNullOrEmpty(this.textBox_dataDir.Text) == true) { strError = "尚未指定数据目录"; goto ERROR1; } // dp2Kernel服务器信息 if (String.IsNullOrEmpty(this.textBox_dp2KernelDef.Text) == true) { strError = "尚未指定dp2Kernel服务器信息"; goto ERROR1; } // 协议绑定 if (String.IsNullOrEmpty(this.textBox_bindings.Text) == true) { strError = "尚未指定协议绑定信息"; goto ERROR1; } // 图书馆名 if (String.IsNullOrEmpty(this.textBox_libraryName.Text) == true) { strError = "尚未指定图书馆名"; goto ERROR1; } if (this.LineInfo == null) this.LineInfo = new DigitalPlatform.LibraryServer.LineInfo(); this.LineInfo.LibraryName = this.textBox_libraryName.Text; this.LineInfo.UpdateCfgsDir = this.checkBox_updateCfgsDir.Checked; // 检查是否为旧式url地址 string strKernelUrl = this.LineInfo.KernelUrl; if (strKernelUrl.IndexOf(".asmx") != -1) { strError = "安装程序发现当前使用了旧版本数据库内核的地址 '" + strKernelUrl + "',需要您将它修改为新版dp2Kernel(内核)的URL地址。"; goto ERROR1; } if (this.IsNew == true && this.m_bDataDirExist == false) { // supervisor用户信息 if (this.LineInfo.SupervisorUserName == null || this.LineInfo.SupervisorPassword == null || this.LineInfo.SupervisorRights == null) { strError = "尚未设定supervisor账户的用户名、密码、权限"; goto ERROR1; } } // 如果修改时,需要创建新的数据目录 if (this.IsNew == false) { // 探测数据目录,是否已经存在数据,是不是属于升级情形 // return: // -1 error // 0 数据目录不存在 // 1 数据目录存在,但是xml文件不存在 // 2 xml文件已经存在 int nRet = LibraryInstallHelper.DetectDataDir(this.textBox_dataDir.Text, out strError); if (nRet == -1) { strError = "探测数据目录 '" + this.textBox_dataDir.Text + "' 是否存在时,出现错误: " + strError; goto ERROR1; } if (nRet == 0 || nRet == 1) { // supervisor用户信息 if (this.LineInfo.SupervisorUserName == null || this.LineInfo.SupervisorPassword == null || this.LineInfo.SupervisorRights == null) { strError = "尚未设定supervisor账户的用户名、密码、权限"; goto ERROR1; } } } // TODO: 如果在编辑状态,需要排除和listview中自己重的情况 if (this.VerifyInstanceName != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.textBox_instanceName.Text; this.VerifyInstanceName(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; goto ERROR1; } } if (this.VerifyDataDir != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.textBox_dataDir.Text; this.VerifyDataDir(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; goto ERROR1; } } if (this.VerifyBindings != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.textBox_bindings.Text; this.VerifyBindings(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; goto ERROR1; } } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); return; ERROR1: MessageBox.Show(this, strError); }
void new_instance_dlg_VerifyInstanceName(object sender, VerifyEventArgs e) { bool bRet = IsInstanceNameDup(e.Value, (ListViewItem)null); if (bRet == true) e.ErrorInfo = "实例名 '" + e.Value + "' 和已存在的其他实例发生了重复"; }
void modify_instance_dlg_VerifyDataDir(object sender, VerifyEventArgs e) { bool bRet = IsDataDirDup(e.Value, this.m_currentEditItem); if (bRet == true) e.ErrorInfo = "数据目录 '" + e.Value + "' 和已存在的其他实例发生了重复"; }
void modify_instance_dlg_VerifyBindings(object sender, VerifyEventArgs e) { string strError = ""; // return: // -1 出错 // 0 不重 // 1 重复 int nRet = IsBindingDup(e.Value, this.m_currentEditItem, out strError); if (nRet != 0) { e.ErrorInfo = strError; return; } nRet = InstallHelper.IsGlobalBindingDup(e.Value, "dp2Library", out strError); if (nRet != 0) { e.ErrorInfo = strError; return; } }
void new_instance_dlg_VerifyDataDir(object sender, VerifyEventArgs e) { bool bRet = IsDataDirDup(e.Value, (ListViewItem)null); if (bRet == true) e.ErrorInfo = "数据目录 '" + e.Value + "' 和已存在的其他实例发生了重复"; }
void new_instance_dlg_VerifyBindings(object sender, VerifyEventArgs e) { string strError = ""; // return: // -1 出错 // 0 不重 // 1 重复 int nRet = IsBindingDup(e.Value, (ListViewItem)null, out strError); if (nRet != 0) { e.ErrorInfo = strError; return; } nRet = InstallHelper.IsGlobalBindingDup(e.Value, "dp2Library", out strError); if (nRet != 0) { e.ErrorInfo = strError; return; } }
private void button_OK_Click(object sender, EventArgs e) { string strError = ""; int nRet = 0; // 检查 if (String.IsNullOrEmpty(this.comboBox_site.Text) == true) { strError = "尚未指定站点名"; goto ERROR1; } if (String.IsNullOrEmpty(this.textBox_instanceName.Text) == true) { strError = "尚未指定虚拟目录名"; goto ERROR1; } if (this.textBox_instanceName.Text[0] != '/') { strError = "虚拟目录名第一字符必须为 '/'"; goto ERROR1; } string strVirtualDirRight = this.textBox_instanceName.Text.Substring(1); if (strVirtualDirRight.IndexOfAny(new char[] { '/', ' ' }) != -1) { strError = "虚拟目录名第一字符以外的字符中,不允许包含 '/' 或空格字符"; goto ERROR1; } // 数据目录 if (String.IsNullOrEmpty(this.textBox_dataDir.Text) == true) { strError = "尚未指定数据目录"; goto ERROR1; } // dp2Library 服务器信息 if (String.IsNullOrEmpty(this.textBox_dp2LibraryDef.Text) == true) { strError = "尚未指定 dp2Library 服务器信息"; goto ERROR1; } if (this.LineInfo == null) this.LineInfo = new DigitalPlatform.OPAC.LineInfo(); // 检查是否为旧式url地址 string strUrl = this.LineInfo.LibraryUrl; if (strUrl.IndexOf(".asmx") != -1) { strError = "安装程序发现当前使用了旧版本 dp2LibraryWs 的地址 '" + strUrl + "',需要您将它修改为新版 dp2Library (图书馆应用服务器) 的 URL 地址。"; goto ERROR1; } if (this.CreateMode == true && this.m_bDataDirExist == false) { // opac 用户信息 if (this.LineInfo.LibraryUserName == null || this.LineInfo.LibraryPassword == null) { strError = "尚未设定 opac 账户的用户名、密码"; goto ERROR1; } } // 如果修改时,需要创建新的数据目录 if (this.CreateMode == false) { // 探测数据目录,是否已经存在数据,是不是属于升级情形 // return: // -1 error // 0 数据目录不存在 // 1 数据目录存在,但是xml文件不存在 // 2 xml文件已经存在 nRet = InstanceDialog.DetectDataDir(this.textBox_dataDir.Text, out strError); if (nRet == -1) { strError = "探测数据目录 '" + this.textBox_dataDir.Text + "' 是否存在时,出现错误: " + strError; goto ERROR1; } if (nRet == 0 || nRet == 1) { // opac 用户信息 if (this.LineInfo.LibraryUserName == null || this.LineInfo.LibraryPassword == null) { strError = "尚未设定 opac 账户的用户名、密码"; goto ERROR1; } } } // 处理数据目录更名情况 nRet = RenameDataDir(out strError); if (nRet == -1) goto ERROR1; // TODO: 如果在编辑状态,需要排除和 listview 中自己重的情况 if (this.VerifyInstanceName != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.comboBox_site.Text + this.textBox_instanceName.Text; this.VerifyInstanceName(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; goto ERROR1; } } if (this.VerifyDataDir != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.textBox_dataDir.Text; this.VerifyDataDir(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; goto ERROR1; } } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); return; ERROR1: MessageBox.Show(this, strError); }
void SetDefaultVirtualDirValue() { string strError = ""; List<OpacAppInfo> infos = null; // 用 appcmd 方式获得 所有虚拟目录的信息 (不仅仅是 dp2OPAC 虚拟目录) int nRet = OpacAppInfo.GetAllVirtualInfoByAppCmd(out infos, out strError); if (nRet == -1) goto ERROR1; for (int i = 0; ; i++) { string strVirtualDir = "/dp2OPAC"; if (i > 0) strVirtualDir = "/dp2OPAC" + (i + 1).ToString(); // 已经存在的虚拟目录不能使用 // 查找一个虚拟目录是否存在 // return: // -1 不存在 // 其他 数组元素的下标 nRet = OpacAppInfo.Find(infos, this.comboBox_site.Text, strVirtualDir); if (nRet != -1) continue; // 注意检查,不能是别的instance的数据目录 if (this.VerifyDataDir != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = strVirtualDir; this.VerifyDataDir(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) continue; } if (this.VerifyInstanceName != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.comboBox_site.Text + strVirtualDir; this.VerifyInstanceName(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) continue; } this.textBox_instanceName.Text = strVirtualDir; return; } return; ERROR1: MessageBox.Show(this, strError); }
void SetDefaultDataDirValue() { for (int i = 0; ; i++) { string strDateDir = "c:\\opac_data"; if (i > 0) strDateDir = "c:\\opac_data_" + (i + 1).ToString(); // 已经存在的物理目录不能使用 if (Directory.Exists(strDateDir) == true) continue; // 注意检查,不能是别的instance的数据目录 if (this.VerifyDataDir != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = strDateDir; this.VerifyDataDir(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) continue; } this.textBox_dataDir.Text = strDateDir; return; } }
// 数据目录需要更名的情况,是否延迟到 OK 时候执行?如果立即执行,则需要禁止 Cancel 按钮,表示必须 OK 结束对话框 // 检测目录是否已经存在 // return: // -1 出错 // 0 没有处理 // 1 已经处理 int RenameDataDir(out string strError) { strError = ""; #if NO // 已经准备Cancel,就不检查了 if (IsMouseOnCancelButton() == true) return; #endif // 新建时 if (CreateMode == true && String.IsNullOrEmpty(this.textBox_dataDir.Text) == false && this.LoadedDataDir != this.textBox_dataDir.Text) { // 注意检查,不能是别的instance的数据目录 if (this.VerifyDataDir != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.textBox_dataDir.Text; this.VerifyDataDir(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; return -1; } } string strXmlFilename = PathUtil.MergePath(this.textBox_dataDir.Text, "opac.xml"); if (File.Exists(strXmlFilename) == true) { DialogResult result = MessageBox.Show(this, "您指定的数据目录 '" + this.textBox_dataDir.Text + "' 中已经存在 opac.xml 文件。\r\n\r\n是否要直接利用其中的配置信息?", "安装 dp2OPAC", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.No) { this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复询问 return 0; } if (this.LoadXmlFileInfo != null) { LoadXmlFileInfoEventArgs e1 = new LoadXmlFileInfoEventArgs(); e1.DataDir = this.textBox_dataDir.Text; this.LoadXmlFileInfo(this, e1); if (string.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; return -1; } // refresh this.LineInfo = (LineInfo)e1.LineInfo; //Refreshdp2KernelDef(); //RefreshSupervisorUserInfo(); //RefreshLibraryName(); //RefreshUpdateCfgsDir(); RefreshDp2LibraryInfo(); this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复装载 this.m_bDataDirExist = true; // 防止OK时不合适的检查警告 } } return 0; } // 修改时 if (CreateMode == false && String.IsNullOrEmpty(this.textBox_dataDir.Text) == false && this.LoadedDataDir != this.textBox_dataDir.Text) { // 注意检查,不能是别的instance的数据目录 if (this.VerifyDataDir != null) { VerifyEventArgs e1 = new VerifyEventArgs(); e1.Value = this.textBox_dataDir.Text; this.VerifyDataDir(this, e1); if (String.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; return -1; } } string strXmlFilename = PathUtil.MergePath(this.textBox_dataDir.Text, "opac.xml"); if (File.Exists(strXmlFilename) == true) { DialogResult result = MessageBox.Show(this, "您指定的数据目录 '" + this.textBox_dataDir.Text + "' 中已经存在 opac.xml 文件。\r\n\r\n是否要直接利用其中的配置信息?\r\n\r\n是:直接利用其中的信息,也即将其中的配置信息装入当前对话框\r\n否:利用这个数据目录,但其中xml文件的相关信息即将被当前对话框中的值覆盖\r\n\r\n(提示:无论您选“是”“否”,原有目录 '" + this.LoadedDataDir + "' 都会被闲置)", "安装 dp2OPAC", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.No) { this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复询问 return 0; } if (this.LoadXmlFileInfo != null) { LoadXmlFileInfoEventArgs e1 = new LoadXmlFileInfoEventArgs(); e1.DataDir = this.textBox_dataDir.Text; this.LoadXmlFileInfo(this, e1); if (string.IsNullOrEmpty(e1.ErrorInfo) == false) { strError = e1.ErrorInfo; return -1; } // refresh this.LineInfo = (LineInfo)e1.LineInfo; //Refreshdp2KernelDef(); //RefreshSupervisorUserInfo(); //RefreshLibraryName(); //RefreshUpdateCfgsDir(); RefreshDp2LibraryInfo(); this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复装载 this.m_bDataDirExist = true; // 防止OK时不合适的检查警告 } } else if (String.IsNullOrEmpty(this.LoadedDataDir) == false) { // 修改目录名 DialogResult result = MessageBox.Show(this, "要将已经存在的数据目录 '" + this.LoadedDataDir + "' 更名为 '" + this.textBox_dataDir.Text + "' 么?\r\n\r\n(如果选择“否”,则安装程序在稍后将新创建一个数据目录,并复制进初始内容)", "安装 dp2OPAC", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.No) { this.m_bDataDirExist = false; return 0; } REDO_MOVE: strError = ""; try { // TODO: 需要测试当数据目录中内容尺寸太大,而目标盘无妨容纳时的报错情况 Directory.Move(this.LoadedDataDir, this.textBox_dataDir.Text); this.LoadedDataDir = this.textBox_dataDir.Text; // 防止重复装载 } catch (Exception ex) { // MessageBox.Show(this, "将已经存在的数据目录 '" + this.LoadedDataDir + "' 更名为 '" + this.textBox_dataDir.Text + "' 时发生错误: " + ex.Message); strError = "将已经存在的数据目录 '" + this.LoadedDataDir + "' 更名为 '" + this.textBox_dataDir.Text + "' 时发生错误: " + ex.Message; } if (string.IsNullOrEmpty(strError) == false) { DialogResult temp_result = MessageBox.Show(this, strError + "\r\n\r\n建议先停止 IIS,然后重试操作。\r\n\r\n是否重试?", "安装 dp2OPAC", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (temp_result == DialogResult.Retry) goto REDO_MOVE; return -1; } } return 0; } return 0; }