本文整理汇总了C#中SerializationInfo.GetDouble方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.GetDouble方法的具体用法?C# SerializationInfo.GetDouble怎么用?C# SerializationInfo.GetDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.GetDouble方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Dot
public Dot(SerializationInfo info, StreamingContext ctxt)
{
x = info.GetDouble("X");
y = info.GetDouble("Y");
byte[] colorBytes = (byte[])info.GetValue("Color", typeof(byte[]));
colorA = colorBytes[0];
colorR = colorBytes[1];
colorG = colorBytes[2];
colorB = colorBytes[3];
radius = info.GetDouble("Radius");
}
示例2: BehaviorTreeEditorSettings
public BehaviorTreeEditorSettings(SerializationInfo info, StreamingContext context)
{
LabelWidth = (float)info.GetDouble(_prefix + _labelWidthPrefs);
EditableFieldsWidth = (float)info.GetDouble(_prefix + _editableWidthPrefs);
ButtonWidth = (float)info.GetDouble(_prefix + _buttonWidthPrefs);
ElementHeight = (float)info.GetDouble(_prefix + _elementHeightPrefs);
ElementWidth = (float)info.GetDouble(_prefix + _elementWidthPrefs);
HorizontalSpaceBetweenElements = (float)info.GetDouble(_prefix + _horizontalSpacePrefs);
VerticalSpaceBetweenElements = (float)info.GetDouble(_prefix + _verticalSpacePrefs);
SequenceBackgroundColor = new Color();
SequenceBackgroundColor.r = (float)info.GetDouble(_prefix + _sequenceColorRPrefs);
SequenceBackgroundColor.b = (float)info.GetDouble(_prefix + _sequenceColorBPrefs);
SequenceBackgroundColor.g = (float)info.GetDouble(_prefix + _sequenceColorGPrefs);
SequenceBackgroundColor.a = 1.0f;
SelectorBackgroundColor = new Color();
SelectorBackgroundColor.r = (float)info.GetDouble(_prefix + _selectorColorRPrefs);
SelectorBackgroundColor.b = (float)info.GetDouble(_prefix + _selectorColorBPrefs);
SelectorBackgroundColor.g = (float)info.GetDouble(_prefix + _selectorColorGPrefs);
SelectorBackgroundColor.a = 1.0f;
DecoratorBackgroundColor = new Color();
DecoratorBackgroundColor.r = (float)info.GetDouble(_prefix + _decoratorColorRPrefs);
DecoratorBackgroundColor.b = (float)info.GetDouble(_prefix + _decoratorColorBPrefs);
DecoratorBackgroundColor.g = (float)info.GetDouble(_prefix + _decoratorColorGPrefs);
DecoratorBackgroundColor.a = 1.0f;
TaskBackgroundColor = new Color();
TaskBackgroundColor.r = (float)info.GetDouble(_prefix + _taskColorRPrefs);
TaskBackgroundColor.b = (float)info.GetDouble(_prefix + _taskColorBPrefs);
TaskBackgroundColor.g = (float)info.GetDouble(_prefix + _taskColorGPrefs);
TaskBackgroundColor.a = 1.0f;
AddButtonBackgroundColor = new Color();
AddButtonBackgroundColor.r = (float)info.GetDouble(_prefix + _addButtonColorRPrefs);
AddButtonBackgroundColor.b = (float)info.GetDouble(_prefix + _addButtonColorBPrefs);
AddButtonBackgroundColor.g = (float)info.GetDouble(_prefix + _addButtonColorGPrefs);
AddButtonBackgroundColor.a = 1.0f;
RemoveButtonBackgroundColor = new Color();
RemoveButtonBackgroundColor.r = (float)info.GetDouble(_prefix + _removeButtonColorRPrefs);
RemoveButtonBackgroundColor.b = (float)info.GetDouble(_prefix + _removeButtonColorBPrefs);
RemoveButtonBackgroundColor.g = (float)info.GetDouble(_prefix + _removeButtonColorGPrefs);
RemoveButtonBackgroundColor.a = 1.0f;
SideMenuRect = new Rect(0, 0, 0, 0);
SideMenuRect.width = (float)info.GetDouble(_prefix + _sideMenuWidth);
SideMenuRect.height = (float)info.GetDouble(_prefix + _sideMenuHeight);
Init();
}
示例3: runTest
//.........这里部分代码省略.........
strLoc="Loc_7573cd_" + i;
ui32Value = (uint)(UInt32.MaxValue * rnd1.NextDouble());
strValue = "UInt32_" + i;
serinfo1.AddValue(strValue, ui32Value);
iCountTestcases++;
if(serinfo1.GetUInt32(strValue)!= ui32Value)
{
iCountErrors++;
Console.WriteLine("Err_4738cd_" + i + "! Wrong value returned, " + serinfo1.GetUInt32(strValue));
}
}
Console.WriteLine("UInt64 ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_63dc_" + i;
ui64Value = (ulong)(UInt64.MaxValue * rnd1.NextDouble());
strValue = "UInt64_" + i;
serinfo1.AddValue(strValue, ui64Value);
iCountTestcases++;
if(serinfo1.GetUInt64(strValue)!= ui64Value)
{
iCountErrors++;
Console.WriteLine("Err_6583fd_" + i + "! Wrong value returned, " + serinfo1.GetUInt64(strValue));
}
}
Console.WriteLine("Double ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_7539cd_" + i;
dblValue = Double.MaxValue * rnd1.NextDouble();
if(rnd1.NextDouble()<0.5)
dblValue = (-1 * dblValue);
strValue = "Double_" + i;
serinfo1.AddValue(strValue, dblValue);
iCountTestcases++;
if(serinfo1.GetDouble(strValue)!= dblValue)
{
iCountErrors++;
Console.WriteLine("Err_653cfd_" + i + "! Wrong value returned, " + serinfo1.GetDouble(strValue));
}
}
Console.WriteLine("Single ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_0247fd_" + i;
sglValue = (float)(Single.MaxValue * rnd1.NextDouble());
if(rnd1.NextDouble()<0.5)
sglValue = (-1 * sglValue);
strValue = "Single_" + i;
serinfo1.AddValue(strValue, sglValue);
iCountTestcases++;
if(serinfo1.GetSingle(strValue)!= sglValue)
{
iCountErrors++;
Console.WriteLine("Err_0468fd_" + i + "! Wrong value returned, " + serinfo1.GetSingle(strValue));
}
}
strValue = "This is a String";
serinfo1.AddValue("String_1", strValue);
iCountTestcases++;
if(!serinfo1.GetString("String_1").Equals(strValue))
{
iCountErrors++;
Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetString("String_1"));
}
strValue = "";
serinfo1.AddValue("String_2", strValue);
iCountTestcases++;
if(!serinfo1.GetString("String_2").Equals(String.Empty))