本文整理汇总了C#中DigitalPlatform.rms.Client.ResPath.MakeDbName方法的典型用法代码示例。如果您正苦于以下问题:C# ResPath.MakeDbName方法的具体用法?C# ResPath.MakeDbName怎么用?C# ResPath.MakeDbName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DigitalPlatform.rms.Client.ResPath
的用法示例。
在下文中一共展示了ResPath.MakeDbName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: DoResUpload
// 上载一个res
// parameter:
// inputfile: 源流
// bIsFirstRes: 是否是第一个资源(xml)
// strError: error info
// return:
// -2 片断中发现时间戳不匹配。本函数调主可重上载整个资源
// -1 error
// 0 successed
public int DoResUpload(
ref RmsChannel channel,
ref string strRecordPath,
Stream inputfile,
ref DbNameMap map,
bool bIsFirstRes,
string strCount,
out string strError)
{
strError = "";
int nRet;
long lBodyStart = 0;
long lBodyLength = 0;
// 1. 从输入流中得到strMetadata,与body(body放到一个临时文件里)
string strMetaDataXml = "";
nRet = GetResInfo(inputfile,
bIsFirstRes,
out strMetaDataXml,
out lBodyStart,
out lBodyLength,
out strError);
if (nRet == -1)
goto ERROR1;
if (lBodyLength == 0)
return 0; // 空包不需上载
// 2.为上载做准备
XmlDocument metadataDom = new XmlDocument();
try
{
metadataDom.LoadXml(strMetaDataXml);
}
catch (Exception ex)
{
strError = "加载元数据到dom出错!\r\n" + ex.Message;
goto ERROR1;
}
XmlNode node = metadataDom.DocumentElement;
string strResPath = DomUtil.GetAttr(node, "path");
string strTargetPath = "";
if (bIsFirstRes == true) // 第一个资源
{
// 从map中查询覆盖还是追加?
ResPath respath = new ResPath(strResPath);
respath.MakeDbName();
REDO:
DbNameMapItem mapItem = (DbNameMapItem)map["*"];
if (mapItem != null)
{
}
else
{
mapItem = (DbNameMapItem)map[respath.FullPath.ToUpper()];
}
if (mapItem == null)
{
OriginNotFoundDlg dlg = new OriginNotFoundDlg();
MainForm.SetControlFont(dlg, this.DefaultFont);
dlg.Message = "数据中声明的数据库路径 '" + respath.FullPath + "' 在覆盖关系对照表中没有找到, 请选择覆盖方式: ";
dlg.Origin = respath.FullPath.ToUpper();
dlg.Servers = this.Servers;
dlg.Channels = this.Channels;
dlg.Map = map;
dlg.StartPosition = FormStartPosition.CenterScreen;
dlg.ShowDialog(this);
if (dlg.DialogResult != DialogResult.OK)
{
strError = "用户中断...";
goto ERROR1;
}
map = dlg.Map;
goto REDO;
}
if (mapItem.Style == "skip")
return 0;
//.........这里部分代码省略.........
示例3: DoXmlItemUpload
// 上载一个item
// parameter:
// strError: error info
// return:
// -1 出错
// 0 正常
// 1 结束
public int DoXmlItemUpload(
bool bFastMode,
string strXml,
DbNameMap map,
bool bSkip,
string strCount,
out string strError)
{
strError = "";
int nRet = 0;
// bool bRet = false;
// MessageBox.Show(this, strXml);
if (bSkip == true)
return 0;
XmlDocument dataDom = new XmlDocument();
try
{
dataDom.LoadXml(strXml);
}
catch (Exception ex)
{
strError = "加载数据到dom出错!\r\n" + ex.Message;
goto ERROR1;
}
XmlNode node = dataDom.DocumentElement;
string strResPath = DomUtil.GetAttr(DpNs.dprms, node, "path");
string strTargetPath = "";
string strSourceDbPath = "";
if (strResPath != "")
{
// 从map中查询覆盖还是追加?
ResPath respath0 = new ResPath(strResPath);
respath0.MakeDbName();
strSourceDbPath = respath0.FullPath;
}
REDO:
DbNameMapItem mapItem = null;
mapItem = map.MatchItem(strSourceDbPath/*strResPath*/);
if (mapItem != null)
goto MAPITEMOK;
if (mapItem == null)
{
if (strSourceDbPath/*strResPath*/ == "")
{
string strText = "源数据文件中记录 " + Convert.ToString(this.m_nRecordCount) + " 没有来源数据库,对所有这样的数据,将作如何处理?";
WriteLog("打开对话框 '" + strText.Replace("\r\n", "\\n") + "'");
nRet = DbNameMapItemDlg.AskNullOriginBox(
this,
this.AppInfo,
strText,
this.SearchPanel,
map);
WriteLog("关闭对话框 '" + strText.Replace("\r\n", "\\n") + "'");
if (nRet == 0)
{
strError = "用户中断";
goto ERROR1; // 中断整个处理
}
goto REDO;
}
else
{
string strText = "源数据文件中记录 " + Convert.ToString(this.m_nRecordCount) + " 的来源数据库 '" + strSourceDbPath/*strResPath*/ + "' 没有找到对应的目标库, 对所有这样的数据,将作如何处理?";
WriteLog("打开对话框 '" + strText.Replace("\r\n", "\\n") + "'");
nRet = DbNameMapItemDlg.AskNotMatchOriginBox(
this,
this.AppInfo,
strText,
this.SearchPanel,
strSourceDbPath/*strResPath*/,
map);
WriteLog("关闭对话框 '" + strText.Replace("\r\n", "\\n") + "'");
if (nRet == 0)
{
strError = "用户中断";
goto ERROR1; // 中断整个处理
//.........这里部分代码省略.........
示例4: GetDbUrl
static string GetDbUrl(string strLongPath)
{
ResPath respath = new ResPath(strLongPath);
respath.MakeDbName();
return respath.FullPath;
}
示例5: PrepareOverwritePath
// 根据原始路径准备即将写入的路径
// return:
// -1 出错
// 0 用户放弃
// 1 成功
public static int PrepareOverwritePath(
ServerCollection Servers,
RmsChannelCollection Channels,
IWin32Window owner,
ref DbNameMap map,
ref string strLongPath,
out string strError)
{
strError = "";
// 从map中查询覆盖还是追加?
ResPath respath = new ResPath(strLongPath);
respath.MakeDbName();
REDO:
DbNameMapItem mapItem = (DbNameMapItem)map["*"];
if (mapItem != null)
{
}
else
{
mapItem = (DbNameMapItem)map[respath.FullPath.ToUpper()];
}
if (mapItem == null)
{
OriginNotFoundDlg dlg = new OriginNotFoundDlg();
Font font = GuiUtil.GetDefaultFont();
if (font != null)
dlg.Font = font;
dlg.Message = "数据中声明的数据库路径 '" +respath.FullPath+ "' 在覆盖关系对照表中没有找到, 请选择覆盖方式: " ;
dlg.Origin = respath.FullPath.ToUpper();
dlg.Servers = Servers;
dlg.Channels = Channels;
dlg.Map = map;
dlg.StartPosition = FormStartPosition.CenterScreen;
dlg.ShowDialog(owner);
if (dlg.DialogResult != DialogResult.OK)
{
strError = "用户中断...";
return 0;
}
map = dlg.Map;
goto REDO;
}
if (mapItem.Style == "skip")
return 0;
// 构造目标路径
// 1)从源路径中提取id。源路径来自备份文件数据
respath = new ResPath(strLongPath);
string strID = respath.GetRecordId();
if (string.IsNullOrEmpty(strID) == true
|| mapItem.Style == "append")
{
strID = "?"; // 将来加一个对话框
}
// 2)用目标库路径构造完整的记录路径
string strTargetFullPath = "";
if (mapItem.Target == "*")
{
respath = new ResPath(strLongPath);
respath.MakeDbName();
strTargetFullPath = respath.FullPath;
}
else
{
strTargetFullPath = mapItem.Target;
}
respath = new ResPath(strTargetFullPath);
respath.Path = respath.Path + "/" + strID;
strLongPath = respath.FullPath;
return 1;
}