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


C# DreamMessage.ToStream方法代码示例

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


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

示例1: CouchContinuousChanges

        internal CouchContinuousChanges(DreamMessage aMessage, CouchChangeDelegate aCallback)
        {
            if (aMessage == null)
                throw new ArgumentNullException("aMessage");
            if (aCallback == null)
                throw new ArgumentNullException("aCallback");

            theReader = new AsyncStreamReader(aMessage.ToStream(), (x, y) => {
                if (!String.IsNullOrEmpty(y.Line))
                {
                    CouchChangeResult result = theSerializer.Deserialize(y.Line);
                    aCallback(this, result);
                }
            });
        }
开发者ID:jaimerosales,项目名称:DreamSeat,代码行数:15,代码来源:CouchContinuousChanges.cs

示例2: GetRequestAsStream

 private static object GetRequestAsStream(DreamContext context, DreamMessage request, Result<DreamMessage> response)
 {
     return request.ToStream();
 }
开发者ID:aaronmars,项目名称:DReAM,代码行数:4,代码来源:DreamFeatureStage.cs

示例3: AddAttachment

		public Yield AddAttachment(DreamContext aContext, DreamMessage aRequest, Result<DreamMessage> aResponse)
		{
			Stream file = aRequest.ToStream();
			Result<bool> result;
			yield return result = Context.Current.Instance.ScoreController.AddAttachment(aContext.GetParam("id"), file,aRequest.ContentLength, aContext.GetParam("filename"), new Result<bool>());
			aResponse.Return(DreamMessage.Ok());
		}
开发者ID:willemda,项目名称:FoireMuses,代码行数:7,代码来源:ScoreService.cs

示例4: CreateSourcePage

		public Yield CreateSourcePage(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			if (request.ContentType.Match(MimeType.JSON))
			{
				ISourcePage page = Context.Current.Instance.SourcePageController.FromJson(request.ToText());
				Result<ISourcePage> result = new Result<ISourcePage>();
				yield return Context.Current.Instance.SourcePageController.Insert(page, result);
				response.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.SourcePageController.ToJson(result.Value)));
			}
			else // Bulk import based on ZIP file
			{
				Stream file = request.ToStream();
				Result<bool> result = new Result<bool>();
				yield return Context.Current.Instance.SourcePageController.BulkImportSourcePages(context.GetParam("sourceId"), file, result);

				if (result.Value)
					response.Return(DreamMessage.Ok());
				else
					response.Return(DreamMessage.BadRequest("Bad name format"));

			}
		}
开发者ID:willemda,项目名称:FoireMuses,代码行数:22,代码来源:SourceService.cs

示例5: AddFascimile

		public Yield AddFascimile(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			Stream file = request.ToStream();
			Result<bool> result;
			yield return result = Context.Current.Instance.SourcePageController.AddFascimile(context.GetParam("sourcePageId"), file, request.ContentLength, new Result<bool>());
			response.Return(DreamMessage.Ok());
		}
开发者ID:willemda,项目名称:FoireMuses,代码行数:7,代码来源:SourceService.cs

示例6: SetRequestResult

        private void SetRequestResult(DreamMessage result, XUri uri)
        {
            String tempfilename = String.Empty;

            _cookies.Update(result.Cookies, uri);

            txtHeaders.Clear();
            foreach (KeyValuePair<string, string> header in result.Headers) {
                txtHeaders.Text += header.Key + " = " + header.Value + Environment.NewLine;
            }

            foreach (DreamCookie c in result.Cookies) {
                txtHeaders.Text += string.Format("Cookie: '{0}' Value: '{1}' Path: '{2}', Expires: '{3}' Domain: '{4}' {5}", c.Name, c.Value, c.Path, c.Expires, c.Domain, Environment.NewLine);
            }

            // if we received a file, save it
            if (!String.IsNullOrEmpty(result.Headers[DreamHeaders.CONTENT_DISPOSITION])) {
                String filename;
                String[] contentInfoList = result.Headers[DreamHeaders.CONTENT_DISPOSITION].Split(';');
                foreach (String contentInfo in contentInfoList) {
                    String trimmedContentInfo = contentInfo.Trim();
                    if (StringUtil.StartsWithInvariantIgnoreCase(trimmedContentInfo, "filename=")) {
                        filename = trimmedContentInfo.Substring(9);
                        filename = filename.Trim('"', '\\');
                        tempfilename = Path.Combine(Path.GetTempPath(), filename);
                        result.ToStream().CopyToFile(tempfilename, result.ContentLength);
                    }
                }
            } else {
                tempfilename = Path.Combine(Path.GetTempPath(), DateTime.Now.Ticks.ToString()) + ".xml";
                RegistryKey key = Registry.ClassesRoot.OpenSubKey("MIME\\Database\\Content Type\\" + result.ContentType.FullType);
                if (null != key) {
                    tempfilename = tempfilename + key.GetValue("Extension");
                    key.Close();
                }
                File.WriteAllBytes(tempfilename, result.ToBytes());
            }

            // browse to the saved temporary file
            if (!String.IsNullOrEmpty(tempfilename))
            {
                webBrowser.Url = new Uri(tempfilename);
            }
            else{
                webBrowser.Url = null;
            }

            tabControl1.SelectedTab = resultsTabPage;
        }
开发者ID:sdether,项目名称:DReAM,代码行数:49,代码来源:DreamAPITest.cs


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