本文整理汇总了C#中System.Web.UI.LosFormatter.Deserialize方法的典型用法代码示例。如果您正苦于以下问题:C# LosFormatter.Deserialize方法的具体用法?C# LosFormatter.Deserialize怎么用?C# LosFormatter.Deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.LosFormatter
的用法示例。
在下文中一共展示了LosFormatter.Deserialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public override void Load()
{
IPersistViewState state = Ra.Brix.Data.Internal.Adapter.Instance as IPersistViewState;
LosFormatter formatter = new LosFormatter();
Pair pair = formatter.Deserialize(state.Load(_session.ToString(), Page.Request.Url.ToString())) as Pair;
ViewState = pair.First;
ControlState = pair.Second;
}
示例2: LoadPageStateFromCompressedViewState
protected object LoadPageStateFromCompressedViewState()
{
string viewState = Request.Form["__VSTATE"];
byte[] bytes = Convert.FromBase64String(viewState);
bytes = IntegrationWebSiteMvc.Classes.Compressor.Decompress(bytes);
LosFormatter formatter = new LosFormatter();
return formatter.Deserialize(Convert.ToBase64String(bytes));
}
示例3: 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)");
}
示例4: Load
public override void Load()
{
string viewStateString = Page.Request["__AJAXVIEWSTATE"];
viewStateString = viewStateString.Replace(",", "").Replace(" ", "");
LosFormatter los = new LosFormatter();
Pair pair = (Pair)los.Deserialize(viewStateString);
base.ViewState = pair.First;
base.ControlState = pair.Second;
}
示例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);
}
示例6: LoadPageStateFromPersistenceMedium
protected override object LoadPageStateFromPersistenceMedium()
{
_formatter = new LosFormatter();
object o;
string vsString = Request.Form["__COMPRESSEDVIEWSTATE"];
string outStr = new ComDePress().DeCompress(vsString);
o = _formatter.Deserialize(outStr);
return o;
}
示例7: LoadPageStateFromPersistenceMedium
protected override object LoadPageStateFromPersistenceMedium()
{
string vState = this.Request.Form["__VSTATE"];
byte[] bytes = System.Convert.FromBase64String( vState );
bytes = this.Decompress( bytes );
LosFormatter format = new LosFormatter();
return format.Deserialize( System.Convert.ToBase64String( bytes ) );
}
示例8: LoadPageStateFromPersistenceMedium
protected override object LoadPageStateFromPersistenceMedium()
{
string viewState = Request.Form["__VSTATE"];
byte[] bytes = Convert.FromBase64String(viewState);
LosFormatter formatter = new LosFormatter();
bytes = bytes.Decompress();
return formatter.Deserialize(Convert.ToBase64String(bytes));
}
示例9: 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");
}
示例10: Load
public override void Load()
{
string id = _session.ToString() + "|" + Page.Request.Url.ToString();
LosFormatter formatter = new LosFormatter();
if (Page.Session[id] == null)
throw new ArgumentException("session timeout ...");
string obj = Page.Session[id] as string;
Pair pair = formatter.Deserialize(obj) as Pair;
ViewState = pair.First;
ControlState = pair.Second;
}
示例11: LoadPageStateFromPersistenceMedium
protected override object LoadPageStateFromPersistenceMedium()
{
object state = null;
StreamReader reader = new StreamReader(GenerateFileName());
LosFormatter formator = new LosFormatter();
state = formator.Deserialize(reader);
reader.Close();
return state;
}
示例12: LoadPageStateFromPersistenceMedium
protected override object LoadPageStateFromPersistenceMedium()
{
object retVal;
string id = Request.Form["__VIEWSTATE_UniqueID"];
byte[] bytes = null;
_config = (ViewStateConfiguration) ConfigurationManager.GetSection("ViewStateConfiguration");
this._viewstateStorage = ViewstateStorageFactory.GetStorageMedium();
bytes = Convert.FromBase64String(this._viewstateStorage.Get(id).Value);
if (_config.Compression)
bytes = bytes.Decompress();
LosFormatter formatter = new LosFormatter();
retVal = formatter.Deserialize(Convert.ToBase64String(bytes));
return retVal;
}
示例13: LoadPageStateFromPersistenceMedium
/// <summary>
/// Loads any saved view-state information to the <see cref="T:System.Web.UI.Page"></see> object.
/// </summary>
/// <returns>The saved view state.</returns>
protected override object LoadPageStateFromPersistenceMedium()
{
String viewState = Request.Params[ViewStateKey];
if (viewState == null)
{
return null;
}
else
{
LosFormatter formatter = new LosFormatter();
return formatter.Deserialize(viewState);
}
}
示例14: LoadPageStateFromPersistenceMedium
// De-serialize view state
protected override object LoadPageStateFromPersistenceMedium()
{
var isCompressed = true;
var compressedViewState = Request.Form[_compressedViewState];
isCompressed = Convert.ToBoolean(Convert.ToInt32(compressedViewState.Substring(0, 1)));
compressedViewState = compressedViewState.Remove(0, 1);
var bytes = Convert.FromBase64String(compressedViewState);
if(isCompressed)
bytes = Compressor.Decompress<byte[]>(bytes);
var losformatter = new LosFormatter();
return losformatter.Deserialize(Convert.ToBase64String(bytes));
}
示例15: Deserialize
// Create a logger for use in this class
/*
private static readonly log4net.ILog log
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
*/
protected virtual void Deserialize(Stream s)
{
// Deserialize the storageConfig
System.Web.UI.LosFormatter scFormatter = new System.Web.UI.LosFormatter();
Hashtable ht = (Hashtable)scFormatter.Deserialize(s);
// Convert to a NameValueCollection. We only use Hashtable for serialization because
// LosFormatter can serialize it efficiently.
if (ht != null)
{
foreach (string key in ht.Keys)
{
this[key] = (string)ht[key];
}
}
}