本文整理汇总了C#中SerializationReader.ReadInt32方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationReader.ReadInt32方法的具体用法?C# SerializationReader.ReadInt32怎么用?C# SerializationReader.ReadInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationReader
的用法示例。
在下文中一共展示了SerializationReader.ReadInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public void Deserialize(byte[] mySerializedBytes)
{
var _SerializationReader = new SerializationReader(mySerializedBytes);
FailedCopy = _SerializationReader.ReadInt32();
MaxNumberOfCopies = _SerializationReader.ReadInt32();
SerializedObjectStream = _SerializationReader.ReadByteArray();
}
示例2: 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();
}
示例3: 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;
}
示例4: SuperPoolCall
/// <summary>
/// Implementing the ISerializable to provide a faster, more optimized
/// serialization for the class.
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
public SuperPoolCall(SerializationInfo info, StreamingContext context)
{
// Get from the info.
SerializationReader reader = new SerializationReader((byte[])info.GetValue("data", typeof(byte[])));
Id = reader.ReadInt64();
State = (StateEnum)reader.ReadInt32();
RequestResponse = reader.ReadBoolean();
Parameters = reader.ReadObjectArray();
string methodInfoName = reader.ReadString();
_methodInfoName = methodInfoName;
MethodInfoLocal = SerializationHelper.DeserializeMethodBaseFromString(_methodInfoName, true);
}
示例5: Deserialize
public void Deserialize(ref SerializationReader mySerializationReader)
{
var typeCode = mySerializationReader.ReadInt16();
Value = new HashSet<IComparable>();
var itemCnt = mySerializationReader.ReadInt32();
for (int i = 0; i < itemCnt; i++)
{
Value.Add((IComparable)mySerializationReader.ReadObject());
}
}
示例6: Load
/// <summary>
/// Load Fallen-8 from a save point
/// </summary>
/// <param name="fallen8">Fallen-8</param>
/// <param name="graphElements">The graph elements </param>
/// <param name="pathToSavePoint">The path to the save point.</param>
/// <param name="currentId">The maximum graph element id</param>
/// <param name="startServices">Start the services</param>
internal static Boolean Load(Fallen8 fallen8, ref BigList<AGraphElement> graphElements, string pathToSavePoint, ref Int32 currentId, Boolean startServices)
{
//if there is no savepoint file... do nothing
if (!File.Exists(pathToSavePoint))
{
Logger.LogError(String.Format("Fallen-8 could not be loaded because the path \"{0}\" does not exist.", pathToSavePoint));
return false;
}
var pathName = Path.GetDirectoryName(pathToSavePoint);
var fileName = Path.GetFileName(pathToSavePoint);
Logger.LogInfo(String.Format("Now loading file \"{0}\" from path \"{1}\"", fileName, pathName));
using (var file = File.Open(pathToSavePoint, FileMode.Open, FileAccess.Read))
{
var reader = new SerializationReader(file);
currentId = reader.ReadInt32();
graphElements.InitializeUntil(currentId);
#region graph elements
//initialize the list of graph elements
var graphElementStreams = new List<String>();
var numberOfGraphElemementStreams = reader.ReadInt32();
for (var i = 0; i < numberOfGraphElemementStreams; i++)
{
var graphElementBunchFilename = Path.Combine(pathName, reader.ReadString());
Logger.LogInfo(String.Format("Found graph element bunch {0} here: \"{1}\"", i, graphElementBunchFilename));
graphElementStreams.Add(graphElementBunchFilename);
}
LoadGraphElements(graphElements, graphElementStreams);
#endregion
#region indexe
var indexStreams = new List<String>();
var numberOfIndexStreams = reader.ReadInt32();
for (var i = 0; i < numberOfIndexStreams; i++)
{
var indexFilename = Path.Combine(pathName, reader.ReadString());
Logger.LogInfo(String.Format("Found index number {0} here: \"{1}\"", i, indexFilename));
indexStreams.Add(indexFilename);
}
var newIndexFactory = new IndexFactory();
LoadIndices(fallen8, newIndexFactory, indexStreams);
fallen8.IndexFactory = newIndexFactory;
#endregion
#region services
var serviceStreams = new List<String>();
var numberOfServiceStreams = reader.ReadInt32();
for (var i = 0; i < numberOfServiceStreams; i++)
{
var serviceFilename = Path.Combine(pathName, reader.ReadString());
Logger.LogInfo(String.Format("Found service number {0} here: \"{1}\"", i, serviceFilename));
serviceStreams.Add(serviceFilename);
}
var newServiceFactory = new ServiceFactory(fallen8);
fallen8.ServiceFactory = newServiceFactory;
LoadServices(fallen8, newServiceFactory, serviceStreams, startServices);
#endregion
return true;
}
}
示例7: LoadVertex
/// <summary>
/// Loads the vertex.
/// </summary>
/// <param name='reader'> Reader. </param>
/// <param name='graphElements'> Graph elements. </param>
/// <param name='edgeTodo'> Edge todo. </param>
private static void LoadVertex(SerializationReader reader, BigList<AGraphElement> graphElements,
Dictionary<Int32, List<EdgeOnVertexToDo>> edgeTodo)
{
var id = reader.ReadInt32();
var creationDate = reader.ReadUInt32();
var modificationDate = reader.ReadUInt32();
#region properties
var propertyCount = reader.ReadInt32();
PropertyContainer[] properties = null;
if (propertyCount > 0)
{
properties = new PropertyContainer[propertyCount];
for (var i = 0; i < propertyCount; i++)
{
var propertyIdentifier = reader.ReadUInt16();
var propertyValue = reader.ReadObject();
properties[i] = new PropertyContainer {PropertyId = propertyIdentifier, Value = propertyValue};
}
}
#endregion
#region edges
#region outgoing edges
List<EdgeContainer> outEdgeProperties = null;
var outEdgeCount = reader.ReadInt32();
if (outEdgeCount > 0)
{
outEdgeProperties = new List<EdgeContainer>(outEdgeCount);
for (var i = 0; i < outEdgeCount; i++)
{
var outEdgePropertyId = reader.ReadUInt16();
var outEdgePropertyCount = reader.ReadInt32();
var outEdges = new List<EdgeModel>(outEdgePropertyCount);
for (var j = 0; j < outEdgePropertyCount; j++)
{
var edgeId = reader.ReadInt32();
EdgeModel edge = graphElements.GetElement(edgeId) as EdgeModel;
if (edge != null)
{
outEdges.Add(edge);
}
else
{
var aEdgeTodo = new EdgeOnVertexToDo
{
VertexId = id,
EdgePropertyId = outEdgePropertyId,
IsIncomingEdge = false
};
List<EdgeOnVertexToDo> todo;
if (edgeTodo.TryGetValue(edgeId, out todo))
{
todo.Add(aEdgeTodo);
}
else
{
edgeTodo.Add(edgeId, new List<EdgeOnVertexToDo> {aEdgeTodo});
}
}
}
outEdgeProperties.Add(new EdgeContainer(outEdgePropertyId, outEdges));
}
}
#endregion
#region incoming edges
List<EdgeContainer> incEdgeProperties = null;
var incEdgeCount = reader.ReadInt32();
if (incEdgeCount > 0)
{
incEdgeProperties = new List<EdgeContainer>(incEdgeCount);
for (var i = 0; i < incEdgeCount; i++)
{
var incEdgePropertyId = reader.ReadUInt16();
var incEdgePropertyCount = reader.ReadInt32();
var incEdges = new List<EdgeModel>(incEdgePropertyCount);
for (var j = 0; j < incEdgePropertyCount; j++)
{
var edgeId = reader.ReadInt32();
EdgeModel edge = graphElements.GetElement(edgeId) as EdgeModel;
//.........这里部分代码省略.........
示例8: LoadEdge
/// <summary>
/// Loads the edge.
/// </summary>
/// <param name='reader'> Reader. </param>
/// <param name='graphElements'> Graph elements. </param>
/// <param name='sneakPeaks'> Sneak peaks. </param>
private static void LoadEdge(SerializationReader reader, BigList<AGraphElement> graphElements,
ref List<EdgeSneakPeak> sneakPeaks)
{
var id = reader.ReadInt32();
var creationDate = reader.ReadUInt32();
var modificationDate = reader.ReadUInt32();
#region properties
PropertyContainer[] properties = null;
var propertyCount = reader.ReadInt32();
if (propertyCount > 0)
{
properties = new PropertyContainer[propertyCount];
for (var i = 0; i < propertyCount; i++)
{
var propertyIdentifier = reader.ReadUInt16();
var propertyValue = reader.ReadObject();
properties[i] = new PropertyContainer {PropertyId = propertyIdentifier, Value = propertyValue};
}
}
#endregion
var sourceVertexId = reader.ReadInt32();
var targetVertexId = reader.ReadInt32();
VertexModel sourceVertex = graphElements.GetElement(sourceVertexId) as VertexModel;
VertexModel targetVertex = graphElements.GetElement(targetVertexId) as VertexModel;
if (sourceVertex != null && targetVertex != null)
{
graphElements.SetValue(id,new EdgeModel(id, creationDate, modificationDate, targetVertex,sourceVertex, properties));
}
else
{
sneakPeaks.Add(new EdgeSneakPeak
{
CreationDate = creationDate,
Id = id,
ModificationDate = modificationDate,
Properties = properties,
SourceVertexId = sourceVertexId,
TargetVertexId = targetVertexId
});
}
}
示例9: Load
public void Load(SerializationReader reader, Fallen8 fallen8)
{
if (WriteResource())
{
try
{
reader.ReadInt32();//parameter
var keyCount = reader.ReadInt32();
_idx = new Dictionary<IComparable, List<AGraphElement>>(keyCount);
for (var i = 0; i < keyCount; i++)
{
var key = reader.ReadObject();
var value = new List<AGraphElement>();
var valueCount = reader.ReadInt32();
for (var j = 0; j < valueCount; j++)
{
var graphElementId = reader.ReadInt32();
AGraphElement graphElement;
if (fallen8.TryGetGraphElement(out graphElement, graphElementId))
{
value.Add(graphElement);
}
else
{
Logger.LogError(String.Format("[DictionaryIndex] Error while deserializing the index. Could not find the graph element \"{0}\"", graphElementId));
}
}
_idx.Add((IComparable)key, value);
}
}
finally
{
FinishWriteResource();
}
return;
}
throw new CollisionException(this);
}
示例10: MapColumn
/// <exclude/>
public MapColumn(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
if (SerializerHelper.UseFastSerialization)
{
_relationshipPath = null;
using (SerializationReader reader = new SerializationReader((byte[])serializationInfo.GetValue("d", typeof(byte[]))))
{
UniqueId = reader.ReadString();
Lookups.Add(UniqueId, this);
_alias = reader.ReadString();
_aliasDisplay = reader.ReadString();
_characterMaximumLength = reader.ReadInt32();
// TODO: CurrentParent
_dataType = reader.ReadString();
_default = reader.ReadString();
_enabled = reader.ReadBoolean();
_foreignColumnId = reader.ReadString();
_inPrimaryKey = reader.ReadBoolean();
_isIdentity = reader.ReadBoolean();
_isNullable = reader.ReadBoolean();
_isUserDefined = reader.ReadBoolean();
_name = reader.ReadString();
_ordinalPosition = reader.ReadInt32();
// TODO: Parent
_readOnly = reader.ReadBoolean();
_RelationshipPathIds = reader.ReadStringArray();
_userOptions = (List<IUserOption>)reader.ReadObject();
for (int i = 0; i < _userOptions.Count; i++)
{
_userOptions[i].Owner = this;
}
}
}
else
{
_IsMapColumn = true;
int version = 0;
if (SerializationVersionExists)
{
try
{
version = serializationInfo.GetInt32("SerializationVersion");
}
catch (SerializationException)
{
// ignore
SerializationVersionExists = false;
}
}
_alias = serializationInfo.GetString("Alias");
_aliasDisplay = serializationInfo.GetString("AliasDisplay");
_characterMaximumLength = serializationInfo.GetInt32("CharacterMaximumLength");
_currentParent = (ScriptObject)serializationInfo.GetValue("CurrentParent", ModelTypes.ScriptObject);
_dataType = serializationInfo.GetString("DataType");
_default = serializationInfo.GetString("Default");
_enabled = serializationInfo.GetBoolean("Enabled");
//_exposedUserOptions = serializationInfo.GetValue("ExposedUserOptions", ModelTypes.Object);
_foreignColumn = (Column)serializationInfo.GetValue("ForeignColumn", ModelTypes.Column);
_inPrimaryKey = serializationInfo.GetBoolean("InPrimaryKey");
_isIdentity = serializationInfo.GetBoolean("IsIdentity");
_isNullable = serializationInfo.GetBoolean("IsNullable");
_isUserDefined = serializationInfo.GetBoolean("IsUserDefined");
_name = serializationInfo.GetString("Name");
_ordinalPosition = serializationInfo.GetInt32("OrdinalPosition");
_parent = (ScriptObject)serializationInfo.GetValue("Parent", ModelTypes.ScriptObject);
_readOnly = serializationInfo.GetBoolean("ReadOnly");
_relationshipPath = (Relationship[])serializationInfo.GetValue("RelationshipPath", ModelTypes.RelationshipArray);
_userOptions = (List<IUserOption>)serializationInfo.GetValue("UserOptions", ModelTypes.UserOptionList);
if (version >= 8)
{
_description = serializationInfo.GetString("Description");
}
}
}
示例11: SetObjectData
protected virtual void SetObjectData(SerializationReader sr)
{
f_Value = sr.ReadInt32();
}
示例12: Deserialize
public object Deserialize(SerializationReader mySerializationReader, Type type)
{
LicensedFeatures thisObject = (LicensedFeatures)Activator.CreateInstance(type);
thisObject.Features = new List<FeatureIDs>();
UInt32 cnt = (UInt32)mySerializationReader.ReadObject();
for (int i = 0; i < cnt; i++)
{
Byte entry = mySerializationReader.ReadOptimizedByte();
thisObject.Features.Add((FeatureIDs)entry);
}
thisObject.NumberOfLicensedCPUs = mySerializationReader.ReadInt32();
thisObject.NumberOfLicensedRAM = mySerializationReader.ReadInt32();
return thisObject;
}
示例13: Column
/// <summary>
/// TODO: I don't think this should be exposed to the user???
/// </summary>
/// <param name="serializationInfo"></param>
/// <param name="streamingContext"></param>
public Column(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
if (SerializerHelper.UseFastSerialization)
{
using (SerializationReader reader = new SerializationReader((byte[])serializationInfo.GetValue("d", typeof(byte[]))))
{
UniqueId = reader.ReadString();
Lookups.Add(UniqueId, this);
_alias = reader.ReadString();
_aliasDisplay = reader.ReadString();
_characterMaximumLength = reader.ReadInt32();
_dataType = reader.ReadString();
_default = reader.ReadString();
_enabled = reader.ReadBoolean();
_inPrimaryKey = reader.ReadBoolean();
_isIdentity = reader.ReadBoolean();
_isNullable = reader.ReadBoolean();
_isUserDefined = reader.ReadBoolean();
_name = reader.ReadString();
_ordinalPosition = reader.ReadInt32();
// Parent
_readOnly = reader.ReadBoolean();
_userOptions = (List<IUserOption>)reader.ReadObject();
_IsCalculated = reader.ReadBoolean();
_precision = reader.ReadInt32();
_scale = reader.ReadInt32();
for (int i = 0; i < _userOptions.Count; i++)
{
_userOptions[i].Owner = this;
}
}
}
else
{
int version = 0;
if (SerializationVersionExists)
{
try
{
version = serializationInfo.GetInt32("SerializationVersion");
}
catch (SerializationException)
{
// ignore
SerializationVersionExists = false;
}
}
_alias = serializationInfo.GetString("Alias");
_aliasDisplay = serializationInfo.GetString("AliasDisplay");
_characterMaximumLength = serializationInfo.GetInt32("CharacterMaximumLength");
_dataType = serializationInfo.GetString("DataType");
_default = serializationInfo.GetString("Default");
_enabled = serializationInfo.GetBoolean("Enabled");
//this._exposedUserOptions = serializationInfo.GetValue("ExposedUserOptions", ObjectType);
_inPrimaryKey = serializationInfo.GetBoolean("InPrimaryKey");
_isIdentity = serializationInfo.GetBoolean("IsIdentity");
_isNullable = serializationInfo.GetBoolean("IsNullable");
_isUserDefined = serializationInfo.GetBoolean("IsUserDefined");
_name = serializationInfo.GetString("Name");
_ordinalPosition = serializationInfo.GetInt32("OrdinalPosition");
_parent = (ScriptObject)serializationInfo.GetValue("Parent", ModelTypes.ScriptObject);
_readOnly = serializationInfo.GetBoolean("ReadOnly");
_userOptions = (List<IUserOption>)serializationInfo.GetValue("UserOptions", ModelTypes.UserOptionList);
if (version >= 2)
{
_IsCalculated = serializationInfo.GetBoolean("IsCalculated");
if (version >= 3)
{
_precision = serializationInfo.GetInt32("Precision");
_scale = serializationInfo.GetInt32("Scale");
if (version >= 8)
{
_description = serializationInfo.GetString("Description");
if (version >= 9)
{
_Lookup = (Lookup)serializationInfo.GetValue("Lookup", ModelTypes.Lookup);
//_Lookup.SubscribingObjects.Add(this);
}
}
}
}
}
}
示例14: Deserialize
public void Deserialize(SerializationReader reader)
{
name = reader.ReadString();
int count = reader.ReadInt32();
senses = new List<KeyValuePair<PhraseSense,double>>(count);
for (int ii = 0; ii < count; ii++)
{
PhraseSense sense = (PhraseSense)reader.ReadPointer();
double weight = reader.ReadDouble();
senses.Add(new KeyValuePair<PhraseSense, double>(sense, weight));
}
}
示例15: Deserialize
private object Deserialize(ref SerializationReader mySerializationReader, DBInt32 myValue)
{
myValue._Value = mySerializationReader.ReadInt32();
return myValue;
}