本文整理汇总了C#中SerializationInfo类的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo类的具体用法?C# SerializationInfo怎么用?C# SerializationInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerializationInfo类属于命名空间,在下文中一共展示了SerializationInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdapterManagementComponent
/// <summary>
/// Deserializing contructor.
/// </summary>
public AdapterManagementComponent(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_adapters = new GenericContainer<IIntegrationAdapter>();
_adapters.ItemAddedEvent += new GenericContainer<IIntegrationAdapter>.ItemUpdateDelegate(Adapters_ItemAddedEvent);
_adapters.ItemRemovedEvent += new GenericContainer<IIntegrationAdapter>.ItemUpdateDelegate(Adapters_ItemRemovedEvent);
_startedAdaptersIds = (List<ComponentId>)info.GetValue("startedAdaptersIds", _startedAdaptersIds.GetType());
// Adapters are serialized one by one, to add safety when deserializing (one adapter will
// otherwise block the entire deserialization for the manager).
int adaptersCount = (int)info.GetValue("adapterCount", typeof(int));
for (int i = 0; i < adaptersCount; i++)
{
try
{
IIntegrationAdapter adapter = (IIntegrationAdapter)info.GetValue("adapter_" + i, typeof(IIntegrationAdapter));
_adapters.Add(adapter);
}
catch (SerializationException ex)
{
SystemMonitor.OperationError("Failed to deserialize integration adapter [" + ex.Message + "].");
}
catch (InvalidCastException ex)
{
SystemMonitor.OperationError("Failed to deserialize integration adapter [" + ex.Message + "].");
}
}
ChangeOperationalState(OperationalStateEnum.Constructed);
}
示例2: Message
public Message(SerializationInfo info, StreamingContext context)
{
SourceID = info.GetInt32 ("SourceID");
DestID = info.GetInt32 ("DestID");
Type = (MessageType)info.GetByte ("MessageType");
SerializedContent = (byte[])info.GetValue ("SerializedContent", typeof(byte[]));
}
示例3: Resource
public Resource(SerializationInfo info, StreamingContext context)
: base(1,(string) info.GetValue("type", typeof(string)), null, (string) info.GetValue("description", typeof(string)), null)
{
// Reset the property value using the GetValue method.
tier = (int) info.GetValue("tier", typeof(int));
use = (int) info.GetValue ("use", typeof(int));
}
示例4: GetObjectData
/*[SecurityPermissionAttribute(
SecurityAction.Demand,
SerializationFormatter = true)] */
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
info.AddValue("x", this.x);
info.AddValue("y", this.y);
info.AddValue("z", this.z);
info.AddValue("w", this.w);
}
示例5: SaveData
public SaveData(SerializationInfo info, StreamingContext ctxt)
{
mapName = (string)info.GetValue ("mapName", typeof(string));
playerLocation = (float[])info.GetValue ("playerLocation", typeof(float[]));
activeQuests = (List<Quest>)info.GetValue ("activeQuests", typeof(List<Quest>));
completedQuests = (List<Quest>)info.GetValue ("completedQuests", typeof(List<Quest>));
}
示例6: foreach
void IMobileObject.SetState(SerializationInfo info)
{
foreach (string key in info.Values.Keys)
{
Add(key, info.Values[key].Value);
}
}
示例7: RuntimeException
/// <summary>
/// Initializes a new instance of the RuntimeException class
/// using data serialized via
/// <see cref="ISerializable"/>
/// </summary>
/// <param name="info"> serialization information </param>
/// <param name="context"> streaming context </param>
/// <returns> constructed object </returns>
protected RuntimeException(SerializationInfo info,
StreamingContext context)
: base(info, context)
{
_errorId = info.GetString("ErrorId");
_errorCategory = (ErrorCategory)info.GetInt32("ErrorCategory");
}
示例8: GetObjectData
// Required by the ISerializable class to be properly serialized. This is called automatically
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
// Repeat this for each var defined in the Values section
info.AddValue("ConeUnlocked", (ConeUnlocked));
info.AddValue("HiScore", HiScore);
info.AddValue("ExplosivesLeft", ExplosivesLeft);
}
示例9: GetObjectData
// Serialization funciton.
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
// You can use any name/value pair, as long as you read them with the same names
info.AddValue("Health", health);
info.AddValue("Name", name);
}
示例10: CChair_SALContainer
//Serializatoin counstructor. call when Deserialize function called.
private CChair_SALContainer(SerializationInfo info, StreamingContext context)
: base(info,context)
{
var1 = info.GetInt32("var1");
var2 = info.GetInt32("var2");
str1 = (string[])info.GetValue("str1",typeof(string[]));
}
示例11: SampledStroke
public SampledStroke(SerializationInfo info, StreamingContext ctxt)
{
beginning = info.GetInt32("beginning");
str = (List<Dot>)info.GetValue("str", typeof(List<Dot>));
positionX = 0;
positionY = 0;
}
示例12: GetObjectData
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
info.AddValue("object2PropertiesMappings", this.object2PropertiesMappings);
info.AddValue("EZR_VERSION", EZR_VERSION);
info.AddValue("recordingInterval", this.recordingInterval);
//base.GetObjectData(info, context);
}
示例13: GetObjectData
// Method called to serialize a Vector3 object
public void GetObjectData(System.Object obj, SerializationInfo info, StreamingContext context)
{
Color c = (Color) obj;
info.AddValue("r", c.r);
info.AddValue("g", c.g);
info.AddValue("b", c.b);
}
示例14: PSArgumentException
/// <summary>
/// Initializes a new instance of the PSArgumentException class
/// using data serialized via
/// <see cref="System.Runtime.Serialization.ISerializable"/>
/// </summary>
/// <param name="info"> serialization information </param>
/// <param name="context"> streaming context </param>
/// <returns> constructed object </returns>
protected PSArgumentException(SerializationInfo info,
StreamingContext context)
: base(info, context)
{
_errorId = info.GetString("ErrorId");
_message = info.GetString("PSArgumentException_MessageOverride");
}
示例15: GetObjectData
// Required by the ISerializable class to be properly serialized. This is called automatically
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
// Repeat this for each var defined in the Values section
info.AddValue("foundGem1", (foundGem1));
info.AddValue("score", score);
info.AddValue("levelReached", levelReached);
}