/// <summary>
        /// Inflate the token
        /// NOTE: This operation is not continuable and assumes that the entire token is available in the stream
        /// </summary>
        /// <param name="source">Stream to inflate the token from.</param>
        /// <returns>True in case of success, false otherwise.</returns>
        public override bool Inflate(Stream source)
        {
            // We skip the token identifier because it is read by token factory
            TDSFeatureID currentFeatureType = TDSFeatureID.FederatedAuthentication;

            do
            {
                // Read feature type
                currentFeatureType = (TDSFeatureID)source.ReadByte();

                // Ensure we're not looking at the terminator
                switch (currentFeatureType)
                {
                case TDSFeatureID.SessionRecovery:
                {
                    // Create a new option
                    Options.Add(new TDSFeatureExtAckSessionStateOption(source));
                    break;
                }

                case TDSFeatureID.FederatedAuthentication:
                {
                    Options.Add(new TDSFeatureExtAckFederatedAuthenticationOption(source));
                    break;
                }

                case TDSFeatureID.Terminator:
                {
                    // Do nothing
                    break;
                }

                default:
                {
                    // Create a new generic option
                    Options.Add(new TDSFeatureExtAckGenericOption(currentFeatureType, source));
                    break;
                }
                }
            }while (currentFeatureType != TDSFeatureID.Terminator);

            // We're done inflating
            return(true);
        }
 /// <summary>
 /// Initialization constructor
 /// </summary>
 public TDSLogin7GenericOptionToken(TDSFeatureID featureID, byte[] data) :
     this(featureID)
 {
     // Save data
     Data = data;
 }
 /// <summary>
 /// Initialization constructor
 /// </summary>
 public TDSLogin7GenericOptionToken(TDSFeatureID featureID)
 {
     // Save feature identifier
     FeatureID = featureID;
 }
 /// <summary>
 /// Inflating constructor
 /// </summary>
 /// <param name="source"></param>
 public TDSFeatureExtAckGenericOption(TDSFeatureID featureID, Stream source) :
     this(source)
 {
     FeatureID = featureID;
 }
示例#5
0
        /// <summary>
        /// Inflate an object instance from the stream
        /// </summary>
        public bool Inflate(Stream source)
        {
            // Identifier of the feature
            TDSFeatureID featureID = TDSFeatureID.Terminator;

            // Iterate
            do
            {
                // Read the feature type
                featureID = (TDSFeatureID)source.ReadByte();

                // Token being inflated
                TDSLogin7FeatureOptionToken optionToken = null;

                // skip this feature extension
                switch (featureID)
                {
                case TDSFeatureID.FederatedAuthentication:
                {
                    // Federated authentication
                    optionToken = new TDSLogin7FedAuthOptionToken();
                    break;
                }

                case TDSFeatureID.SessionRecovery:
                {
                    // Session recovery
                    optionToken = new TDSLogin7SessionRecoveryOptionToken();
                    break;
                }

                case TDSFeatureID.Terminator:
                {
                    // Do nothing
                    break;
                }

                default:
                {
                    // Create a generic option
                    optionToken = new TDSLogin7GenericOptionToken(featureID);
                    break;
                }
                }

                // Check if we have an option token
                if (optionToken != null)
                {
                    // Inflate it
                    optionToken.Inflate(source);

                    // Register with the collection
                    Add(optionToken);

                    // Update inflation offset
                    InflationSize += optionToken.InflationSize;
                }
            }while (TDSFeatureID.Terminator != featureID);

            // We don't support continuation of inflation so report as fully inflated
            return(true);
        }
 /// <summary>
 /// Initialization constructor
 /// </summary>
 /// <param name="type">type of the FeatureExtAckToken.</param>
 /// <param name="featureAckDataLen">Length of the data.</param>
 public TDSFeatureExtAckGenericOption(TDSFeatureID type, uint featureAckDataLen)
     : this(type)
 {
     FeatureAckDataLen = featureAckDataLen;
 }
 /// <summary>
 /// Initialization constructor
 /// </summary>
 /// <param name="type">type of the FeatureExtAckToken.</param>
 /// <param name="featureAckDataLen">Length of the data.</param>
 /// <param name="data">Data of the FeatureAck token.</param>
 public TDSFeatureExtAckGenericOption(TDSFeatureID type, uint featureAckDataLen, byte[] data)
     : this(type, featureAckDataLen)
 {
     FeatureAckData = data;
 }
示例#8
0
 /// <summary>
 /// Initialization constructor
 /// </summary>
 public TDSLogin7GenericOptionToken(TDSFeatureID featureID, byte[] data) :
     this(featureID)
 {
     // Save data
     Data = data;
 }
 /// <summary>
 /// Initialization constructor
 /// </summary>
 /// <param name="type">type of the FeatureExtAckToken.</param>
 public TDSFeatureExtAckGenericOption(TDSFeatureID type)
 {
     FeatureID = type;
 }
示例#10
0
 /// <summary>
 /// Initialization constructor
 /// </summary>
 public TDSLogin7GenericOptionToken(TDSFeatureID featureID)
 {
     // Save feature identifier
     FeatureID = featureID;
 }
 /// <summary>
 /// Inflating constructor
 /// </summary>
 /// <param name="source"></param>
 public TDSFeatureExtAckGenericOption(TDSFeatureID featureID, Stream source) :
     this(source)
 {
     FeatureID = featureID;
 }
 /// <summary>
 /// Initialization constructor
 /// </summary>
 /// <param name="type">type of the FeatureExtAckToken.</param>
 /// <param name="featureAckDataLen">Length of the data.</param>
 /// <param name="data">Data of the FeatureAck token.</param>
 public TDSFeatureExtAckGenericOption(TDSFeatureID type, uint featureAckDataLen, byte[] data)
     : this(type, featureAckDataLen)
 {
     FeatureAckData = data;
 }
 /// <summary>
 /// Initialization constructor
 /// </summary>
 /// <param name="type">type of the FeatureExtAckToken.</param>
 /// <param name="featureAckDataLen">Length of the data.</param>
 public TDSFeatureExtAckGenericOption(TDSFeatureID type, uint featureAckDataLen)
     : this(type)
 {
     FeatureAckDataLen = featureAckDataLen;
 }
 /// <summary>
 /// Initialization constructor
 /// </summary>
 /// <param name="type">type of the FeatureExtAckToken.</param>
 public TDSFeatureExtAckGenericOption(TDSFeatureID type)
 {
     FeatureID = type;
 }