protected Phenotype(SerializationInfo info, StreamingContext context) { _genotype = (Genotype <TGene>)info.GetValue("_genotype", typeof(Genotype <TGene>)); _generation = info.GetInt64("_generation"); _rawFitness = new Lazy <TAllele>((TAllele)info.GetValue("_rawFitness", typeof(TAllele))); _fitness = new Lazy <TAllele>((TAllele)info.GetValue("_fitness", typeof(TAllele))); _function = a => default; _scaler = a => a; }
protected Map(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } mapname = info.GetString(KEY_MAPNAME); created = new DateTime(info.GetInt64(KEY_CREATED)); chunks = (List <Chunk>)info.GetValue(KEY_CHUNKS, typeof(List <Chunk>)); for (int a = 0; a < chunks.Count; a++) { chunks [a].map = this; } players = (List <Player>)info.GetValue(KEY_PLAYERS, typeof(List <Player>)); for (int a = 0; a < players.Count; a++) { players [a].chunk = getChunk(players [a].getChunkX(), players [a].getChunkZ()); } time = info.GetInt64(KEY_TIME); }
protected HttpWebResponse(SerializationInfo serializationInfo, StreamingContext streamingContext) { uri = (Uri)serializationInfo.GetValue("uri", typeof(Uri)); contentLength = serializationInfo.GetInt64("contentLength"); contentType = serializationInfo.GetString("contentType"); method = serializationInfo.GetString("method"); statusDescription = serializationInfo.GetString("statusDescription"); cookieCollection = (CookieCollection)serializationInfo.GetValue("cookieCollection", typeof(CookieCollection)); version = (Version)serializationInfo.GetValue("version", typeof(Version)); statusCode = (HttpStatusCode)(int)serializationInfo.GetValue("statusCode", typeof(HttpStatusCode)); }
public Kupac(SerializationInfo info, StreamingContext context) { ime = info.GetString("ime"); prezime = info.GetString("prezime"); korisnickoIme = info.GetString("korisicko_ime"); lozinka = info.GetString("lozinka"); datumRodjenja = info.GetString("datumRodjenja"); idbr = info.GetInt32("idbr"); jmbg = info.GetInt64("jmbg"); telefon = info.GetString("telefon"); }
protected FileWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { m_headers = (WebHeaderCollection)serializationInfo.GetValue("headers", typeof(WebHeaderCollection)); m_proxy = (IWebProxy)serializationInfo.GetValue("proxy", typeof(IWebProxy)); m_uri = (Uri)serializationInfo.GetValue("uri", typeof(Uri)); m_connectionGroupName = serializationInfo.GetString("connectionGroupName"); m_method = serializationInfo.GetString("method"); m_contentLength = serializationInfo.GetInt64("contentLength"); m_timeout = serializationInfo.GetInt32("timeout"); m_fileAccess = (FileAccess )serializationInfo.GetInt32("fileAccess"); }
protected OAuth2AccessToken(SerializationInfo info, StreamingContext context) : base(info, context) { if (info == null) { throw new ArgumentNullException("info"); } this.ExpiresIn = info.GetInt64("ExpiresIn"); this.RefreshToken = info.GetString("RefreshToken"); this.Scope = info.GetString("Scope"); this.TokenType = info.GetString("TokenType"); }
/// <summary> /// The serialization constructor. This function is normally not called directly by user code. /// </summary> /// <param name="info">The SerializationInfo object from the serializer.</param> /// <param name="context">This parameter is ignored.</param> public LuaBlock([NotNull] SerializationInfo info, StreamingContext context) { ID = info.GetUInt32("id"); Stamp = DateTimeOffset.FromUnixTimeSeconds(info.GetInt64("stamp")); Type = (CommandType)info.GetByte("type"); Message = info.GetString("message") ?? string.Empty; Address = info.GetUInt32("address"); Domain = info.GetString("domain") ?? string.Empty; Value = info.GetUInt32("value"); Block = info.GetValue("block", typeof(byte[])) as byte[]; }
private unsafe IntPtr(SerializationInfo info, StreamingContext context) { long l = info.GetInt64("value"); if (Size == 4 && (l > int.MaxValue || l < int.MinValue)) { throw new ArgumentException(SR.Serialization_InvalidPtrValue); } _value = (void *)l; }
private unsafe IntPtr(SerializationInfo info, StreamingContext context) { long l = info.GetInt64("value"); if (Size == 4 && (l > Int32.MaxValue || l < Int32.MinValue)) { throw new ArgumentException(Environment.GetResourceString("Serialization_InvalidPtrValue")); } m_value = (void *)l; }
private VideoFile(SerializationInfo info, DeserializeInfo di) : this(di.Server, di.Info, di.Type) { actors = info.GetValue("a", typeof(string[])) as string[]; description = info.GetString("de"); director = info.GetString("di"); genre = info.GetString("g"); title = info.GetString("t"); try { width = info.GetInt32("w"); height = info.GetInt32("h"); } catch (Exception) { // ignored } var ts = info.GetInt64("du"); if (ts > 0) { duration = new TimeSpan(ts); } try { bookmark = info.GetInt64("b"); } catch (Exception) { bookmark = 0; } try { subTitle = info.GetValue("st", typeof(Subtitle)) as Subtitle; } catch (Exception) { subTitle = null; } initialized = true; }
protected TimeZoneResponse(SerializationInfo info, StreamingContext context) { if (info is null) { throw new ArgumentNullException(nameof(info)); } Status = info.GetString(STATUS_FIELD).MapToStatusCode(); if (Status == HttpStatusCode.OK) { DstOffset = info.GetInt64(DST_OFFSET_FIELD); RawOffset = info.GetInt64(RAW_OFFSET_FIELD); TimeZoneId = info.GetString(TIME_ZONE_ID_FIELD); TimeZoneName = info.GetString(TIME_ZONE_NAME_FIELD); } else if (Status != HttpStatusCode.NoContent) { ErrorMessage = info.GetString(ERROR_MESSAGE_FIELD); } }
/// <summary> /// Constructor for deserialization. /// </summary> /// <param name="info">Serialization Info.</param> /// <param name="context">Streaming context.</param> protected PersistentMultiWaySuffixEdge(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } Key = info.GetInt64("PersistentMultiWaySuffixEdge:Key"); _children = (long[])info.GetValue("PersistentMultiWaySuffixEdge:Children", typeof(long[])); StartIndex = info.GetInt32("PersistentMultiWaySuffixEdge:StartIndex"); EndIndex = info.GetInt32("PersistentMultiWaySuffixEdge:EndIndex"); }
protected HttpWebResponse(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { this.m_HttpResponseHeaders = (WebHeaderCollection)serializationInfo.GetValue("m_HttpResponseHeaders", typeof(WebHeaderCollection)); this.m_Uri = (Uri)serializationInfo.GetValue("m_Uri", typeof(Uri)); this.m_Certificate = (X509Certificate)serializationInfo.GetValue("m_Certificate", typeof(X509Certificate)); this.m_IsVersionHttp11 = ((Version)serializationInfo.GetValue("m_Version", typeof(Version))).Equals(HttpVersion.Version11); this.m_StatusCode = (HttpStatusCode)serializationInfo.GetInt32("m_StatusCode"); this.m_ContentLength = serializationInfo.GetInt64("m_ContentLength"); this.m_Verb = KnownHttpVerb.Parse(serializationInfo.GetString("m_Verb")); this.m_StatusDescription = serializationInfo.GetString("m_StatusDescription"); this.m_MediaType = serializationInfo.GetString("m_MediaType"); }
private BooleanPointer(SerializationInfo info, StreamingContext context) { long num = info.GetInt64("value"); if ((Size == Constants.X86PlatformPtrSize) && ((num > Constants.X86UpperBound) || (num < Constants.X86LowerBound))) { throw new Exception("Invalid pointer value."); } this.internalPointer = (bool *)num; }
/// <summary> /// Creates a new <see cref="ChannelFrameBase{T}"/> 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 ChannelFrameBase(SerializationInfo info, StreamingContext context) { // Deserialize key frame elements... m_idCode = info.GetUInt16("idCode"); m_cells = (IChannelCellCollection <T>)info.GetValue("cells", typeof(IChannelCellCollection <T>)); m_timestamp = info.GetInt64("timestamp"); m_lifespan = ShortTime.Now; m_trustHeaderLength = true; m_validateCheckSum = true; m_measurements = new ConcurrentDictionary <MeasurementKey, IMeasurement>(); m_sortedMeasurements = -1; }
protected FileWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext) { webHeaders = (WebHeaderCollection)serializationInfo.GetValue("headers", typeof(WebHeaderCollection)); proxy = (IWebProxy)serializationInfo.GetValue("proxy", typeof(IWebProxy)); uri = (Uri)serializationInfo.GetValue("uri", typeof(Uri)); connectionGroup = serializationInfo.GetString("connectionGroupName"); method = serializationInfo.GetString("method"); contentLength = serializationInfo.GetInt64("contentLength"); timeout = serializationInfo.GetInt32("timeout"); fileAccess = (FileAccess)(int)serializationInfo.GetValue("fileAccess", typeof(FileAccess)); preAuthenticate = serializationInfo.GetBoolean("preauthenticate"); }
/// <summary> /// Initializes a new instance of the MalformedLineException class with serialized data. /// </summary> /// <param name="info">The SerializationInfo object that holds the serialized /// object data about the exception being thrown.</param> /// <param name="context">The StreamingContext structure that contains contextual /// information about the source or destination.</param> protected MalformedLineException(SerializationInfo info, StreamingContext context) : base(info, context) { if (info != null) { this.lineNumber = info.GetInt64("LineNumber"); } else { this.lineNumber = -1; } }
protected OAuth2Client(SerializationInfo info, StreamingContext context) { this.clientKey = info.GetString(nameof(this.clientKey)); this.secretKey = info.GetString(nameof(this.secretKey)); this.oauth2Code = info.GetString(nameof(this.oauth2Code)); this.accessToken = info.GetString(nameof(this.accessToken)); this.refleshToken = info.GetString(nameof(this.refleshToken)); this.tokenExpired = info.GetInt64(nameof(this.tokenExpired)); this.tokenQueryTime = info.GetDateTime(nameof(this.tokenQueryTime)); this.redirectUri = info.GetString(nameof(this.redirectUri)); this.scope = info.GetString(nameof(this.scope)); }
protected Primitives(SerializationInfo info, StreamingContext context) { SerializationCtorCalled = true; Byte = info.GetByte("byte"); Bytes = (byte[])info.GetValue("bytes", typeof(byte[])); Sbyte = info.GetSByte("sbyte"); Sbytes = (sbyte[])info.GetValue("sbytes", typeof(sbyte[])); Bool = info.GetBoolean("bool"); Bools = (bool[])info.GetValue("bools", typeof(bool[])); Char = info.GetChar("char"); Chars = (char[])info.GetValue("chars", typeof(char[])); Short = info.GetInt16("short"); Shorts = (short[])info.GetValue("shorts", typeof(short[])); Ushort = info.GetUInt16("ushort"); Ushorts = (ushort[])info.GetValue("ushorts", typeof(ushort[])); Int = info.GetInt32("int"); Ints = (int[])info.GetValue("ints", typeof(int[])); Uint = info.GetUInt32("uint"); Uints = (uint[])info.GetValue("uints", typeof(uint[])); Long = info.GetInt64("long"); Longs = (long[])info.GetValue("longs", typeof(long[])); Ulong = info.GetUInt64("ulong"); Ulongs = (ulong[])info.GetValue("ulongs", typeof(ulong[])); Float = info.GetSingle("float"); Floats = (float[])info.GetValue("floats", typeof(float[])); Double = info.GetDouble("double"); Doubles = (double[])info.GetValue("doubles", typeof(double[])); Decimal = info.GetDecimal("decimal"); Decimals = (decimal[])info.GetValue("decimals", typeof(decimal[])); Guid = (Guid)info.GetValue("guid", typeof(Guid)); Guids = (Guid[])info.GetValue("guids", typeof(Guid[])); DateTime = info.GetDateTime("datetime"); DateTimes = (DateTime[])info.GetValue("datetimes", typeof(DateTime[])); String = info.GetString("string"); Strings = (string[])info.GetValue("strings", typeof(string[])); }
/// <summary> /// Creates a new <see cref="ConfigurationCell"/> 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 ConfigurationCell(SerializationInfo info, StreamingContext context) : base(info, context) { // Create a cached signal reference dictionary for generated signal references m_generatedSignalReferenceCache = new string[Enum.GetValues(typeof(SignalKind)).Length][]; // Deserialize configuration cell m_lastReportTime = info.GetInt64("lastReportTime"); m_analogDataFormat = (DataFormat)info.GetValue("analogDataFormat", typeof(DataFormat)); m_frequencyDataFormat = (DataFormat)info.GetValue("frequencyDataFormat", typeof(DataFormat)); m_phasorDataFormat = (DataFormat)info.GetValue("phasorDataFormat", typeof(DataFormat)); m_phasorCoordinateFormat = (CoordinateFormat)info.GetValue("phasorCoordinateFormat", typeof(CoordinateFormat)); }
/// <summary> /// Constructor for deserialization. /// </summary> /// <param name="info">Serialization Info.</param> /// <param name="context">Streaming context.</param> protected Hit(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } _hsps = (IList <Hsp>)info.GetValue("Hit:Hsps", typeof(IList <Hsp>)); Id = info.GetString("Hit:Id"); Def = info.GetString("Hit:Def"); Accession = info.GetString("Hit:Accession"); Length = info.GetInt64("Hit:Length"); }
protected ArchiveFileInfo(SerializationInfo info, StreamingContext context) : base(info, context) { archiveInfo = (ArchiveInfo)info.GetValue("archiveInfo", typeof(ArchiveInfo)); name = info.GetString("name"); path = info.GetString("path"); initialized = info.GetBoolean("initialized"); exists = info.GetBoolean("exists"); archiveNumber = info.GetInt32("archiveNumber"); attributes = (FileAttributes)info.GetValue("attributes", typeof(FileAttributes)); lastWriteTime = info.GetDateTime("lastWriteTime"); length = info.GetInt64("length"); }
public SimpleSerializable(SerializationInfo info, StreamingContext context) { Byte = info.GetByte("Byte"); Bool = info.GetBoolean("Bool"); Short = info.GetInt16("Short"); Int = info.GetInt32("Int"); Long = info.GetInt64("Long"); Float = info.GetSingle("Float"); Double = info.GetDouble("Double"); Decimal = info.GetDecimal("Decimal"); Guid = (Guid)info.GetValue("Guid", typeof(Guid)); String = info.GetString("String"); }
/// <summary> /// Serialization constructor used for deserialization /// </summary> /// <param name="info">The serialization info</param> /// <param name="context">The context of the stream</param> protected DomainEntityBase(SerializationInfo info, StreamingContext context) { Id = (TIdType)info.GetValue("Id", typeof(TIdType)); ExternalId = info.GetString("ExternalId"); Culture = info.GetString("Culture"); Name = info.GetString("DisplayName"); DescriptionShort = info.GetString("DescriptionShort"); DescriptionFull = info.GetString("DescriptionFull"); Tags = (IEnumerable <MetadataTag>)info.GetValue("Metadata", typeof(IEnumerable <MetadataTag>)); CreationTime = info.GetDateTime("CreationTime"); CreatorUserId = info.GetInt64("CreatorUserId"); LastModificationTime = info.GetDateTime("LastModificationTime"); LastModifierUserId = info.GetInt64("LastModifierUserId"); IsDeleted = info.GetBoolean("IsDeleted"); DeleterUserId = info.GetInt64("DeleterUserId"); DeletionTime = info.GetDateTime("DeletionTime"); IsActive = info.GetBoolean("IsActive"); TranslatedFromId = (TIdType)info.GetValue("TranslatedFromId", typeof(TIdType)); SeqNum = info.GetInt32("SeqNum"); //Metadata = (MetadataInformation)info.GetValue("Metadata", typeof(MetadataInformation)); }
object ISerializationSurrogate.SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { TokenResponse token = (TokenResponse)obj; token.AccessToken = info.GetString("AccessToken"); token.ExpiresInSeconds = info.GetInt64("ExpiresInSeconds"); token.Issued = info.GetDateTime("Issued"); token.RefreshToken = info.GetString("RefreshToken"); token.Scope = info.GetString("Scope"); token.TokenType = info.GetString("TokenType"); return(token); }
/// <summary> /// Initializes a new instance of the <see cref="HttpOutcome"/> class. /// </summary> /// <param name="info"> /// The information. /// </param> /// <param name="context"> /// The context. /// </param> /// <exception cref="ArgumentNullException"> /// The <paramref name="info"/> is <c>null</c>. /// </exception> protected HttpOutcome(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } _location = new Uri(info.GetString("Location")); _method = new HttpMethod(info.GetString("Method")); _statusCode = (HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), info.GetString("StatusCode")); _responseMessage = info.GetString("ResonseMessage"); _responseTime = new TimeSpan(info.GetInt64("ResonseTime")); }
private IntPtr(SerializationInfo info, StreamingContext context) { long value = info.GetInt64("value"); #if TARGET_32BIT if ((value > int.MaxValue) || (value < int.MinValue)) { throw new ArgumentException(SR.Serialization_InvalidPtrValue); } #endif _value = (nint)value; }
/// <summary> /// Конструктор вызываемый при десериализации объекта /// </summary> internal Parameter(SerializationInfo info, StreamingContext context) { if (info != null) { locker = new ReaderWriterLock(); device = info.GetInt64(deviceSName); offset = info.GetInt64(offsetSName); size = info.GetInt64(sizeSName); position = info.GetInt64(positionSName); type = (ParameterType)Enum.Parse(typeof(ParameterType), info.GetString(typeSName)); desc = info.GetString(descSName); identifier = (Guid)info.GetValue(identifierSName, typeof(Guid)); actual = info.GetInt64(actualSName); } else { throw new ArgumentNullException("info"); } }
/* * ISerializable constructor */ protected Regex(SerializationInfo info, StreamingContext context) : this(info.GetString("pattern"), (RegexOptions)info.GetInt32("options")) { try { Int64 timeoutTicks = info.GetInt64("matchTimeout"); TimeSpan timeout = new TimeSpan(timeoutTicks); ValidateMatchTimeout(timeout); this.internalMatchTimeout = timeout; } catch (SerializationException) { // If this occurs, then assume that this object was serialised using a version // before timeout was added. In that case just do not set a timeout // (keep default value) } }
protected SimplifiedSvnChangeItem(SerializationInfo info, StreamingContext context) { Revision = info.GetInt64("rev"); CopyFromRevision = info.GetInt64("cfr"); Path = info.GetString("path"); CopyFromPath = info.GetString("cfp"); byte nodki = info.GetByte("nodki"); byte act = info.GetByte("act"); switch (nodki) { case 1: NodeKind = SvnNodeKind.Directory; break; case 2: NodeKind = SvnNodeKind.File; break; case 3: NodeKind = SvnNodeKind.SymbolicLink; break; case 4: NodeKind = SvnNodeKind.None; break; case 5: NodeKind = SvnNodeKind.Unknown; break; default: NodeKind = SvnNodeKind.Unknown; break; } switch (act) { case 1: Action = SvnChangeAction.Add; break; case 2: Action = SvnChangeAction.Modify; break; case 3: Action = SvnChangeAction.Replace; break; case 4: Action = SvnChangeAction.Delete; break; default: Action = SvnChangeAction.None; break; } }
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> /// Constructors a ParameterBindingException using serialized data. /// </summary> /// /// <param name="info"> /// serialization information /// </param> /// /// <param name="context"> /// streaming context /// </param> protected ParameterBindingException( SerializationInfo info, StreamingContext context) : base(info, context) { _message = info.GetString("ParameterBindingException_Message"); _parameterName = info.GetString("ParameterName"); _line = info.GetInt64("Line"); _offset = info.GetInt64("Offset"); }