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


C# LosFormatter.Serialize方法代码示例

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


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

示例1: Ctor0_Deny_Unrestricted

		public void Ctor0_Deny_Unrestricted ()
		{
			LosFormatter lf = new LosFormatter ();

			MemoryStream ms = new MemoryStream ();
			lf.Serialize (ms, "mono");
			ms.Position = 0;
			Assert.IsNotNull (lf.Deserialize (ms), "Deserialize(Stream)");

			StringWriter sw = new StringWriter ();
			lf.Serialize (sw, "mono");
			string s = sw.ToString ();
			StringReader sr = new StringReader (s);
			Assert.IsNotNull (lf.Deserialize (sr), "Deserialize(TextReader)");

			Assert.IsNotNull (lf.Deserialize (s), "Deserialize(string)");
		}
开发者ID:nobled,项目名称:mono,代码行数:17,代码来源:LosFormatterCas.cs

示例2: GetCacheKey

        /// <summary>
        /// Creates a unique key which describes the current object. This key is used
        /// by <see cref="SoundInTheory.DynamicImage.Caching.DynamicImageCacheManager" />
        /// to cache dynamically generated images.
        /// </summary>
        /// <returns>A unique key which describes the current object.</returns>
        public string GetCacheKey()
        {
            object allViewState = SaveViewState(true);

            LosFormatter formatter = new LosFormatter();
            StringWriter output = new StringWriter();
            formatter.Serialize(output, allViewState);

            return output.ToString();
        }
开发者ID:dbre2,项目名称:dynamic-image,代码行数:16,代码来源:StateManagedObject.cs

示例3: SavePageStateToCompressedViewState

 protected void SavePageStateToCompressedViewState(object viewState)
 {
     LosFormatter formatter = new LosFormatter();
     System.IO.StringWriter writer = new System.IO.StringWriter();
     formatter.Serialize(writer, viewState);
     string viewStateString = writer.ToString();
     byte[] bytes = Convert.FromBase64String(viewStateString);
     bytes = IntegrationWebSiteMvc.Classes.Compressor.Compress(bytes);
     ClientScript.RegisterHiddenField("__VSTATE", Convert.ToBase64String(bytes));
 }
开发者ID:bedford603067,项目名称:Augment,代码行数:10,代码来源:AssetAttributes.aspx.cs

示例4: LosFormatter

		private LosFormatter  _formatter;// = new LosFormatter();
		protected override void SavePageStateToPersistenceMedium(object viewState)
		{
			_formatter = new LosFormatter();

			StringWriter sw = new StringWriter();
			_formatter.Serialize(sw, viewState);
			ComDePress cmp = new ComDePress();
			string outStr = cmp.Compress(sw.ToString());
			Page.RegisterHiddenField("__COMPRESSEDVIEWSTATE",outStr);
		}
开发者ID:alexan1,项目名称:marketweb,代码行数:11,代码来源:CompressedVSBasePage.cs

示例5: Deserialize_Stream_NonSeekable

		[Test] // bug #411115
		public void Deserialize_Stream_NonSeekable ()
		{
			string s1 = "Hello world";
			NonSeekableStream ns = new NonSeekableStream ();
			LosFormatter lf = new LosFormatter ();
			lf.Serialize (ns, s1);
			ns.Reset ();
			string s2 = lf.Deserialize (ns) as string;
			Assert.AreEqual (s1, s2);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:11,代码来源:LosFormatterTest.cs

示例6: Save

 public override void Save()
 {
     IPersistViewState state = Ra.Brix.Data.Internal.Adapter.Instance as IPersistViewState;
     LosFormatter formatter = new LosFormatter();
     StringBuilder builder = new StringBuilder();
     using (StringWriter writer = new StringWriter(builder))
     {
         formatter.Serialize(writer, new Pair(ViewState, ControlState));
     }
     state.Save(_session.ToString(), Page.Request.Url.ToString(), builder.ToString());
 }
开发者ID:greaterwinner,项目名称:ra-brix,代码行数:11,代码来源:RaBrixPageStatePersister.cs

示例7: Serialize

		[Test] // bug #324526
		public void Serialize ()
		{
			string s = "Hello world";
			LosFormatter lf = new LosFormatter ();
			StringWriter sw = new StringWriter ();
			lf.Serialize (sw, s);
			string s1 = sw.ToString ();
			Assert.IsNotNull (s1, "#1");
			string s2 = lf.Deserialize (s1) as string;
			Assert.IsNotNull (s2, "#2");
			Assert.AreEqual (s, s2, "#3");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:13,代码来源:LosFormatterTest.cs

示例8: Save

		public override void Save()
		{
            LosFormatter formatter = new LosFormatter();
            StringBuilder builder = new StringBuilder();

            using (StringWriter writer = new StringWriter(builder))
            {
                formatter.Serialize(writer, new Pair(ViewState, ControlState));
            }

			string id = _session.ToString() + "|" + Page.Request.Url.ToString().Replace(" ", "+");

			Page.Session[id] = builder.ToString();
		}
开发者ID:polterguy,项目名称:magix,代码行数:14,代码来源:Magix_PageStatePersister.cs

示例9: SavePageStateToPersistenceMedium

 protected override void SavePageStateToPersistenceMedium(object pageViewState)
 {
     MemoryStream ms = new MemoryStream();
     LosFormatter m_formatter = new LosFormatter();
     m_formatter.Serialize(ms, pageViewState);
     ms.Position = 0;
     StreamReader sr = new StreamReader(ms);
     string viewStateString = sr.ReadToEnd();
     byte[] ViewStateBytes = Convert.FromBase64String(viewStateString);
     ViewStateBytes = ViewStateCompression.Compress(ViewStateBytes);
     Session["ViewState"] = Convert.ToBase64String(ViewStateBytes);
     ms.Close();
     return;
 }
开发者ID:kuangzhongwei,项目名称:ad,代码行数:14,代码来源:BasePage.cs

示例10: SavePageStateToPersistenceMedium

        protected override void SavePageStateToPersistenceMedium( object viewState )
        {
            LosFormatter format = new LosFormatter();
            StringWriter writer = new StringWriter();
            format.Serialize( writer, viewState );
            string viewStateStr = writer.ToString();

            byte[] bytes = System.Convert.FromBase64String( viewStateStr );
            bytes = this.Compress( bytes );

            string vStateStr = System.Convert.ToBase64String( bytes );

            ClientScript.RegisterHiddenField( "__VSTATE", vStateStr );
        }
开发者ID:popovegor,项目名称:gt,代码行数:14,代码来源:GTCommonWebPage.cs

示例11: Save

 public override void Save()
 {
     Pair pair = new Pair();
     if (base.ViewState != null)
         pair.First = base.ViewState;
     if (base.ControlState != null)
         pair.Second = base.ControlState;
     //
     LosFormatter los = new LosFormatter();
     StringWriter writer = new StringWriter();
     los.Serialize(writer, pair);
     StreamWriter sw = File.CreateText(ViewStateFilePath);
     sw.Write(writer.ToString());
     sw.Close();
 }
开发者ID:SaintLoong,项目名称:AjaxEngine,代码行数:15,代码来源:FilePageStatePersister.cs

示例12: SavePageStateToPersistenceMedium

        protected override void SavePageStateToPersistenceMedium(object state)
        {
            string file = GenerateFileName(true);

            FileStream filestream = new FileStream(file, FileMode.Create);

            LosFormatter formator = new LosFormatter();

            formator.Serialize(filestream, state);

            filestream.Flush();

            filestream.Close();

            filestream = null;
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:16,代码来源:RockPageMod.cs

示例13: SavePageStateToPersistenceMedium

 protected override void SavePageStateToPersistenceMedium(object viewState)
 {
     this._viewstateStorage = ViewstateStorageFactory.GetStorageMedium();
     _config = (ViewStateConfiguration) ConfigurationManager.GetSection("ViewStateConfiguration");
     LosFormatter formatter = new LosFormatter();
     StringWriter writer = new StringWriter();
     formatter.Serialize(writer, viewState);
     string viewStateString = writer.ToString();
     byte[] bytes = Convert.FromBase64String(viewStateString);
     if (_config.Compression)
         bytes = bytes.Compress();
     string viewstateBase64 = Convert.ToBase64String(bytes);
     string id = ViewstateStorageFactory.GetUserUniqueID().GetUniqueID();
     this._viewstateStorage.Add(new KeyValuePair<object, string>(id, viewstateBase64));
     ScriptManager.RegisterHiddenField(this, "__VIEWSTATE_UniqueID", id);
 }
开发者ID:JasonSoft,项目名称:JasonSoft,代码行数:16,代码来源:NoViewStateBasePage.cs

示例14: Serialize_Output

		public void Serialize_Output ()
		{
			string s = "Hello world";
			LosFormatter lf = new LosFormatter ();
			StringWriter sw = new StringWriter ();
			lf.Serialize (sw, s);
			string s1 = sw.ToString ();
#if NET_2_0
			Assert.AreEqual ("/wEFC0hlbGxvIHdvcmxk", s1, "#1");
#else
			Assert.AreEqual ("SGVsbG8gd29ybGQ=", s1, "#1");
#endif
			string s2 = lf.Deserialize (s1) as string;
			Assert.IsNotNull (s2, "#2");
			Assert.AreEqual (s, s2, "#3");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:LosFormatterTest.cs

示例15: SavePageStateToPersistenceMedium

        protected override void SavePageStateToPersistenceMedium(object state)
        {
            LosFormatter formatter = new LosFormatter();
            StringWriter writer = new StringWriter();

            formatter.Serialize(writer, state);

            string viewStateString = writer.ToString();
            byte[] bytes = Convert.FromBase64String(viewStateString);

            this.normalViewState.Text = viewStateString;

            bytes = bytes.Compress();
            this.encryptedViewState.Text = Convert.ToBase64String(bytes);

            ClientScript.RegisterHiddenField("__VSTATE", Convert.ToBase64String(bytes));
        }
开发者ID:gabla5,项目名称:SO-Answers,代码行数:17,代码来源:CompressPageViewState.aspx.cs


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