本文整理汇总了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;
}
}
示例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;
}
}