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


C# IStorage.ReadDouble方法代码示例

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


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

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

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