Пример #1
0
        /// <summary>
        /// Creates an IFileProfile and returns.
        /// IFileProfile is the root of all MIP SDK File API operations. Typically only one should be created per app.
        /// </summary>
        /// <param name="appInfo"></param>
        /// <param name="authDelegate"></param>
        /// <returns></returns>
        private IFileProfile CreateFileProfile(ApplicationInfo appInfo, ref AuthDelegateImplementation authDelegate)
        {
            mipContext = MIP.CreateMipContext(appInfo, "mip_data", LogLevel.Trace, null, null);

            // Initialize file profile settings to create/use local state.
            var profileSettings = new FileProfileSettings(mipContext, CacheStorageType.OnDiskEncrypted, new ConsentDelegateImplementation());

            // Use MIP.LoadFileProfileAsync() providing settings to create IFileProfile.
            // IFileProfile is the root of all SDK operations for a given application.
            var profile = Task.Run(async() => await MIP.LoadFileProfileAsync(profileSettings)).Result;

            return(profile);
        }
        /// <summary>
        /// Creates a new IFileProfile object and stores in private _fileProfile.
        /// </summary>
        private void CreateFileProfile()
        {
            try
            {
                mipContext = MIP.CreateMipContext(appInfo, mipPath, LogLevel.Error, null, null);
                var profileSettings = new FileProfileSettings(mipContext, CacheStorageType.OnDisk, new ConsentDelegateImplementation());
                fileProfile = Task.Run(async() => await MIP.LoadFileProfileAsync(profileSettings)).Result;
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        private IProtectionProfile CreateProtectionProfile(ApplicationInfo appInfo, ref AuthDelegateImplementation authDelegate)
        {
            // Initialize MipContext
            mipContext = MIP.CreateMipContext(appInfo, "mip_data", LogLevel.Trace, null, null);

            // Initialize ProtectionProfileSettings
            var profileSettings = new ProtectionProfileSettings(mipContext,
                                                                CacheStorageType.OnDisk,
                                                                new ConsentDelegateImplementation());

            // Use MIP.LoadProtectionProfileAsync() providing settings to create IProtectionProfile
            // IProtectionProfile is the root of all SDK operations for a given application
            var profile = MIP.LoadProtectionProfile(profileSettings);

            return(profile);
        }