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


C# SerializationReader.ReadUInt16方法代码示例

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


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

示例1: 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;
//.........这里部分代码省略.........
开发者ID:kuba85,项目名称:fallen-8,代码行数:101,代码来源:PersistencyFactory.cs

示例2: 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
                                   });
            }
        }
开发者ID:kuba85,项目名称:fallen-8,代码行数:55,代码来源:PersistencyFactory.cs

示例3: Deserialize

        public override void Deserialize(ref SerializationReader mySerializationReader)
        {
            UInt16 NumberOfObjectLocatorPositions;
            UInt16 NumberOfINodePositions;

            try
            {

                #region Read Common attributes

                _CreationTime                   =           mySerializationReader.ReadUInt64();
                _LastModificationTime           =           mySerializationReader.ReadUInt64();
                _LastAccessTime                 =           mySerializationReader.ReadUInt64();
                _DeletionTime                   =           mySerializationReader.ReadUInt64();
                _ObjectSize                     =           mySerializationReader.ReadUInt64();

                #endregion

                #region Object Safety and Security

                _IntegrityCheckAlgorithm        =           (IntegrityCheckTypes)mySerializationReader.ReadOptimizedByte();
                _EncryptionAlgorithm            =           (SymmetricEncryptionTypes)mySerializationReader.ReadOptimizedByte();

                #endregion

                #region Read list of ObjectLocatorPositions

                _ObjectLocatorLength            =           mySerializationReader.ReadUInt64();
                _ObjectLocatorCopies            =           mySerializationReader.ReadUInt64();

                NumberOfObjectLocatorPositions  =           mySerializationReader.ReadUInt16();
                _ObjectLocatorPositions         =           new List<ExtendedPosition>();

                for (int i = 1; i <= NumberOfObjectLocatorPositions; i++)
                    _ObjectLocatorPositions.Add(new ExtendedPosition(new StorageUUID(mySerializationReader.ReadByteArray()), mySerializationReader.ReadUInt64()));

                #endregion

                #region Read list of INodePositions

                NumberOfINodePositions          =           mySerializationReader.ReadUInt16();
                _INodePositions                 =           new List<ExtendedPosition>();

                for (int i = 1; i <= NumberOfINodePositions; i++)
                    _INodePositions.Add(new ExtendedPosition(new StorageUUID(mySerializationReader.ReadByteArray()), mySerializationReader.ReadUInt64()));

                #endregion

                #region Read State

                _ObjectLocatorStates = (ObjectLocatorStates)mySerializationReader.ReadOptimizedByte();

                #endregion

            }

            catch (Exception e)
            {
                throw new GraphFSException_INodeCouldNotBeDeserialized("INode could not be deserialized!\n\n" + e);
            }

            //isDirty = true;       // this is not useful!
        }
开发者ID:TheByte,项目名称:sones,代码行数:63,代码来源:INode.cs

示例4: Load

        public void Load(SerializationReader reader, Fallen8 fallen8)
        {
            _uriPattern = reader.ReadString ();
            _address = IPAddress.Parse (reader.ReadString ());
            _port = reader.ReadUInt16 ();

            _service = LoadServiceFromSerialization (reader, fallen8);
            _service.Load (reader, fallen8);

            StartService ();
        }
开发者ID:politician,项目名称:fallen-8,代码行数:11,代码来源:ARESTServicePlugin.cs

示例5: Deserialize

        public override void Deserialize(ref SerializationReader mySerializationReader)
        {
            UInt32 _Capacity;

            if (mySerializationReader != null)
            {
                try
                {
                    _UUID = new TypeUUID(this.ObjectUUID.GetByteArray());
                    ParentTypeUUID = new TypeUUID();
                    ParentTypeUUID.Deserialize(ref mySerializationReader);
                    _IsUserDefined = mySerializationReader.ReadBoolean();
                    _IsAbstract = mySerializationReader.ReadBoolean();
                    _Comment = mySerializationReader.ReadString();

                    _Capacity = mySerializationReader.ReadUInt32();

                    _Attributes = new Dictionary<AttributeUUID, TypeAttribute>();

                    _TypeAttributeLookupTable = new Dictionary<AttributeUUID, TypeAttribute>();

                    for (UInt32 i = 0; i < _Capacity; i++)
                    {
                        var _AttrAtrib = new AttributeUUID();
                        _AttrAtrib.Deserialize(ref mySerializationReader);
                        var _TypeObj = new TypeAttribute();
                        _TypeObj.Deserialize(ref mySerializationReader);
                        _Attributes.Add(_AttrAtrib, _TypeObj);
                        _TypeAttributeLookupTable.Add(_AttrAtrib, _TypeObj);
                    }

                    _Capacity = mySerializationReader.ReadUInt32();
                    _TypeSettings = new Dictionary<String, ADBSettingsBase>();

                    for (var i = 0; i < _Capacity; i++)
                    {
                        ADBSettingsBase _ADBSettingsBase = (ADBSettingsBase) mySerializationReader.ReadObject();
                        if(_ADBSettingsBase != null)
                            _TypeSettings.Add(_ADBSettingsBase.Name, _ADBSettingsBase);
                    }

                    _Capacity = mySerializationReader.ReadUInt32();
                    _UniqueAttributes = new List<AttributeUUID>();
                    AttributeUUID AttribID = null;

                    for (UInt32 i = 0; i < _Capacity; i++)
                    {
                        AttribID = new AttributeUUID(ref mySerializationReader);
                        _UniqueAttributes.Add(AttribID);
                    }

                    _Capacity = mySerializationReader.ReadUInt32();
                    _MandatoryAttributes = new HashSet<AttributeUUID>();

                    for (UInt32 i = 0; i < _Capacity; i++)
                    {
                        AttribID = new AttributeUUID(ref mySerializationReader);
                        _MandatoryAttributes.Add(AttribID);
                    }

                    ObjectDirectoryShards = mySerializationReader.ReadUInt16();

                    #region Indices

                    _AttributeIndices = new Dictionary<IndexKeyDefinition, Dictionary<String, AAttributeIndex>>();
                    _AttributeIndicesNameLookup = new Dictionary<String, IndexKeyDefinition>();

                    var idxCount = mySerializationReader.ReadUInt32();
                    for (var i = 0; i < idxCount; i++)
                    {

                        var idxKey = new IndexKeyDefinition();
                        idxKey.Deserialize(ref mySerializationReader);

                        //_AttributeIndices.Add(idxKey, new Dictionary<String, AttributeIndex>());

                        var idxVersionCount = mySerializationReader.ReadUInt32();

                        for (var j = 0; j < idxVersionCount; j++)
                        {

                            var key                 = mySerializationReader.ReadString();
                            var fileSystemLocation  = new ObjectLocation(mySerializationReader.ReadString());
                            var indexEdition        = mySerializationReader.ReadString();
                            var indexName           = mySerializationReader.ReadString();
                            var indexType           = mySerializationReader.ReadString();
                            var isUUIDIdx           = mySerializationReader.ReadBoolean();
                            var keyCount            = mySerializationReader.ReadUInt64();
                            var valueCount          = mySerializationReader.ReadUInt64();
                            var attributeIdxShards = mySerializationReader.ReadUInt16();

                            //var CreateIdxExcept = CreateAttributeIndex(indexName, idxKey.IndexKeyAttributeUUIDs, indexEdition, indexObjectType, fileSystemLocation);

                            if (isUUIDIdx)
                            {
                                AddAttributeIndex(new UUIDIndex(indexName, idxKey, this, attributeIdxShards, indexType, indexEdition, keyCount));
                            }
                            else
                            {
                                AddAttributeIndex(new AttributeIndex(indexName, idxKey, this, attributeIdxShards, indexType, indexEdition, keyCount, valueCount));
//.........这里部分代码省略.........
开发者ID:TheByte,项目名称:sones,代码行数:101,代码来源:GraphDBType.cs


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