本文整理汇总了C#中DigitalPlatform.rms.Client.RmsChannel类的典型用法代码示例。如果您正苦于以下问题:C# RmsChannel类的具体用法?C# RmsChannel怎么用?C# RmsChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RmsChannel类属于DigitalPlatform.rms.Client命名空间,在下文中一共展示了RmsChannel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SearchResultLoader
public SearchResultLoader(RmsChannel channel,
DigitalPlatform.Stop stop,
string resultsetName,
string formatList,
string lang = "zh")
{
this.Channel = channel;
this.Stop = stop;
this.ResultSetName = resultsetName;
this.FormatList = formatList;
this.Lang = lang;
}
开发者ID:renyh1013,项目名称:dp2,代码行数:12,代码来源:SearchResultLoader.cs
示例2: SaveToTemplate
// 保存记录到模板配置文件
// parameters:
public void SaveToTemplate()
{
// 选择目标数据库
OpenResDlg dlg = new OpenResDlg();
dlg.Font = GuiUtil.GetDefaultFont();
dlg.Text = "请选择目标数据库";
dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
dlg.ap = this.MainForm.AppInfo;
dlg.ApCfgTitle = "detailform_openresdlg";
dlg.Path = textBox_recPath.Text;
dlg.Initial( MainForm.Servers,
this.Channels);
// dlg.StartPosition = FormStartPosition.CenterScreen;
dlg.ShowDialog(this);
if (dlg.DialogResult != DialogResult.OK)
return;
// 下载模板配置文件
ResPath respath = new ResPath(dlg.Path);
string strError;
string strContent;
byte[] baTimeStamp = null;
string strMetaData;
string strOutputPath;
string strCfgFilePath = respath.Path + "/cfgs/template";
long lRet = 0;
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在下载文件" + strCfgFilePath);
stop.BeginLoop();
lRet = channel.GetRes(
MainForm.cfgCache,
strCfgFilePath,
out strContent,
out strMetaData,
out baTimeStamp,
out strOutputPath,
out strError);
stop.EndLoop();
stop.OnStop -= new StopEventHandler(this.DoStop);
stop.Initial("");
if (lRet == -1)
{
this.TimeStamp = null;
MessageBox.Show(this, strError);
return;
}
}
finally
{
channel = channelSave;
}
SelectRecordTemplateDlg tempdlg = new SelectRecordTemplateDlg();
tempdlg.Font = GuiUtil.GetDefaultFont();
int nRet = tempdlg.Initial(strContent, out strError);
if (nRet == -1)
goto ERROR1;
tempdlg.Text = "请选择要修改的模板记录";
tempdlg.CheckNameExist = false; // 按OK按钮时不警告"名字不存在",这样允许新建一个模板
tempdlg.ap = this.MainForm.AppInfo;
tempdlg.ApCfgTitle = "detailform_selecttemplatedlg";
tempdlg.ShowDialog(this);
if (tempdlg.DialogResult != DialogResult.OK)
return;
string strXmlBody = "";
bool bHasUploadedFile = false;
nRet = GetXmlRecord(out strXmlBody,
out bHasUploadedFile,
out strError);
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs
示例3: SearchPath
/// <summary>
/// 检索获得若干路径
/// </summary>
/// <param name="channel"></param>
/// <param name="strDbName"></param>
/// <param name="strFrom"></param>
/// <param name="strKey"></param>
/// <param name="nMax"></param>
/// <param name="paths"></param>
/// <param name="strError"></param>
/// <returns>-1 error;0 not found;>=1 found</returns>
static int SearchPath(RmsChannel channel,
string strDbName,
string strFrom,
string strKey,
long nMax,
out string[] paths,
out string strError)
{
paths = null;
strError = "";
// 2007/4/5 改造 加上了 GetXmlStringSimple()
string strQueryXml = "<target list='"
+ StringUtil.GetXmlStringSimple(strDbName + ":" + strFrom) // 2007/9/14
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple(strKey)
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>" + Convert.ToString(nMax) + "</maxCount></item><lang>zh</lang></target>";
long lRet = channel.DoSearch(strQueryXml,
"default",
"", // strOuputStyle
out strError);
if (lRet == -1)
{
strError = "检索库 '" + strDbName + "/" + strFrom + "' 时出错: " + strError;
return -1;
}
if (lRet == 0)
{
return 0; // 没有找到
}
if (lRet > 1)
{
strError = "以Key '" + strKey + "' 检索库 '" + strDbName + "' 时命中 " + Convert.ToString(lRet) + " 条,属于不正常情况。请修改库 '" + strDbName + "' 中相应记录,确保同一Key只有一条对应的记录。";
return -1;
}
List<string> aPath = null;
lRet = channel.DoGetSearchResult(
"default",
0,
-1,
"zh",
null, // this.stop,
out aPath,
out strError);
if (lRet == -1)
{
strError = "检索库 '" + strDbName + "' 获取检索结果时出错: " + strError;
return -1;
}
paths = new string[aPath.Count];
for (int i = 0; i < aPath.Count; i++)
{
paths[i] = (string)aPath[i];
}
return paths.Length;
}
开发者ID:renyh1013,项目名称:dp2,代码行数:76,代码来源:Util.cs
示例4: DeleteAllDatabase
// 删除所有用到的内核数据库
// 专门开发给安装程序卸载时候使用
public static int DeleteAllDatabase(
RmsChannel channel,
XmlDocument cfg_dom,
out string strError)
{
strError = "";
string strTempError = "";
long lRet = 0;
// 大书目库
XmlNodeList nodes = cfg_dom.DocumentElement.SelectNodes("itemdbgroup/database");
for (int i = 0; i < nodes.Count; i++)
{
XmlNode node = nodes[i];
// 实体库
string strEntityDbName = DomUtil.GetAttr(node, "name");
if (String.IsNullOrEmpty(strEntityDbName) == false)
{
lRet = channel.DoDeleteDB(strEntityDbName,
out strTempError);
if (lRet == -1 && channel.ErrorCode != ChannelErrorCode.NotFound)
{
strError += "删除实体库 '" + strEntityDbName + "' 内数据时候发生错误:" + strTempError + "; ";
}
}
// 订购库
string strOrderDbName = DomUtil.GetAttr(node, "orderDbName");
if (String.IsNullOrEmpty(strOrderDbName) == false)
{
lRet = channel.DoDeleteDB(strOrderDbName,
out strTempError);
if (lRet == -1 && channel.ErrorCode != ChannelErrorCode.NotFound)
{
strError += "删除订购库 '" + strOrderDbName + "' 内数据时候发生错误:" + strTempError + "; ";
}
}
// 期库
string strIssueDbName = DomUtil.GetAttr(node, "issueDbName");
if (String.IsNullOrEmpty(strIssueDbName) == false)
{
lRet = channel.DoDeleteDB(strIssueDbName,
out strTempError);
if (lRet == -1 && channel.ErrorCode != ChannelErrorCode.NotFound)
{
strError += "删除期库 '" + strIssueDbName + "' 内数据时候发生错误:" + strTempError + "; ";
}
}
// 小书目库
string strBiblioDbName = DomUtil.GetAttr(node, "biblioDbName");
if (String.IsNullOrEmpty(strBiblioDbName) == false)
{
lRet = channel.DoDeleteDB(strBiblioDbName,
out strTempError);
if (lRet == -1 && channel.ErrorCode != ChannelErrorCode.NotFound)
{
strError += "删除小书目库 '" + strBiblioDbName + "' 内数据时候发生错误:" + strTempError + "; ";
}
}
}
// 读者库
nodes = cfg_dom.DocumentElement.SelectNodes("readerdbgroup/database");
for (int i = 0; i < nodes.Count; i++)
{
XmlNode node = nodes[i];
string strDbName = DomUtil.GetAttr(node, "name");
if (String.IsNullOrEmpty(strDbName) == false)
{
lRet = channel.DoDeleteDB(strDbName,
out strTempError);
if (lRet == -1 && channel.ErrorCode != ChannelErrorCode.NotFound)
{
strError += "删除读者库 '" + strDbName + "' 内数据时候发生错误:" + strTempError + "; ";
}
}
}
// 预约到书队列库
XmlNode arrived_node = cfg_dom.DocumentElement.SelectSingleNode("arrived");
if (arrived_node != null)
{
string strArrivedDbName = DomUtil.GetAttr(arrived_node, "dbname");
if (String.IsNullOrEmpty(strArrivedDbName) == false)
{
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:AppDatabase.cs
示例5: NewServerSideObject
// 在服务器端创建对象
// parameters:
// strStyle 风格。当创建目录的时候,为"createdir",否则为空
// return:
// -1 错误
// 1 以及存在同名对象
// 0 正常返回
int NewServerSideObject(
RmsChannel channel,
string strPath,
string strStyle,
Stream stream,
byte[] baTimeStamp,
out string strError)
{
strError = "";
byte[] baOutputTimestamp = null;
string strOutputPath = "";
string strRange = "";
if (stream != null && stream.Length != 0)
{
Debug.Assert(stream.Length != 0, "test");
strRange = "0-" + Convert.ToString(stream.Length - 1);
}
long lRet = channel.DoSaveResObject(strPath,
stream,
(stream != null && stream.Length != 0) ? stream.Length : 0,
strStyle,
"", // strMetadata,
strRange,
true,
baTimeStamp, // timestamp,
out baOutputTimestamp,
out strOutputPath,
out strError);
if (lRet == -1)
{
if (channel.ErrorCode == ChannelErrorCode.AlreadyExist)
{
return 1; // 已经存在同名同类型对象
}
strError = "写入 '" + strPath + "' 发生错误: " + strError;
return -1;
}
return 0;
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:49,代码来源:AppDatabase.cs
示例6: RefreshDatabase
// 根据数据库模板的定义,刷新一个已经存在的数据库的定义
// return:
// -1
// 0 keys定义没有更新
// 1 keys定义更新了
int RefreshDatabase(RmsChannel channel,
string strTemplateDir,
string strDatabaseName,
string strIncludeFilenames,
string strExcludeFilenames,
out string strError)
{
strError = "";
int nRet = 0;
strIncludeFilenames = strIncludeFilenames.ToLower();
strExcludeFilenames = strExcludeFilenames.ToLower();
bool bKeysChanged = false;
DirectoryInfo di = new DirectoryInfo(strTemplateDir);
FileInfo[] fis = di.GetFiles();
// 创建所有文件对象
for (int i = 0; i < fis.Length; i++)
{
string strName = fis[i].Name;
if (strName == "." || strName == "..")
continue;
if (FileUtil.IsBackupFile(strName) == true)
continue;
/*
if (strName.ToLower() == "keys"
|| strName.ToLower() == "browse")
continue;
* */
// 如果Include和exclude里面都有一个文件名,优先依exclude(排除)
if (StringUtil.IsInList(strName, strExcludeFilenames) == true)
continue;
if (strIncludeFilenames != "*")
{
if (StringUtil.IsInList(strName, strIncludeFilenames) == false)
continue;
}
string strFullPath = fis[i].FullName;
nRet = ConvertGb2312TextfileToUtf8(strFullPath,
out strError);
if (nRet == -1)
return -1;
string strExistContent = "";
string strNewContent = "";
Stream new_stream = new FileStream(strFullPath, FileMode.Open);
{
StreamReader sr = new StreamReader(new_stream, Encoding.UTF8);
strNewContent = ConvertCrLf(sr.ReadToEnd());
}
new_stream.Seek(0, SeekOrigin.Begin);
try
{
string strPath = strDatabaseName + "/cfgs/" + strName;
// 获取已有的配置文件对象
byte[] timestamp = null;
string strOutputPath = "";
string strMetaData = "";
string strStyle = "content,data,metadata,timestamp,outputpath";
MemoryStream exist_stream = new MemoryStream();
try
{
long lRet = channel.GetRes(
strPath,
exist_stream,
null, // stop,
strStyle,
null, // byte [] input_timestamp,
out strMetaData,
out timestamp,
out strOutputPath,
out strError);
if (lRet == -1)
{
// 配置文件不存在,怎么返回错误码的?
if (channel.ErrorCode == ChannelErrorCode.NotFound)
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:AppDatabase.cs
示例7: ChangeDbName
// 包装后的版本
int ChangeDbName(
RmsChannel channel,
string strOldDbName,
string strNewDbName,
out string strError)
{
return ChangeDbName(
channel,
strOldDbName,
strNewDbName,
() => { },
out strError);
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:14,代码来源:AppDatabase.cs
示例8: SearchOneClassTailNumberPathAndRecord
// 检索尾号记录的路径和记录体
// return:
// -1 error(注:检索命中多条情况被当作错误返回)
// 0 not found
// 1 found
public int SearchOneClassTailNumberPathAndRecord(
// RmsChannelCollection Channels,
RmsChannel channel,
string strArrangeGroupName,
string strClass,
out string strPath,
out string strXml,
out byte[] timestamp,
out string strError)
{
strError = "";
strPath = "";
strXml = "";
timestamp = null;
if (strClass == "")
{
strError = "尚未指定分类号";
return -1;
}
if (strArrangeGroupName == "")
{
strError = "尚未指定排架体系名";
return -1;
}
string strZhongcihaoDbName = GetTailDbName(strArrangeGroupName);
if (String.IsNullOrEmpty(strZhongcihaoDbName) == true)
{
strError = "无法通过排架体系名 '" + strArrangeGroupName + "' 获得种次号库名";
return -1;
}
string strQueryXml = "<target list='"
+ StringUtil.GetXmlStringSimple(strZhongcihaoDbName + ":" + "分类号") // 2007/9/14
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple(strClass)
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang></target>";
List<string> aPath = null;
// 获得通用记录
// 本函数可获得超过1条以上的路径
// return:
// -1 error
// 0 not found
// 1 命中1条
// >1 命中多于1条
int nRet = GetRecXml(
// Channels,
channel,
strQueryXml,
out strXml,
2,
out aPath,
out timestamp,
out strError);
if (nRet == -1)
{
strError = "检索库 " + strZhongcihaoDbName + " 时出错: " + strError;
return -1;
}
if (nRet == 0)
{
return 0; // 没有找到
}
if (nRet > 1)
{
strError = "以分类号'" + strClass + "'检索库 " + strZhongcihaoDbName + " 时命中 " + Convert.ToString(nRet) + " 条,无法取得尾号。请修改库 '" + strZhongcihaoDbName + "' 中相应记录,确保同一类目只有一条对应的记录。";
return -1;
}
Debug.Assert(aPath.Count >= 1, "");
strPath = aPath[0];
return 1;
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:84,代码来源:AppCallNumber.cs
示例9: AutoGenerate
// 自动加工数据
public void AutoGenerate()
{
// 库名部分路径
ResPath respath = new ResPath(textBox_recPath.Text);
respath.MakeDbName();
string strError;
string strCode;
string strRef;
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
string strCfgPath = respath.Path + "/cfgs/autoGenerate.cs";
string strCfgRefPath = respath.Path + "/cfgs/autoGenerate.cs.ref";
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在下载文件" + strCfgPath);
stop.BeginLoop();
byte[] baTimeStamp = null;
string strMetaData;
string strOutputPath;
long lRet = channel.GetRes(
MainForm.cfgCache,
strCfgPath,
out strCode,
out strMetaData,
out baTimeStamp,
out strOutputPath,
out strError);
stop.EndLoop();
stop.OnStop -= new StopEventHandler(this.DoStop);
stop.Initial("");
if (lRet == -1)
{
MessageBox.Show(this, strError);
return;
}
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在下载文件" + strCfgRefPath);
stop.BeginLoop();
lRet = channel.GetRes(
MainForm.cfgCache,
strCfgRefPath,
out strRef,
out strMetaData,
out baTimeStamp,
out strOutputPath,
out strError);
stop.EndLoop();
stop.OnStop -= new StopEventHandler(this.DoStop);
stop.Initial("");
if (lRet == -1)
{
MessageBox.Show(this, strError);
return;
}
}
finally
{
channel = channelSave;
}
// 执行代码
int nRet = RunScript(strCode,
strRef,
out strError);
if (nRet == -1)
{
MessageBox.Show(this, strError);
return;
}
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:94,代码来源:DetailForm.cs
示例10: SaveToBackup
//.........这里部分代码省略.........
fileTarget.Write(length, 0, 8); // 临时写点数据,占据记录总长度位置
bool bHasUploadedFile = false;
// 获得Xml记录
string strXmlBody;
int nRet = GetXmlRecord(out strXmlBody,
out bHasUploadedFile,
out strError);
if (nRet == -1)
{
fileTarget.SetLength(lStart); // 把本次追加写入的全部去掉
goto ERROR1;
}
ResPath respath = new ResPath(textBox_recPath.Text);
// 向backup文件中保存第一个 res
ExportUtil.ChangeMetaData(ref this.m_strMetaData, // ResFileList
null,
null,
null,
null,
respath.FullPath,
ByteArray.GetHexTimeStampString(this.TimeStamp)); // 任延华加 2005/6/11
long lRet = Backup.WriteFirstResToBackupFile(
fileTarget,
this.m_strMetaData,
strXmlBody);
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在保存记录 " + respath.FullPath + "到备份文件 " + strOutputFileName);
stop.BeginLoop();
EnableControlsInLoading(true);
nRet = this.listView_resFiles.DoSaveResToBackupFile(
fileTarget,
respath.Path,
channel,
stop,
out strError);
EnableControlsInLoading(false);
stop.EndLoop();
stop.OnStop -= new StopEventHandler(this.DoStop);
stop.Initial("");
if (nRet == -1)
{
fileTarget.SetLength(lStart); // 把本次追加写入的全部去掉
strError = "保存记录失败,原因: "+ strError;
goto ERROR1;
开发者ID:paopaofeng,项目名称:dp2,代码行数:67,代码来源:DetailForm.cs
示例11: DownloadOneFileMetaData
// 回调函数
int DownloadOneFileMetaData(string strID,
out string strResultXml,
out byte[] timestamp,
out string strError)
{
timestamp = null;
strError = "";
ResPath respath = new ResPath(textBox_recPath.Text);
string strResPath = respath.Path + "/object/" + strID;
strResPath = strResPath.Replace(":", "/");
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在下载资源文件的元数据 " + strResPath);
stop.BeginLoop();
byte [] baOutputTimeStamp = null;
string strOutputPath = "";
EnableControlsInLoading(true);
// 只得到metadata
long lRet = channel.GetRes(strResPath,
(Stream)null,
stop,
"metadata,timestamp,outputpath",
null,
out strResultXml,
out baOutputTimeStamp,
out strOutputPath,
out strError);
EnableControlsInLoading(false);
stop.EndLoop();
stop.OnStop -= new StopEventHandler(this.DoStop);
stop.Initial("");
if (lRet == -1)
{
MessageBox.Show(this, "下载资源文件元数据失败,原因: "+strError);
goto ERROR1;
}
timestamp = baOutputTimeStamp;
}
finally
{
channel = channelSave;
}
return 0;
ERROR1:
return -1;
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:68,代码来源:DetailForm.cs
示例12: DownloadOneFile
int DownloadOneFile(string strID,
out string strError)
{
strError = "";
ResPath respath = new ResPath(textBox_recPath.Text);
string strResPath = respath.Path + "/object/" + strID;
strResPath = strResPath.Replace(":", "/");
string strLocalPath = this.listView_resFiles.GetLocalFileName(strID);
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "请指定要保存的本地文件名";
dlg.CreatePrompt = false;
dlg.FileName = strLocalPath == "" ? strID + ".res" : strLocalPath;
dlg.InitialDirectory = Environment.CurrentDirectory;
// dlg.Filter = "projects files (outer*.xml)|outer*.xml|All files (*.*)|*.*" ;
dlg.RestoreDirectory = true ;
if(dlg.ShowDialog() != DialogResult.OK)
{
strError = "放弃";
return -1;
}
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在下载资源文件 " + strResPath);
stop.BeginLoop();
byte [] baOutputTimeStamp = null;
EnableControlsInLoading(true);
string strMetaData;
string strOutputPath = "";
long lRet = channel.GetRes(strResPath,
dlg.FileName,
stop,
out strMetaData,
out baOutputTimeStamp,
out strOutputPath,
out strError);
EnableControlsInLoading(false);
stop.EndLoop();
stop.OnStop -= new StopEventHandler(this.DoStop);
stop.Initial("");
if (lRet == -1)
{
MessageBox.Show(this, "下载资源文件失败,原因: "+strError);
goto ERROR1;
}
}
finally
{
channel = channelSave;
}
return 0;
ERROR1:
return -1;
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:82,代码来源:DetailForm.cs
示例13: ViewAccessPoint
// 观察检索点
// parameters:
// strRecordPath 记录路径。如果==null,表示直接用textBox_recPath中当前的内容作为路径
public void ViewAccessPoint(string strRecordPath)
{
if (strRecordPath == null || strRecordPath == "")
strRecordPath = textBox_recPath.Text;
if (strRecordPath == "")
{
MessageBox.Show(this, "必须指定好路径后, 才能模拟创建检索点");
return;
}
ResPath respath = new ResPath(strRecordPath);
string strError;
string strXml = "";
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
bool bHasUploadedFile = false;
int nRet = GetXmlRecord(out strXml,
out bHasUploadedFile,
out strError);
if (nRet == -1)
{
MessageBox.Show(this, strError);
return;
}
}
finally
{
channel = channelSave;
}
ViewAccessPointForm accessPointWindow = MainForm.TopViewAccessPointForm;
if (accessPointWindow == null)
{
accessPointWindow = new ViewAccessPointForm();
// accessPointWindow.StartPosition = FormStartPosition.CenterScreen;
accessPointWindow.Show();
accessPointWindow.MdiParent = MainForm; // MDI子窗口
}
else
accessPointWindow.Activate();
/*
else
{
accessPointWindow.Focus();
if (accessPointWindow.WindowState == FormWindowState.Minimized)
{
accessPointWindow.WindowState = FormWindowState.Normal;
}
}
*/
/*
if (accessPointWindow.Visible == false)
{
try // Close()过的窗口
{
accessPointWindow.Show();
}
catch (System.ObjectDisposedException)
{
accessPointWindow = new ViewAccessPointForm();
accessPointWindow.StartPosition = FormStartPosition.CenterScreen;
accessPointWindow.Show();
}
}
*/
// 使用Channel
channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在获取检索点 " + respath.FullPath);
stop.BeginLoop();
EnableControlsInLoading(true);
long lRet = channel.DoGetKeys(
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs
示例14: DeleteRecord
// 删除记录
// parameters:
// strRecordPath 记录路径。如果==null,表示直接用textBox_recPath中当前的内容作为路径
public void DeleteRecord(string strRecordPath)
{
if (strRecordPath != null)
textBox_recPath.Text = strRecordPath;
if (textBox_recPath.Text == "")
{
MessageBox.Show(this, "路径不能为空");
return;
}
ResPath respath = new ResPath(textBox_recPath.Text);
Uri uri = null;
try
{
uri = new Uri(respath.Url);
}
catch (Exception ex)
{
MessageBox.Show(this, "路径错误: " + ex.Message);
return;
} // 保存到文件
if (uri.IsFile)
{
MessageBox.Show(this, "暂时不支持删除文件");
return;
}
string strText = "你确实要删除位于服务器 '"+respath.Url+"' 上的记录 '"+respath.Path + "' 吗?";
DialogResult msgResult = MessageBox.Show(this,
strText,
"dp2rms",
MessageBoxButtons.OKCancel,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (msgResult != DialogResult.OK)
{
MessageBox.Show(this, "删除操作被放弃...");
return;
}
string strError;
byte [] baOutputTimeStamp = null;
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在删除记录 " + respath.FullPath);
stop.BeginLoop();
EnableControlsInLoading(true);
long lRet = channel.DoDeleteRes(respath.Path,
this.TimeStamp,
out baOutputTimeStamp,
out strError);
EnableControlsInLoading(false);
stop.EndLoop();
stop.OnStop -= new StopEventHandler(this.DoStop);
stop.Initial("");
if (lRet == -1)
{
MessageBox.Show(this, "删除记录 '"+respath.Path+"' 失败,原因: "+strError);
return;
}
}
finally
{
channel = channelSave;
}
// 如果删除成功,原来时间戳遗留在this.TimeStamp中,也无害
MessageBox.Show(this, "删除记录 '" + respath.FullPath + "' 成功。");
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:97,代码来源:DetailForm.cs
示例15: SaveRecord
// 保存记录
// parameters:
// strRecordPath 记录路径。如果==null,表示直接用textBox_recPath中当前的内容作为路径
public void SaveRecord(string strRecordPath)
{
if (strRecordPath != null)
textBox_recPath.Text = strRecordPath;
if (textBox_recPath.Text == "")
{
MessageBox.Show(this, "路径不能为空");
return;
}
ResPath respath = new ResPath(textBox_recPath.Text);
Uri uri = null;
try
{
uri = new Uri(respath.Url);
}
catch (Exception ex)
{
MessageBox.Show(this, "路径错误: " + ex.Message);
return;
}
// 保存到文件
if (uri.IsFile)
{
MessageBox.Show(this, "暂时不支持保存到文件");
return;
}
string strError;
string strXml = "";
bool bHasUploadedFile = false;
int nRet = GetXmlRecord(out strXml,
out bHasUploadedFile,
out strError);
if (nRet == -1)
{
MessageBox.Show(this, strError);
return;
}
byte [] baOutputTimeStamp = null;
string strOutputPath = "";
long lRet = 0;
int nUploadCount = 0;
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在保存记录 " + respath.FullPath);
stop.BeginLoop();
EnableControlsInLoading(true);
//string strTemp = ByteArray.GetHexTimeStampString(this.TimeStamp);
if (String.IsNullOrEmpty(this.strDatabaseOriginPath) == false
&& bHasUploadedFile == true
&& respath.FullPath != this.strDatabaseOriginPath)
{
ResPath respath_old = new ResPath(this.strDatabaseOriginPath);
if (respath_old.Url != respath.Url)
{
MessageBox.Show(this, "目前暂不支持跨服务器情况下的资源复制。本记录中原有的已上载资源,在另存到目标库的时丢失(为空),请注意保存完后手动上载。");
goto SKIPCOPYRECORD;
}
// 复制记录
// return:
// -1 出错。错误信息在strError中
// 0或者其他 成功
nRet = channel.DoCopyRecord(respath_old.Path,
respath.Path,
false, // bool bDeleteOriginRecord,
out baOutputTimeStamp,
out strOutputPath,
out strError);
if (nRet == -1)
{
MessageBox.Show(this, "复制资源时发生错误: " + strError);
}
else
{
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs
示例16: GetOnePinyin
// 获得一个汉字的拼音
// 所获得的拼音, 是一个分号间隔的字符串, 表示对应于这个汉字的多音
// return:
// -1 error
// 1 found
// 0 not found
int GetOnePinyin(string strOneHanzi,
out string strPinyin,
out string strError)
{
strPinyin = "";
strError = "";
// 拼音库路径
string strPinyinDbPath = MainForm.AppInfo.GetString("pinyin",
"pinyin_db_path",
"");
if (String.IsNullOrEmpty(strPinyinDbPath) == true)
{
strError = "拼音库路径尚未配置。请先用菜单“帮助/系统参数设置”功能配置适当的拼音库路径。";
return -1;
}
ResPath respath = new ResPath(strPinyinDbPath);
string strDbName = respath.Path;
// 2007/4/5 改造 加上了 GetXmlStringSimple()
string strQueryXml = "<target list='" + strDbName + ":" + "汉字'><item><word>"
+ StringUtil.GetXmlStringSimple(strOneHanzi)
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>10</maxCount></item><lang>chi</lang></target>";
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.GetChannel(respath.Url);
Debug.Assert(channel != null, "Channels.GetChannel 异常");
try
{
stop.OnStop += new StopEventHandler(this.DoStop);
stop.Initial("正在检索拼音 '" + strOneHanzi + "'");
stop.BeginLoop();
try
{
long nRet = channel.DoSearch(strQueryXml,
"default",
out strError);
if (nRet == -1)
{
strError = "检索拼音库时出错: " + strError;
return -1;
}
if (nRet == 0)
return 0; // not found
List<string> aPath = null;
nRet = channel.DoGetSearchResult(
"default",
1,
this.Lang,
stop,
out aPath,
out strError);
if (nRet == -1)
{
strError = "检索拼音库获取检索结果时出错: " + strError;
return -1;
}
if (aPath.Count == 0)
{
strError = "检索拼音库获取的检索结果为空";
return -1;
}
string strStyle = "content,data";
string strContent;
string strMetaData;
byte[] baTimeStamp;
string strOutputPath;
nRet = channel.GetRes((string)aPath[0],
strStyle,
// this.eventClose,
out strContent,
out strMetaData,
out baTimeStamp,
out strOutputPath,
out strError);
if (nRet == -1)
{
strError = "获取拼音记录体时出错: " + strError;
return -1;
}
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs
示例17: DeleteDatabase
// 删除一个数据库,并删除library.xml中相关OPAC检索库定义
// 如果数据库不存在会当作出错-1来报错
int DeleteDatabase(RmsChannel channel,
string strDbName,
out string strError)
{
strError = "";
long lRet = channel.DoDeleteDB(strDbName, out strError);
if (lRet == -1 && channel.ErrorCode != ChannelErrorCode.NotFound)
return -1;
// 删除一个数据库在OPAC可检索库中的定义
// return:
// -1 error
// 0 not change
// 1 changed
int nRet = RemoveOpacDatabaseDef(
channel.Container,
strDbName,
out strError);
if (nRet == -1)
{
this.Changed = true;
return -1;
}
return 0;
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:28,代码来源:AppDatabase.cs
示例18: GetMarcDefCfgFile
// return:
// -1 出错
// 0 没有找到
// 1 找到
int GetMarcDefCfgFile(string strUrl,
string strDbName,
out Stream s,
out string strError)
{
strError = "";
s = null;
if (String.IsNullOrEmpty(strUrl) == true)
{
/*
strError = "URL为空";
goto ERROR1;
*/
return 0;
}
string strPath = strDbName + "/cfgs/marcdef";
// 使用Channel
RmsChannel channelSave = channel;
channel = Channels.Get
|
请发表评论