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