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"); }
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(); }
public virtual object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { var ts = (TileSchema)obj; ts.Name = info.GetString("name"); ts.Srs = info.GetString("srs"); ts.Extent = (Extent)info.GetValue("extent", typeof(Extent)); ts.OriginX = info.GetDouble("originX"); ts.OriginY = info.GetDouble("originY"); ts.Width = info.GetInt32("width"); ts.Height = info.GetInt32("height"); ts.Format = info.GetString("format"); var type = (Type)info.GetValue("resolutionsType", typeof(Type)); var list = (IDictionary <int, Resolution>)Activator.CreateInstance(type); var count = info.GetInt32("resolutionsCount"); var keyValue = 0; var counter = 0; while (counter < count) { Resolution value = default(Resolution); try { value = (Resolution)info.GetValue(string.Format("resolution{0}", keyValue), typeof(Resolution)); } catch {} if (!value.Equals(default(Resolution))) { list[keyValue] = value; counter++; } keyValue++; } Utility.SetFieldValue(ref obj, "_resolutions", BindingFlags.NonPublic | BindingFlags.Instance, list); ts.Axis = (AxisDirection)info.GetInt32("axis"); return(ts); }
protected Primitives(SerializationInfo info, StreamingContext context) { SerializationCtorCalled = true; Byte = info.GetByte("byte"); Bytes = (byte[])info.GetValue("bytes", typeof(byte[])); Sbyte = info.GetSByte("sbyte"); Sbytes = (sbyte[])info.GetValue("sbytes", typeof(sbyte[])); Bool = info.GetBoolean("bool"); Bools = (bool[])info.GetValue("bools", typeof(bool[])); Char = info.GetChar("char"); Chars = (char[])info.GetValue("chars", typeof(char[])); Short = info.GetInt16("short"); Shorts = (short[])info.GetValue("shorts", typeof(short[])); Ushort = info.GetUInt16("ushort"); Ushorts = (ushort[])info.GetValue("ushorts", typeof(ushort[])); Int = info.GetInt32("int"); Ints = (int[])info.GetValue("ints", typeof(int[])); Uint = info.GetUInt32("uint"); Uints = (uint[])info.GetValue("uints", typeof(uint[])); Long = info.GetInt64("long"); Longs = (long[])info.GetValue("longs", typeof(long[])); Ulong = info.GetUInt64("ulong"); Ulongs = (ulong[])info.GetValue("ulongs", typeof(ulong[])); Float = info.GetSingle("float"); Floats = (float[])info.GetValue("floats", typeof(float[])); Double = info.GetDouble("double"); Doubles = (double[])info.GetValue("doubles", typeof(double[])); Decimal = info.GetDecimal("decimal"); Decimals = (decimal[])info.GetValue("decimals", typeof(decimal[])); Guid = (Guid)info.GetValue("guid", typeof(Guid)); Guids = (Guid[])info.GetValue("guids", typeof(Guid[])); DateTime = info.GetDateTime("datetime"); DateTimes = (DateTime[])info.GetValue("datetimes", typeof(DateTime[])); String = info.GetString("string"); Strings = (string[])info.GetValue("strings", typeof(string[])); }
public ConfigurationFrame(SerializationInfo info, StreamingContext context) { int nCount = info.GetInt32("plotCount"); for (int i = 0; i < nCount; i++) { ConfigurationPlot plot = (ConfigurationPlot)info.GetValue("plot_" + i.ToString(), typeof(ConfigurationPlot)); m_rgPlots.Add(plot); } nCount = info.GetInt32("targetLineCount"); for (int i = 0; i < nCount; i++) { ConfigurationTargetLine line = (ConfigurationTargetLine)info.GetValue("targetline_" + i.ToString(), typeof(ConfigurationTargetLine)); m_rgLines.Add(line); } m_configPlotArea = (ConfigurationPlotArea)info.GetValue("plotArea", typeof(ConfigurationPlotArea)); m_configXAxis = (ConfigurationAxis)info.GetValue("axisX", typeof(ConfigurationAxis)); m_configYAxis = (ConfigurationAxis)info.GetValue("axisY", typeof(ConfigurationAxis)); m_nDataIndex = info.GetInt32("plotCollectionIdx"); m_nFrameHeight = info.GetInt32("frameHeight"); m_clrTitle = (Color)info.GetValue("clrTitle", typeof(Color)); m_fontTitle = (Font)info.GetValue("fontTitle", typeof(Font)); m_strName = info.GetString("name"); m_bVisible = info.GetBoolean("visible"); try { m_minmaxTarget = (PlotCollection.MINMAX_TARGET)info.GetInt32("minmax_target"); } catch (Exception) { } try { m_bScaleToVisibleWhenRelative = info.GetBoolean("scale_to_visible"); } catch (Exception) { } try { m_dfMinYRange = info.GetDouble("min_y_range"); } catch (Exception) { } }
protected FileSystemDocument(SerializationInfo info, StreamingContext context) { this.argbColor = info.GetInt32("argbColor"); this.documentTitle = info.GetString("documentTitle"); this.documentLocationX = info.GetInt32("documentLocationX"); this.documentLocationY = info.GetInt32("documentLocationY"); this.fontFamily = info.GetString("fontFamily"); this.fontSize = (float)info.GetDouble("fontSize"); this.fontStyle = info.GetString("fontStyle"); this.text = info.GetString("text"); }
/// <summary> /// Create a new instance of this type -- constructor defined for serializatiom /// </summary> /// <param name="info">The SerializationInfo member</param> /// <param name="context">The StreamingContext member</param> protected MomentDescriptorBase(SerializationInfo info, StreamingContext context) : base(info, context) { xMin = (int)info.GetInt32("xMin"); yMin = (int)info.GetInt32("yMin"); xMax = (int)info.GetInt32("xMax"); yMax = (int)info.GetInt32("yMax"); xMedian = (float)info.GetDouble("xMedian"); yMedian = (float)info.GetDouble("yMedian"); xMedianSilhouette = (float)info.GetDouble("xMedianSilhouette"); yMedianSilhouette = (float)info.GetDouble("yMedianSilhouette"); DescriptorSquareMatrix silhouette = (DescriptorSquareMatrix)info.GetValue("Silhouette", typeof(DescriptorSquareMatrix)); DescriptorSquareMatrix shape = (DescriptorSquareMatrix)info.GetValue("Shape", typeof(DescriptorSquareMatrix)); DescriptorSquareMatrix texture = (DescriptorSquareMatrix)info.GetValue("Texture", typeof(DescriptorSquareMatrix)); ColorDouble shapeColorAverage = (ColorDouble)info.GetValue("ShapeColorAverage", typeof(ColorDouble)); ColorDouble silhouetteColorAverage = (ColorDouble)info.GetValue("SilhouetteColorAverage", typeof(ColorDouble)); DescriptorDependentObjects.Add("silhouette", silhouette); DescriptorDependentObjects.Add("shape", shape); DescriptorDependentObjects.Add("texture", texture); DescriptorDependentObjects.Add("shapecoloraverage", shapeColorAverage); DescriptorDependentObjects.Add("silhouettecoloraverage", silhouetteColorAverage); }
/// <summary> /// 反序列化构造函数。 假定提供的序列化信息包含有效数据。 /// </summary> /// <param name="info"> /// 序列化信息以反序列化和获取值 /// </param> /// <param name="context"> /// 序列化上下文 /// </param> /// <exception cref="ArgumentNullException"> /// 如果<c> info </ c>是<c> null </ c> /// </exception> public Network(SerializationInfo info, StreamingContext context) { // 验证 Helper.ValidateNotNull(info, "info"); this.inputLayer = info.GetValue("inputLayer", typeof(ILayer)) as ILayer; this.outputLayer = info.GetValue("outputLayer", typeof(ILayer)) as ILayer; this.layers = info.GetValue("layers", typeof(IList <ILayer>)) as IList <ILayer>; this.connectors = info.GetValue("connectors", typeof(IList <IConnector>)) as IList <IConnector>; this.trainingMethod = (TrainingMethod)info.GetValue("trainingMethod", typeof(TrainingMethod)); this.jitterEpoch = info.GetInt32("jitterEpoch"); this.jitterNoiseLimit = info.GetDouble("jitterNoiseLimit"); }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected Fill(SerializationInfo info, StreamingContext context) { Init(); // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32("schema"); color = (Color)info.GetValue("color", typeof(Color)); //brush = (Brush) info.GetValue( "brush", typeof(Brush) ); //brushHolder = (BrushHolder) info.GetValue( "brushHolder", typeof(BrushHolder) ); type = (FillType)info.GetValue("type", typeof(FillType)); isScaled = info.GetBoolean("isScaled"); alignH = (AlignH)info.GetValue("alignH", typeof(AlignH)); alignV = (AlignV)info.GetValue("alignV", typeof(AlignV)); rangeMin = info.GetDouble("rangeMin"); rangeMax = info.GetDouble("rangeMax"); //BrushHolder brushHolder = (BrushHolder) info.GetValue( "brushHolder", typeof( BrushHolder ) ); //brush = brush; colorList = (Color[])info.GetValue("colorList", typeof(Color[])); positionList = (float[])info.GetValue("positionList", typeof(float[])); angle = info.GetSingle("angle"); image = (Image)info.GetValue("image", typeof(Image)); wrapMode = (WrapMode)info.GetValue("wrapMode", typeof(WrapMode)); if (colorList != null && positionList != null) { ColorBlend blend = new ColorBlend(); blend.Colors = colorList; blend.Positions = positionList; CreateBrushFromBlend(blend, angle); } else if (image != null) { this.brush = new TextureBrush(image, wrapMode); } }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <remarks> /// You MUST set the _ownerPane property after deserializing a BarSettings object. /// </remarks> /// <param name="info">A <see c_ref="SerializationInfo"/> instance that defines the /// serialized data /// </param> /// <param name="context">A <see c_ref="StreamingContext"/> instance that contains /// the serialized data /// </param> internal BarSettings(SerializationInfo info, StreamingContext context) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32("schema"); _minClusterGap = info.GetSingle("minClusterGap"); _minBarGap = info.GetSingle("minBarGap"); _clusterScaleWidth = info.GetDouble("clusterScaleWidth"); _clusterScaleWidthAuto = info.GetBoolean("clusterScaleWidthAuto"); _base = (BarBase)info.GetValue("base", typeof(BarBase)); _type = (BarType)info.GetValue("type", typeof(BarType)); }
protected SettingsKinect(SerializationInfo info, StreamingContext context) { int SerVersion = info.GetInt32("m_SerVersion"); // Check version of XML version if (SerVersion < 1) { return; } m_XScale = info.GetInt32("m_XScale"); m_YScale = info.GetInt32("m_YScale"); m_Ratio = info.GetDouble("m_Ratio"); }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info">The info.</param> /// <param name="context">The context.</param> protected GradientPaintStyle(SerializationInfo info, StreamingContext context) { if (Tracing.BinaryDeserializationSwitch.Enabled) { Trace.WriteLine("Deserializing the fields of 'GradientPaintStyle'."); } double version = info.GetDouble("GradientPaintStyleVersion"); mAngle = info.GetSingle("Angle"); mEndColor = (Color)info.GetValue("EndColor", typeof(Color)); mStartColor = (Color)info.GetValue("StartColor", typeof(Color)); }
private Invoice(SerializationInfo info, StreamingContext context) { DayPayment = info.GetDecimal("DayPayment"); NumbersOfDays = info.GetInt32("NumbersOfDays"); DayPenaltyForLate = info.GetDouble("DayPenaltyForLate"); NumbersOfDaysForLate = info.GetInt32("NumbersOfDaysForLate"); if (formatSerializable) { PaymentWithoutPenalty = info.GetDecimal("PaymentWithoutPenalty"); Penalty = info.GetDecimal("Penalty"); TotalPayment = info.GetDecimal("TotalPayment"); } }
/// <summary> /// 反序列化构造函数 /// </summary> /// <param name="info"> /// 序列化信息反序列化和获取数据 /// </param> /// <param name="context"> /// 要使用的序列化上下文 /// </param> /// <exception cref="ArgumentNullException"> /// 如果<c> info </ c>是<c> null </ c> /// </exception> public BackpropagationConnector(SerializationInfo info, StreamingContext context) : base(info, context) { ConstructSynapses(); this.momentum = info.GetDouble("momentum"); double[] weights = (double[])info.GetValue("weights", typeof(double[])); for (int i = 0; i < synapses.Length; i++) { synapses[i].Weight = weights[i]; } }
public MainObject(SerializationInfo info, StreamingContext context) { MessageBox.Show($"{DateTime.Now.ToString("HH:mm:ss.fff")}:Main 序列化开始"); ivalue = info.GetInt32("ivalue"); m_innerObj2 = (InnerObject1)info.GetValue("innerObject2", typeof(InnerObject1)); MessageBox.Show($"{DateTime.Now.ToString("HH:mm:ss.fff")}:加载InnerObj"); m_innerObj = (InnerObject)info.GetValue("innerObject", typeof(InnerObject)); dvalue = info.GetDouble("dvalue"); svalue = info.GetString("svalue"); MessageBox.Show($"{DateTime.Now.ToString("HH:mm:ss.fff")}:反序列化完成"); }
protected SceneColor(SerializationInfo pInfo, StreamingContext context) : base(pInfo, context) { m_SerVersionSceneColor = pInfo.GetInt32("m_SerVersionSceneColor"); m_Color = (Color)pInfo.GetValue("m_Color", typeof(Color)); m_ColorStart = (Color)pInfo.GetValue("m_ColorStart", typeof(Color)); m_ColorEnd = (Color)pInfo.GetValue("m_ColorEnd", typeof(Color)); m_IsColorPulsing = pInfo.GetBoolean("m_IsColorPulsing"); m_PluseTime = pInfo.GetDouble("m_PluseTime"); init(); }
public SimpleSerializable(SerializationInfo info, StreamingContext context) { Byte = info.GetByte("Byte"); Bool = info.GetBoolean("Bool"); Short = info.GetInt16("Short"); Int = info.GetInt32("Int"); Long = info.GetInt64("Long"); Float = info.GetSingle("Float"); Double = info.GetDouble("Double"); Decimal = info.GetDecimal("Decimal"); Guid = (Guid)info.GetValue("Guid", typeof(Guid)); String = info.GetString("String"); }
public Gauge(SerializationInfo info, StreamingContext context) : base(info, context) { _gaugetype = (GaugeType )info.GetValue("GaugeType", typeof(GaugeType)); _templateindex = info.GetInt32("TemplateIndex"); _indicatorname = info.GetString("IndicatorName"); _needlecolor = (Color)info.GetValue("NeedleColor", typeof(Color)); _needlelength = info.GetInt32("NeedleLength"); _fontcolor = (Color)info.GetValue("TickFontColor", typeof(Color)); _linecolor = (Color)info.GetValue("LineColor", typeof(Color)); _tickcolor = (Color)info.GetValue("TickColor", typeof(Color)); _sectionstart = info.GetInt32("SectionStart"); _sectionend = info.GetInt32("SectionEnd"); _tickstart = info.GetInt32("TickStart"); _tickend = info.GetInt32("TickEnd"); _textloc = info.GetInt32("TextLoc"); _gapheight = info.GetInt32("GapHeight"); _maxtick = info.GetDouble("MaxTick"); _mintick = info.GetDouble("MinTick"); _bsemicircle = info.GetBoolean("SemiCircle"); _gaugecolor = (Color)info.GetValue("GaugeColor", typeof(Color)); }
public FieldSolveContext(SerializationInfo info, StreamingContext context) { RADeg = info.GetDouble("RADeg"); DEDeg = info.GetDouble("DEDeg"); ErrFoVs = info.GetDouble("ErrFoVs"); Method = (RecognitionMethod)info.GetInt32("Method"); DataBaseServer = info.GetString("DataBaseServer"); DataBaseName = info.GetString("DataBaseName"); CellX = info.GetDouble("CellX"); CellY = info.GetDouble("CellY"); FocalLength = info.GetDouble("FocalLength"); LimitMagn = info.GetDouble("LimitMagn"); PyramidMinMag = info.GetDouble("MinMag"); PyramidMaxMag = info.GetDouble("MaxMag"); UtcTime = info.GetDateTime("UtcTime"); FrameNoOfUtcTime = info.GetInt32("FrameNoOfUtcTime"); FrameNoOfUtcTime = info.GetInt32("FrameNoOfUtcTime"); ObsCode = info.GetString("ObsCode"); byte[] data = (byte[])info.GetValue("CatalogueStars", typeof(byte[])); BinaryFormatter fmt = new BinaryFormatter(); using (MemoryStream mem = new MemoryStream(data)) { CatalogueStars = new List <IStar>(); int count = (int)fmt.Deserialize(mem); for (int i = 0; i < count; i++) { IStar star = (Star)fmt.Deserialize(mem); CatalogueStars.Add(star); } } try { } catch (InvalidCastException) { } }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info">Serialization info</param> /// <param name="context">Streaming context</param> protected WpfShape(SerializationInfo info, StreamingContext context) { try { LoadTextures(info); } catch (Exception e) { e.ShowError(10); } try { Xaml = info.GetString("Xaml"); isColored = info.GetBoolean("IsColored"); consumer = info.Deserialize <Motion6D.FieldConsumer3D>("FieldConsumer"); ch = new IAssociatedObject[] { consumer }; try { scaled = info.GetBoolean("Scaled"); } catch (Exception) { } try { forecastTime = (TimeSpan)info.GetValue("ForecastTime", typeof(TimeSpan)); coordinateError = info.GetDouble("CoordinateError"); angleError = info.GetDouble("AngleError"); } catch (Exception) { } } catch (Exception) { CreateFieldConsumer(); } }
/// <summary> /// Initializes a new instance of the <see cref="FrameElement2Node"/> class. /// </summary> /// <param name="info">The information.</param> /// <param name="context">The context.</param> /// <exception cref="System.NotImplementedException"></exception> protected FrameElement2Node(SerializationInfo info, StreamingContext context) : base(info, context) { _a = info.GetDouble("_a"); _ay = info.GetDouble("_ay"); _az = info.GetDouble("_az"); _iy = info.GetDouble("_iy"); _iz = info.GetDouble("_iz"); _j = info.GetDouble("_j"); _geometry = (PolygonYz)info.GetValue("_geometry", typeof(PolygonYz)); _useOverridedProperties = info.GetBoolean("_useOverridedProperties"); _considerShearDeformation = info.GetBoolean("_considerShearDeformation"); _hingedAtStart = info.GetBoolean("_hingedAtStart"); _hingedAtEnd = info.GetBoolean("_hingedAtEnd"); _webRotation = info.GetDouble("_webRotation"); _massDensity = info.GetDouble("_massDensity"); }
protected RTUpdate(SerializationInfo info, StreamingContext context) { this.version = info.GetUInt16("version"); this.slideIndex = info.GetInt32("slideIndex"); this.deckType = info.GetInt32("deckType"); this.slideSize = info.GetDouble("slideSize"); this.slideAssociation = info.GetInt32("slideAssociation"); this.deckAssociation = new Guid(info.GetString("deckAssociation")); if (this.version >= 2) { this.deckTypeAssociation = info.GetInt32("deckTypeAssociation"); } else { this.deckTypeAssociation = this.deckType; } this.backgroundColor = (Color)Helpers.ByteArrayToObject((byte[])info.GetValue("backgroundColor", typeof(byte[]))); this.deckGuid = new Guid(info.GetString("deckGuid")); this.baseUrl = info.GetString("baseUrl"); this.extent = info.GetString("extent"); this.scrollPosition = info.GetDouble("scrollPosition"); this.scrollExtent = info.GetDouble("scrollExtent"); }
protected SceneText(SerializationInfo info, StreamingContext context) : base(info, context) { int pSerVersion = info.GetInt32("m_SerVersion"); if (pSerVersion > 0) { m_Text = info.GetString("m_Text"); m_FontFamily = (FontFamily)info.GetValue("m_FontFamily", typeof(FontFamily)); m_FontSize = info.GetDouble("m_FontSize"); reconstrctDrawable(); } }
public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { var orderDetail = (Order_Detail)obj; orderDetail.OrderID = info.GetInt32(nameof(orderDetail.OrderID)); orderDetail.ProductID = info.GetInt32(nameof(orderDetail.ProductID)); orderDetail.UnitPrice = info.GetDecimal(nameof(orderDetail.UnitPrice)); orderDetail.Quantity = info.GetInt16(nameof(orderDetail.Quantity)); orderDetail.Discount = (float)info.GetDouble(nameof(orderDetail.Discount)); orderDetail.Order = (Order)info.GetValue(nameof(orderDetail.Order), typeof(Order)); orderDetail.Product = (Product)info.GetValue(nameof(orderDetail.Product), typeof(Product)); return(obj); }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info">Serialization info</param> /// <param name="context">Streaming context</param> protected DataPerformerCollectionStateTransformer(SerializationInfo info, StreamingContext context) : base(info, context) { try { step = info.GetDouble("Step"); transformerType = info.GetValue("TransformerType", typeof(Type)) as Type; measurements = info.GetString("Measurements"); } catch (Exception) { } SetChildren(); }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info">The info.</param> /// <param name="context">The context.</param> protected DocumentInformation(SerializationInfo info, StreamingContext context) { if (Tracing.BinaryDeserializationSwitch.Enabled) { Trace.WriteLine("Deserializing the fields of 'DocumentInformation'."); } double version = info.GetDouble("DocumentInfoVersion"); mAuthor = info.GetString("Author"); mCreationDate = info.GetDateTime("CreationDate").ToString(); mDescription = info.GetString("Description"); mTitle = info.GetString("Title"); }
public Save(SerializationInfo info, StreamingContext context) { playerPosition.x = (float)info.GetDouble("playerPositionX"); playerPosition.y = (float)info.GetDouble("playerPositionY"); playerPosition.z = (float)info.GetDouble("playerPositionZ"); playerAngles.x = (float)info.GetDouble("playerAnglesX"); playerAngles.y = (float)info.GetDouble("playerAnglesY"); playerAngles.z = (float)info.GetDouble("playerAnglesZ"); }
protected UniformParametric1DSection(SerializationInfo info, StreamingContext context) : base(info, context) { _a = info.GetDouble("_a"); _iy = info.GetDouble("_iy"); _iz = info.GetDouble("_iz"); _ay = info.GetDouble("_ay"); _az = info.GetDouble("_az"); _j = info.GetDouble("_j"); }
/// <summary> /// Конструктор для десериализации /// </summary> /// <param name="info"></param> /// <param name="context"></param> private NetworkController(SerializationInfo info, StreamingContext context) { DeviceBase device; // Восстанавливаем сохранённые параметры _NetworkId = info.GetUInt32("NetworkId"); _Description = info.GetString("Description"); _CanPort = (ICanPort)info.GetValue("CanPort", typeof(ICanPort)); if (_CanPort != null) { _CanPort.Stop(); _CanPort.MessageReceived += new EventHandler(EventHandler_CanPort_MessageReceived); //_CanPort.PortChangedStatus += // new EventHandlerPortChangesStatus(EventHandler_CanPort_PortChangesStatus); //_CanPort.ErrorReceived += // new EventHandlerErrorRecived(EventHandler_CanPort_ErrorReceived); } _TotalAttempts = info.GetInt32("TotalAttempts"); // Восстанавливаем список устройств _DevicesList = new DevicesCollection(this); List <string> list = (List <string>)info.GetValue("Devices", typeof(List <string>)); foreach (string str in list) { device = DeviceBase.Create(str); _DevicesList.Add(device); } // Запускаем сетевые сервисы InitNetworkServices(); // Настройки сетевых сервисов ((ServicePdoReceive)_NetworkServices[ServiceType.PdoReceive]).Interval = info.GetInt32("PdoReceiveInterval"); ((ServiceSync)_NetworkServices[ServiceType.Sync]).PeriodSync = info.GetDouble("SyncPeriodSync"); foreach (Service service in _NetworkServices) { service.TotalAttempts = _TotalAttempts; } DeviceChangedData = new EventHandler(EventHandlerDeviceChangedValue); DeviceChangedStatus = new EventHandler(EventHandlerDeviceChangedStatus); }
/// <summary> /// Load operation /// </summary> /// <param name="info">Serialization info</param> /// <param name="context">Streaming context</param> protected override void Load(SerializationInfo info, StreamingContext context) { base.Load(info, context); try { if (type == null) { type = typeof(DataPerformer.DataConsumer); } cBuf = info.GetValue("Colors", typeof(Dictionary <string, Color>)) as Dictionary <string, Color>; string argument = info.GetValue("Argument", typeof(string)) as string; string condition = info.GetValue("Condition", typeof(string)) as string; textsBuf = info.GetValue("Texts", typeof(Dictionary <string, string>)) as Dictionary <string, string>; string start = info.GetValue("Start", typeof(string)) as string; string step = info.GetValue("Step", typeof(string)) as string; string stepCount = info.GetValue("StepCount", typeof(string)) as string; int dist = info.GetInt32("Split"); stepChartBuf = info.GetValue("StepChart", typeof(Dictionary <string, bool>)) as Dictionary <string, bool>; string points = info.GetString("Points"); int pause = info.GetInt32("Pause"); string[] s = data.Item4; s[0] = condition; s[1] = argument; s[2] = start; s[3] = step; s[4] = stepCount; s[5] = points; int[] n = data.Item5; n[0] = pause; n[1] = dist; timeType = (TimeType)info.GetValue("TimeType", typeof(TimeType)); absoluteTime = info.GetBoolean("AbsoluteTime"); rtime = info.GetValue("Realtime", typeof(Tuple <double[], Dictionary <string, Dictionary <string, Tuple <Color, bool, double[]> > > >)) as Tuple <double[], Dictionary <string, Dictionary <string, Tuple <Color, bool, double[]> > > >; animationType = (Animation.Interfaces.Enums.AnimationType)info.GetValue("AnimationType", typeof(Animation.Interfaces.Enums.AnimationType)); timeScaleAnimation = info.GetDouble("TimeScaleAnimation"); timeUnitAnimation = (TimeType)info.GetValue("TimeUnitAnimation", typeof(TimeType)); sizes = info.GetValue("IndicatorSizes", typeof(Dictionary <string, Size>)) as Dictionary <string, Size>; cadrNumber = info.GetInt32("CadrNumber"); } catch (Exception ex) { ex.ShowError(10); } }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info">The info.</param> /// <param name="context">The context.</param> protected GroupShape(SerializationInfo info, StreamingContext context) : base(info, context) { if (Tracing.BinaryDeserializationSwitch.Enabled) { Trace.WriteLine("Deserializing the fields of 'GroupShape'."); } double version = info.GetDouble("GroupShapeVersion"); mAllowUnGroup = info.GetBoolean("CanUngroup"); mEntities = info.GetValue("Entities", typeof(CollectionBase <IDiagramEntity>)) as CollectionBase <IDiagramEntity>; }
public Save(SerializationInfo info, StreamingContext context) { saveName = info.GetString("saveName"); gameName = info.GetString("gameName"); sceneTime = info.GetSingle("sceneTime"); gameTime = info.GetDouble("gameTime"); currScene = info.GetString("currScene"); prevScene = info.GetString("prevScene"); difficulty = (Difficulty)info.GetInt32("difficulty"); playerData = (SeedCollection)info.GetValue("playerData", typeof(SeedCollection)); dtUnlocks = info.GetInt32("dtUnlocks"); abilities = info.GetInt32("abilities"); }
public bool runTest() { Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer); int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; SerializationInfo serinfo1 = null; Boolean fValue; Char chValue; SByte sbtValue; Byte btValue; Int16 i16Value; Int32 i32Value; Int64 i64Value; UInt16 ui16Value; UInt32 ui32Value; UInt64 ui64Value; Double dblValue; Single sglValue; DateTime dtValue; Decimal dcmValue; StringBuilder sbldr1; String strValue; Random rnd1; try { do { strLoc="Loc_6573cd"; serinfo1 = new SerializationInfo(typeof(Int32), new FormatterConverter()); iCountTestcases++; if(serinfo1.MemberCount != 0) { iCountErrors++; Console.WriteLine("Err_0246sd! Wrong number of members, " + serinfo1.MemberCount.ToString()); } strLoc="Loc_6853vd"; fValue = false; serinfo1.AddValue("Boolean_1", fValue); iCountTestcases++; if(serinfo1.GetBoolean("Boolean_1") != fValue) { iCountErrors++; Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetBoolean("Boolean_1")); } fValue = true; serinfo1.AddValue("Boolean_2", fValue); iCountTestcases++; if(serinfo1.GetBoolean("Boolean_2") != fValue) { iCountErrors++; Console.WriteLine("Err_6753vd! wrong value returned, " + serinfo1.GetBoolean("Boolean_2")); } try { iCountTestcases++; serinfo1.AddValue("Boolean_2", fValue); iCountErrors++; Console.WriteLine("Err_1065753cd! Exception not thrown"); }catch(SerializationException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_5739cd! Wrong exception thrown, " + ex); } Console.WriteLine("Large String, ticks, " + Environment.TickCount); sbldr1 = new StringBuilder("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); fValue = false; serinfo1.AddValue(sbldr1.ToString(), fValue); iCountTestcases++; if(serinfo1.GetBoolean(sbldr1.ToString()) != fValue) { iCountErrors++; Console.WriteLine("Err_6538fvd! wrong value returned, " + serinfo1.GetBoolean(sbldr1.ToString())); } try { iCountTestcases++; serinfo1.AddValue(null, fValue); iCountErrors++; Console.WriteLine("Err_0156ds! Exception not thrown"); }catch(ArgumentNullException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_57834fd! Wrong exception thrown, " + ex); } Console.WriteLine("Char ticks, " + Environment.TickCount); rnd1 = new Random(); for(int i=0; i<50; i++) { strLoc="Loc_6753cd_" + i; chValue = (Char)(65536 * rnd1.NextDouble()); strValue = "Char_" + i; serinfo1.AddValue(strValue, chValue); iCountTestcases++; if(serinfo1.GetChar(strValue)!= chValue) { iCountErrors++; Console.WriteLine("Err_65730dsw_" + i + "! Wrong Char returned, " + serinfo1.GetChar(strValue)); } } try { iCountTestcases++; serinfo1.AddValue("Char_1", 'a'); iCountErrors++; Console.WriteLine("Err_643cd! Exception not thrown"); }catch(SerializationException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_02457fd! Wrong exception thrown, " + ex); } try { iCountTestcases++; serinfo1.AddValue("Boolean_1", 'a'); iCountErrors++; Console.WriteLine("Err_5732fcd! Exception not thrown"); }catch(SerializationException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_024568fd! Wrong exception thrown, " + ex); } Console.WriteLine("SByte ticks, " + Environment.TickCount); for(int i=(int)SByte.MinValue; i<(int)SByte.MaxValue; i++) { strLoc="Loc_56473vd_" + i; sbtValue = (SByte)i;; strValue = "SByte_" + i; serinfo1.AddValue(strValue, sbtValue); iCountTestcases++; if(serinfo1.GetSByte(strValue)!= sbtValue) { iCountErrors++; Console.WriteLine("Err_4627fds_" + i + "! Wrong Sbyte returned, " + serinfo1.GetSByte(strValue)); } } Console.WriteLine("Byte ticks, " + Environment.TickCount); for(int i=(int)Byte.MinValue; i<(int)Byte.MaxValue; i++) { strLoc="Loc_01192ds_" + i; btValue = (Byte)i;; strValue = "Byte_" + i; serinfo1.AddValue(strValue, btValue); iCountTestcases++; if(serinfo1.GetByte(strValue)!= btValue) { iCountErrors++; Console.WriteLine("Err_0267fe_" + i + "! Wrong byte returned, " + serinfo1.GetByte(strValue)); } } Console.WriteLine("Int16 ticks, " + Environment.TickCount); for(int i=0; i<50; i++) { strLoc="Loc_012965565ds_" + i; i16Value = (short)((int)Int16.MaxValue * rnd1.NextDouble()); if(rnd1.NextDouble()<0.5) i16Value = (short)(-1 * i16Value); strValue = "Int16_" + i; serinfo1.AddValue(strValue, i16Value); iCountTestcases++; if(serinfo1.GetInt16(strValue)!= i16Value) { iCountErrors++; Console.WriteLine("Err_0267fe_" + i + "! Wrong value returned, " + serinfo1.GetInt16(strValue)); } } Console.WriteLine("Int32 ticks, " + Environment.TickCount); for(int i=0; i<50; i++) { strLoc="Loc_015643ds_" + i; i32Value = (int)(Int32.MaxValue * rnd1.NextDouble()); if(rnd1.NextDouble()<0.5) i32Value = (-1 * i32Value); strValue = "Int32_" + i; serinfo1.AddValue(strValue, i32Value); iCountTestcases++; if(serinfo1.GetInt32(strValue)!= i32Value) { iCountErrors++; Console.WriteLine("Err_5427ds_" + i + "! Wrong value returned, " + serinfo1.GetInt32(strValue)); } } Console.WriteLine("Int64 ticks, " + Environment.TickCount); for(int i=0; i<50; i++) { strLoc="Loc_625bfg_" + i; i64Value = (long)((long)Int64.MaxValue * rnd1.NextDouble()); if(rnd1.NextDouble()<0.5) i64Value = (long)(-1 * i64Value); strValue = "Int64_" + i; serinfo1.AddValue(strValue, i64Value); iCountTestcases++; if(serinfo1.GetInt64(strValue)!= i64Value) { iCountErrors++; Console.WriteLine("Err_6427dc_" + i + "! Wrong value returned, " + serinfo1.GetInt64(strValue)); } } Console.WriteLine("UInt16 ticks, " + Environment.TickCount); for(int i=0; i<50; i++) { strLoc="Loc_6473cd_" + i; ui16Value = (ushort)((int)UInt16.MaxValue * rnd1.NextDouble()); strValue = "UInt16_" + i; serinfo1.AddValue(strValue, ui16Value); iCountTestcases++; if(serinfo1.GetUInt16(strValue)!= ui16Value) { iCountErrors++; Console.WriteLine("Err_748vd_" + i + "! Wrong value returned, " + serinfo1.GetUInt16(strValue)); } } Console.WriteLine("UInt32 ticks, " + Environment.TickCount); for(int i=0; i<50; i++) { 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)) { iCountErrors++; Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetString("String_2")); } strValue = null; serinfo1.AddValue("String_3", strValue); iCountTestcases++; if(serinfo1.GetString("String_3") != null) { iCountErrors++; Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetString("String_3")); } try { iCountTestcases++; serinfo1.AddValue("String_2", fValue); iCountErrors++; Console.WriteLine("Err_1065753cd! Exception not thrown"); }catch(SerializationException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_5739cd! Wrong exception thrown, " + ex); } Console.WriteLine("Single ticks, " + Environment.TickCount); for(int i=0; i<50; i++) { strLoc="Loc_0247fd_" + i; dblValue = (double)(DateTime.MaxValue.ToOADate() * rnd1.NextDouble()); strValue = "DateTime_" + i; dtValue = DateTime.FromOADate(dblValue); serinfo1.AddValue(strValue, dtValue); iCountTestcases++; if(serinfo1.GetDateTime(strValue)!= dtValue) { iCountErrors++; Console.WriteLine("Err_0468fd_" + i + "! Wrong value returned, " + serinfo1.GetDateTime(strValue)); } } for(int i=0; i<50; i++) { strLoc="Loc_0247fd_" + i; dcmValue = (Decimal)((double)Decimal.MaxValue * rnd1.NextDouble()); if(rnd1.NextDouble()<0.5) dcmValue = (Decimal)(-1 * dcmValue); strValue = "Decimal_" + i; serinfo1.AddValue(strValue, dcmValue); iCountTestcases++; if(serinfo1.GetDecimal(strValue)!= dcmValue) { iCountErrors++; Console.WriteLine("Err_2342fdsg_" + i + "! Wrong value returned, " + serinfo1.GetDecimal(strValue)); } } } while (false); } catch (Exception exc_general ) { ++iCountErrors; Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general==\n"+exc_general.StackTrace); } if ( iCountErrors == 0 ) { Console.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases.ToString()); return true; } else { Console.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors.ToString()+" , BugNums?: "+s_strActiveBugNums ); return false; } }