本文整理汇总了C#中SerializationReader类的典型用法代码示例。如果您正苦于以下问题:C# SerializationReader类的具体用法?C# SerializationReader怎么用?C# SerializationReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerializationReader类属于命名空间,在下文中一共展示了SerializationReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Association
public Association(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
if (SerializerHelper.UseFastSerialization)
{
using (SerializationReader reader = new SerializationReader((byte[])serializationInfo.GetValue("d", typeof(byte[]))))
{
_UniqueId = reader.ReadString();
_AssociatedObjectId = reader.ReadString();
_AssociationKind = reader.ReadString();
_Mappings = (List<Mapping>)reader.ReadObject();
_Name = reader.ReadString();
_Enabled = reader.ReadBoolean();
}
}
else
{
if (SerializationVersionExists)
{
try
{
}
catch (SerializationException)
{
// ignore
SerializationVersionExists = false;
}
}
_AssociatedObject = (ScriptObject)serializationInfo.GetValue("AssociatedObject", ModelTypes.ScriptObject);
_PrimaryObject = (ScriptObject)serializationInfo.GetValue("PrimaryObject", ModelTypes.ScriptObject);
_AssociationKind = serializationInfo.GetString("AssociationKind");
_Mappings = (List<Mapping>)serializationInfo.GetValue("Mappings", typeof(List<Mapping>));
_Name = serializationInfo.GetString("Name");
_Enabled = serializationInfo.GetBoolean("Enabled");
}
}
示例2: Deserialize
public void Deserialize(byte[] mySerializedBytes)
{
var _SerializationReader = new SerializationReader(mySerializedBytes);
ObjectLocation = _SerializationReader.ReadString();
NewDefaultRule = _SerializationReader.ReadOptimizedByte();
}
示例3: Deserialize
public void Deserialize(byte[] mySerializedBytes)
{
var _SerializationReader = new SerializationReader(mySerializedBytes);
FailedCopy = _SerializationReader.ReadInt32();
MaxNumberOfCopies = _SerializationReader.ReadInt32();
SerializedObjectStream = _SerializationReader.ReadByteArray();
}
示例4: GetHistoryOrdersUncompressed
public RequestStatus GetHistoryOrdersUncompressed(int? accountId, DateTime? startDate, out List<MarketOrder> orders)
{
orders = null;
byte[] buffer;
var retVal = proxy.GetHistoryOrdersCompressed(accountId, startDate, out buffer);
if (buffer == null || buffer.Length == 0) return retVal;
try
{
using (var reader = new SerializationReader(buffer))
{
var array = reader.ReadObjectArray(typeof (MarketOrder));
if (array != null && array.Length > 0)
orders = array.Cast<MarketOrder>().ToList();
}
}
catch (Exception ex)
{
Logger.Error("GetHistoryOrdersUncompressed() - serialization error", ex);
return RequestStatus.SerializationError;
}
return retVal;
}
示例5: DeserializeStateBag
public static StateBag DeserializeStateBag(SerializationReader reader)
{
var flags = reader.ReadOptimizedBitVector32();
var stateBag = new StateBag(flags[StateBagIsIgnoreCase]);
if (flags[StateBagHasDirtyEntries])
{
var count = reader.ReadOptimizedInt32();
for(var i = 0; i < count; i++)
{
var key = reader.ReadOptimizedString();
var value = reader.ReadObject();
// ReSharper disable PossibleNullReferenceException
stateBag.Add(key, value).IsDirty = true;
// ReSharper restore PossibleNullReferenceException
}
}
if (flags[StateBagHasCleanEntries])
{
var count = reader.ReadOptimizedInt32();
for(var i = 0; i < count; i++)
{
var key = reader.ReadOptimizedString();
var value = reader.ReadObject();
stateBag.Add(key, value);
}
}
return stateBag;
}
示例6: TestOutOfRange
public void TestOutOfRange()
{
using (MemoryStream ms = new MemoryStream())
using (SerializationReader sr = new SerializationReader(ms))
{
sr.Read<bool>();
sr.Read<byte>();
sr.Read<char>();
sr.Read<short>();
sr.Read<int>();
sr.Read<long>();
sr.Read<float>();
sr.Read<double>();
sr.Read<decimal>();
sr.Read<DateTime>();
sr.Read<string>();
sr.Read<TestEnum>();
sr.Read<string[]>();
sr.Read<List<string>>();
sr.Read<Dictionary<int, string>>();
sr.Read<TestSerializable>();
}
}
示例7: Deserialize
public void Deserialize(byte[] mySerializedBytes)
{
var reader = new SerializationReader(mySerializedBytes);
ObjectLocation = reader.ReadString();
RightUUID = new UUID(reader.ReadByteArray());
EntitiyUUID = new UUID(reader.ReadByteArray());
}
示例8: EnvelopeStamp
/// <summary>
/// Implementing the ISerializable to provide a faster, more optimized
/// serialization for the class.
/// </summary>
public EnvelopeStamp(SerializationInfo info, StreamingContext context)
{
// Get from the info.
SerializationReader reader = new SerializationReader((byte[])info.GetValue("data", typeof(byte[])));
_stampId = reader.ReadInt64();
_receiverId = (ClientId)reader.ReadObject();
_senderId = (ClientId)reader.ReadObject();
}
示例9: Index
/// <exclude/>
public Index(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
if (SerializerHelper.UseFastSerialization)
{
_columns = null;
using (SerializationReader reader = new SerializationReader((byte[])serializationInfo.GetValue("d", typeof(byte[]))))
{
UniqueId = reader.ReadString();
Lookups.Add(UniqueId, this);
_alias = reader.ReadString();
_columnIds = reader.ReadStringArray();
_enabled = reader.ReadBoolean();
_isUserDefined = reader.ReadBoolean();
_name = reader.ReadString();
// TODO: Parent
_type = reader.ReadString();
_userOptions = (List<IUserOption>)reader.ReadObject();
}
}
else
{
int version = 0;
if (SerializationVersionExists)
{
try
{
version = serializationInfo.GetInt32("SerializationVersion");
}
catch (SerializationException)
{
// ignore
SerializationVersionExists = false;
}
}
_alias = serializationInfo.GetString("Alias");
_columns = (List<Column>)serializationInfo.GetValue("Columns", ModelTypes.ColumnList);
_enabled = serializationInfo.GetBoolean("Enabled");
//this._exposedUserOptions = serializationInfo.GetValue("ExposedUserOptions", ModelTypes.Object);
_isUserDefined = serializationInfo.GetBoolean("IsUserDefined");
_name = serializationInfo.GetString("Name");
_parent = (ScriptObject)serializationInfo.GetValue("Parent", ModelTypes.ScriptObject);
_type = serializationInfo.GetString("Type");
_userOptions = (List<IUserOption>)serializationInfo.GetValue("UserOptions", ModelTypes.UserOptionList);
for (int i = 0; i < _userOptions.Count; i++)
{
_userOptions[i].Owner = this;
}
if (version >= 8)
{
_description = serializationInfo.GetString("Description");
}
}
}
示例10: Deserialize
public void Deserialize(byte[] Data)
{
SerializationReader reader = new SerializationReader(Data);
AccountName = (String)reader.ReadObject();
DeviceID = (String)reader.ReadObject();
Timestamp = (String)reader.ReadObject();
Latitude = (String)reader.ReadObject();
Longitude = (String)reader.ReadObject();
AccuracyInMeters = (String)reader.ReadObject();
}
示例11: Envelope
/// <summary>
/// Implementing the ISerializable to provide a faster, more optimized
/// serialization for the class using the fast serialization elements.
/// </summary>
public Envelope(SerializationInfo info, StreamingContext context)
{
// Get from the info.
SerializationReader reader = new SerializationReader((byte[])info.GetValue("data", typeof(byte[])));
_duplicationMode = (DuplicationModeEnum)reader.ReadInt32();
_executionModel = (ExecutionModelEnum)reader.ReadInt32();
_message = reader.ReadObject();
_transportHistory = (EnvelopeTransportation)reader.ReadObject();
_transportTargetAddress = (EnvelopeTransportation)reader.ReadObject();
}
示例12: Deserialize
public void Deserialize(byte[] mySerializedBytes)
{
SerializationReader reader = new SerializationReader(mySerializedBytes);
ServiceGlobalUniqueName = reader.ReadString();
String _ServiceUri = reader.ReadString();
ServiceType = (DiscoverableServiceType)reader.ReadOptimizedByte();
if (!Uri.TryCreate(_ServiceUri,UriKind.Absolute,out ServiceUri))
throw new NotificationException_InvalidNotificationPayload("IP not parseable. Notification Packet invalid!");
}
示例13: Deserialize
public object Deserialize(SerializationReader reader, Type type)
{
if (type == typeof(Color))
{
return DeserializeColor(reader);
}
else
{
throw new InvalidOperationException(string.Format("{0} does not support Type: {1}", GetType(), type));
}
}
示例14: DeserializeOrder
public static MarketOrder DeserializeOrder(SerializationReader reader)
{
var deal = new MarketOrder
{
ID = reader.ReadInt32(),
AccountID = reader.ReadInt32(),
Comment = reader.ReadString(),
ExitReason = (PositionExitReason)reader.ReadInt16(),
ExpertComment = reader.ReadString(),
PriceEnter = reader.ReadSingle(),
ResultDepo = reader.ReadSingle(),
ResultPoints = reader.ReadSingle(),
Side = reader.ReadSByte(),
State = (PositionState) reader.ReadInt16(),
Symbol = reader.ReadString(),
TimeEnter = reader.ReadDateTime(),
Trailing = reader.ReadString(),
Volume = reader.ReadInt32(),
VolumeInDepoCurrency = reader.ReadSingle()
};
// nullable values
var flags = reader.ReadOptimizedBitVector32();
if (flags[magicIsValued])
deal.Magic = reader.ReadInt32();
if (flags[pendingOrderIdIsValued])
deal.PendingOrderID = reader.ReadInt32();
if (flags[priceBestIsValued])
deal.PriceBest = reader.ReadSingle();
if (flags[priceExitIsValued])
deal.PriceExit = reader.ReadSingle();
if (flags[priceWorstIsValued])
deal.PriceWorst = reader.ReadSingle();
if (flags[stopLossIsValued])
deal.StopLoss = reader.ReadSingle();
if (flags[swapIsValued])
deal.Swap = reader.ReadSingle();
if (flags[takeProfitIsValued])
deal.TakeProfit = reader.ReadSingle();
if (flags[timeExitIsValued])
deal.TimeExit = reader.ReadDateTime();
return deal;
}
示例15: Deserialize
public void Deserialize(byte[] Data)
{
SerializationReader reader = new SerializationReader(Data);
AccountName = (String)reader.ReadObject();
LatitudeID = (String)reader.ReadObject();
Timecode = (Int64)reader.ReadObject();
reverseGeocode = (String)reader.ReadObject();
Latitude = (Double)reader.ReadObject();
Longitude = (Double)reader.ReadObject();
AccuracyInMeters = (Int32)reader.ReadObject();
}