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


C# IStorage.ReadInteger方法代码示例

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


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

示例1: Deserialize

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

            if (storage.ReadUnsignedInteger(FieldCode.DataHeaderSignature) != Configurations.DataHeaderSignature)
                throw new InvalidOperationException("Invalid input data");

            try
            {
                this.version = (DataHeader.Version)storage.ReadInteger(FieldCode.DataHeaderVersion);
                this.HeaderSize = storage.ReadLong(FieldCode.HeaderSize);
                this.DataSize = storage.ReadLong(FieldCode.DataSize);
                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Data header deserialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:21,代码来源:DataHeader.cs

示例2: Deserialize

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

            try
            {
                base.Deserialize(storage);

                int embeddedNodesCount = storage.ReadInteger(FieldCode.EmbeddedNodesCount);
                this.embeddedNodes.Clear();
                for (int i = 0; i < embeddedNodesCount; i++)
                    this.embeddedNodes.Add(storage.ReadUnsignedInteger(FieldCode.EmbeddedNode));

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

示例3: Deserialize

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

            if (storage.ReadUnsignedInteger(FieldCode.EdgeSignature) != Configurations.EdgeSignature)
                throw new InvalidOperationException("Invalid input data");

            try
            {
                this.EdgeType = (EdgeType)storage.ReadInteger(FieldCode.EdgeType);
                this.version = (VisualEdge.Version)storage.ReadInteger(FieldCode.EdgeVersion);
                this.EdgeId = storage.ReadUnsignedInteger(FieldCode.EdgeId);
                this.edgeState = (States)storage.ReadInteger(FieldCode.EdgeState);
                this.StartSlotId = storage.ReadUnsignedInteger(FieldCode.StartSlotId);
                this.EndSlotId = storage.ReadUnsignedInteger(FieldCode.EndSlotId);

                int controlPointsCount = storage.ReadInteger(FieldCode.ControlPointsCount);
                this.controlPoints.Clear();
                for (int i = 0; i < controlPointsCount; i++)
                {
                    double ptX = storage.ReadDouble(FieldCode.ControlPointsX);
                    double ptY = storage.ReadDouble(FieldCode.ControlPointsY);
                    Point pt = new Point(ptX, ptY);
                    this.controlPoints.Add(pt);
                }

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

示例4: RetrieveSlotsFromStorage

 private List<ISlot> RetrieveSlotsFromStorage(IStorage storage)
 {
     DataHeader header = new DataHeader();
     List<ISlot> slotList = new List<ISlot>();
     int slotCount = storage.ReadInteger(FieldCode.SlotCount);
     for (int i = 0; i < slotCount; i++)
     {
         header.Deserialize(storage);
         ISlot slot = Slot.Create(this.graphController, storage);
         slotList.Add(slot);
     }
     return slotList;
 }
开发者ID:samuto,项目名称:designscript,代码行数:13,代码来源:UndoRedoRecorder.cs

示例5: RetrieveSlotIdsFromStorage

 private List<uint> RetrieveSlotIdsFromStorage(IStorage storage)
 {
     DataHeader header = new DataHeader();
     List<uint> slotIdList = new List<uint>();
     int slotCount = storage.ReadInteger(FieldCode.SlotCount);
     for (int i = 0; i < slotCount; i++)
     {
         header.Deserialize(storage);
         storage.Seek(36, SeekOrigin.Current);
         slotIdList.Add(storage.ReadUnsignedInteger(FieldCode.SlotId));
         storage.Seek(header.DataSize - 48, SeekOrigin.Current);
     }
     return slotIdList;
 }
开发者ID:samuto,项目名称:designscript,代码行数:14,代码来源:UndoRedoRecorder.cs

示例6: RetrieveNodesFromStorage

 private List<IVisualNode> RetrieveNodesFromStorage(IStorage storage)
 {
     DataHeader header = new DataHeader();
     List<IVisualNode> nodeList = new List<IVisualNode>();
     int nodeCount = storage.ReadInteger(FieldCode.NodeCount);
     for (int i = 0; i < nodeCount; i++)
     {
         header.Deserialize(storage);
         IVisualNode node = VisualNode.Create(this.graphController, storage);
         nodeList.Add(node);
     }
     return nodeList;
 }
开发者ID:samuto,项目名称:designscript,代码行数:13,代码来源:UndoRedoRecorder.cs

示例7: RetrieveNodesFromIdsInStorage

 private List<IVisualNode> RetrieveNodesFromIdsInStorage(IStorage storage)
 {
     DataHeader header = new DataHeader();
     List<IVisualNode> nodeList = new List<IVisualNode>();
     int nodeCount = storage.ReadInteger(FieldCode.NodeCount);
     for (int i = 0; i < nodeCount; i++)
     {
         header.Deserialize(storage);
         uint nodeId = storage.ReadUnsignedInteger(FieldCode.NodeId);
         nodeList.Add(this.graphController.GetVisualNode(nodeId));
     }
     return nodeList;
 }
开发者ID:samuto,项目名称:designscript,代码行数:13,代码来源:UndoRedoRecorder.cs

示例8: RetrieveEdgesFromStorage

 private List<IVisualEdge> RetrieveEdgesFromStorage(IStorage storage)
 {
     DataHeader header = new DataHeader();
     List<IVisualEdge> edgeList = new List<IVisualEdge>();
     int edgeCount = storage.ReadInteger(FieldCode.EdgeCount);
     for (int i = 0; i < edgeCount; i++)
     {
         header.Deserialize(storage);
         IVisualEdge edge = this.graphController.CreateEdgeFromStorage(storage);
         edgeList.Add(edge);
     }
     return edgeList;
 }
开发者ID:samuto,项目名称:designscript,代码行数:13,代码来源:UndoRedoRecorder.cs

示例9: Deserialize

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

            try
            {
                base.Deserialize(storage);
                this.Assembly = storage.ReadString(FieldCode.Assembly);
                this.QualifiedName = storage.ReadString(FieldCode.QualifiedName);
                this.ArgumentTypes = storage.ReadString(FieldCode.ArgumentTypes);
                this.argumentNames = CoreComponent.Instance.GetArgumentNames(this.Assembly, this.QualifiedName, this.ArgumentTypes);
                this.UpdateReturnTypeAndMemberType();

                replicationGuides.Clear();

                if (storage.PeekUnsignedLong() == FieldCode.ReplicationGuides)
                    this.LoadLegacyReplicationGuide(storage);
                else
                {
                    int replicationArgumentCount = storage.ReadInteger(FieldCode.ReplicationArgumentCount);
                    for (int i = 0; i < replicationArgumentCount; i++)
                    {
                        List<int> repGuidesForThisArgument = new List<int>();
                        int replicationIndexCount = storage.ReadInteger(FieldCode.ReplicationIndexCount);
                        for (int j = 0; j < replicationIndexCount; j++)
                            repGuidesForThisArgument.Add(storage.ReadInteger(FieldCode.ReplicationIndex));

                        replicationGuides.Add(repGuidesForThisArgument);
                    }
                }

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

示例10: ReadVariableSlotInfo

 private VariableSlotInfo ReadVariableSlotInfo(IStorage storage)
 {
     string variable = storage.ReadString(FieldCode.VariableSlotInfoVar);
     int line = storage.ReadInteger(FieldCode.VariableSlotInfoLine);
     uint slotId = storage.ReadUnsignedInteger(FieldCode.VariableSlotInfoSlotId);
     return new VariableSlotInfo(variable, line, slotId);
 }
开发者ID:samuto,项目名称:designscript,代码行数:7,代码来源:Statement.cs

示例11: Deserialize

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

            uint signature = storage.ReadUnsignedInteger(FieldCode.RuntimeStatesSignature);
            if (signature != Configurations.RuntimeStatesSignature)
                throw new InvalidOperationException("Invalid input data");

            try
            {
                // Here we attempt to take a snapshot of what variables are currently
                // defined in the system, and which is the node defining it.
                //
                Dictionary<string, uint> oldDefinitions = null;
                if (null != this.undefinedVarsTracker)
                {
                    oldDefinitions = new Dictionary<string, uint>();
                    foreach (KeyValuePair<string, List<uint>> kvp in variableNodesMap)
                    {
                        List<uint> definingNodes = kvp.Value;
                        if (null != definingNodes && (definingNodes.Count > 0))
                            oldDefinitions.Add(kvp.Key, definingNodes[0]);
                    }
                }

                this.version = (RuntimeStates.Version)storage.ReadInteger(FieldCode.RuntimeStatesVersion);
                this.IsModified = storage.ReadBoolean(FieldCode.IsModified);

                int variableNodesMapCount = storage.ReadInteger(FieldCode.VariableNodesMapCount);
                this.variableNodesMap.Clear();
                for (int i = 0; i < variableNodesMapCount; i++)
                {
                    string key = storage.ReadString(FieldCode.VariableNodesMapKey);
                    List<uint> value = new List<uint>();
                    int valueCount = storage.ReadInteger(FieldCode.VariableNodesMapValueCount);
                    for (int j = 0; j < valueCount; j++)
                        value.Add(storage.ReadUnsignedInteger(FieldCode.VariableNodesMapValue));
                    this.variableNodesMap.Add(key, value);
                }

                // After deserialization is done, we'll move all the previously defined variables
                // into the "undefinedVarsTracker". Note that we copy ALL of them into the tracker,
                // but some of them may still be defined after the "variableNodesMap" got updated.
                // This is because eventually these variables which are still in the system will
                // be removed in the final pass in "EndDefinitionMonitor" call.
                //
                if (null != oldDefinitions && (oldDefinitions.Count > 0))
                {
                    foreach (KeyValuePair<string, uint> oldDefinition in oldDefinitions)
                    {
                        string name = oldDefinition.Key;
                        uint nodeId = oldDefinition.Value;
                        if (!undefinedVarsTracker.ContainsKey(nodeId))
                            undefinedVarsTracker[nodeId] = new List<string>();

                        List<string> variables = undefinedVarsTracker[nodeId];
                        if (!variables.Contains(name))
                            variables.Add(name);
                    }
                }

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

示例12: Deserialize

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

            if (storage.ReadUnsignedInteger(FieldCode.NodeSignature) != Configurations.NodeSignature)
                throw new InvalidOperationException("Invalid input data");

            try
            {
                this.nodeType = (NodeType)storage.ReadInteger(FieldCode.NodeType);
                this.version = (VisualNode.Version)storage.ReadInteger(FieldCode.NodeVersion);
                this.nodeId = storage.ReadUnsignedInteger(FieldCode.NodeId);
                this.nodeState = (States)storage.ReadInteger(FieldCode.NodeState);
                this.Text = storage.ReadString(FieldCode.Text);
                this.Caption = storage.ReadString(FieldCode.Caption);
                this.nodePosition.X = storage.ReadDouble(FieldCode.NodePositionX);
                this.nodePosition.Y = storage.ReadDouble(FieldCode.NodePositionY);

                int inputSlotsCount = storage.ReadInteger(FieldCode.InputSlotsCount);
                this.inputSlots.Clear();
                for (int i = 0; i < inputSlotsCount; i++)
                    this.inputSlots.Add(storage.ReadUnsignedInteger(FieldCode.InputSlots));

                int outputSlotsCount = storage.ReadInteger(FieldCode.OutputSlotsCount);
                this.outputSlots.Clear();
                for (int j = 0; j < outputSlotsCount; j++)
                    this.outputSlots.Add(storage.ReadUnsignedInteger(FieldCode.OutputSlots));

                this.Dirty = true; // Mark as dirty for painting.
                return true;
            }
            catch (Exception e)
            {
                //@TODO(Zx): Move this to error handler
                Console.WriteLine(e.Message + "\n Visual node deserialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:39,代码来源:VisualNode.cs

示例13: Create

        public static IVisualNode Create(IGraphController graphController, IStorage storage)
        {
            if (graphController == null || storage == null)
                throw new ArgumentNullException("graphcontroller, storage");

            storage.Seek(12, SeekOrigin.Current); //Skip NodeSignature
            NodeType type = (NodeType)storage.ReadInteger(FieldCode.NodeType);
            storage.Seek(-24, SeekOrigin.Current); //Shift cursor back to the start point of reading NodeSignature
            VisualNode node = null;
            switch (type)
            {
                case NodeType.CodeBlock:
                    node = new CodeBlockNode(graphController);
                    node.Deserialize(storage);
                    break;
                case NodeType.Condensed:
                    node = new CondensedNode(graphController);
                    node.Deserialize(storage);
                    break;
                case NodeType.Driver:
                    node = new DriverNode(graphController);
                    node.Deserialize(storage);
                    break;
                case NodeType.Function:
                    node = new FunctionNode(graphController);
                    node.Deserialize(storage);
                    break;
                case NodeType.Identifier:
                    node = new IdentifierNode(graphController);
                    node.Deserialize(storage);
                    break;
                case NodeType.Property:
                    node = new PropertyNode(graphController);
                    node.Deserialize(storage);
                    break;
                case NodeType.Render:
                    node = new RenderNode(graphController);
                    node.Deserialize(storage);
                    break;
                default:
                    throw new ArgumentException("Invalid 'nodeType'");
            }

            return node;
        }
开发者ID:samuto,项目名称:designscript,代码行数:45,代码来源:VisualNode.cs

示例14: Deserialize

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

            if (storage.ReadUnsignedInteger(FieldCode.GraphPropertiesSignature) != Configurations.GraphPropertiesSignature)
                throw new InvalidOperationException("Invalid input data");

            int value = storage.ReadInteger(FieldCode.GraphPropertiesVersion);
            string appVersion = storage.ReadString(FieldCode.ApplicationVersion, "0.1.0.0");

            GraphProperties.Version loadedVersion = ((GraphProperties.Version)value);
            if (loadedVersion > GraphProperties.Version.Current)
                throw new FileVersionException(appVersion);

            // There are three scenarios when it comes to the value of "appVersion":
            //
            //   1. It was not stored in the file, in which case it is an ancient file.
            //   2. It was stored, but different from the current DLL version.
            //   3. It was stored, and it is the same as the current DLL version.
            //
            // In any of the above cases, there's no need to set "ApplicationVersion"
            // locally since appVersion's sole purpose is to be displayed when the
            // "FileVersionException" is thrown (for use on the dialog). When we
            // store "GraphProperties", it is always written with the current DLL
            // version (set in the constructor of "GraphProperties" object).
            //
            // this.ApplicationVersion = appVersion;

            this.version = loadedVersion;
            this.AuthorName = storage.ReadString(FieldCode.AuthorName);
            this.CompanyName = storage.ReadString(FieldCode.CompanyName);
            this.ImportedScripts.Clear();

            // We optionally store the number of imported scripts in the BIN file.
            int importedSciptsCount = storage.ReadInteger(FieldCode.ImportedScriptsCount, 0);
            for (int i = 0; i < importedSciptsCount; i++)
                this.ImportedScripts.Add(storage.ReadString(FieldCode.ImportedScript));

            this.RuntimeStates.Deserialize(storage);
            return true;
        }
开发者ID:samuto,项目名称:designscript,代码行数:42,代码来源:GraphProperties.cs

示例15: LoadLegacyReplicationGuide

        private void LoadLegacyReplicationGuide(IStorage storage)
        {
            for (int i = 0; i < Configurations.ArraySize; i++)
            {
                replicationGuides.Add(new List<int>());
                replicationGuideStrings.Add(string.Empty);
                for (int j = 0; j < Configurations.ArraySize; j++)
                {
                    int temp = storage.ReadInteger(FieldCode.ReplicationGuides);
                    if (temp != 0)
                        replicationGuides[i].Add(temp);
                }
            }

            int repGuideCount = Configurations.ArraySize - this.inputSlots.Count;
            replicationGuides.RemoveRange(this.inputSlots.Count, repGuideCount);
            replicationGuideStrings.RemoveRange(this.inputSlots.Count, repGuideCount);
        }
开发者ID:samuto,项目名称:designscript,代码行数:18,代码来源:FunctionNode.cs


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