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


C# IStorage.ReadUnsignedInteger方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: Deserialize

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

            if (storage.ReadUnsignedInteger(FieldCode.SlotSignature) != Configurations.SlotSignature)
                throw new InvalidOperationException("Invalid input data {9D939DA2}");

            try
            {
                this.slotType = (SlotType)storage.ReadInteger(FieldCode.SlotType);
                this.version = (Slot.Version)storage.ReadInteger(FieldCode.SlotVersion);
                this.slotId = storage.ReadUnsignedInteger(FieldCode.SlotId);
                this.slotState = (SlotStates)storage.ReadInteger(FieldCode.SlotState);

                int ownersCount = storage.ReadInteger(FieldCode.OwnersCount);
                this.owners.Clear();
                for (int i = 0; i < ownersCount; i++)
                    owners.Add(storage.ReadUnsignedInteger(FieldCode.Owners));

                int connectingSlotsCount = storage.ReadInteger(FieldCode.ConnectingSlotsCount);
                this.connectingSlots.Clear();
                for (int i = 0; i < connectingSlotsCount; i++)
                    connectingSlots.Add(storage.ReadUnsignedInteger(FieldCode.ConnectingSlots));

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

示例5: 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

示例6: 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

示例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: Deserialize

        public virtual bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage (58D0A328653F)"); // @TODO(done): GUID?
            if (storage.ReadUnsignedInteger(FieldCode.StatementSignature) != Configurations.StatementSignature)
                throw new InvalidOperationException("Invalid input data (8404892D29B6)"); // @TODO(done): GUID?

            this.flags = (Flags)storage.ReadInteger(FieldCode.StatementFlag);
            this.definedVariable = storage.ReadString(FieldCode.DefinedVariable);
            this.outputExpression = ReadVariableSlotInfo(storage);

            this.references.Clear();
            int referenceCount = storage.ReadInteger(FieldCode.ReferencesCount);
            for (int i = 0; i < referenceCount; i++)
                this.references.Add(ReadVariableSlotInfo(storage));

            // @TODO(Sean): Write Serialize/Deserialize test cases with and without children.
            this.children.Clear();
            int childrenCount = storage.ReadInteger(FieldCode.ChildrenCount);
            for (int i = 0; i < childrenCount; i++)
                this.children.Add(new Statement(storage));

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

示例9: 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

示例10: 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

示例11: 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


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