//------------------------------------------------------
        //
        // Constructors
        //
        //------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Constructor.
        /// </summary>
        internal UserUseLicenseDictionaryLoader(RightsManagementEncryptionTransform rmet)
        {
            _dict = new Dictionary<ContentUser, UseLicense>(ContentUser._contentUserComparer);

            //
            // This constructor is only called from RightsManagementEncryptionTransform
            // .GetEmbeddedUseLicenses. That method passes "this" as the parameter.
            // So it can't possibly be null.
            //
            Invariant.Assert(rmet != null);

            Load(rmet);
        }
 RightsManagementInformation(
     RightsManagementEncryptionTransform rmet
     )
 {
     _rmet = rmet;
 }
    /// <summary>
    /// Tranform object is created. We are no longer using reflection to do this. We are supporting limited data transforms.
    /// </summary>
    private IDataTransform InstantiateDataTransformObject(int transformClassType,  string transformClassName, TransformEnvironment transformEnvironment )
    {
        object transformInstance = null;

        if (transformClassType != (int) TransformIdentifierTypes_PredefinedTransformName)
            throw new NotSupportedException(SR.Get(SRID.TransformTypeUnsupported));

        // Transform Identifier: we preserve casing, but do case-insensitive comparison
        if (((IEqualityComparer) CU.StringCaseInsensitiveComparer).Equals(transformClassName,
                RightsManagementEncryptionTransform.ClassTransformIdentifier))
        {
            transformInstance = new RightsManagementEncryptionTransform( transformEnvironment);
        }
        else if (((IEqualityComparer) CU.StringCaseInsensitiveComparer).Equals(transformClassName,
                CompressionTransform.ClassTransformIdentifier))
        {
             transformInstance = new CompressionTransform( transformEnvironment );
        }
        else
        {
            //this transform class is not supported. Need to change this to appropriate error.
            throw new ArgumentException(
                    SR.Get(SRID.TransformLabelUndefined));
        }

        if (null != transformInstance)
        {
            if( !( transformInstance is IDataTransform ) )
                throw new ArgumentException(
                    SR.Get(SRID.TransformObjectImplementIDataTransform));
            return (IDataTransform)transformInstance;
        }

        return null;        
    }
        DeleteUseLicenseForUser(
            RightsManagementEncryptionTransform rmet,
            StreamInfo si,
            object param,
            ref bool stop
            )
        {
            ContentUser userToDelete = param as ContentUser;
            if (userToDelete == null)
            {
                throw new ArgumentException(SR.Get(SRID.CallbackParameterInvalid), "param");
            }

            ContentUser userFromStream = null;
            using (Stream stream = si.GetStream(FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader utf8Reader = new BinaryReader(stream, Encoding.UTF8))
                {
                    userFromStream = rmet.LoadUserFromStream(utf8Reader);
                }
            }

            if (userFromStream.GenericEquals(userToDelete))
            {
                si.Delete();
            }
        }
        LoadUseLicenseForUser(
            RightsManagementEncryptionTransform rmet,
            StreamInfo si,
            object param,
            ref bool stop
            )
        {
            LoadUseLicenseForUserParams lulfup = param as LoadUseLicenseForUserParams;
            if (lulfup == null)
            {
                throw new ArgumentException(SR.Get(SRID.CallbackParameterInvalid), "param");
            }

            ContentUser userDesired = lulfup.User;
            Debug.Assert(userDesired != null);

            ContentUser userFromStream = null;
            using (Stream stream = si.GetStream(FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader utf8Reader = new BinaryReader(stream, Encoding.UTF8))
                {
                    userFromStream = rmet.LoadUserFromStream(utf8Reader);

                    if (userFromStream.GenericEquals(userDesired))
                    {
                        lulfup.UseLicense = rmet.LoadUseLicenseFromStream(utf8Reader);
                        stop = true;
                    }
                }
            }

        }
        //------------------------------------------------------
        //
        // Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        /// <summary>
        /// Load the contents of the dictionary from the compound file.
        /// </summary>
        /// <param name="rmet">
        /// The object that knows how to load use license data from the compound file.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="rmet"/> is null.
        /// </exception>
        private void Load(RightsManagementEncryptionTransform rmet )
        {
            rmet.EnumUseLicenseStreams(
                    new RightsManagementEncryptionTransform.UseLicenseStreamCallback(
                            this.AddUseLicenseFromStreamToDictionary
                            ),
                    null
                    );
        }
        AddUseLicenseFromStreamToDictionary(
            RightsManagementEncryptionTransform rmet,
            StreamInfo si,
            object param,
            ref bool stop
            )
        {
            ContentUser user;
            using (Stream stream = si.GetStream(FileMode.Open, FileAccess.Read))
            {
                using(BinaryReader utf8Reader = new BinaryReader(stream, _utf8Encoding))
                {
                    UseLicense useLicense = rmet.LoadUseLicenseAndUserFromStream(utf8Reader, out user);

                    _dict.Add(user, useLicense);
                }
            }
        }