public JumpPoint(SerializationInfo info, StreamingContext context) : base(info, context) { JumpID = info.GetString("jumpID"); TargetID = info.GetString("targetID"); _target = Entity.Global(info.GetInt16("target")); _collider = Entity.Global(info.GetInt16("collider")); _locked = info.GetBoolean("locked"); _collided = info.GetBoolean("collided"); BodyShape = SaveLoadHelper.LoadRectangle(ref info, "bodyShape"); MovingShape = SaveLoadHelper.LoadRectangle(ref info, "movingShape"); }
private RouteClassConfiguration(SerializationInfo info, StreamingContext ctxt) { int version = info.GetInt16("version"); IList<PropertyInfo> props = new List<PropertyInfo>(this.GetType().GetProperties().Where(p => p.GetCustomAttribute(typeof(Versioning)) != null && ((Versioning)p.GetCustomAttribute(typeof(Versioning))).AutoGenerated)); foreach (SerializationEntry entry in info) { PropertyInfo prop = props.FirstOrDefault(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Name == entry.Name); if (prop != null) prop.SetValue(this, entry.Value); } var notSetProps = props.Where(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Version > version); foreach (PropertyInfo prop in notSetProps) { Versioning ver = (Versioning)prop.GetCustomAttribute(typeof(Versioning)); if (ver.AutoGenerated) prop.SetValue(this, ver.DefaultValue); } }
protected BaseModel(SerializationInfo info, StreamingContext context) { Version = info.GetInt16("version"); IEnumerable<FieldInfo> fields = GetType() .GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) .Where(p => p.GetCustomAttribute(typeof (Versioning)) != null); IList<PropertyInfo> props = new List<PropertyInfo>( GetType() .GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) .Where(p => p.GetCustomAttribute(typeof (Versioning)) != null)); IEnumerable<MemberInfo> propsAndFields = props.Cast<MemberInfo>().Union(fields).ToList(); foreach (SerializationEntry entry in info) { MemberInfo prop = propsAndFields.FirstOrDefault( p => ((Versioning) p.GetCustomAttribute(typeof (Versioning))).Name == entry.Name); if (prop != null) { var fieldInfo = prop as FieldInfo; if (fieldInfo != null) { fieldInfo.SetValue(this, entry.Value); } else { ((PropertyInfo) prop).SetValue(this, entry.Value); } } } IEnumerable<MemberInfo> notSetProps = propsAndFields.Where(p => ((Versioning) p.GetCustomAttribute(typeof (Versioning))).Version > Version); foreach (MemberInfo notSet in notSetProps) { var ver = (Versioning) notSet.GetCustomAttribute(typeof (Versioning)); if (ver.AutoGenerated) { var set = notSet as FieldInfo; if (set != null) { set.SetValue(this, ver.DefaultValue); } else { ((PropertyInfo) notSet).SetValue(this, ver.DefaultValue); } } } }
/// <summary> /// Deserializable constructor /// </summary> /// <param name="info"></param> /// <param name="ctxt"></param> public Song(SerializationInfo info, StreamingContext context) { this.ID = info.GetInt32("ID"); this.Title = info.GetString("Title"); this.TrackNumber = info.GetInt16("TrackNumber"); this.Duration = (TimeSpan)info.GetValue("Duration", typeof(TimeSpan)); this.SongLocation = (SongLocations)info.GetValue("SongLocation", typeof(SongLocations)); this.UploadDate = info.GetDateTime("UploadDate"); }
/// <summary> /// Serialize this object /// </summary> /// <param name="info"></param> /// <param name="cnxt"></param> public DeviceSettings(SerializationInfo info, StreamingContext cnxt) { redBias = info.GetInt16("redBias"); greenBias = info.GetInt16("greenBias"); blueBias = info.GetInt16("blueBias"); maxBrightness = info.GetDouble("maxBrightness"); x = (int)info.GetValue("x", typeof(int)); y = (int)info.GetValue("y", typeof(int)); width = (int)info.GetValue("width", typeof(int)); height = (int)info.GetValue("height", typeof(int)); boundX = (int)info.GetValue("boundX", typeof(int)); boundY = (int)info.GetValue("boundY", typeof(int)); boundWidth = (int)info.GetValue("boundWidth", typeof(int)); boundHeight = (int)info.GetValue("boundHeight", typeof(int)); captureThrottle = (int)info.GetValue("captureThrottle", typeof(int)); stepSleep = (int)info.GetValue("stepSleep", typeof(int)); weightingEnabled = info.GetBoolean("weightingEnabled"); newColorWeight = info.GetDouble("newColorWeight"); }
public DrawableContainer(SerializationInfo info, StreamingContext ctxt) { childLabel.ForeColor = foreColor = (Color)info.GetValue("foreColor", typeof(Color)); backColor = (Color)info.GetValue("backColor", typeof(Color)); thickness = info.GetInt16("thickness"); supportedProperties = (List<Property>)info.GetValue("supportedProperties", typeof(List<Property>)); left = info.GetInt16("left"); top = info.GetInt16("top"); width = info.GetInt16("width"); height = info.GetInt16("height"); }
public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { var orderDetail = (OrderDetail)obj; orderDetail.OrderID = info.GetInt32("OrderID"); orderDetail.ProductID = info.GetInt32("ProductID"); orderDetail.UnitPrice = info.GetDecimal("UnitPrice"); orderDetail.Quantity = info.GetInt16("Quantity"); orderDetail.Discount = info.GetSingle("Discount"); orderDetail.Order = (Order)info.GetValue("Order", typeof(Order)); orderDetail.Product = (Product)info.GetValue("Product", typeof(Product)); return orderDetail; }
protected AbstractLibraryItem(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } this.FirstName = info.GetString("FirstName"); this.LastName = info.GetString("LastName"); this.PhoneType = (PhoneType)info.GetInt16("PhoneType"); this.PhoneNumber = info.GetString("PhoneNumber"); }
// protected StoreWorldDetail(SerializationInfo info, StreamingContext context) { _storeid = info.GetInt64("sid"); _storeworldid = info.GetInt64 ("swid"); _year = info.GetInt16("y"); _available_work_time_hours = (decimal?)info.GetValue("_1", typeof(decimal?)); _available_buffer_hours = (double?)info.GetValue("_2", typeof(double?)); _business_volume_hours = (decimal?)info.GetValue("_3", typeof(decimal?)); _targetedbusinessvolume = (decimal?)info.GetValue("_4", typeof(decimal?)); _netbusinessvolume1 = (decimal?)info.GetValue("_5", typeof(decimal?)); _netbusinessvolume2 = (decimal?)info.GetValue("_6", typeof(decimal?)); _benchmark_perfomance = (double?)info.GetValue("_7", typeof(double?)); }
private Airliner(SerializationInfo info, StreamingContext ctxt) { int version = info.GetInt16("version"); var fields = this.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(p => p.GetCustomAttribute(typeof(Versioning)) != null); IList<PropertyInfo> props = new List<PropertyInfo>(this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(p => p.GetCustomAttribute(typeof(Versioning)) != null)); var propsAndFields = props.Cast<MemberInfo>().Union(fields.Cast<MemberInfo>()); foreach (SerializationEntry entry in info) { MemberInfo prop = propsAndFields.FirstOrDefault(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Name == entry.Name); if (prop != null) { if (prop is FieldInfo) ((FieldInfo)prop).SetValue(this, entry.Value); else ((PropertyInfo)prop).SetValue(this, entry.Value); } } var notSetProps = propsAndFields.Where(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Version > version); foreach (MemberInfo notSet in notSetProps) { Versioning ver = (Versioning)notSet.GetCustomAttribute(typeof(Versioning)); if (ver.AutoGenerated) { if (notSet is FieldInfo) ((FieldInfo)notSet).SetValue(this, ver.DefaultValue); else ((PropertyInfo)notSet).SetValue(this, ver.DefaultValue); } } this.Classes.RemoveAll(c=>c == null); var doubleClasses = new List<AirlinerClass.ClassType>(this.Classes.Where(c => this.Classes.Count(cc=>cc.Type == c.Type) > 1).Select(c=>c.Type)); foreach (var doubleClassType in doubleClasses) { var dClass = this.Classes.Last(c=>c.Type == doubleClassType); this.Classes.Remove(dClass); } }
public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { var orderDetail = (Order_Detail) obj; orderDetail.OrderID = info.GetInt32(MemberNameHelper.GetPropertyName<Order_Detail, int>(p => p.OrderID)); orderDetail.ProductID = info.GetInt32(MemberNameHelper.GetPropertyName<Order_Detail, int>(p => p.ProductID)); orderDetail.UnitPrice = info.GetDecimal(MemberNameHelper.GetPropertyName<Order_Detail, decimal>(p => p.UnitPrice)); orderDetail.Quantity = info.GetInt16(MemberNameHelper.GetPropertyName<Order_Detail, short>(p => p.Quantity)); orderDetail.Discount = info.GetSingle(MemberNameHelper.GetPropertyName<Order_Detail, float>(p => p.Discount)); orderDetail.Product = (Product) info.GetValue(MemberNameHelper.GetPropertyName<Order_Detail, Product>(p => p.Product), typeof(Product)); orderDetail.Order = (Order) info.GetValue(MemberNameHelper.GetPropertyName<Order_Detail, Order>(p => p.Order), typeof (Order)); return orderDetail; }
private AirportContract(SerializationInfo info, StreamingContext ctxt) { int version = info.GetInt16("version"); var fields = this.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(p => p.GetCustomAttribute(typeof(Versioning)) != null); IList<PropertyInfo> props = new List<PropertyInfo>(this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(p => p.GetCustomAttribute(typeof(Versioning)) != null)); var propsAndFields = props.Cast<MemberInfo>().Union(fields.Cast<MemberInfo>()); foreach (SerializationEntry entry in info) { MemberInfo prop = propsAndFields.FirstOrDefault(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Name == entry.Name); if (prop != null) { if (prop is FieldInfo) ((FieldInfo)prop).SetValue(this, entry.Value); else ((PropertyInfo)prop).SetValue(this, entry.Value); } } var notSetProps = propsAndFields.Where(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Version > version); foreach (MemberInfo notSet in notSetProps) { Versioning ver = (Versioning)notSet.GetCustomAttribute(typeof(Versioning)); if (ver.AutoGenerated) { if (notSet is FieldInfo) ((FieldInfo)notSet).SetValue(this, ver.DefaultValue); else ((PropertyInfo)notSet).SetValue(this, ver.DefaultValue); } } if (version == 1) { this.Type = ContractType.Full; } if (version == 2) { this.AutoRenew = true; } }
/// <summary> /// Initializes a new instance of the <see cref="ActiveScriptException"/> class with serialized data /// </summary> /// <param name="info">The object that holds the serialized data</param> /// <param name="context">The contextual information about the source or destination</param> private ActiveScriptException(SerializationInfo info, StreamingContext context) : base(info, context) { if (info != null) { _errorCode = info.GetInt32("ErrorCode"); _errorWCode = info.GetInt16("ErrorWCode"); _sourceContext = info.GetUInt32("SourceContext"); _subcategory = info.GetString("Subcategory"); _lineNumber = info.GetUInt32("LineNumber"); _columnNumber = info.GetInt32("ColumnNumber"); _sourceError = info.GetString("SourceError"); } }
/// <summary> /// Called when deserializing /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected DynLightShape(SerializationInfo info, StreamingContext context) : base(info, context) { _lightColor = (Color)info.GetValue("_lightColor", typeof(Color)); _fIntensity = info.GetSingle("_fIntensity"); LightType_e oldType = (LightType_e)info.GetValue("_lightType", typeof(LightType_e)); _lightType = (LightSourceType_e)oldType; _fSpotAngle = info.GetSingle("_fSpotAngle"); _sProjectedTexture = info.GetString("_sProjectedTexture"); //_bSpecularity = info.GetBoolean( "_bSpecularity"); _bDeprecatedModelShadows = info.GetBoolean("_bModelShadows"); _bCastStaticShadows = info.GetBoolean("_bWorldShadows"); _colorAnimTable = info.GetString("_colorAnimTable"); _fAnimTiming = info.GetSingle("_fAnimTiming"); _fAnimPhase = info.GetSingle("_fAnimPhase"); _iWorldInfluence = info.GetInt32("_iWorldInfluence"); _iObjectInfluence = info.GetInt32("_iObjectInfluence"); if (SerializationHelper.HasElement(info, "_iVisibleBitmask")) _iVisibleBitmask = (FlagsInt32_e)info.GetValue("_iVisibleBitmask", typeof(FlagsInt32_e)); if (SerializationHelper.HasElement(info, "_bStatic")) _bStatic = info.GetBoolean("_bStatic"); if (SerializationHelper.HasElement(info, "_bPreviewStatic")) _bPreviewStatic = info.GetBoolean("_bPreviewStatic"); if (SerializationHelper.HasElement(info, "_bTurnOffAfterLighting")) _bTurnOffAfterLighting = info.GetBoolean("_bTurnOffAfterLighting"); if (SerializationHelper.HasElement(info, "_bExportWhenNotRelevant")) _bExportWhenNotRelevant = info.GetBoolean("_bExportWhenNotRelevant"); if (SerializationHelper.HasElement(info, "_bBakedToLightmap")) _bBakedToLightmap = info.GetBoolean("_bBakedToLightmap"); else _bBakedToLightmap = true; // for old maps if (SerializationHelper.HasElement(info, "_sLightAttenuationTex")) _sLightAttenuationTex = info.GetString("_sLightAttenuationTex"); if (SerializationHelper.HasElement(info, "_eLightAttenuationCurve")) _eLightAttenuationCurve = (LightAttenuationCurve_e)info.GetValue("_eLightAttenuationCurve", typeof(LightAttenuationCurve_e)); if (SerializationHelper.HasElement(info, "_lightKey")) // OLD version map to base member _objectKey = info.GetString("_lightKey"); if (SerializationHelper.HasElement(info, "_lightMultiplier")) _lightMultiplier = info.GetSingle("_lightMultiplier"); if (SerializationHelper.HasElement(info, "_fFadeStart")) _fFadeStart = info.GetSingle("_fFadeStart"); if (SerializationHelper.HasElement(info, "_fFadeEnd")) _fFadeEnd = info.GetSingle("_fFadeEnd"); if (SerializationHelper.HasElement(info, "_bTriggered")) _bTriggered = info.GetBoolean("_bTriggered"); if (SerializationHelper.HasElement(info, "_bUseSpecular")) _bUseSpecular = info.GetBoolean("_bUseSpecular"); if (SerializationHelper.HasElement(info, "_bRemoveLightAfterAnim")) _bRemoveLightAfterAnim = info.GetBoolean("_bRemoveLightAfterAnim"); // backwards compatibility if (!SerializationHelper.HasElement(info, "SupportScaling")) SetScaling_Internal(1.0f, 1.0f, 1.0f); // corona: convert old shape properties into component if (SerializationHelper.HasElement(info, "_bCorona") && info.GetBoolean("_bCorona")) { #if !HK_ANARCHY if (SerializationHelper.HasElement(info, "_coronaTexture")) CoronaTexture = info.GetString("_coronaTexture"); if (SerializationHelper.HasElement(info, "_fCoronaScaling")) CoronaScaling = info.GetSingle("_fCoronaScaling"); if (SerializationHelper.HasElement(info, "_eCoronaFlags")) CoronaFlags = (CoronaScaleModeFlags_e)info.GetValue("_eCoronaFlags", typeof(CoronaScaleModeFlags_e)); if (SerializationHelper.HasElement(info, "_iCheckBlockSize")) CoronaCheckBlockSize = info.GetInt16("_iCheckBlockSize"); #endif } else if (SerializationHelper.HasElement(info, "_bLensFlares") && info.GetBoolean("_bLensFlares")) { #if !HK_ANARCHY // Creates default lens flare component if property is true. GetLensFlareComponentSafe(); #endif } }
/// <summary> /// Constructor for deserialization. /// </summary> /// <param name="info">info is the serialization info to deserialize with</param> /// <param name="context">context is the context in which to deserialize...?</param> protected PhysicsComponent_cl(SerializationInfo info, StreamingContext context) : base(info, context) { mIsStatic = info.GetBoolean("IsStatic"); mWidth = info.GetSingle("Width"); mHeight = info.GetSingle("Height"); mCollisionGroup = info.GetInt16("CollisionGroup"); mCollisionTexture = info.GetString("CollisionTexture"); mPhysicsType = (PhysicsObjectType)info.GetInt32("PhysicsType"); }
protected SpiderSetting(SerializationInfo info, StreamingContext context) { this.name = info.GetString("name"); this.startUrl = info.GetValue("startUrl", typeof(StartUrl)) as StartUrl; this.maxDepth = info.GetInt16("maxDepth"); this.allowRedirect = info.GetBoolean("allowRedirect"); this.requestTimeout = info.GetInt32("requestTimeout"); this.iOTimeout = info.GetInt32("iOTimeout"); this.readBufferSize = info.GetInt32("readBufferSize"); this.crawlThreads = info.GetInt16("crawlThreads"); this.processThreads = info.GetInt16("processThreads"); this.proxy = info.GetValue("proxy", typeof(IWebProxy)) as IWebProxy; this.userAgent = info.GetString("userAgent"); this.referer = info.GetString("referer"); this.cookies = info.GetValue("cookies", typeof(CookieCollection)) as CookieCollection; this.requestEncoding = info.GetValue("requestEncoding", typeof(Encoding)) as Encoding; this.urlExtractor = info.GetValue("urlExtractor", typeof(UrlExtractor)) as UrlExtractor; this.contentHandlers = info.GetValue("contentHandlers", typeof(ContentHandlerCollection)) as ContentHandlerCollection; this.logger = info.GetValue("logger", typeof(ILogger)) as ILogger; this.memLimitSize = info.GetInt32("memLimitSize"); this.depositePath = info.GetString("depositePath"); this.speedMode = (SpeedModes)info.GetValue("speedMode",typeof(SpeedModes)); }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <param name="context"></param> private Color(SerializationInfo info, StreamingContext context) { Red = info.GetInt16("Red"); Green = info.GetInt16("Green"); Blue = info.GetInt16("Blue"); }
//Private constructor for seialization private SettingsFormatException(SerializationInfo info, StreamingContext context) : base(info,context) { lineNumber = info.GetInt32("lineNumber"); linePosition = info.GetInt16("linePosition"); }
protected Airline(SerializationInfo info, StreamingContext ctxt) { try { int version = info.GetInt16("version"); var fields = this.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(p => p.GetCustomAttribute(typeof(Versioning)) != null); IList<PropertyInfo> props = new List<PropertyInfo>(this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(p => p.GetCustomAttribute(typeof(Versioning)) != null)); var propsAndFields = props.Cast<MemberInfo>().Union(fields.Cast<MemberInfo>()); foreach (SerializationEntry entry in info) { MemberInfo prop = propsAndFields.FirstOrDefault(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Name == entry.Name); if (prop != null) { if (prop is FieldInfo) ((FieldInfo)prop).SetValue(this, entry.Value); else ((PropertyInfo)prop).SetValue(this, entry.Value); } } var notSetProps = propsAndFields.Where(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Version > version); foreach (MemberInfo notSet in notSetProps) { Versioning ver = (Versioning)notSet.GetCustomAttribute(typeof(Versioning)); if (ver.AutoGenerated) { if (notSet is FieldInfo) ((FieldInfo)notSet).SetValue(this, ver.DefaultValue); else ((PropertyInfo)notSet).SetValue(this, ver.DefaultValue); } } this.Shares = new List<AirlineShare>(); if (version == 1) { AirlineHelpers.CreateStandardAirlineShares(this,100); } if (version < 4) { this.Routes = new List<Route>(); this.Advertisements = new Dictionary<AdvertisementType.AirlineAdvertisementType, AdvertisementType>(); createStandardAdvertisement(); } if (this.Invoices == null) this.Invoices = new Invoices(); } catch (Exception e) { string s = e.ToString(); } }
private AirlineProfile(SerializationInfo info, StreamingContext ctxt) { int version = info.GetInt16("version"); var fields = this.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(p => p.GetCustomAttribute(typeof(Versioning)) != null); IList<PropertyInfo> props = new List<PropertyInfo>(this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Where(p => p.GetCustomAttribute(typeof(Versioning)) != null)); var propsAndFields = props.Cast<MemberInfo>().Union(fields.Cast<MemberInfo>()); foreach (SerializationEntry entry in info) { MemberInfo prop = propsAndFields.FirstOrDefault(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Name == entry.Name); if (prop != null) { if (prop is FieldInfo) ((FieldInfo)prop).SetValue(this, entry.Value); else ((PropertyInfo)prop).SetValue(this, entry.Value); } } var notSetProps = propsAndFields.Where(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Version > version); foreach (MemberInfo notSet in notSetProps) { Versioning ver = (Versioning)notSet.GetCustomAttribute(typeof(Versioning)); if (ver.AutoGenerated) { if (notSet is FieldInfo) ((FieldInfo)notSet).SetValue(this, ver.DefaultValue); else ((PropertyInfo)notSet).SetValue(this, ver.DefaultValue); } } if (version == 1) this.PreferedAircrafts = new List<AirlinerType>(); if (version == 2 || version == 3) this.PrimaryPurchasing = PreferedPurchasing.Random; }
private void SetObjectData(SerializationInfo info) { this.ProductID = info.GetInt32(nameof(this.ProductID)); this.ProductName = info.GetString(nameof(this.ProductName)); this.SupplierID = (int?)info.GetValue(nameof(this.SupplierID), typeof(int?)); this.CategoryID = (int?)info.GetValue(nameof(this.CategoryID), typeof(int?)); this.QuantityPerUnit = info.GetString(nameof(this.QuantityPerUnit)); this.UnitPrice = (decimal?)info.GetValue(nameof(this.UnitPrice), typeof(decimal?)); this.UnitsInStock = (short?)info.GetValue(nameof(this.UnitsInStock), typeof(short?)); this.ReorderLevel = (short?)info.GetValue(nameof(this.UnitsOnOrder), typeof(short?)); this.Discontinued = info.GetBoolean(nameof(this.Discontinued)); if (!info.GetBoolean(nameof(this.Category) + "IsNull")) { this.Category = new Category { CategoryID = info.GetInt32(nameof(this.Category) + nameof(this.Category.CategoryID)), CategoryName = info.GetString(nameof(this.Category) + nameof(this.Category.CategoryName)), Description = info.GetString(nameof(this.Category) + nameof(this.Category.Description)), Picture = (byte[])info.GetValue(nameof(this.Category) + nameof(this.Category.Picture), typeof(byte[])) }; } var orderDetailsList = new List<OrderDetail>(); for (var index = 0; index < info.GetInt32("orderDetailsCount"); index++) { var orderDetail = new OrderDetail { OrderID = info.GetInt32($"{nameof(this.OrderDetails)}-{index}-{nameof(OrderDetail.OrderID)}"), ProductID = info.GetInt32($"{nameof(this.OrderDetails)}-{index}-{nameof(OrderDetail.ProductID)}"), UnitPrice = info.GetDecimal($"{nameof(this.OrderDetails)}-{index}-{nameof(OrderDetail.UnitPrice)}"), Quantity = info.GetInt16($"{nameof(this.OrderDetails)}-{index}-{nameof(OrderDetail.Quantity)}"), Discount = (float)info.GetValue($"{nameof(this.OrderDetails)}-{index}-{nameof(OrderDetail.Discount)}", typeof(float)) }; orderDetailsList.Add(orderDetail); } this.OrderDetails = orderDetailsList; if (!info.GetBoolean(nameof(this.Supplier) + "IsNull")) { this.Supplier = new Supplier { SupplierID = info.GetInt32(nameof(this.Supplier) + nameof(this.Supplier.SupplierID)), CompanyName = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.CompanyName)), ContactName = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.ContactName)), Address = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.Address)), City = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.City)), Region = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.Region)), PostalCode = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.PostalCode)), Country = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.Country)), Phone = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.Phone)), Fax = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.Fax)), HomePage = info.GetString(nameof(this.Supplier) + nameof(this.Supplier.HomePage)) }; } }
protected AirlinerType(SerializationInfo info, StreamingContext ctxt) { int version = info.GetInt16("version"); IList<PropertyInfo> props = new List<PropertyInfo>(this.GetType().GetProperties().Where(p => p.GetCustomAttribute(typeof(Versioning)) != null && ((Versioning)p.GetCustomAttribute(typeof(Versioning))).AutoGenerated)); foreach (SerializationEntry entry in info) { PropertyInfo prop = props.FirstOrDefault(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Name == entry.Name); if (prop != null) prop.SetValue(this, entry.Value); } var notSetProps = props.Where(p => ((Versioning)p.GetCustomAttribute(typeof(Versioning))).Version > version); foreach (PropertyInfo prop in notSetProps) { Versioning ver = (Versioning)prop.GetCustomAttribute(typeof(Versioning)); if (ver.AutoGenerated) prop.SetValue(this, ver.DefaultValue); } if (version == 1) { if (this.TypeAirliner == TypeOfAirliner.Cargo) this.IsConvertable = false; else this.IsConvertable = true; } }
/// <summary> /// Initializes a new instance of the NotificationFormatException class. /// </summary> /// This is needed for ISerializable interface /// <param name="serializationInfo">SerializationInfo provides the class where the class is serialized.</param> /// <param name="streamingContext">Additional StreamingContext class.</param> protected NotificationFormatException(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { if (serializationInfo != null) { PushMessageType messageType = (PushMessageType)serializationInfo.GetInt16("MessageType"); string subscriptionName = serializationInfo.GetString("SubscriptionName"); if ((PushMessageType)this.NotificationMessage.MessageType == PushMessageType.Raw) { string rawMessageText = serializationInfo.GetString("rawMessageText"); RawMessage rawMessage = new RawMessage(subscriptionName, rawMessageText); this.NotificationMessage = rawMessage; } else if ((PushMessageType)this.NotificationMessage.MessageType == PushMessageType.Toast) { string tileMessageText = serializationInfo.GetString("toastMessageText"); ToastMessage toastMessage = new ToastMessage(subscriptionName, tileMessageText); this.NotificationMessage = toastMessage; } else if ((PushMessageType)this.NotificationMessage.MessageType == PushMessageType.Tile) { string tileMessageTitle = serializationInfo.GetString("tileMessageTitle"); string tileMessageCount = serializationInfo.GetString("tileMessageCount"); string tileMessageUrl = serializationInfo.GetString("tileMessageUrl"); TileMessage tileMessage = new TileMessage(subscriptionName, tileMessageTitle, tileMessageCount, tileMessageUrl); this.NotificationMessage = tileMessage; } else if ((PushMessageType)this.NotificationMessage.MessageType == PushMessageType.Iphone) { string messageAlert = serializationInfo.GetString("iPhoneMessageAlert"); string messageBadge = serializationInfo.GetString("iPhoneMessageBadge"); string messageSound = serializationInfo.GetString("iPhoneMessageSound"); iPhoneMessage iphoneMessage = new iPhoneMessage(subscriptionName, messageAlert, messageBadge, messageSound); this.NotificationMessage = iphoneMessage; } else if ((PushMessageType)this.NotificationMessage.MessageType == PushMessageType.Common) { string messageTitle = serializationInfo.GetString("commmonMessageTitle"); int messageCount = serializationInfo.GetInt32("commonMessageCount"); string messageImage = serializationInfo.GetString("commonMessageImage"); string messageSound = serializationInfo.GetString("commonMessageSound"); CommonMessage commonMessage = new CommonMessage(subscriptionName, messageTitle, messageCount, messageImage, messageSound); this.NotificationMessage = commonMessage; } } }
protected BaseModule(SerializationInfo info, StreamingContext context) { _owner = Entity.Global(info.GetInt16("owner")); }
public InvalidTopicMetadataException(SerializationInfo info, StreamingContext context) : base(info, context) { ErrorResponseCode = (ErrorResponseCode)info.GetInt16("ErrorResponseCode"); }
/// <summary> /// Constructor /// </summary> /// <param name="info">SerializationInfo</param> /// <param name="context">StreamingContext</param> protected RecordSetHelper(SerializationInfo info, StreamingContext context) : base(info, context) { isDeserialized = true; isDefaultSerializationInProgress = false; int old_index = info.GetInt16("Index"); index = old_index; newRow = info.GetBoolean("NewRow"); filtered = info.GetBoolean("Filtered"); opened = info.GetBoolean("Opened"); firstEOF = info.GetBoolean("FirstEof"); firstChange = info.GetBoolean("FirstChange"); bool old_eof = info.GetBoolean("EOF"); eof = old_eof; string factoryName = info.GetString("FactoryName"); providerFactory = AdoFactoryManager.GetFactory(factoryName); sqlSelectQuery = info.GetString("RecordSource"); if (opened) { //NOTE: all OpenRecordset logic can be reused. However after //executing the openrecordset logic the eof and index variables //will be reset and we need them to keep the original values; OpenRecordset(false); eof = old_eof; index = old_index; } //These properties must be handle in the classes that extend the recordset helper serializationInfo = new Hashtable(); serializationInfo.Add("ActiveConnectionWasNull", info.GetBoolean("ActiveConnectionWasNull")); serializationInfo.Add("ConnectionString", info.GetString("ConnectionString")); }
protected KeyboardOutputBase(SerializationInfo info, StreamingContext context) : base(info, context) { Key = (DirectInputKeys)info.GetInt16("Key"); }
/// <summary> /// Construtor utilizado na deserialização. /// </summary> /// <param name="info">O objeto <see cref="SerializationInfo"/></param> /// <param name="context">A enumeração <see cref="StreamingContext"/></param> public bool2(SerializationInfo info, StreamingContext context) { this.b = info.GetInt16("b"); }
public void GetObjectData_SerializationInfo_AreEqual() { ISerializable obj = TestStruct; var info = new SerializationInfo(typeof(Year), new System.Runtime.Serialization.FormatterConverter()); obj.GetObjectData(info, default(StreamingContext)); Assert.AreEqual(1979, info.GetInt16("Value")); }
protected BaseEvent(SerializationInfo info, StreamingContext context) { m_TimeStamp = DateTime.Now; m_Source = string.Empty; m_ThreadInfo = null; m_CallingMethod = null; m_StackDepth = 0; m_Message = string.Empty; m_Bag = new PropertyBag(); m_Severity = EventSeverity.Trace; m_EventID = 0; m_EventCategoryID = 0; m_TimeStamp = info.GetDateTime("timestamp"); m_Source = info.GetString("source"); m_ThreadInfo = info.GetString("threadinfo"); m_StackDepth = info.GetInt32("stackdepth"); m_Message = info.GetString("message"); m_WindowsIdentityName = info.GetString("windowsidentity"); m_EventID = info.GetInt32("eventid"); m_EventCategoryID = info.GetInt16("categoryid"); int num1 = info.GetInt32("severity"); m_Severity = EventSeverity.Parse(num1); int num2 = info.GetInt32("propcount"); for (int num3 = 0; num3 < num2; num3++) { string text1 = info.GetString("propname-" + num3.ToString()); string text2 = info.GetString("propvalue-" + num3.ToString()); m_Bag.Add(text1, text2); } }