//serialization constructor protected SavedState(SerializationInfo info,StreamingContext context) { try { this.position = (SerVector3)info.GetValue("position",typeof(SerVector3)); this.rotation = (SerQuaternion)info.GetValue("rotation",typeof(SerQuaternion)); } catch { //not available if used an older version to save the replay, ignore } this.localPosition = (SerVector3)info.GetValue("localPosition",typeof(SerVector3)); this.localRotation = (SerQuaternion)info.GetValue("localRotation",typeof(SerQuaternion)); emittingParticles = info.GetBoolean("emittingParticles"); isActive = info.GetBoolean("isActive"); }
public AuthenticationInfo(SerializationInfo info, StreamingContext context) { IsAuthenticated = info.GetBoolean("IsAuthenticated"); UserId = info.GetString("UserId"); UserAlias = info.GetString("UserAlias"); UserName = info.GetString("UserName"); Token = info.GetString("Token"); TokenSecret = info.GetString("TokenSecret"); }
private FirebirdSQLDataProvider(SerializationInfo info, StreamingContext context) : base(info, context) { int version = info.GetInt32("FirebirdSQLDataProvider.Version"); if (version >= 1) { Connection = new FbConnection(); Connection.ConnectionString = info.GetString("ConnectionString"); SupportedElementTypes = (DbConnectionElementTypes)info.GetInt32("SupportedElementTypes"); Provider.CancelBeforeClose = false; } if (version >= 2) { SupportsAdvancedFiltering = info.GetBoolean("SupportsAdvancedFiltering"); } }
public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { var type = obj.GetType(); foreach (var field in type.GetFields(publicOrNonPublicInstanceFields)) { var fieldValueIsSerializable = info.GetBoolean(field.Name + "ValueIsNull"); if (fieldValueIsSerializable) { var fieldValueRuntimeType = info.GetString(field.Name + "RuntimeType"); field.SetValue(obj, info.GetValue(field.Name, Type.GetType(fieldValueRuntimeType))); } } return(obj); }
/// <summary> /// Deserializing constuctor. /// </summary> internal FileState(SerializationInfo info, StreamingContext context) { ErrorUtilities.VerifyThrowArgumentNull(info, "info"); lastModified = new DateTime(info.GetInt64("mod"), (DateTimeKind)info.GetInt32("modk")); assemblyName = (AssemblyNameExtension)info.GetValue("an", typeof(AssemblyNameExtension)); dependencies = (AssemblyNameExtension[])info.GetValue("deps", typeof(AssemblyNameExtension[])); scatterFiles = (string[])info.GetValue("sfiles", typeof(string[])); runtimeVersion = (string)info.GetValue("rtver", typeof(string)); if (info.GetBoolean("fn")) { var frameworkNameVersion = (Version)info.GetValue("fnVer", typeof(Version)); var frameworkIdentifier = info.GetString("fnId"); var frameworkProfile = info.GetString("fmProf"); frameworkName = new FrameworkName(frameworkIdentifier, frameworkNameVersion, frameworkProfile); } }
public override object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { base.SetObjectData(obj, info, context, selector); SchemaModel schemaModel = (SchemaModel)obj; schemaModel.Suspend(); try { schemaModel.WorkspaceType = (esriWorkspaceType)Enum.Parse(typeof(esriWorkspaceType), info.GetString("workspaceType"), true); schemaModel.Version = info.GetString("version"); schemaModel.Metadata = info.GetString("metadata"); schemaModel.XmlEncoding = (DiagramEncoding)Enum.Parse(typeof(DiagramEncoding), info.GetString("encoding"), true); schemaModel.XmlIndent = info.GetBoolean("indent"); } catch { } schemaModel.Resume(); return(schemaModel); }
public UBTMakefile(SerializationInfo Info, StreamingContext Context) { Version = Info.GetInt32("ve"); if (Version != CurrentVersion) { throw new Exception(string.Format("Makefile version does not match - found {0}, expected: {1}", Version, CurrentVersion)); } AllActions = (List <Action>)Info.GetValue("ac", typeof(List <Action>)); PrerequisiteActions = (Action[])Info.GetValue("pa", typeof(Action[])); EnvironmentVariables = ((string[])Info.GetValue("e1", typeof(string[]))).Zip((string[])Info.GetValue("e2", typeof(string[])), (i1, i2) => new Tuple <string, string>(i1, i2)).ToList(); TargetNameToUObjectModules = (Dictionary <string, List <UHTModuleInfo> >)Info.GetValue("nu", typeof(Dictionary <string, List <UHTModuleInfo> >)); Targets = (List <UEBuildTarget>)Info.GetValue("ta", typeof(List <UEBuildTarget>)); bUseAdaptiveUnityBuild = Info.GetBoolean("ua"); SourceFileWorkingSet = (HashSet <FileItem>)Info.GetValue("ws", typeof(HashSet <FileItem>)); CandidateSourceFilesForWorkingSet = (HashSet <FileItem>)Info.GetValue("wc", typeof(HashSet <FileItem>)); }
internal SerializableDelegate(SerializationInfo info, StreamingContext context) { var delegateType = (Type)info.GetValue("delegateType", typeof(Type)); if (info.GetBoolean("isSerializable")) { //If it's a "simple" delegate we just read it straight off Delegate = (TDelegate)info.GetValue("delegate", delegateType); } else { //otherwise, we need to read its anonymous class var methodInfo = (MethodInfo)info.GetValue("method", typeof(MethodInfo)); var anonymousClassWrapper = (AnonymousClassWrapper)info.GetValue("class", typeof(AnonymousClassWrapper)); Delegate = (TDelegate)(object)System.Delegate.CreateDelegate(delegateType, anonymousClassWrapper.TargetInstance, methodInfo); } }
private DisplayModeDescription(SerializationInfo info, StreamingContext context) { m_ptr = UnsafeNativeMethods.DisplayAttrsMgrListDesc_New(); InMenu = info.GetBoolean("InMenu"); SupportsShadeCommand = info.GetBoolean("SupportsShadeCommand"); SupportsShading = info.GetBoolean("SupportsShading"); AllowObjectAssignment = info.GetBoolean("AllowObjectAssignment"); ShadedPipelineRequired = info.GetBoolean("ShadedPipelineRequired"); WireframePipelineRequired = info.GetBoolean("WireframePipelineRequired"); PipelineLocked = info.GetBoolean("PipelineLocked"); Rhino.Display.DisplayPipelineAttributes attrs = info.GetValue("DisplayAttributes", typeof(Rhino.Display.DisplayPipelineAttributes)) as Rhino.Display.DisplayPipelineAttributes; Rhino.Display.DisplayPipelineAttributes current = DisplayAttributes; current.CopyContents(attrs); }
#pragma warning disable CS8618, CS8601 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. Possible null reference assignment. private Result(SerializationInfo info, StreamingContext context) { var isSuccess = info.GetBoolean(nameof(_isSuccess)); if (isSuccess) { _isSuccess = true; _success = (TSuccess)info.GetValue(nameof(_success), typeof(TSuccess)); _failure = default; } else { _isSuccess = false; _success = default; _failure = (TFailure)info.GetValue(nameof(_failure), typeof(TFailure)); } }
public Settings(SerializationInfo info, StreamingContext context) { try { RegexText = info.GetString("RegexText"); Strings = info.GetString("Strings"); IgnoreWhitespace = info.GetBoolean("IgnoreWhitespace"); IgnoreCase = info.GetBoolean("IgnoreCase"); Compiled = info.GetBoolean("Compiled"); ExplicitCapture = info.GetBoolean("ExplicitCapture"); Multiline = info.GetBoolean("Multiline"); Singleline = info.GetBoolean("Singleline"); Iterations = info.GetString("Iterations"); OneString = info.GetBoolean("OneString"); Description = info.GetString("Description"); ReplaceString = info.GetString("ReplaceString"); MatchEvaluator = info.GetBoolean("MatchEvaluator"); HideGroupZero = info.GetBoolean("HideGroupZero"); } catch (Exception) { } }
/// <summary> /// Initializes a new instance of the Password class with serialized data. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized password data.</param> /// <param name="context">The <see cref="StreamingContext"/> that contains contextual information about the source or destination.</param> /// <remarks> /// The serialization routine uses a simple Base64 encoding on the password text so that the passwords are /// not stored in clear text, but there is no additional security provided to the serialized password data. /// </remarks> protected Password(SerializationInfo info, StreamingContext context) { string p = info.GetString("password"); string d = info.GetString("description"); bool m = true; try { m = info.GetBoolean("permanent"); } catch { } this.password = Base64.Decode(p); this.description = d; this.permanent = m; }
/// <summary> /// Initializes a new instance of the AlignedSequence class /// Constructor for deserialization. /// </summary> /// <param name="info">Serialization Info.</param> /// <param name="context">Streaming context.</param> protected AlignedSequence(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } if (info.GetBoolean("M")) { Metadata = (Dictionary <string, object>)info.GetValue("MD", typeof(Dictionary <string, object>)); } else { Metadata = new Dictionary <string, object>(); } Sequences = (IList <ISequence>)info.GetValue("Seqs", typeof(IList <ISequence>)); }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info">The info.</param> /// <param name="context">The context.</param> protected ClassShape(SerializationInfo info, StreamingContext context) : base(info, context) { if (Tracing.BinaryDeserializationSwitch.Enabled) { Trace.WriteLine("Deserializing the fields of 'ClassShape'."); } this.Resizable = false; this.mTitle = info.GetString("Title"); this.mSubTitle = info.GetString("SubTitle"); sf.Trimming = StringTrimming.EllipsisCharacter; this.textMaterial = info.GetValue("TextMaterial", typeof(LabelMaterial)) as LabelMaterial; mFolders = new CollectionBase <FolderMaterial>(); this.Resizable = false; this.mCollapsed = info.GetBoolean("Collapsed"); this.mBodyType = (BodyType)Enum.Parse(typeof(BodyType), info.GetString("BodyType")); }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info">The info.</param> /// <param name="context">The context.</param> protected Layer(SerializationInfo info, StreamingContext context) { if (Tracing.BinaryDeserializationSwitch.Enabled) { Trace.WriteLine("Deserializing the fields of 'Layer'."); } double version = info.GetDouble("LayerVersion"); mEntities = info.GetValue( "Entities", typeof(CollectionBase <IDiagramEntity>)) as CollectionBase <IDiagramEntity>; mIsVisible = info.GetBoolean("IsVisible"); mName = info.GetString("Name"); }
//Creates a new element from the supplied XML. protected Label(SerializationInfo info, StreamingContext context) { SuspendEvents = true; Text = info.GetString("Text"); Offset = Serialization.Serialize.GetPointF(info.GetString("Offset")); Opacity = info.GetByte("Opacity"); Color = Color.FromArgb(Convert.ToInt32(info.GetString("Color"))); Visible = info.GetBoolean("Visible"); //Only set if exists eg is not default if (Serialize.Contains(info, "Font")) { SetFont(Serialize.GetFont(info.GetString("Font"))); } SuspendEvents = false; }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected Entity(SerializationInfo info, StreamingContext context) { InitEntity(); //overwrite some members with the serialized data this.mUID = new Guid(info.GetString("mUID")); this.mText = info.GetString("mText"); this.mShowLabel = info.GetBoolean("mShowLabel"); this.mTextColor = (Color)info.GetValue("mTextColor", typeof(Color)); try { this.mFont = (Font)info.GetValue("mFont", typeof(Font)); } catch { //font is set by default in the member definition } //this.mIsSelected = info.GetBoolean("mIsSelected"); }
/// <summary> /// Initializes a new instance of the <see cref="SortedDictionary"/> /// class that is serializable using the specified /// <see cref="T:System.Runtime.Serialization.SerializationInfo" /> /// and <see cref="T:System.Runtime.Serialization.StreamingContext" /> /// objects. /// </summary> /// <param name="info"> /// A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> /// object containing the information required to serialize the /// <see cref="HashDictionary" /> object. /// </param> /// <param name="context"> /// A <see cref="T:System.Runtime.Serialization.StreamingContext" /> /// object containing the source and destination of the serialized /// stream associated with the <see cref="SortedDictionary" />. /// </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="info" /> is null. /// </exception> protected SortedDictionary(SerializationInfo info, StreamingContext context) { var entries = (DictionaryEntry[]) info.GetValue("entries", typeof(DictionaryEntry[])); foreach (DictionaryEntry entry in entries) { base.Add(entry.Key, entry.Value); } bool isNullValueSet = info.GetBoolean("isNullValueSet"); if (isNullValueSet) { m_nullValue = info.GetValue("nullValue", typeof(Object)); } }
internal WeakReference(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException(nameof(info)); } T target = (T)info.GetValue("TrackedObject", typeof(T)); bool trackResurrection = info.GetBoolean("TrackResurrection"); m_handle = (IntPtr)GCHandle.Alloc(target, trackResurrection ? GCHandleType.WeakTrackResurrection : GCHandleType.Weak); if (target != null) { // Set the conditional weak table if the target is a __ComObject. TrySetComTarget(target); } }
/// <summary> /// デシリアライズ時に実行 /// </summary> /// <param name="sender">現在はサポートされていない 常にnullを返す</param> void IDeserializationCallback.OnDeserialization(object sender) { if (seInfo == null) { return; } CenterPosition = seInfo.GetValue <SerializableVector2DF>(S_CenterPosition); Color = seInfo.GetValue <ColorPlus>(S_Color); DrawingPriority = seInfo.GetInt32(S_DrawingPriority); IsClickable = seInfo.GetBoolean(S_IsClickable); Mode = seInfo.GetInt32(S_Mode); Name = seInfo.GetString(S_Name); Position = seInfo.GetValue <SerializableVector2DF>(S_Position); Scale = seInfo.GetValue <SerializableVector2DF>(S_Scale); Text = seInfo.GetString(S_Text); WritingDirection = EnumHelper.FromNumber <WritingDirection>(seInfo.GetInt32(S_WritingDirection)); seInfo = null; }
public Product(SerializationInfo info, StreamingContext context) { ProductID = info.GetInt32("ProductID"); ProductName = info.GetString("ProductName"); SupplierID = info.GetInt32("SupplierID"); CategoryID = info.GetInt32("CategoryID"); QuantityPerUnit = info.GetString("QuantityPerUnit"); UnitPrice = info.GetDecimal("UnitPrice"); UnitsInStock = info.GetInt16("UnitsInStock"); UnitsOnOrder = info.GetInt16("UnitsOnOrder"); ReorderLevel = info.GetInt16("ReorderLevel"); Discontinued = info.GetBoolean("Discontinued"); Category = null; var order_DetailsArray = (Order_Detail[])info.GetValue("Order_Details", typeof(Order_Detail[])); Order_Details = order_DetailsArray.ToList(); Supplier = (Supplier)info.GetValue("Supplier", typeof(Supplier)); }
protected ValueBinary(SerializationInfo info, StreamingContext context) { // Reset the property value using the GetValue method. Name = info.GetString("Name"); Type = (TValue)info.GetValue("Type", typeof(TValue)); if (Type == TValue.Boolean) { bValue = info.GetBoolean("bValue"); } else if (Type == TValue.Int) { iValue = info.GetInt32("iValue"); } else if (Type == TValue.Float) { fValue = info.GetSingle("fValue"); } }
public Product(SerializationInfo info, StreamingContext context) { ProductID = info.GetInt32("ProductID"); ProductName = info.GetString("ProductName"); SupplierID = info.GetInt32("SupplierID"); CategoryID = info.GetInt32("CategoryID"); QuantityPerUnit = info.GetString("QuantityPerUnit"); UnitPrice = info.GetDecimal("UnitPrice"); UnitsInStock = info.GetInt16("UnitsInStock"); UnitsOnOrder = info.GetInt16("UnitsOnOrder"); ReorderLevel = info.GetInt16("ReorderLevel"); Discontinued = info.GetBoolean("Discontinued"); var dbContext = new Northwind(); dbContext.Configuration.ProxyCreationEnabled = false; Category = dbContext.Categories.Find(CategoryID); }
protected Job(SerializationInfo info, StreamingContext c) { JobName = info.GetString("JobName"); Assembly = (byte[])info.GetValue("Assembly", typeof(byte[])); Client = info.GetString("Client"); MapReducerClass = info.GetString("MapReducerClass"); IsDone = info.GetBoolean("isDone"); _otherAttributes = (Dictionary <string, string>)info.GetValue("otherAttributes", typeof(Dictionary <string, string>)); if (IsDone) { Results = (ISerializable)info.GetValue("Results", typeof(ISerializable)); } else { Inputs = (IEnumerable <ISerializable>)info.GetValue("Inputs", typeof(IEnumerable <ISerializable>)); } }
/// <summary> /// Construtor usado na deserialização dos dados. /// </summary> /// <param name="info"></param> /// <param name="context"></param> private RecordDescriptor(SerializationInfo info, StreamingContext context) { var localeName = info.GetString("Locale"); if (!string.IsNullOrEmpty(localeName)) { _locale = System.Globalization.CultureInfo.GetCultureInfo(localeName); } _name = info.GetString("Name"); _cultureUserSet = info.GetBoolean("CultureUserSet"); _namespace = info.GetString("Namespace"); var count = info.GetInt32("c"); for (var i = 0; i < count; i++) { _fields.Add(info.GetValue(i.ToString(), typeof(Field)) as Field); } }
public static IList <T> SetList <T>(SerializationInfo info, StreamingContext context, string baseFieldName) { if (info.GetBoolean(baseFieldName + "IsNull")) { return(null); } var type = (Type)info.GetValue(baseFieldName + "Type", typeof(Type)); var instance = (IList <T>)Activator.CreateInstance(type); var count = info.GetInt32(baseFieldName + "Count"); for (var i = 0; i < count; i++) { instance.Add((T)info.GetValue(baseFieldName + i, typeof(T))); } return(instance); }
/// <summary> /// Initializes a new instance of the ActionPreferenceStopException 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 ActionPreferenceStopException(SerializationInfo info, StreamingContext context) : base(info, context) { bool hasErrorRecord = info.GetBoolean("HasErrorRecord"); if (hasErrorRecord) { _errorRecord = (ErrorRecord)info.GetValue("ErrorRecord", typeof(ErrorRecord)); } // fix for BUG: Windows Out Of Band Releases: 906263 and 906264 // The interpreter prompt CommandBaseStrings:InquireHalt // should be suppressed when this flag is set. This will be set // when this prompt has already occurred and Break was chosen, // or for ActionPreferenceStopException in all cases. this.SuppressPromptInInterpreter = true; }
public ResultSetDeserializationInfo(SerializationInfo info, StreamingContext context) { _type = (SparqlResultsType)info.GetValue("type", typeof(SparqlResultsType)); switch (_type) { case SparqlResultsType.Boolean: _r = info.GetBoolean("result"); break; case SparqlResultsType.VariableBindings: _vars = (List <String>)info.GetValue("variables", typeof(List <String>)); _results = (List <SparqlResult>)info.GetValue("results", typeof(List <SparqlResult>)); break; default: throw new RdfParseException("The type property of a serialized SparqlResultSet did not contain a valid value"); } }
private AnyObjectSerializerWrapper(SerializationInfo info, StreamingContext context) { byte[] rawData = (byte[])info.GetValue("data", Reflector.ByteArrayType); BinarySerializationFormatter serializer = new BinarySerializationFormatter(); if (info.GetBoolean(nameof(isWeak))) { serializer.Binder = new WeakAssemblySerializationBinder(); } if (info.GetValueOrDefault <bool>(nameof(byFields))) { serializer.SurrogateSelector = new CustomSerializerSurrogateSelector { IgnoreISerializable = true } } ; obj = serializer.Deserialize(rawData); }
/// <summary> /// Called when deserializing /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected ProjectorShape(SerializationInfo info, StreamingContext context) : base(info, context) { _textureFile = info.GetString("_textureFile"); _transp = (TransparencyType)info.GetValue("_transp", typeof(TransparencyType)); _fConeAngleX = info.GetSingle("_fConeAngleX"); _fConeAngleY = info.GetSingle("_fConeAngleY"); _fLength = info.GetSingle("_fLength"); _fFadeOutDist = info.GetSingle("_fFadeOutDist"); _iIntensity = info.GetByte("_iIntensity"); _color = (Color)info.GetValue("_color", typeof(Color)); if (SerializationHelper.HasElement(info, "_bLightmapped")) { _bLightmapped = info.GetBoolean("_bLightmapped"); } if (SerializationHelper.HasElement(info, "_geomTypeFilter")) { _geomTypeFilter = (GeometryTypeMask)info.GetValue("_geomTypeFilter", typeof(GeometryTypeMask)); } else { _geomTypeFilter = GeometryTypeMask.All; // backwards compatibility } if (SerializationHelper.HasElement(info, "_fFarClipDistance")) { _fFarClipDistance = info.GetSingle("_fFarClipDistance"); } // backwards compatibility if (!SerializationHelper.HasElement(info, "SupportScaling")) { SetScaling_Internal(1.0f, 1.0f, 1.0f); } if (SerializationHelper.HasElement(info, "_iInfluenceBitmask")) { _iInfluenceBitmask = (FlagsInt32_e)info.GetValue("_iInfluenceBitmask", typeof(FlagsInt32_e)); } else { _iInfluenceBitmask = FlagsInt32_e.All; } if (SerializationHelper.HasElement(info, "_shaderFX")) { _shaderFX = (ShaderEffectConfig)info.GetValue("_shaderFX", typeof(ShaderEffectConfig)); } }
public SftpDrive(SerializationInfo info, StreamingContext context) { Name = info.GetString("name"); Host = info.GetString("host"); Port = info.GetInt32("port"); Letter = info.GetChar("drive"); Root = info.GetString("path"); Automount = info.GetBoolean("mount"); Username = info.GetString("user"); try { ProxyType = info.GetInt32("proxyType"); ProxyHost = info.GetString("proxyHost"); ProxyUser = info.GetString("proxyUser"); ProxyPass = info.GetString("proxyPass"); } catch { } try { KeepAliveInterval = info.GetInt16("keepAliveInterval"); } catch { KeepAliveInterval = 1; } ConnectionType = (ConnectionType)info.GetByte("c"); if (ConnectionType == ConnectionType.Password) { Password = Utilities.UnprotectString(info.GetString("p")); } else { Passphrase = Utilities.UnprotectString(info.GetString("p")); PrivateKey = info.GetString("k"); } try { MountPoint = info.GetString("mountpoint"); } catch { MountPoint = Name;//default is name after version update } }
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)); } }
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; } }
//serialization constructor protected Object2PropertiesMapping(SerializationInfo info,StreamingContext context) { savedStates = (SerializableDictionary<int,SavedState>)info.GetValue("savedStates",typeof(SerializableDictionary<int,SavedState>)); isParentObj = info.GetBoolean("isParentObj"); parentMapping = (Object2PropertiesMapping)info.GetValue("parentMapping",typeof(Object2PropertiesMapping)); childNo = info.GetInt32("childNo"); prefabLoadPath = info.GetString("prefabLoadPath"); lastChangedFrame = info.GetInt32("lastChangedFrame"); firstChangedFrame = info.GetInt32("firstChangedFrame"); try { childIdentificationMode = (ChildIdentificationMode)info.GetValue("childIdentificationMode",typeof(ChildIdentificationMode)); } catch (SerializationException e) { //file was recorded using old version of this plugin childIdentificationMode = ChildIdentificationMode.IDENTIFY_BY_ORDER; } try { gameObjectName = info.GetString("gameObjectName"); } catch (SerializationException e) { //file was recorded using old version of this plugin childIdentificationMode = ChildIdentificationMode.IDENTIFY_BY_ORDER; gameObjectName = "name_untraceable"; } }
protected GlobalDefine( SerializationInfo info, StreamingContext context ) { define = info.GetString( "define" ); enabled = info.GetBoolean( "enabled" ); }
//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 KRecord( SerializationInfo info, StreamingContext context ) { int count = (int)info.GetValue( "ColumnCount", typeof( int ) ); _Columns = new object[count]; for( int i = 0; i < count; i++ ) { string type = info.GetString( "ColumnType" + i ); object value = type == "VOID" ? null : info.GetValue( "ColumnValue" + i, Type.GetType( type ) ); _Columns[i] = value; } _Sealed = info.GetBoolean( "RecordSealed" ); _SerializeSchema = info.GetBoolean( "SerializeSchema" ); if( _SerializeSchema ) _Schema = (KSchema)info.GetValue( "Schema", typeof( KSchema ) ); }
/// <summary> /// Initializes a new instance of the CmdletInvocationException 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 CmdletInvocationException(SerializationInfo info, StreamingContext context) : base(info, context) { bool hasErrorRecord = info.GetBoolean("HasErrorRecord"); if (hasErrorRecord) _errorRecord = (ErrorRecord)info.GetValue("ErrorRecord", typeof(ErrorRecord)); }
/// <summary> /// Initializes a new instance of the ActionPreferenceStopException 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 ActionPreferenceStopException(SerializationInfo info, StreamingContext context) : base(info, context) { bool hasErrorRecord = info.GetBoolean("HasErrorRecord"); if (hasErrorRecord) _errorRecord = (ErrorRecord)info.GetValue("ErrorRecord", typeof(ErrorRecord)); // fix for BUG: Windows Out Of Band Releases: 906263 and 906264 // The interpreter prompt CommandBaseStrings:InquireHalt // should be suppressed when this flag is set. This will be set // when this prompt has already occurred and Break was chosen, // or for ActionPreferenceStopException in all cases. this.SuppressPromptInInterpreter = true; }