public GameplayMessage(SerializationInfo info, StreamingContext context) { Message = (MessageValue)info.GetByte ("Message"); PlayerID = info.GetInt32 ("PlayerID"); MoveDelta = new Vector2((float)info.GetValue("x",typeof(float)),(float)info.GetValue("y",typeof(float))); OldPosition = new Vector3((float)info.GetValue("xloc", typeof(float)), (float)info.GetValue("yloc", typeof(float)), (float)info.GetValue("zloc", typeof(float))); }
public Message(SerializationInfo info, StreamingContext context) { SourceID = info.GetInt32 ("SourceID"); DestID = info.GetInt32 ("DestID"); Type = (MessageType)info.GetByte ("MessageType"); SerializedContent = (byte[])info.GetValue ("SerializedContent", typeof(byte[])); }
/// <summary> /// Constructor for serialization /// </summary> /// <param name="info">The serialization information.</param> /// <param name="context">The streaming context.</param> protected Color(SerializationInfo info, StreamingContext context) { R = info.GetByte("R_Color_Value"); G = info.GetByte("G_Color_Value"); B = info.GetByte("B_Color_Value"); }
/// <summary> /// Initializes a new instance of this Exception Class with serialized data. Needed for Remoting and general serialization. /// </summary> /// <remarks> /// Only to be used by the .NET Serialization system (eg within .NET Remoting). /// </remarks> /// <param name="AInfo">The <see cref="SerializationInfo" /> that holds the serialized object data about the <see cref="Exception" /> being thrown.</param> /// <param name="AContext">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param> public ESecurityPartnerAccessDeniedException(SerializationInfo AInfo, StreamingContext AContext) : base(AInfo, AContext) { FPartnerKey = AInfo.GetInt64("PartnerKey"); FPartnerShortName = AInfo.GetString("PartnerShortName"); FAccessLevel = AInfo.GetByte("AccessLevel"); }
/// <summary> /// Initializes a new instance of the <see cref="InvalidChannelEventParameterValueException"/> /// with serialized data. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized /// object data about the exception being thrown.</param> /// <param name="context">The <see cref="StreamingContext"/> that contains contextual information /// about the source or destination.</param> private InvalidChannelEventParameterValueException(SerializationInfo info, StreamingContext context) : base(info, context) { Value = info.GetByte(ValueSerializationPropertyName); }
/// <summary> /// Initializes a new instance of the <see cref="InvalidModbusRequestException" /> class with serialized data. /// </summary> /// <param name="info">The object that holds the serialized object data.</param> /// <param name="context">The contextual information about the source or destination.</param> protected InvalidModbusRequestException(SerializationInfo info, StreamingContext context) : base(info, context) { _exceptionCode = info.GetByte(nameof(ExceptionCode)); }
/// <summary> /// Creates a new <see cref="CommandCell"/> from serialization parameters. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> with populated with data.</param> /// <param name="context">The source <see cref="StreamingContext"/> for this deserialization.</param> protected CommandCell(SerializationInfo info, StreamingContext context) : base(info, context) { // Deserialize command cell value m_extendedDataByte = info.GetByte("extendedDataByte"); }
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; } }
/// <summary> /// <see cref="SerializationInfo"/>를 사용하여 <see cref="SecureInt64"/>의 인스턴스를 초기화합니다. /// </summary> /// <param name="info">가져올 데이터가 포함된 <see cref="SerializationInfo"/></param> /// <param name="context">이 deserialization에 대한 대상입니다(<seealso cref="StreamingContext"/> 참조).</param> public SecureInt64(SerializationInfo info, StreamingContext context) { this.securedValue = info.GetInt64("securedValue"); this.hash = info.GetInt64("hash"); this.keyIndex = info.GetByte("keyIndex"); }
protected RiakInvalidDataException(SerializationInfo info, StreamingContext context) : base(info, context) { this.messageCode = info.GetByte("MessageCode"); }
public HotBar(SerializationInfo info, StreamingContext cntxt) : this() { this.selected = (int)info.GetByte("HotBar_Selected"); this.spells = (AttackSpriteId[])info.GetValue("HotBar_Spells", typeof(AttackSpriteId[])); }
/// <summary>Initializes a new instance of month based on the serialization info.</summary> /// <param name="info">The serialization info.</param> /// <param name="context">The streaming context.</param> private Month(SerializationInfo info, StreamingContext context) { Guard.NotNull(info, "info"); m_Value = info.GetByte("Value"); }
private NumericType(SerializationInfo info, StreamingContext context) : base(info, context) { Precision = info.GetInt32("Precision"); Scale = info.GetByte("Scale"); }
private SqlBoolean(SerializationInfo info) { value = info.GetByte("value"); }
protected CommandLineException(SerializationInfo info, StreamingContext context) : base(info, context) { ExitCode = info.GetByte(nameof(ExitCode)); }
/// <summary> /// Initializes a new instance of the <see cref="UnknownChannelEventException"/> /// with serialized data. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized /// object data about the exception being thrown.</param> /// <param name="context">The <see cref="StreamingContext"/> that contains contextual information /// about the source or destination.</param> private UnknownChannelEventException(SerializationInfo info, StreamingContext context) : base(info, context) { StatusByte = (FourBitNumber)info.GetByte(StatusByteSerializationPropertyName); Channel = (FourBitNumber)info.GetByte(ChannelSerializationPropertyName); }
/// <summary> /// Initializes a new instance of the <see cref="ChannelNotPublishedException"/> class. /// </summary> /// <param name="info">Serialization info.</param> /// <param name="context">Serialization context.</param> protected ChannelNotPublishedException(SerializationInfo info, StreamingContext context) : base(info, context) { this.MessageTemplate = info.GetString(PropMessageTemplate); this.PublishingStatus = (OnlineChannelPublishStatusType)info.GetByte(PropPublishingStatus); }
public virtual object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { Element element = (Element)obj; SerializationInfoEnumerator enumerator = info.GetEnumerator(); //Reset reference properties element.ResetPath(); //Enumerate the info object and apply to the appropriate properties while (enumerator.MoveNext()) { if (enumerator.Name == "Key") { element.SetKey(info.GetString("Key")); } else if (enumerator.Name == "Path") { element.SetPath(Serialize.GetPath(info.GetString("Path"))); } else if (enumerator.Name == "ZOrder") { element.SetOrder(info.GetInt32("ZOrder")); } else if (enumerator.Name == "BorderColor") { element.BorderColor = Color.FromArgb(Convert.ToInt32(info.GetString("BorderColor"))); } else if (enumerator.Name == "BorderStyle") { element.BorderStyle = (DashStyle)Enum.Parse(typeof(DashStyle), info.GetString("BorderStyle")); } else if (enumerator.Name == "BorderWidth") { element.BorderWidth = info.GetSingle("BorderWidth"); } else if (enumerator.Name == "DrawShadow") { element.DrawShadow = info.GetBoolean("DrawShadow"); } else if (enumerator.Name == "SmoothingMode") { element.SmoothingMode = (SmoothingMode)Enum.Parse(typeof(SmoothingMode), info.GetString("SmoothingMode")); } else if (enumerator.Name == "Opacity") { element.Opacity = info.GetByte("Opacity"); } else if (enumerator.Name == "Tooltip") { element.Tooltip = info.GetString("Tooltip"); } else if (enumerator.Name == "Visible") { element.Visible = info.GetBoolean("Visible"); } else if (enumerator.Name == "Tag") { element.Tag = info.GetValue("Tag", typeof(object)); } } return(element); }
protected Socks5ConnectException( SerializationInfo info, StreamingContext context) : base(info, context) { Status = (ConnectStatus)info.GetByte("Status"); }
public NetworkMessage(SerializationInfo info, StreamingContext context) { Message = (MessageValue)info.GetByte ("Message"); }
public DemoClass(SerializationInfo info, StreamingContext context) { Id = info.GetInt32("Id"); Age = info.GetByte("Age"); }
//***************** .NET ICollection API /// <summary> /// Implements the ISerializable interface and raises the deserialization event when the deserialization is complete. /// </summary> /// <param name="sender">Source of the deserialization event</param> #if (!DEVICE) public void OnDeserialization(object sender) { // save current sort order // save btree // - save comparer // - save other btree data try { this.CurrentSortOrder = (SortOrderType)SerializationInfo.GetInt32("SortOrder"); } catch (System.Exception e) { throw new System.Runtime.Serialization.SerializationException(GetStringResource("CurrentSortOrderDeSerializeError"), e); } IComparer Comparer; // save comparer, SlotLength, save Keys & save Values try { Comparer = (IComparer)SerializationInfo.GetValue("Comparer", typeof(IComparer)); } catch (System.Exception e) { throw new System.Runtime.Serialization.SerializationException(GetStringResource("ComparerDeSerializeError"), e); } ValidSlotLengths SlotLength; try { SlotLength = (ValidSlotLengths)SerializationInfo.GetByte("SlotLength"); } catch (System.Exception e) { throw new System.Runtime.Serialization.SerializationException(GetStringResource("SlotLengthDeSerializeError"), e); } btree = new BTreeAlgorithm((ValidSlotLengths)SlotLength, Comparer); object[] Keys, Values; try { Keys = (object[])SerializationInfo.GetValue("Keys", typeof(object)); } catch (System.Exception e) { if (e.Message == "Members Keys was not found.") { Keys = new object[0]; } else { throw new System.Runtime.Serialization.SerializationException(GetStringResource("KeysDeSerializeError"), e); } } if (Keys.Length == 0) { Values = new object[0]; } else { try { Values = (object[])SerializationInfo.GetValue("Values", typeof(object)); } catch (System.Exception e) { throw new System.Runtime.Serialization.SerializationException(GetStringResource("ValuesDeSerializeError"), e); } } if (Keys.Length != Values.Length) { throw new System.Runtime.Serialization.SerializationException(GetStringResource("KeysAndValuesDifferInSizeError")); } for (int i = 0; i < Keys.Length; i++) { if (Keys[i] == null) { throw new System.Runtime.Serialization.SerializationException(GetStringResource("DeSerializedNullKeyError")); } this.Add(Keys[i], Values[i]); } }
private ChangeTriggerStatusAction(SerializationInfo info, StreamingContext context) { Status = (TriggerStatus)info.GetByte("Status"); }
/// <summary> /// Creates a new <see cref="HeaderCell"/> from serialization parameters. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> with populated with data.</param> /// <param name="context">The source <see cref="StreamingContext"/> for this deserialization.</param> protected HeaderCell(SerializationInfo info, StreamingContext context) : base(info, context) { // Deserialize header cell value m_character = info.GetByte("character"); }
public NetworkMessage(SerializationInfo info, StreamingContext context) { Message = (MessageValue)info.GetByte("Message"); }
/// <summary> /// Initializes a new instance of the <see cref="InvalidMidiTimeCodeComponentException"/> /// with serialized data. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized /// object data about the exception being thrown.</param> /// <param name="context">The <see cref="StreamingContext"/> that contains contextual information /// about the source or destination.</param> private InvalidMidiTimeCodeComponentException(SerializationInfo info, StreamingContext context) : base(info, context) { Value = info.GetByte(ValueSerializationPropertyName); }
protected AddChannelFailedException(SerializationInfo info, StreamingContext context) : base(info, context) { Reason = (AddChannelFailedReason)info.GetByte("Reason"); }
/// <summary> /// Initializes a new instance of the ScsiCommandException class. /// </summary> /// <param name="info">The serialization info</param> /// <param name="context">Ther context</param> protected ScsiCommandException(SerializationInfo info, StreamingContext context) : base(info, context) { _status = (ScsiStatus)info.GetByte("status"); _senseData = (byte[])info.GetValue("senseData", typeof(byte[])); }
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; Object oValue; StringBuilder sbldr1; String strValue; Random rnd1; try { do { strLoc = "Loc_6573cd"; serinfo1 = new SerializationInfo(typeof(Int32), new FormatterConverter()); rnd1 = new Random(); 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); } 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); } 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); } 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)); } } 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)); } } 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)); } } 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)); } } 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)); } } 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)); } } 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)); } } for (int i = 0; i < 50; i++) { strLoc = "Loc_63dc_" + i; ui64Value = (ulong)((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)); } } 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)); } } 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)); } } 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)); } } strLoc = "Loc_6853vd"; oValue = false; serinfo1.AddValue("Object_1", oValue); fValue = false; iCountTestcases++; if (serinfo1.GetBoolean("Object_1") != fValue) { iCountErrors++; Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetBoolean("Object_1")); } oValue = true; fValue = true; serinfo1.AddValue("Object_2", oValue); iCountTestcases++; if (serinfo1.GetBoolean("Object_2") != fValue) { iCountErrors++; Console.WriteLine("Err_6753vd! wrong value returned, " + serinfo1.GetBoolean("Object_2")); } try { iCountTestcases++; oValue = 5; serinfo1.AddValue("Boolean_2", oValue); iCountErrors++; Console.WriteLine("Err_1065753cd! Exception not thrown"); }catch (SerializationException) { }catch (Exception ex) { iCountErrors++; Console.WriteLine("Err_5739cd! Wrong exception thrown, " + ex); } strLoc = "Loc_6853vd"; oValue = false; serinfo1.AddValue("Object_Type_1", oValue, typeof(Boolean)); fValue = false; iCountTestcases++; if (serinfo1.GetBoolean("Object_Type_1") != fValue) { iCountErrors++; Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetBoolean("Object_Type_1")); } sglValue = Single.MaxValue; oValue = sglValue; serinfo1.AddValue("Object_Type_2", oValue, typeof(Single)); iCountTestcases++; if (serinfo1.GetSingle("Object_Type_2") != sglValue) { iCountErrors++; Console.WriteLine("Err_6753vd! wrong value returned, " + serinfo1.GetSingle("Object_Type_2")); } oValue = null; serinfo1.AddValue("Object_Type_3", oValue, typeof(Int32)); iCountTestcases++; if (serinfo1.GetValue("Object_Type_3", typeof(Int32)) != null) { iCountErrors++; Console.WriteLine("Err_6753vd! wrong value returned, " + serinfo1.GetBoolean("Object_Type_3")); } try { iCountTestcases++; oValue = 5; serinfo1.AddValue("Object_Type_3", oValue, typeof(Int32)); iCountErrors++; Console.WriteLine("Err_1065753cd! Exception not thrown"); }catch (SerializationException) { }catch (Exception ex) { iCountErrors++; Console.WriteLine("Err_5739cd! Wrong exception thrown, " + ex); } try { iCountTestcases++; oValue = 5; serinfo1.AddValue("Object_Type_5", oValue, null); iCountErrors++; Console.WriteLine("Err_1065753cd! Exception not thrown"); }catch (ArgumentNullException) { }catch (Exception ex) { iCountErrors++; Console.WriteLine("Err_5739cd! Wrong exception thrown, " + ex); } } while (false); } catch (Exception exc_general) { ++iCountErrors; Console.WriteLine(s_strTFAbbrev + " : Error Err_8888yyy! strLoc==" + strLoc + ", exc_general==\n" + exc_general); } 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); } }
public JoinClusterFailedException(SerializationInfo info, StreamingContext context) : base(info, context) { this.Reason = (JoinClusterFailedReason)info.GetByte("Reason"); }
public Color3b(SerializationInfo info, StreamingContext context) { this.Red = info.GetByte(RED); this.Green = info.GetByte(GREEN); this.Blue = info.GetByte(BLUE); }