public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
 {
     Utility.SetFieldValue(ref obj, "_baseUrl", Utility.PrivateInstance, info.GetString("baseUrl"));
     Utility.SetFieldValue(ref obj, "_token", Utility.PrivateInstance, info.GetString("token"));
     Utility.SetFieldValue(ref obj, "_mapType", Utility.PrivateInstance, info.GetChar("mapType"));
     return obj;
 }
        protected BootstrapContext(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
                return;

            switch (info.GetChar(_tokenTypeKey))
            {
                case _securityTokenType:
                    {
                        SecurityTokenHandler sth = context.Context as SecurityTokenHandler;
                        if (sth != null)
                        {
                            using (XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(Convert.FromBase64String(info.GetString(_tokenKey)), XmlDictionaryReaderQuotas.Max))
                            {
                                reader.MoveToContent();
                                if (sth.CanReadToken(reader))
                                {
                                    string tokenName = reader.LocalName;
                                    string tokenNamespace = reader.NamespaceURI;
                                    SecurityToken token = sth.ReadToken(reader);

                                    if (token == null)
                                    {
                                        _tokenString = Text.Encoding.UTF8.GetString(Convert.FromBase64String(info.GetString(_tokenKey)));
                                    }
                                    else
                                    {
                                        _token = token;
                                    }
                                }
                            }
                        }
                        else
                        {
                            _tokenString = Text.Encoding.UTF8.GetString(Convert.FromBase64String(info.GetString(_tokenKey)));
                        }
                    }

                    break;

                case _stringTokenType:
                    {
                        _tokenString = info.GetString(_tokenKey);
                    }
                    break;

                case _byteTokenType:
                    {
                        _tokenBytes = (byte[])info.GetValue(_tokenKey, typeof(byte[]));
                    }
                    break;

                default:
                    break;
            }
        }
Beispiel #3
0
        private TuringTapes(SerializationInfo info, StreamingContext context)
        {
            int n = info.GetInt32("n");
            _units = new List<TuringUnit>();

            for (int i = 0; i < n; i++)
                _units.Add(info.GetValue("u" + i.ToString(), typeof(TuringUnit)) as TuringUnit);

            _symbols = info.GetValue("s", typeof(SymbolSet)) as SymbolSet;
            _defaultChar = info.GetChar("c");

            _units.ForEach(x => x.Tape.Update += Tape_Update);
        }
Beispiel #4
0
		/// <summary>Initializes a new instance of the <see cref="BootstrapContext"/> class from a stream.</summary>
		protected BootstrapContext (SerializationInfo info, StreamingContext context)
		{
			if (info == null)
				throw new ArgumentNullException ("info");
			char type = info.GetChar ("K");
			switch (type) {
			case 'S':
				Token = info.GetString ("T");
				break;
			case 'B':
				TokenBytes = (byte [])info.GetValue ("T", typeof (byte []));
				break;
			case 'T':
				Token = Encoding.UTF8.GetString (Convert.FromBase64String (info.GetString ("T")));
				break;
			}
		}
Beispiel #5
0
 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 { }
     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
     }
 }
Beispiel #6
0
 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");
     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");
     }
 }
 /// <summary>
 /// Constructor for deserialization.
 /// </summary>
 /// <param name="info">the info holding the serialization data</param>
 /// <param name="context">the serialization context</param>
 public UnexpectedFieldTypeException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     _fieldType = info.GetChar("FieldType");
 }
 /// <summary>
 /// Serialized constructor.
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected clsTSMMessage(SerializationInfo info, StreamingContext  context)
 {
     if(info != null)
     {
         this.Prefix = info.GetString("Prefix");
         this.Number = info.GetInt32("Number");
         this.Type = info.GetChar("Type");
         this.Text = info.GetString("Text");
     }
 }
Beispiel #9
0
 public VirtualDrive(SerializationInfo info,
     StreamingContext context)
 {
     Letter = info.GetChar("letter");
 }
Beispiel #10
0
 public Node(SerializationInfo info, StreamingContext context)
 {
     IP = info.GetString("i");
     Port = info.GetInt32("p");
     char c = info.GetChar("c");
     if (c == 'c')
     {
         Type = NodeType.Client;
     }
     else {
         Type = NodeType.Server;
     }
 }