//Serializatoin counstructor. call when Deserialize function called. private CChair_SALContainer(SerializationInfo info, StreamingContext context) : base(info,context) { var1 = info.GetInt32("var1"); var2 = info.GetInt32("var2"); str1 = (string[])info.GetValue("str1",typeof(string[])); }
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[])); }
public CUBEGridInfo(SerializationInfo info, StreamingContext context) { position = (sVector3)info.GetValue("position", typeof(sVector3)); rotation = (sVector3)info.GetValue("rotation", typeof(sVector3)); weaponMap = info.GetInt32("weaponMap"); augmentationMap = info.GetInt32("augmentationMap"); colors = (int[])info.GetValue("colors", typeof(int[])); }
/// <summary> /// Initializes a new instance of the <see cref="MailChimpException"/> class. /// </summary> /// <param name="info"> /// The info. /// </param> /// <param name="context"> /// The context. /// </param> /// <exception cref="ArgumentNullException"><paramref> /// <name>name</name> /// </paramref> /// is null. </exception> /// <exception cref="InvalidCastException">The value associated with <paramref> /// <name>name</name> /// </paramref> /// cannot be converted to a <see cref="T:System.String" />. </exception> /// <exception cref="SerializationException">An element with the specified name is not found in the current instance. </exception> // ReSharper disable once UnusedParameter.Local public MailChimpException(SerializationInfo info, StreamingContext context) { var errorText = string.Empty; try { this.Detail = info?.GetString("detail"); this.Title = info?.GetString("title"); this.Type = info?.GetString("type"); this.Status = info?.GetInt32("status") ?? 0; this.Instance = info?.GetString("instance"); errorText = $"Title: {this.Title + Environment.NewLine} Type: {this.Type + Environment.NewLine} Status: {this.Status + Environment.NewLine} + Detail: {this.Detail + Environment.NewLine}"; this.Errors = (List <Error>)info?.GetValue("errors", typeof(List <Error>)); errorText += "Errors: " + string.Join(" : ", this.Errors.Select(x => x.Field + " " + x.Message)); } catch { // ignored } finally { Trace.Write(errorText); Debug.Write(errorText); } }
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))); }
/// <summary> /// Initializes a new instance of the RuntimeException class /// using data serialized via /// <see cref="ISerializable"/> /// </summary> /// <param name="info"> serialization information </param> /// <param name="context"> streaming context </param> /// <returns> constructed object </returns> protected RuntimeException(SerializationInfo info, StreamingContext context) : base(info, context) { _errorId = info.GetString("ErrorId"); _errorCategory = (ErrorCategory)info.GetInt32("ErrorCategory"); }
public SampledStroke(SerializationInfo info, StreamingContext ctxt) { beginning = info.GetInt32("beginning"); str = (List<Dot>)info.GetValue("str", typeof(List<Dot>)); positionX = 0; positionY = 0; }
/// <summary> /// Initializes a new instance of the <see cref="MailChimpException"/> class. /// </summary> /// <param name="info"> /// The info. /// </param> /// <param name="context"> /// The context. /// </param> /// <exception cref="ArgumentNullException"><paramref> /// <name>name</name> /// </paramref> /// is null. </exception> /// <exception cref="InvalidCastException">The value associated with <paramref> /// <name>name</name> /// </paramref> /// cannot be converted to a <see cref="T:System.String" />. </exception> /// <exception cref="SerializationException">An element with the specified name is not found in the current instance. </exception> // ReSharper disable once UnusedParameter.Local public MailChimpException(SerializationInfo info, StreamingContext context) { this.Detail = info?.GetString("detail"); this.Title = info?.GetString("title"); this.Type = info?.GetString("type"); this.Status = info?.GetInt32("status") ?? 0; this.Instance = info?.GetString("instance"); }
protected ConfigurationException(SerializationInfo info, StreamingContext context) : base(info, context) { HResult = unchecked((int)0x80131902); this.filename = info.GetString("filename"); this.line = info.GetInt32("line"); }
// Extract the HResult from an exception object. We have to // do it this way because HResult is "protected". public static int GetHResult(Exception e) { SerializationInfo info = new SerializationInfo(typeof(Exception), new FormatterConverter()); StreamingContext context = new StreamingContext(); e.GetObjectData(info, context); return info.GetInt32("HResult"); }
protected ConfigurationErrorsException(SerializationInfo info, StreamingContext context) : base(info, context) { string filename = info.GetString("firstFilename"); int line = info.GetInt32("firstLine"); this.Init(filename, line); int num2 = info.GetInt32("count"); if (num2 != 0) { this._errors = new ConfigurationException[num2]; for (int i = 0; i < num2; i++) { string str2 = i.ToString(CultureInfo.InvariantCulture); Type type = Type.GetType(info.GetString(str2 + "_errors_type"), true); if ((type != typeof(ConfigurationException)) && (type != typeof(ConfigurationErrorsException))) { throw ExceptionUtil.UnexpectedError("ConfigurationErrorsException"); } this._errors[i] = (ConfigurationException) info.GetValue(str2 + "_errors", type); } } }
/// <summary> /// Initializes a new instance of the <see cref="MailChimpException"/> class. /// </summary> /// <param name="info"> /// The info. /// </param> /// <param name="context"> /// The context. /// </param> /// <exception cref="ArgumentNullException"><paramref> /// <name>name</name> /// </paramref> /// is null. </exception> /// <exception cref="InvalidCastException">The value associated with <paramref> /// <name>name</name> /// </paramref> /// cannot be converted to a <see cref="T:System.String" />. </exception> /// <exception cref="SerializationException">An element with the specified name is not found in the current instance. </exception> // ReSharper disable once UnusedParameter.Local public MailChimpException(SerializationInfo info, StreamingContext context) { try { this.Detail = info?.GetString("detail"); this.Title = info?.GetString("title"); this.Type = info?.GetString("type"); this.Status = info?.GetInt32("status") ?? 0; this.Instance = info?.GetString("instance"); this.Errors = (List <Error>)info?.GetValue("errors", typeof(List <Error>)); } catch { } }
/// <summary> /// This constructor is required by serialization. /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected FormatTableLoadException(SerializationInfo info, StreamingContext context) : base(info, context) { if (info == null) { throw new PSArgumentNullException("info"); } int errorCount = info.GetInt32("ErrorCount"); if (errorCount > 0) { _errors = new Collection<string>(); for (int index = 0; index < errorCount; index++) { string key = string.Format(CultureInfo.InvariantCulture, "Error{0}", index); _errors.Add(info.GetString(key)); } } }
private c2(SerializationInfo info, StreamingContext context) { a = info.GetInt32("a"); s1 = info.GetString("s1"); }
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> /// Initializes a new instance of the CabinetFileInfo class with serialized data. /// </summary> /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param> protected CabFileInfo(SerializationInfo info, StreamingContext context) : base(info, context) { this.cabFolder = info.GetInt32("cabFolder"); }
public Object SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector){ Object objRet = obj; if(obj.GetType().Equals(typeof(A))){ ((A)obj).I = info.GetInt32("IntValueForA"); }else if(obj.GetType().Equals(typeof(V))){ FieldInfo[] members = obj.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance); members[0].SetValue(obj, info.GetInt32("IntValueForV")); }else throw new Exception("Err_34tsdg! Unknown type"); return objRet; }
private HttpParseException(SerializationInfo info, StreamingContext context) :base(info, context) { _virtualPath = (VirtualPath)info.GetValue("_virtualPath", typeof(VirtualPath)); _line = info.GetInt32("_line"); _parserErrors = (ParserErrorCollection)info.GetValue("_parserErrors", typeof(ParserErrorCollection)); }
private DataServiceClientException(SerializationInfo info, StreamingContext context) : base(info, context) { this.statusCode = info.GetInt32("StatusCode"); }
/// <summary cref="Exception(SerializationInfo, StreamingContext)"/> private CuBlasException(SerializationInfo info, StreamingContext context) : base(info, context) { Error = (CuBlasStatus)info.GetInt32("Error"); }
/// <summary> /// Initializes a new instance of this class 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> protected TokenMgrError(SerializationInfo info, StreamingContext context) : base(info, context) { errorCode = info.GetInt32("errorCode"); }
private ChannelId(SerializationInfo info, StreamingContext context) { fullKey = (byte[])info.GetValue("fk", typeof(byte[])); this.keyIndex = info.GetUInt16("ki"); this.hash = info.GetInt32("fh"); }
protected Win32Exception(SerializationInfo info, StreamingContext context) : base(info, context) { NativeErrorCode = info.GetInt32(nameof(NativeErrorCode)); }
/// <summary> /// Serialization Constructor /// </summary> /// <param name="info">SerializationInfo object</param> /// <param name="ctxt">StreamingContext object</param> protected AMQException(SerializationInfo info, StreamingContext ctxt) : base(info, ctxt) { _errorCode = info.GetInt32("ErrorCode"); }
protected MessageQueueException(SerializationInfo info, StreamingContext context) : base(info, context) { this.nativeErrorCode = info.GetInt32("NativeErrorCode"); }
protected PointCloud(SerializationInfo info, StreamingContext context) { // for version evaluation while deserializing int pSerVersionMobilitaet = info.GetInt32("m_SerVersion"); }
private ProcessOutput(SerializationInfo info, StreamingContext context) { ExitCode = info.GetInt32(nameof(ExitCode)); OutputLines = info.GetValue(nameof(OutputLines), typeof(List <string>)) as List <string>; ErrorLines = info.GetValue(nameof(ErrorLines), typeof(List <string>)) as List <string>; }
protected InsufficientBufferSizeException(SerializationInfo info, StreamingContext context) : base(info, context) { SizeAvailable = info.GetBoolean(KeyHasSizeAvailable) ? (int?)info.GetInt32(nameof(SizeAvailable)) : (int?)default;
// Deserialize schema. private void DeserializeDataSetSchema(SerializationInfo info, StreamingContext context, SerializationFormat remotingFormat, SchemaSerializationMode schemaSerializationMode) { if (remotingFormat != SerializationFormat.Xml) { if (schemaSerializationMode == SchemaSerializationMode.IncludeSchema) { //DataSet public state properties DeserializeDataSetProperties(info, context); //Tables Count int tableCount = info.GetInt32("DataSet.Tables.Count"); //Tables, Columns, Rows for (int i = 0; i < tableCount; i++) { Byte[] buffer = (Byte[])info.GetValue(String.Format(CultureInfo.InvariantCulture, "DataSet.Tables_{0}", i), typeof(Byte[])); MemoryStream memStream = new MemoryStream(buffer); memStream.Position = 0; BinaryFormatter bf = new BinaryFormatter(null, new StreamingContext(context.State, false)); DataTable dt = (DataTable)bf.Deserialize(memStream); Tables.Add(dt); } //Constraints for (int i = 0; i < tableCount; i++) { Tables[i].DeserializeConstraints(info, context, /* table index */i, /* serialize all constraints */ true); // } //Relations DeserializeRelations(info, context); //Expression Columns for (int i = 0; i < tableCount; i++) { Tables[i].DeserializeExpressionColumns(info, context, i); } } else { //DeSerialize DataSet public properties.[Locale, CaseSensitive and EnforceConstraints] DeserializeDataSetProperties(info, context); } } else { string strSchema = (String)info.GetValue(KEY_XMLSCHEMA, typeof(System.String)); if (strSchema != null) { this.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)), true); } } }
protected AlimapException(SerializationInfo info, StreamingContext context) : base(info, context) { this.Code = info.GetInt32(nameof(this.Code)); }
/// <summary> /// Private constructor only present for serialization. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> to fetch data from.</param> /// <param name="context">The source for this deserialization.</param> private Offset(SerializationInfo info, StreamingContext context) : this(info.GetInt32(MillisecondsSerializationName)) { }
private V_I(SerializationInfo info, StreamingContext context) { i = info.GetInt32("IntValue"); }
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"; Hashtable dic1; Int32 iNumberOfItems = 10; SerializationInfo ser1; Object[] serKeys; Object[] serValues; Hashtable hsh1; Hashtable hsh3; Hashtable hsh4; DictionaryEntry[] strValueArr; MemoryStream ms1; try { do { strLoc = "Loc_8345vdfv"; dic1 = new Hashtable(); for(int i=0; i<iNumberOfItems; i++) { dic1.Add(i, "String_" + i); } ser1 = new SerializationInfo(typeof(Hashtable), new FormatterConverter()); dic1.GetObjectData(ser1, new StreamingContext()); iCountTestcases++; if(ser1.GetSingle("LoadFactor") != 0.72f) { iCountErrors++; Console.WriteLine("Err_748cdg! Expected value not returned, " + ser1.GetSingle("LoadFactor")); } if(ser1.GetInt32("Version") != 11) { iCountErrors++; Console.WriteLine("Err_01823csdf! Expected value not returned, " + ser1.GetSingle("Version")); } if(ser1.GetSingle("HashSize") != 23) { iCountErrors++; Console.WriteLine("Err_7132fgfg! Expected value not returned, " + ser1.GetSingle("LoadFactor")); } serKeys = (Object[])ser1.GetValue("Keys", typeof(Object[])); serValues = (Object[])ser1.GetValue("Values", typeof(Object[])); Array.Sort(serKeys); Array.Sort(serValues); for(int i=0; i<iNumberOfItems; i++) { if((Int32)serKeys[i] != i) { iCountErrors++; Console.WriteLine("Err_1nd342_" + i + "! Expected value not returned, " + i); } if(!((String)serValues[i]).Equals("String_" + i)) { iCountErrors++; Console.WriteLine("Err_7539fdg_" + i + "! Expected value not returned, " + i); } } try { iCountTestcases++; dic1.GetObjectData(null, new StreamingContext()); iCountErrors++; Console.WriteLine("Err_7439dg! Exception not thrown"); } catch(ArgumentNullException) { } catch(Exception ex) { iCountErrors++; Console.WriteLine("Err_6572fdg! Unexpected exception thrown, " + ex); } iCountTestcases++; hsh1 = new Hashtable(); for(int i=0; i<10; i++) { hsh1.Add("Key_" + i, "Value_" + i); } BinaryFormatter formatter = new BinaryFormatter(); ms1 = new MemoryStream(); formatter.Serialize(ms1, hsh1); ms1.Position = 0; hsh4 = (Hashtable)formatter.Deserialize(ms1); if(hsh4.Count != hsh1.Count) { iCountErrors++; Console.WriteLine("Err_072xsf! Expected value not returned, " + hsh4.Count); } strValueArr = new DictionaryEntry[hsh4.Count]; hsh4.CopyTo(strValueArr, 0); hsh3 = new Hashtable(); for(int i=0; i<10; i++) { if(!hsh4.Contains("Key_" + i)) { iCountErrors++; Console.WriteLine("Err_742ds8f! Expected value not returned, " + hsh4.Contains("Key_" + i)); } if(!hsh4.ContainsKey("Key_" + i)) { iCountErrors++; Console.WriteLine("Err_742389dsaf! Expected value not returned, " + hsh4.ContainsKey("Key_" + i)); } if(!hsh4.ContainsValue("Value_" + i)) { iCountErrors++; Console.WriteLine("Err_0672esfs! Expected value not returned, " + hsh4.ContainsValue("Value_" + i)); } if(!hsh1.ContainsValue(((DictionaryEntry)strValueArr[i]).Value)) { iCountErrors++; Console.WriteLine("Err_87429dsfd! Expected value not returned, " + ((DictionaryEntry)strValueArr[i]).Value); } try { hsh3.Add(((DictionaryEntry)strValueArr[i]).Value, null); } catch(Exception) { iCountErrors++; Console.WriteLine("Err_74298dsd! Exception thrown for " + ((DictionaryEntry)strValueArr[i]).Value); } } } while (false); } catch (Exception exc_general ) { ++iCountErrors; Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general==\n"+exc_general.ToString()); } if ( iCountErrors == 0 ) { Console.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases); return true; } else { Console.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums ); return false; } }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected LogScale(SerializationInfo info, StreamingContext context) : base(info, context) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32("schema2"); }
private V_I(SerializationInfo info, StreamingContext context){ i = info.GetInt32("IntValue"); }
/// <summary>Deserialization constructor</summary> /// <param name="info">Info.</param> /// <param name="context">Context.</param> protected ResultsetFields(SerializationInfo info, StreamingContext context) : base(info.GetInt32("_amountFields"), InheritanceInfoProviderSingleton.GetInstance(), null) { List <IEntityField> fields = (List <IEntityField>)info.GetValue("_fields", typeof(List <IEntityField>)); for (int i = 0; i < fields.Count; i++) { this[i] = fields[i]; } }
private DeclensionException(SerializationInfo info, StreamingContext context) : base(info, context) { ErrorCode = info.GetInt32("ErrorCode"); }
/// <summary> /// Constructor: Deserialises the information and recreates the instance. /// </summary> /// <param name="info">Standard <c>SerializationInfo</c> object</param> /// <param name="ctxt">Standard <c>StreamingContext</c> object</param> public StableHeader(SerializationInfo info, StreamingContext ctxt) { type = info.GetInt32("type"); digest = (Digest)info.GetValue("digest", typeof(object)); }
protected RolePrincipal(SerializationInfo info, StreamingContext context) :base(info, context) { _Version = info.GetInt32("_Version"); _ExpireDate = info.GetDateTime("_ExpireDate"); _IssueDate = info.GetDateTime("_IssueDate"); try { _Identity = info.GetValue("_Identity", typeof(IIdentity)) as IIdentity; } catch { } // Ignore Exceptions _ProviderName = info.GetString("_ProviderName"); _Username = info.GetString("_Username"); _IsRoleListCached = info.GetBoolean("_IsRoleListCached"); _Roles = new HybridDictionary(true); string allRoles = info.GetString("_AllRoles"); if (allRoles != null) { foreach(string role in allRoles.Split(new char[] {','})) if (_Roles[role] == null) _Roles.Add(role, String.Empty); } // attach ourselves to the first valid claimsIdentity. bool found = false; foreach (var claimsIdentity in base.Identities) { if (claimsIdentity != null) { AttachRoleClaims(claimsIdentity); found = true; break; } } if (!found) { AddIdentityAttachingRoles(new ClaimsIdentity(_Identity)); } }
/// <summary> /// Initializes a new instance of the PhpException class with serialized data. This constructor is used /// when an exception is thrown in a remotely called method. Such an exceptions needs to be serialized, /// transferred back to the caller and then rethrown using this constructor. /// </summary> /// <param name="info">The SerializationInfo that holds the serialized object data about the exception /// being thrown.</param> /// <param name="context">The StreamingContext that contains contextual information about the source or /// destination.</param> protected PhpException(SerializationInfo info, StreamingContext context) : base(info, context) { this.error = (PhpError)info.GetValue("error", typeof(PhpError)); this.info = new ErrorStackInfo( (string)info.GetString("file"), (string)info.GetString("caller"), (int)info.GetInt32("line"), (int)info.GetInt32("column"), (bool)info.GetBoolean("libraryCaller")); }
//serialization constructor protected SavedState(SerializationInfo info,StreamingContext context) { //this.position = (SerVector3)info.GetValue("position",typeof(SerVector3)); this.localPosition = (SerVector3)info.GetValue("localPosition",typeof(SerVector3)); //this.rotation = (SerQuaternion)info.GetValue("rotation",typeof(SerQuaternion)); this.localRotation = (SerQuaternion)info.GetValue("localRotation",typeof(SerQuaternion)); emittingParticles = info.GetBoolean("emittingParticles"); isActive = info.GetBoolean("isActive"); /************************************************************** * New Addition **************************************************************/ this.isMainCameraChild = info.GetBoolean("isMainCameraChild"); this.tag = info.GetString("tag"); this.convoTitle = info.GetString("convoTitle"); this.dialogueNum = info.GetInt32("dialogueNum"); this.dialogueType = info.GetString("dialogueType"); //************************************************************* }
protected AlphaElement(SerializationInfo info, StreamingContext context) : base(info, context) { info.GetInt32("AlphaElementVersion"); }
/// <summary> /// This constructor is required by serialization. /// </summary> /// <param name="info"></param> /// <param name="context"></param> /// <exception cref="ArgumentNullException"> /// 1. info is null. /// </exception> protected PSRemotingTransportException(SerializationInfo info, StreamingContext context) : base(info, context) { if (info == null) { throw new PSArgumentNullException("info"); } _errorCode = info.GetInt32("ErrorCode"); _transportMessage = info.GetString("TransportMessage"); }
private RedisConnectionException(SerializationInfo info, StreamingContext ctx) : base(info, ctx) { FailureType = (ConnectionFailureType)info.GetInt32("failureType"); CommandStatus = (CommandStatus)info.GetValue("commandStatus", typeof(CommandStatus)); }
// Serialization methods protected ConfigurationErrorsException(SerializationInfo info, StreamingContext context) : base(info, context) { string firstFilename; int firstLine; int count; string numPrefix; string currentType; Type currentExceptionType; // Retrieve out members firstFilename = info.GetString(SERIALIZATION_PARAM_FILENAME); firstLine = info.GetInt32(SERIALIZATION_PARAM_LINE); Init(firstFilename, firstLine); // Retrieve errors for _errors object count = info.GetInt32(SERIALIZATION_PARAM_ERROR_COUNT); if (count != 0) { _errors = new ConfigurationException[count]; for (int i = 0; i < count; i++) { numPrefix = i.ToString(CultureInfo.InvariantCulture); currentType = info.GetString(numPrefix + SERIALIZATION_PARAM_ERROR_TYPE); currentExceptionType = Type.GetType(currentType, true); // Only allow our exception types if ( ( currentExceptionType != typeof( ConfigurationException ) ) && ( currentExceptionType != typeof( ConfigurationErrorsException ) ) ) { throw ExceptionUtil.UnexpectedError( "ConfigurationErrorsException" ); } _errors[i] = (ConfigurationException) info.GetValue(numPrefix + SERIALIZATION_PARAM_ERROR_DATA, currentExceptionType); } } }
/// <summary> /// Construtor usado na deserializaĆ§Ć£o dos dados. /// </summary> /// <param name="info"></param> /// <param name="context"></param> private TakeParameters(SerializationInfo info, StreamingContext context) { _take = info.GetInt32("Count"); _skip = info.GetInt32("Skip"); }
/// <devdoc> /// <para> Contructor used for derialization.</para> /// </devdoc> protected HttpException(SerializationInfo info, StreamingContext context) :base(info, context) { _httpCode = info.GetInt32("_httpCode"); }
public void GetObjectData() { string msg = "MESSAGE"; Exception inner = new ArgumentException("whatever"); SerializationInfo si; Exception se; se = new Exception(msg, inner); si = new SerializationInfo(typeof(Exception), new FormatterConverter()); se.GetObjectData(si, new StreamingContext()); #if NET_2_0 Assert.AreEqual(11, si.MemberCount, "#A1"); #else Assert.AreEqual(10, si.MemberCount, "#A1"); #endif Assert.AreEqual(typeof(Exception).FullName, si.GetString("ClassName"), "#A2"); #if NET_2_0 Assert.IsNull(si.GetValue("Data", typeof(IDictionary)), "#A3"); #endif Assert.AreSame(msg, si.GetString("Message"), "#A4"); Assert.AreSame(inner, si.GetValue("InnerException", typeof(Exception)), "#A5"); Assert.AreSame(se.HelpLink, si.GetString("HelpURL"), "#A6"); Assert.IsNull(si.GetString("StackTraceString"), "#A7"); Assert.IsNull(si.GetString("RemoteStackTraceString"), "#A8"); Assert.AreEqual(0, si.GetInt32("RemoteStackIndex"), "#A9"); Assert.AreEqual(-2146233088, si.GetInt32("HResult"), "#A10"); Assert.IsNull(si.GetString("Source"), "#A11"); Assert.IsNull(si.GetString("ExceptionMethod"), "#A12"); // attempt initialization of lazy init members #if NET_2_0 Assert.IsNotNull(se.Data); #endif Assert.IsNull(se.Source); Assert.IsNull(se.StackTrace); si = new SerializationInfo(typeof(Exception), new FormatterConverter()); se.GetObjectData(si, new StreamingContext()); #if NET_2_0 Assert.AreEqual(11, si.MemberCount, "#B1"); #else Assert.AreEqual(10, si.MemberCount, "#B1"); #endif Assert.AreEqual(typeof(Exception).FullName, si.GetString("ClassName"), "#B2"); #if NET_2_0 Assert.AreSame(se.Data, si.GetValue("Data", typeof(IDictionary)), "#B3"); #endif Assert.AreSame(msg, si.GetString("Message"), "#B4"); Assert.AreSame(inner, si.GetValue("InnerException", typeof(Exception)), "#B5"); Assert.AreSame(se.HelpLink, si.GetString("HelpURL"), "#B6"); Assert.IsNull(si.GetString("StackTraceString"), "#B7"); Assert.IsNull(si.GetString("RemoteStackTraceString"), "#B8"); Assert.AreEqual(0, si.GetInt32("RemoteStackIndex"), "#B9"); Assert.AreEqual(-2146233088, si.GetInt32("HResult"), "#B10"); Assert.IsNull(si.GetString("Source"), "#B11"); Assert.IsNull(si.GetString("ExceptionMethod"), "#B12"); try { throw new Exception(msg, inner); } catch (Exception ex) { si = new SerializationInfo(typeof(Exception), new FormatterConverter()); ex.GetObjectData(si, new StreamingContext()); #if NET_2_0 Assert.AreEqual(11, si.MemberCount, "#C1"); #else Assert.AreEqual(10, si.MemberCount, "#C1"); #endif Assert.AreEqual(typeof(Exception).FullName, si.GetString("ClassName"), "#C2"); #if NET_2_0 Assert.IsNull(si.GetValue("Data", typeof(IDictionary)), "#C3"); #endif Assert.AreSame(msg, si.GetString("Message"), "#C4"); Assert.AreSame(inner, si.GetValue("InnerException", typeof(Exception)), "#C5"); Assert.AreSame(se.HelpLink, si.GetString("HelpURL"), "#C6"); Assert.IsNotNull(si.GetString("StackTraceString"), "#C7"); Assert.IsNull(si.GetString("RemoteStackTraceString"), "#C8"); Assert.AreEqual(0, si.GetInt32("RemoteStackIndex"), "#C9"); Assert.AreEqual(-2146233088, si.GetInt32("HResult"), "#C10"); Assert.IsNotNull(si.GetString("Source"), "#C11"); //Assert.IsNotNull (si.GetString ("ExceptionMethod"), "#C12"); } try { throw new Exception(msg, inner); } catch (Exception ex) { // force initialization of lazy init members #if NET_2_0 Assert.IsNotNull(ex.Data); #endif Assert.IsNotNull(ex.StackTrace); si = new SerializationInfo(typeof(Exception), new FormatterConverter()); ex.GetObjectData(si, new StreamingContext()); #if NET_2_0 Assert.AreEqual(11, si.MemberCount, "#D1"); #else Assert.AreEqual(10, si.MemberCount, "#D1"); #endif Assert.AreEqual(typeof(Exception).FullName, si.GetString("ClassName"), "#D2"); #if NET_2_0 Assert.AreSame(ex.Data, si.GetValue("Data", typeof(IDictionary)), "#D3"); #endif Assert.AreSame(msg, si.GetString("Message"), "#D4"); Assert.AreSame(inner, si.GetValue("InnerException", typeof(Exception)), "#D5"); Assert.AreSame(ex.HelpLink, si.GetString("HelpURL"), "#D6"); Assert.IsNotNull(si.GetString("StackTraceString"), "#D7"); Assert.IsNull(si.GetString("RemoteStackTraceString"), "#D8"); Assert.AreEqual(0, si.GetInt32("RemoteStackIndex"), "#D9"); Assert.AreEqual(-2146233088, si.GetInt32("HResult"), "#D10"); Assert.AreEqual(typeof(ExceptionTest).Assembly.GetName().Name, si.GetString("Source"), "#D11"); //Assert.IsNotNull (si.GetString ("ExceptionMethod"), "#D12"); } }
private void DeserializeDataSetSchema(SerializationInfo info, StreamingContext context, SerializationFormat remotingFormat, System.Data.SchemaSerializationMode schemaSerializationMode) { if (remotingFormat != SerializationFormat.Xml) { if (schemaSerializationMode == System.Data.SchemaSerializationMode.IncludeSchema) { this.DeserializeDataSetProperties(info, context); int num4 = info.GetInt32("DataSet.Tables.Count"); for (int i = 0; i < num4; i++) { byte[] buffer = (byte[]) info.GetValue(string.Format(CultureInfo.InvariantCulture, "DataSet.Tables_{0}", new object[] { i }), typeof(byte[])); MemoryStream serializationStream = new MemoryStream(buffer) { Position = 0L }; BinaryFormatter formatter = new BinaryFormatter(null, new StreamingContext(context.State, false)); DataTable table = (DataTable) formatter.Deserialize(serializationStream); this.Tables.Add(table); } for (int j = 0; j < num4; j++) { this.Tables[j].DeserializeConstraints(info, context, j, true); } this.DeserializeRelations(info, context); for (int k = 0; k < num4; k++) { this.Tables[k].DeserializeExpressionColumns(info, context, k); } } else { this.DeserializeDataSetProperties(info, context); } } else { string s = (string) info.GetValue("XmlSchema", typeof(string)); if (s != null) { this.ReadXmlSchema(new XmlTextReader(new StringReader(s)), true); } } }
/// <summary> /// Constructs a SessionStateException using serialized data. /// </summary> /// <param name="info"> serialization information </param> /// <param name="context"> streaming context </param> protected SessionStateException(SerializationInfo info, StreamingContext context) : base(info, context) { _sessionStateCategory = (SessionStateCategory)info.GetInt32("SessionStateCategory"); // CODEWORK test this }
public override void GetObjectData(SerializationInfo info, StreamingContext context) { ErrorCode = info?.GetInt32("errorCode") ?? throw new ArgumentNullException("info"); ErrorText = info.GetString("errorText"); base.GetObjectData(info, context); }
protected ConfigurationException (SerializationInfo info, StreamingContext context) : base (info, context) { filename = info.GetString ("filename"); line = info.GetInt32 ("line"); }
protected BerException(SerializationInfo info, StreamingContext context) : base(info, context) { Debug.WriteLine($"Exception: BerException thrown"); ErrorCode = info.GetInt32("BerException.ErrorCode"); }
/// <summary> /// Serialization constructor for class RestartComputerTimeoutException /// </summary> /// /// <param name="info"> /// serialization information /// </param> /// /// <param name="context"> /// streaming context /// </param> private RestartComputerTimeoutException(SerializationInfo info, StreamingContext context) : base(info, context) { if (info == null) { throw new PSArgumentNullException("info"); } ComputerName = info.GetString("ComputerName"); Timeout = info.GetInt32("Timeout"); }
private Ver2(SerializationInfo info, StreamingContext context) { a = info.GetInt32("x"); b = info.GetInt32("y"); c = info.GetInt32("z"); }
public TestException (SerializationInfo i, StreamingContext ctx): base (i, ctx) { Code = i.GetInt32 ("Code"); }
protected CommandException(SerializationInfo info, StreamingContext context) : base(info, context) { _code = info.GetInt32("Code"); }
} // TransitionCall internal TransitionCall(SerializationInfo info, StreamingContext context) { if (info == null || (context.State != StreamingContextStates.CrossAppDomain)) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); _props = (IDictionary)info.GetValue("props", typeof(IDictionary)); _delegate = (CrossContextDelegate) info.GetValue("delegate", typeof(CrossContextDelegate)); _sourceCtxID = (IntPtr) info.GetValue("sourceCtxID", typeof(IntPtr)); _targetCtxID = (IntPtr) info.GetValue("targetCtxID", typeof(IntPtr)); _eeData = (IntPtr) info.GetValue("eeData", typeof(IntPtr)); _targetDomainID = info.GetInt32("targetDomainID"); Contract.Assert(_targetDomainID != 0, "target domain should be non-zero"); }
protected Coin(SerializationInfo info, StreamingContext context) { MonetaryValue = info.GetDouble("MonetaryValue"); Name = info.GetString("Name"); Year = info.GetInt32("Year"); }