当前位置: 首页>>代码示例>>C#>>正文


C# RmsChannel.DoSaveResObject方法代码示例

本文整理汇总了C#中DigitalPlatform.rms.Client.RmsChannel.DoSaveResObject方法的典型用法代码示例。如果您正苦于以下问题:C# RmsChannel.DoSaveResObject方法的具体用法?C# RmsChannel.DoSaveResObject怎么用?C# RmsChannel.DoSaveResObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DigitalPlatform.rms.Client.RmsChannel的用法示例。


在下文中一共展示了RmsChannel.DoSaveResObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: button_OK_Click


//.........这里部分代码省略.........
                /*
                this.Stream.SetLength(0);
                StreamWriter sw = new StreamWriter(this.Stream, Encoding.UTF8);
                sw.Write(this.textBox_content.Text);
                */
            }

            if (this.Stream != null)
                this.Stream.Seek(0, SeekOrigin.Begin);

            // 保存配置文件
            string strError = "";
            byte[] baOutputTimestamp = null;
            string strOutputPath = "";
            string strStyle = "";

            if (this.checkBox_autoCreate.Checked == true)
            {
                if (strStyle != "")
                    strStyle += ",";
                strStyle += "autocreatedir";
            }


            StringUtil.ChangeMetaData(ref strMetaData,
                null,	// string strID,
                this.LocalPath,	// string strLocalPath,
                this.Mime,	// string strMimeType,
                null,	// string strLastModified,
                null,	// string strPath,
                null);	// string strTimestamp)

            string strRange = "";
            if (this.Stream != null && this.Stream.Length != 0)
            {
                Debug.Assert(this.Stream.Length != 0, "test");
                strRange = "0-" + Convert.ToString(this.Stream.Length - 1);
            }
            long lRet = channel.DoSaveResObject(this.Path,
                this.Stream,
                (this.Stream != null && this.Stream.Length != 0) ? this.Stream.Length : 0,
                strStyle,
                strMetaData,	// strMetadata,
                strRange,
                true,
                this.TimeStamp,	// timestamp,
                out baOutputTimestamp,
                out strOutputPath,
                out strError);

            /*
            // 保存配置文件
            byte[] baOutputTimeStamp = null;
            string strOutputPath = "";
            string strError = "";


            long lRet = channel.DoSaveTextRes(this.Path,
                this.textBox_content.Text,
                true,	// bInlucdePreamble
                "",	// style
                this.TimeStamp,
                out baOutputTimeStamp,
                out strOutputPath,
                out strError);
            */

            if (stopManager != null)
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");
            }

            if (lRet == -1)
            {
                MessageBox.Show(this, strError);
                goto FINISH;
            }

            this.TimeStamp = baOutputTimestamp;

            MessageBox.Show(this, "配置文件 '" + this.Path + "' 保存成功");


            /////////////
        FINISH:

            if (stopManager != null && stop != null)
            {

                stop.Unregister();	// 和容器关联
                stop = null;
            }

            this.channel = null;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:CfgFileEditDlg.cs

示例3: NewServerSideObject

        // 在服务器端创建对象
        // return:
        //		-1	错误
        //		1	以及存在同名对象
        //		0	正常返回
        int NewServerSideObject(string strPath,
            int nType,
            Stream stream,
            byte[] baTimeStamp,
            out byte[] baOutputTimestamp,
            out string strError)
        {
            strError = "";
            baOutputTimestamp = null;

            Debug.Assert(this.Channels != null, "");

            this.channel = Channels.GetChannel(this.ServerUrl);

            Debug.Assert(channel != null, "Channels.GetChannel() 异常");

            DigitalPlatform.Stop stop = null;

            if (stopManager != null)
            {
                stop = new DigitalPlatform.Stop();

                stop.Register(this.stopManager, true);	// 和容器关联

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在创建新对象: " + this.ServerUrl + "?" + strPath);

                stop.BeginLoop();

            }

            string strOutputPath = "";
            string strStyle = "";

            if (nType == ResTree.RESTYPE_FOLDER)
                strStyle = "createdir";
            /*
            long lRet = channel.DoSaveTextRes(strPath,
                "",	// content 暂时为空
                true,	// bInlucdePreamble
                strStyle,	// style
                null,	// baTimeStamp,
                out baOutputTimestamp,
                out strOutputPath,
                out strError);
            */

            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 (stopManager != null)
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");

                stop.Unregister();	// 和容器关联
            }

            if (lRet == -1)
            {
                if (this.channel.ErrorCode == ChannelErrorCode.AlreadyExist)
                {
                    this.channel = null;
                    return 1;	// 已经存在同名同类型对象
                }
                this.channel = null;
                strError = "写入 '" + strPath + "' 发生错误: " + strError;
                return -1;
            }

            this.channel = null;
            return 0;
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:94,代码来源:DatabaseObjectTree.cs

示例4: DoUpload


//.........这里部分代码省略.........
				{
				REDOSINGLESAVE:

					Application.DoEvents();	// 出让界面控制权

					if (stop.State != 0)
					{
						strError = "用户中断";
						goto ERROR1;
					}

					string strWaiting = "";
					if (j == ranges.Length - 1)
						strWaiting = " 请耐心等待...";

					string strPercent = "";
					RangeList rl = new RangeList(ranges[j]);
					if (rl.Count >= 1) 
					{
						double ratio = (double)((RangeItem)rl[0]).lStart / (double)fi.Length;
						strPercent = String.Format("{0,3:N}",ratio * (double)100) + "%";
					}

					if (stop != null)
						stop.SetMessage("正在上载 " + ranges[j] + "/"
							+ Convert.ToString(fi.Length)
							+ " " + strPercent + " " + strLocalFileName + strWarning + strWaiting);

					/*
					if (stop != null)
						stop.SetMessage("正在上载 " + ranges[j] + "/" + Convert.ToString(fi.Length) + " " + strLocalFileName);
					*/

					long lRet = channel.DoSaveResObject(strResPath,
						strLocalFileName,
						strLocalFileName,
						strMime,
                        strLastModifyTime,
						ranges[j],
						j == ranges.Length - 1 ? true : false,	// 最尾一次操作,提醒底层注意设置特殊的WebService API超时时间
						timestamp,
						out output_timestamp,
						out strError);
					timestamp = output_timestamp;
					ListViewUtil.ChangeItemText(this.Items[i], COLUMN_TIMESTAMP, ByteArray.GetHexTimeStampString(timestamp));

					strWarning = "";

					if (lRet == -1) 
					{
						if (channel.ErrorCode == ChannelErrorCode.TimestampMismatch)
						{

							if (this.bNotAskTimestampMismatchWhenOverwrite == true) 
							{
								timestamp = new byte[output_timestamp.Length];
								Array.Copy(output_timestamp, 0, timestamp, 0, output_timestamp.Length);
								strWarning = " (时间戳不匹配, 自动重试)";
								if (ranges.Length == 1 || j==0) 
									goto REDOSINGLESAVE;
								goto REDOWHOLESAVE;
							}


							DialogResult result = MessageDlg.Show(this, 
								"上载 '" + strLocalFileName + "' (片断:" + ranges[j] + "/总尺寸:"+Convert.ToString(fi.Length)
开发者ID:paopaofeng,项目名称:dp2,代码行数:67,代码来源:ResFileList.cs

示例5: SaveUploadFile


//.........这里部分代码省略.........
                {
                    string strRange = "";
                    strRange = "0-" + Convert.ToString(fi.Length - 1);

                    // 按照100K作为一个chunk
                    ranges = RangeList.ChunkRange(strRange,
                        100 * 1024);
                }

                byte[] timestamp = ByteArray.GetTimeStampByteArray(strResTimeStamp);
                byte[] output_timestamp = null;

                // 2007/12/13
                string strLastModifyTime = DateTime.UtcNow.ToString("u");

                string strLocalPath = postedFile.FileName;

                // page.Response.Write("<br/>正在保存" + strLocalPath);

            REDOWHOLESAVE:
                string strWarning = "";

                for (int j = 0; j < ranges.Length; j++)
                {
                REDOSINGLESAVE:

                    // Application.DoEvents();	// 出让界面控制权

                    if (stop.State != 0)
                    {
                        strError = "用户中断";
                        goto ERROR1;
                    }

                    string strWaiting = "";
                    if (j == ranges.Length - 1)
                        strWaiting = " 请耐心等待...";

                    string strPercent = "";
                    RangeList rl = new RangeList(ranges[j]);
                    if (rl.Count >= 1)
                    {
                        double ratio = (double)((RangeItem)rl[0]).lStart / (double)fi.Length;
                        strPercent = String.Format("{0,3:N}", ratio * (double)100) + "%";
                    }

                    if (stop != null)
                        stop.SetMessage("正在上载 " + ranges[j] + "/"
                            + Convert.ToString(fi.Length)
                            + " " + strPercent + " " + strLocalFileName + strWarning + strWaiting);

                    // page.Response.Write(".");	// 防止前端因等待过久而超时

                    long lRet = channel.DoSaveResObject(strResPath,
                        strLocalFileName,
                        strLocalPath,
                        postedFile.ContentType,
                        strLastModifyTime,
                        ranges[j],
                        j == ranges.Length - 1 ? true : false,	// 最尾一次操作,提醒底层注意设置特殊的WebService API超时时间
                        timestamp,
                        out output_timestamp,
                        out strError);

                    timestamp = output_timestamp;

                    // DomUtil.SetAttr(node, "__timestamp",	ByteArray.GetHexTimeStampString(timestamp));

                    strWarning = "";

                    if (lRet == -1)
                    {
                        if (channel.ErrorCode == ChannelErrorCode.TimestampMismatch)
                        {

                            timestamp = new byte[output_timestamp.Length];
                            Array.Copy(output_timestamp, 0, timestamp, 0, output_timestamp.Length);
                            strWarning = " (时间戳不匹配, 自动重试)";
                            if (ranges.Length == 1 || j == 0)
                                goto REDOSINGLESAVE;
                            goto REDOWHOLESAVE;
                        }

                        goto ERROR1;
                    }


                }


                return 1;	// 已经保存
            ERROR1:
                return -1;
            }
            finally
            {
                // 不要忘记删除临时文件
                File.Delete(strLocalFileName);
            }
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:AppCirculation.cs

示例6: UploadOneRes


//.........这里部分代码省略.........
                        MessageBoxDefaultButton.Button2);
                    if (result == DialogResult.Yes)
                    {
                        strError = "用户中断";
                        goto ERROR1;
                    }
                    else
                    {
                        stop.Continue();
                    }
                }


                string strWaiting = "";
                if (j == ranges.Length - 1)
                    strWaiting = " 请耐心等待...";

                string strPercent = "";
                RangeList rl = new RangeList(ranges[j]);
                if (rl.Count >= 1)
                {
                    double ratio = (double)((RangeItem)rl[0]).lStart / (double)res.Length;
                    strPercent = String.Format("{0,3:N}", ratio * (double)100) + "%";
                }

                if (stop != null)
                    stop.SetMessage("正在保存 " + ranges[j] + "/"
                        + Convert.ToString(res.Length)
                        + " " + strPercent + " " + strRecordPath + strWarning + strWaiting + " " + strCount);


                inputfile.Seek(res.StartOffs, SeekOrigin.Begin);

                long lRet = channel.DoSaveResObject(strRecordPath,
                    inputfile,
                    res.Length,
                    "",	// style
                    res.MetadataXml,
                    ranges[j],
                    j == ranges.Length - 1 ? true : false,	// 最尾一次操作,提醒底层注意设置特殊的WebService API超时时间
                    timestamp,
                    out output_timestamp,
                    out strOutputPath,
                    out strError);

                // stop.SetProgressValue(inputfile.Position);

                strWarning = "";

                if (lRet == -1)
                {
                    if (channel.ErrorCode == ChannelErrorCode.TimestampMismatch)
                    {
                        string strDisplayRecPath = strOutputPath;
                        if (string.IsNullOrEmpty(strDisplayRecPath) == true)
                            strDisplayRecPath = strRecordPath;

                        if (bDontPromptTimestampMismatchWhenOverwrite == true)
                        {
                            timestamp = new byte[output_timestamp.Length];
                            Array.Copy(output_timestamp, 0, timestamp, 0, output_timestamp.Length);
                            strWarning = " (时间戳不匹配, 自动重试)";
                            if (ranges.Length == 1 || j == 0)
                                goto REDOSINGLESAVE;
                            goto REDOWHOLESAVE;
                        }
开发者ID:renyh1013,项目名称:dp2,代码行数:67,代码来源:ImportUtil.cs


注:本文中的DigitalPlatform.rms.Client.RmsChannel.DoSaveResObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。