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


C# SerializationInfo.GetInt16方法代码示例

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


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

示例1: JumpPoint

 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");
 }
开发者ID:floAr,项目名称:WarTornLands,代码行数:12,代码来源:JumpPoint.cs

示例2: RouteClassConfiguration

        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);

            }
        }
开发者ID:tehknox,项目名称:tap-desktop,代码行数:25,代码来源:RouteConfiguration.cs

示例3: BaseModel

        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);
                    }
                }
            }
        }
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:59,代码来源:BaseModel.cs

示例4: Song

 /// <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");
 }
开发者ID:ssickles,项目名称:archive,代码行数:14,代码来源:Song.cs

示例5: DeviceSettings

 /// <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");
 }
开发者ID:abigail3306,项目名称:wintumbra,代码行数:24,代码来源:DeviceSettings.cs

示例6: DrawableContainer

 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");
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:11,代码来源:DrawableContainer.cs

示例7: SetObjectData

 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;
 }
开发者ID:VictorGavrish,项目名称:MentoringD2D3,代码行数:12,代码来源:OrderDetailsSerializationSurrogate.cs

示例8: AbstractLibraryItem

        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");
        }
开发者ID:bstaykov,项目名称:Telerik-DSA,代码行数:12,代码来源:AbstractLibraryItem.cs

示例9: StoreWorldDetail

 //
 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?));
 }
开发者ID:5509850,项目名称:baumax,代码行数:14,代码来源:StoreWorldDetail.cs

示例10: Airliner

        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);
             }
        }
开发者ID:tehknox,项目名称:tap-desktop,代码行数:50,代码来源:Airliner.cs

示例11: SetObjectData

        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;
        }
开发者ID:RamanBut-Husaim,项目名称:.NET-Practice,代码行数:14,代码来源:OrderDetailSerializationSurrogate.cs

示例12: AirportContract

        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;
            }
        }
开发者ID:tehknox,项目名称:tap-desktop,代码行数:50,代码来源:AirportContract.cs

示例13: ActiveScriptException

 /// <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");
     }
 }
开发者ID:Taritsyn,项目名称:MsieJavaScriptEngine,代码行数:19,代码来源:ActiveScriptException.cs

示例14: DynLightShape

        /// <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
              }
        }
开发者ID:hxzpily,项目名称:projectanarchy,代码行数:85,代码来源:DynLightShape.cs

示例15: PhysicsComponent_cl

 /// <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");
 }
开发者ID:IDGASoft,项目名称:Molydeux,代码行数:15,代码来源:PhysicsComponent.cs


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