C# (CSharp) Класс System.Runtime.Serialization. StreamingContext Code Examples

C# (CSharp) System.Runtime.Serialization.StreamingContext - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.Runtime.Serialization.StreamingContext, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Основные методы
Пример #1
0
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue(nameof(Name), Name);
     info.AddValue(nameof(ProviderName), ProviderName);
     info.AddValue(nameof(ProviderParameters), ProviderParameters);
     info.AddValue(nameof(VaultParameters), VaultParameters);
 }
Пример #2
0
        internal SoapFault(SerializationInfo info, StreamingContext context)
        {
            SerializationInfoEnumerator siEnum = info.GetEnumerator();        

            while(siEnum.MoveNext())
            {
                String name = siEnum.Name;
                Object value = siEnum.Value;
                SerTrace.Log(this, "SetObjectData enum ",name," value ",value);
                if (String.Compare(name, "faultCode", true, CultureInfo.InvariantCulture) == 0)
                {
                    int index = ((String)value).IndexOf(':');
                    if (index > -1)
                        faultCode = ((String)value).Substring(++index);
                    else
                        faultCode = (String)value;
                }
                else if (String.Compare(name, "faultString", true, CultureInfo.InvariantCulture) == 0)
                    faultString = (String)value;
                else if (String.Compare(name, "faultActor", true, CultureInfo.InvariantCulture) == 0)
                    faultActor = (String)value;
                else if (String.Compare(name, "detail", true, CultureInfo.InvariantCulture) == 0)
                    detail = value;
            }
        }
		public SO_NWS_Highlight(
			SerializationInfo info_in,
			StreamingContext context_in
		) {
			haschanges_ = false;

			idhighlight_ = (long)info_in.GetValue("IDHighlight", typeof(long));
			ifapplication_ 
				= (info_in.GetValue("IFApplication", typeof(int)) == null)
					? 0
					: (int)info_in.GetValue("IFApplication", typeof(int));
			IFApplication_isNull = (bool)info_in.GetValue("IFApplication_isNull", typeof(bool));
			ifhighlight__parent_ 
				= (info_in.GetValue("IFHighlight__parent", typeof(long)) == null)
					? 0L
					: (long)info_in.GetValue("IFHighlight__parent", typeof(long));
			IFHighlight__parent_isNull = (bool)info_in.GetValue("IFHighlight__parent_isNull", typeof(bool));
			name_ = (string)info_in.GetValue("Name", typeof(string));
			ifuser__approved_ 
				= (info_in.GetValue("IFUser__Approved", typeof(long)) == null)
					? 0L
					: (long)info_in.GetValue("IFUser__Approved", typeof(long));
			IFUser__Approved_isNull = (bool)info_in.GetValue("IFUser__Approved_isNull", typeof(bool));
			approved_date_ 
				= (info_in.GetValue("Approved_date", typeof(DateTime)) == null)
					? new DateTime(1900, 1, 1)
					: (DateTime)info_in.GetValue("Approved_date", typeof(DateTime));
			Approved_date_isNull = (bool)info_in.GetValue("Approved_date_isNull", typeof(bool));
		}
 private UnresolvableObjectException(
     SerializationInfo info,
     StreamingContext context)
     : base(info, context)
 {
     ObjectName = info.GetString("ObjectName");
 }
        private void OnDeserializedMethod(StreamingContext context)
        {
            // Here it the matrix of possible serializations
            //
            // Version From  |  Version To | ClaimsIdentities | Roles
            // ============     ==========   ================   ========================================================
            // 4.0               4.5         None               We always need to add a ClaimsIdentity
            //
            // 4.5               4.5         Yes                There should be a ClaimsIdentity

            ClaimsIdentity firstNonNullIdentity = null;
            foreach (var identity in base.Identities)
            {
                if (identity != null)
                {
                    firstNonNullIdentity = identity;
                    break;
                }
            }

            if (firstNonNullIdentity == null)
            {
                base.AddIdentity(m_identity);
            }
        }
Пример #6
0
        /// <exclude/>
        public Lookup(SerializationInfo serializationInfo, StreamingContext streamingContext)
        {
            int version = 0;

            if (SerializationVersionExists)
            {
                try
                {
                    version = serializationInfo.GetInt32("SerializationVersion");
                }
                catch (SerializationException)
                {
                    // ignore
                    SerializationVersionExists = false;
                }
            }
            _alias = serializationInfo.GetString("Alias");
            _aliasPlural = serializationInfo.GetString("AliasPlural");
            _enabled = serializationInfo.GetBoolean("Enabled");
            _isUserDefined = serializationInfo.GetBoolean("IsUserDefined");
            _name = serializationInfo.GetString("Name");
            _userOptions = (List<IUserOption>)serializationInfo.GetValue("UserOptions", ModelTypes.UserOptionList);
            _description = serializationInfo.GetString("Description");
            _backingObject = (ScriptObject)serializationInfo.GetValue("BackingObject", ModelTypes.ScriptObject);
            _idColumn = (Column)serializationInfo.GetValue("IdColumn", ModelTypes.Column);
            _nameColumn = (Column)serializationInfo.GetValue("NameColumn", ModelTypes.Column);
            _LookupValues = (List<LookupValue>)serializationInfo.GetValue("LookupValues", ModelTypes.LookupValueList);
        }
 protected TimeOfDayChangedAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     v3dLayer = EditorManager.Project.Scene.MainLayer as V3DLayer;
       oldConfig = (TimeOfDay)info.GetValue("oldConfig", typeof(TimeOfDay));
       newConfig = (TimeOfDay)info.GetValue("newConfig", typeof(TimeOfDay));
 }
Пример #8
0
 // ISerializable implementation. called during serialization.
 void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
 {
     SerializeEncoder(info);
     info.AddValue("encoding", this.m_encoding);
     info.AddValue("charLeftOver", this.charLeftOver);
     info.SetType(typeof(Encoding.DefaultEncoder));
 }
 /// <summary>
 /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object.
 /// </summary>
 /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param>
 /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param>
 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
 public override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     if(Tracing.BinarySerializationSwitch.Enabled)
         Trace.WriteLine("Serializing the fields of 'SwitchIconMaterial'.");
     base.GetObjectData(info, context);
     info.AddValue("SwitchType", this.mSwitchType.ToString());
 }
Пример #10
0
	protected override void Deserialize (SerializationInfo info, StreamingContext context)
	{
		text = (string) info.GetValue ("AssemblyName", typeof (AssemblyName));
		base.Filter = (ICollection)info.GetValue ("Filter", typeof (ICollection));
		base.DisplayName = info.GetString ("DisplayName");
		if (info.GetBoolean ("Locked")) base.Lock ();
	}
Пример #11
0
 // Constructor called by serialization. called during deserialization.
 internal EncoderNLS(SerializationInfo info, StreamingContext context)
 {
     throw new NotSupportedException(
                 String.Format(
                     System.Globalization.CultureInfo.CurrentCulture, 
                     Environment.GetResourceString("NotSupported_TypeCannotDeserialized"), this.GetType()));
 }
Пример #12
0
        protected XmlException(SerializationInfo info, StreamingContext context) : base(info, context) {
            res                 = (string)  info.GetValue("res"  , typeof(string));
            args                = (string[])info.GetValue("args", typeof(string[]));
            lineNumber          = (int)     info.GetValue("lineNumber", typeof(int));
            linePosition        = (int)     info.GetValue("linePosition", typeof(int));

            // deserialize optional members
            sourceUri = string.Empty;
            string version = null;
            foreach ( SerializationEntry e in info ) {
                switch ( e.Name ) {
                    case "sourceUri":
                        sourceUri = (string)e.Value;
                        break;
                    case "version":
                        version = (string)e.Value;
                        break;
                }
            }

            if ( version == null ) {
                // deserializing V1 exception
                message = CreateMessage( res, args, lineNumber, linePosition );
            }
            else {
                // deserializing V2 or higher exception -> exception message is serialized by the base class (Exception._message)
                message = null;
            }
        }
 /// <summary>
 ///     Initializes a new, empty instance of the <see cref="T:System.Collections.Hashtable"></see> class that is
 ///     serializable using the specified <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> and
 ///     <see cref="T:System.Runtime.Serialization.StreamingContext"></see> objects.
 /// </summary>
 /// <param name="context">
 ///     A <see cref="T:System.Runtime.Serialization.StreamingContext"></see> object containing the source
 ///     and destination of the serialized stream associated with the <see cref="T:System.Collections.Hashtable"></see>.
 /// </param>
 /// <param name="info">
 ///     A <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> object containing the
 ///     information required to serialize the <see cref="T:System.Collections.Hashtable"></see> object.
 /// </param>
 /// <exception cref="T:System.ArgumentNullException">info is null. </exception>
 protected CaseInsensitiveHashtable(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     var cultureName = info.GetString("_cultureName");
     _culture = new CultureInfo(cultureName);
     AssertUtils.ArgumentNotNull(_culture, "Culture");
 }
Пример #14
0
        public Tile(SerializationInfo info, StreamingContext ctx)
            : base(info, ctx)
        {
            m_strName = null;
            try {
                m_strName = info.GetString("Name");
            } catch {
                m_strName = info.GetInt32("Cookie").ToString();
            }

            m_afVisible = (bool[,])info.GetValue("Visibility", typeof(bool[,]));

            try {
                m_afOccupancy = (bool[,])info.GetValue("Occupancy", typeof(bool[,]));
            } catch {
                TemplateDoc tmpd = (TemplateDoc)DocManager.GetActiveDocument(typeof(TemplateDoc));
                Template tmpl = tmpd.FindTemplate(m_strName);
                if (tmpl != null) {
                    m_afOccupancy = tmpl.OccupancyMap;
                } else {
                    m_afOccupancy = new bool[1, 1];
                }
            }

            InitCommon();
        }
Пример #15
0
 public void OnDeserializing(StreamingContext context)
 {
     // set defaults
     this.message = "message";
     this.title = "Alert";
     this.buttonLabel = "ok";
 }
Пример #16
0
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     if (info == null)
     {
         throw new ArgumentNullException(nameof(info));
     }
 }
        public object Restore()
        {
            var type = Type.GetType(assemblyQualifiedName);

            var ctor = type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new [] {
                typeof(SerializationInfo),
                typeof(StreamingContext)
            }, null);

            var serializationInfo = new SerializationInfo(type, new FormatterConverter());
            serializationInfo.SetType(type);
            for(var i = 0; i < keys.Length; i++)
            {
                serializationInfo.AddValue(keys[i], values[i]);
            }
            var streamingContext = new StreamingContext(StreamingContextStates.Clone);
            var result = ctor.Invoke(new object[] { serializationInfo, streamingContext });
            var onDeserialization = result as IDeserializationCallback;
            if(onDeserialization != null)
            {
                onDeserialization.OnDeserialization(this);
            }

            return result;
        }
 /// <summary>
 /// Required constructor for deserialization.
 /// </summary>
 protected SolutionFolderWSPReference(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     if (this.AssetName == "PageLayout")
       {
       }
 }
Пример #19
0
 protected DatasetPatrols(SerializationInfo info, StreamingContext context) {
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((strSchema != null)) {
         DataSet ds = new DataSet();
         ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["Patrols"] != null)) {
             this.Tables.Add(new PatrolsDataTable(ds.Tables["Patrols"]));
         }
         this.DataSetName = ds.DataSetName;
         this.Prefix = ds.Prefix;
         this.Namespace = ds.Namespace;
         this.Locale = ds.Locale;
         this.CaseSensitive = ds.CaseSensitive;
         this.EnforceConstraints = ds.EnforceConstraints;
         this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
         this.InitVars();
     }
     else {
         this.InitClass();
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     this.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
		protected ProxyObjectReference(SerializationInfo info, StreamingContext context)
		{
			// Deserialize the base type using its assembly qualified name
			string qualifiedName = info.GetString("__baseType");
			_baseType = System.Type.GetType(qualifiedName, true, false);

			// Rebuild the list of interfaces
			var interfaceList = new List<System.Type>();
			int interfaceCount = info.GetInt32("__baseInterfaceCount");
			for (int i = 0; i < interfaceCount; i++)
			{
				string keyName = string.Format("__baseInterface{0}", i);
				string currentQualifiedName = info.GetString(keyName);
				System.Type interfaceType = System.Type.GetType(currentQualifiedName, true, false);

				interfaceList.Add(interfaceType);
			}

			// Reconstruct the proxy
			var factory = new ProxyFactory();
			System.Type proxyType = factory.CreateProxyType(_baseType, interfaceList.ToArray());

			// Initialize the proxy with the deserialized data
			var args = new object[] {info, context};
			_proxy = (IProxy) Activator.CreateInstance(proxyType, args);
		}
        protected UpdateException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            this.Errors = (IList<UpdateError>)info.GetValue(ERRORSKEY, typeof(IList<UpdateError>));

            this.ErrorDetail = info.GetString(ERRORDETAILKEY);
        }
Пример #22
0
 private Spheroid(SerializationInfo info, StreamingContext context)
 {
     this.Axis = info.GetDouble("Axis");
     this.Flatten = info.GetDouble("Flatten");
     this.Name = info.GetString("Name");
     this.Type = (SpheroidType)info.GetValue("Type", typeof(SpheroidType));
 }
Пример #23
0
 public void GetObjectData(object obj, SerializationInfo info, StreamingContext context) {
     var color = (Color)obj;
     info.AddValue("r", color.r);
     info.AddValue("g", color.g);
     info.AddValue("b", color.b);
     info.AddValue("a", color.a);
 }
Пример #24
0
 void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue("Axis", this.Axis);
     info.AddValue("Flatten", this.Flatten);
     info.AddValue("Name", this.Name);
     info.AddValue("Type", this.Type);
 }
Пример #25
0
		public override void GetObjectData (SerializationInfo info, StreamingContext context)
		{
			if (info == null)
				throw new ArgumentNullException ("info");

			base.GetObjectData (info, context);
		}
Пример #26
0
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("ClipboardOwnerProcessName", processName);
            info.AddValue("ClipboardOwnerProcessId", processId);

            base.GetObjectData(info, context);
        }
Пример #27
0
 protected ClaimsPrincipal(SerializationInfo info, StreamingContext context)
 {
     if (null == info)
     {
         throw new ArgumentNullException(nameof(info));
     }
 }
Пример #28
0
 protected DocumentException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     Line = info.GetInt32(nameof(Line));
     Column = info.GetInt32(nameof(Column));
     File = info.GetString(nameof(File));
 }
Пример #29
0
 public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
 {
     info.AddValue("Uid", this.Uid);
     info.AddValue("Name", this.Name);
     info.AddValue("Products", this.Products);
     info.AddValue("Orders", this.Orders);
 }
Пример #30
0
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);

            info.AddValue("DataServiceException.FaultMessage", Fault.Message);
            info.AddValue("DataServiceException.FaultMessage", Fault.Detail);
        }