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


C# IStorage.WriteInteger方法代码示例

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


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

示例1: Serialize

        public override bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                base.Serialize(storage);

                storage.WriteInteger(FieldCode.EmbeddedNodesCount, this.embeddedNodes.Count);
                foreach (uint i in this.embeddedNodes)
                    storage.WriteUnsignedInteger(FieldCode.EmbeddedNode, i);

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Condensed node serialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:21,代码来源:CondensedNode.cs

示例2: Serialize

        public bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                storage.WriteUnsignedInteger(FieldCode.SlotSignature, Configurations.SlotSignature);
                storage.WriteInteger(FieldCode.SlotType, (int)this.slotType);
                storage.WriteInteger(FieldCode.SlotVersion, (int)Slot.Version.Current);
                storage.WriteUnsignedInteger(FieldCode.SlotId, this.slotId);
                storage.WriteInteger(FieldCode.SlotState, (int)this.slotState);

                storage.WriteInteger(FieldCode.OwnersCount, this.owners.Count);
                foreach (uint i in this.owners)
                    storage.WriteUnsignedInteger(FieldCode.Owners, i);

                storage.WriteInteger(FieldCode.ConnectingSlotsCount, this.connectingSlots.Count);
                foreach (uint j in this.connectingSlots)
                    storage.WriteUnsignedInteger(FieldCode.ConnectingSlots, j);

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Slot serialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:29,代码来源:Slot.cs

示例3: Serialize

        public bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                storage.WriteUnsignedInteger(FieldCode.EdgeSignature, Configurations.EdgeSignature);
                storage.WriteInteger(FieldCode.EdgeType, (int)this.EdgeType);
                storage.WriteInteger(FieldCode.EdgeVersion, (int)VisualEdge.Version.Current);
                storage.WriteUnsignedInteger(FieldCode.EdgeId, this.EdgeId);
                storage.WriteInteger(FieldCode.EdgeState, (int)this.edgeState);
                storage.WriteUnsignedInteger(FieldCode.StartSlotId, this.StartSlotId);
                storage.WriteUnsignedInteger(FieldCode.EndSlotId, this.EndSlotId);

                storage.WriteInteger(FieldCode.ControlPointsCount, this.controlPoints.Count);
                foreach (Point pt in this.controlPoints)
                {
                    storage.WriteDouble(FieldCode.ControlPointsX, pt.X);
                    storage.WriteDouble(FieldCode.ControlPointsY, pt.Y);
                }

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Edge serialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:30,代码来源:VisualEdge.cs

示例4: RecordNodeIds

        private void RecordNodeIds(IStorage storage, List<IVisualNode> nodeList, UserAction userAction)
        {
            DataHeader header = new DataHeader();
            header.DataSize = Configurations.UndoReDoDataHeaderSize;
            long initialPosition = storage.GetPosition();

            //Record the number of nodes and the nodeIds
            storage.WriteInteger(FieldCode.NodeCount, nodeList.Count);
            foreach (IVisualNode node in nodeList)
            {
                header.Serialize(storage);
                storage.WriteUnsignedInteger(FieldCode.NodeId, node.NodeId);
            }

            this.RecordFlag(storage, initialPosition, userAction);
        }
开发者ID:samuto,项目名称:designscript,代码行数:16,代码来源:UndoRedoRecorder.cs

示例5: RecordNodesAndSlots

        private void RecordNodesAndSlots(IStorage storage, List<IVisualNode> nodeList, UserAction userAction)
        {
            DataHeader header = new DataHeader();
            long initialPostionForData, currentPositionForData = 0;
            long initialPosition = storage.GetPosition();

            //Retrieve all the slots Id in nodeList
            List<uint> allSlotsId = new List<uint>();
            foreach (IVisualNode node in nodeList)
            {
                if (node.GetInputSlots() != null)
                    allSlotsId.AddRange(node.GetInputSlots());
                if (node.GetOutputSlots() != null)
                    allSlotsId.AddRange(node.GetOutputSlots());
            }

            //Record the number of slots and the slot itself
            storage.WriteInteger(FieldCode.SlotCount, allSlotsId.Count());
            foreach (uint slotId in allSlotsId)
            {
                storage.Seek(header.HeaderSize, SeekOrigin.Current);
                initialPostionForData = storage.GetPosition();
                ISlot slot = this.graphController.GetSlot(slotId);
                slot.Serialize(storage);
                currentPositionForData = storage.GetPosition();
                header.DataSize = currentPositionForData - initialPostionForData;
                storage.Seek(-(header.HeaderSize + header.DataSize), SeekOrigin.Current);
                header.Serialize(storage);
                storage.Seek(header.DataSize, SeekOrigin.Current);
            }

            //Record the number of nodes and the node itself
            storage.WriteInteger(FieldCode.NodeCount, nodeList.Count);
            foreach (IVisualNode node in nodeList)
            {
                storage.Seek(header.HeaderSize, SeekOrigin.Current);
                initialPostionForData = storage.GetPosition();
                node.Serialize(storage);
                currentPositionForData = storage.GetPosition();
                header.DataSize = currentPositionForData - initialPostionForData;
                storage.Seek(-(header.HeaderSize + header.DataSize), SeekOrigin.Current);
                header.Serialize(storage);
                storage.Seek(header.DataSize, SeekOrigin.Current);
            }

            this.RecordFlag(storage, initialPosition, userAction);
        }
开发者ID:samuto,项目名称:designscript,代码行数:47,代码来源:UndoRedoRecorder.cs

示例6: RecordEdges

        private void RecordEdges(IStorage storage, List<IVisualEdge> edgeList, UserAction userAction)
        {
            DataHeader header = new DataHeader();
            long initialPostionForData, currentPositionForData = 0;
            long initialPosition = storage.GetPosition();

            //Record the number of edges and the edge itself
            storage.WriteInteger(FieldCode.EdgeCount, edgeList.Count);
            foreach (IVisualEdge edge in edgeList)
            {
                storage.Seek(header.HeaderSize, SeekOrigin.Current);
                initialPostionForData = storage.GetPosition();
                edge.Serialize(storage);
                currentPositionForData = storage.GetPosition();
                header.DataSize = currentPositionForData - initialPostionForData;
                storage.Seek(-(header.HeaderSize + header.DataSize), SeekOrigin.Current);
                header.Serialize(storage);
                storage.Seek(header.DataSize, SeekOrigin.Current);
            }

            this.RecordFlag(storage, initialPosition, userAction);
        }
开发者ID:samuto,项目名称:designscript,代码行数:22,代码来源:UndoRedoRecorder.cs

示例7: RecordFlag

 private void RecordFlag(IStorage storage, long initialPosition, UserAction userAction)
 {
     //Record the number of bytes shifted
     long currentPosition = storage.GetPosition();
     long shift = currentPosition - initialPosition;
     storage.WriteLong(FieldCode.Shift, shift);
     storage.WriteInteger(FieldCode.UserAction, (int)userAction);
 }
开发者ID:samuto,项目名称:designscript,代码行数:8,代码来源:UndoRedoRecorder.cs

示例8: WriteVariableSlotInfo

 private bool WriteVariableSlotInfo(IStorage storage, VariableSlotInfo variableSlotInfo)
 {
     storage.WriteString(FieldCode.VariableSlotInfoVar, variableSlotInfo.Variable);
     storage.WriteInteger(FieldCode.VariableSlotInfoLine, variableSlotInfo.Line);
     storage.WriteUnsignedInteger(FieldCode.VariableSlotInfoSlotId, variableSlotInfo.SlotId);
     return true;
 }
开发者ID:samuto,项目名称:designscript,代码行数:7,代码来源:Statement.cs

示例9: RecordEdgeIds

        private void RecordEdgeIds(IStorage storage, List<IVisualEdge> edgeList, UserAction userAction)
        {
            DataHeader header = new DataHeader();
            header.DataSize = 12;
            long initialPosition = storage.GetPosition();

            //Record the number of edges and the edgeIds
            storage.WriteInteger(FieldCode.EdgeCount, edgeList.Count);
            foreach (IVisualEdge edge in edgeList)
            {
                header.Serialize(storage);
                storage.WriteUnsignedInteger(FieldCode.EdgeId, edge.EdgeId);
            }

            this.RecordFlag(storage, initialPosition, userAction);
        }
开发者ID:samuto,项目名称:designscript,代码行数:16,代码来源:UndoRedoRecorder.cs

示例10: Serialize

        public bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                storage.WriteUnsignedInteger(FieldCode.RuntimeStatesSignature, Configurations.RuntimeStatesSignature);
                storage.WriteInteger(FieldCode.RuntimeStatesVersion, (int)(RuntimeStates.Version.Current));
                storage.WriteBoolean(FieldCode.IsModified, this.IsModified);

                storage.WriteInteger(FieldCode.VariableNodesMapCount, this.variableNodesMap.Count);
                foreach (KeyValuePair<string, List<uint>> kvp in this.variableNodesMap)
                {
                    storage.WriteString(FieldCode.VariableNodesMapKey, kvp.Key);
                    List<uint> values = kvp.Value.ToList<uint>();
                    storage.WriteInteger(FieldCode.VariableNodesMapValueCount, values.Count);
                    foreach (uint value in values)
                        storage.WriteUnsignedInteger(FieldCode.VariableNodesMapValue, value);
                }

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n RuntimeStates serialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:29,代码来源:RuntimeStates.cs

示例11: Serialize

        public virtual bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            storage.WriteUnsignedInteger(FieldCode.StatementSignature, Configurations.StatementSignature);
            storage.WriteInteger(FieldCode.StatementFlag, (int)this.flags);
            storage.WriteString(FieldCode.DefinedVariable, this.definedVariable);
            WriteVariableSlotInfo(storage, this.outputExpression);

            storage.WriteInteger(FieldCode.ReferencesCount, this.references.Count);
            foreach (VariableSlotInfo reference in this.references)
                WriteVariableSlotInfo(storage, reference);

            // @TODO(Sean): Write Serialize/Deserialize test cases with and without children.
            storage.WriteInteger(FieldCode.ChildrenCount, this.children.Count);
            foreach (Statement childStatement in this.children)
                childStatement.Serialize(storage);

            return true;
        }
开发者ID:samuto,项目名称:designscript,代码行数:21,代码来源:Statement.cs

示例12: Serialize

        public bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                long before = storage.GetPosition();
                storage.WriteUnsignedInteger(FieldCode.DataHeaderSignature, Configurations.DataHeaderSignature);
                storage.WriteInteger(FieldCode.DataHeaderVersion, (int)DataHeader.Version.Current);
                storage.WriteLong(FieldCode.HeaderSize, this.HeaderSize);
                storage.WriteLong(FieldCode.DataSize, this.DataSize);
                long after = storage.GetPosition();

                // Ensuring the header size agrees with what we say it is.
                System.Diagnostics.Debug.Assert((after - before) == this.HeaderSize);
                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Data header serialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:24,代码来源:DataHeader.cs

示例13: Serialize

        public virtual bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                storage.WriteUnsignedInteger(FieldCode.NodeSignature, Configurations.NodeSignature);
                storage.WriteInteger(FieldCode.NodeType, (int)this.nodeType);
                storage.WriteInteger(FieldCode.NodeVersion, (int)VisualNode.Version.Current);
                storage.WriteUnsignedInteger(FieldCode.NodeId, this.nodeId);
                storage.WriteInteger(FieldCode.NodeState, (int)this.nodeState);
                storage.WriteString(FieldCode.Text, this.Text);
                storage.WriteString(FieldCode.Caption, this.Caption);
                storage.WriteDouble(FieldCode.NodePositionX, this.nodePosition.X);
                storage.WriteDouble(FieldCode.NodePositionY, this.nodePosition.Y);

                storage.WriteInteger(FieldCode.InputSlotsCount, this.inputSlots.Count);
                foreach (uint i in this.inputSlots)
                    storage.WriteUnsignedInteger(FieldCode.InputSlots, i);

                storage.WriteInteger(FieldCode.OutputSlotsCount, this.outputSlots.Count);
                foreach (uint j in this.outputSlots)
                    storage.WriteUnsignedInteger(FieldCode.OutputSlots, j);

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Visual node serialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:33,代码来源:VisualNode.cs

示例14: Serialize

        public bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                storage.WriteUnsignedInteger(FieldCode.GraphPropertiesSignature, Configurations.GraphPropertiesSignature);
                storage.WriteInteger(FieldCode.GraphPropertiesVersion, (int)(GraphProperties.Version.Current));
                storage.WriteString(FieldCode.ApplicationVersion, this.ApplicationVersion);
                storage.WriteString(FieldCode.AuthorName, this.AuthorName);
                storage.WriteString(FieldCode.CompanyName, this.CompanyName);

                storage.WriteInteger(FieldCode.ImportedScriptsCount, this.ImportedScripts.Count);
                foreach (string importedScript in this.ImportedScripts)
                    storage.WriteString(FieldCode.ImportedScript, importedScript);

                this.RuntimeStates.Serialize(storage);
                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n GraphProperties serialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:26,代码来源:GraphProperties.cs

示例15: Serialize

        public override bool Serialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                base.Serialize(storage);
                storage.WriteString(FieldCode.Assembly, this.Assembly);
                storage.WriteString(FieldCode.QualifiedName, this.QualifiedName);
                storage.WriteString(FieldCode.ArgumentTypes, this.ArgumentTypes);

                // Take for example, this case:
                //
                //      foo(a<8><9>, b, c<7>)
                //
                // The serialized replication guides would be as follow:
                //
                //      [RAC|3][RIC|2][RI|8][RI|9][RIC|0][RIC|1][RI|7]
                //
                // Where:
                //
                //      RAC = FieldCode.ReplicationArgumentCount
                //      RIC = FieldCode.ReplicationIndexCount
                //      RI  = FieldCode.ReplicationIndex
                //
                storage.WriteInteger(FieldCode.ReplicationArgumentCount, this.replicationGuides.Count);
                foreach (List<int> list in replicationGuides)
                {
                    storage.WriteInteger(FieldCode.ReplicationIndexCount, list.Count);
                    foreach (int value in list)
                        storage.WriteInteger(FieldCode.ReplicationIndex, value);
                }

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Function node serialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:42,代码来源:FunctionNode.cs


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