示例#1
0
        public override void OnClose()
        {
            mControllerNode = null;

            mDisposableList.Dispose();
            mDisposableList = null;
        }
示例#2
0
 public void OnDispose()
 {
     mDisposableList.Dispose();
     mDisposableList = null;
     mPackageKitLoginApp.Dispose();
     mPackageKitLoginApp = null;
 }
示例#3
0
 public void Dispose()
 {
     if (log)
     {
         disList.Dispose();
     }
 }
示例#4
0
        public void OnDispose()
        {
            mControllerNode.Recycle2Cache();
            mControllerNode = null;

            mDisposableList.Dispose();
            mDisposableList = null;
        }
示例#5
0
        public override void OnClose()
        {
            mPackageMakerApp.Dispose();
            mPackageMakerApp = null;

            mDisposableList.Dispose();
            mDisposableList = null;
        }
        public void Dispose()
        {
            var list = new DisposableList<MyDisposable>();

            Assert.True(list.All(x => !x.IsDisposed));

            list.Dispose();

            Assert.True(list.All(x => x.IsDisposed));
        }
示例#7
0
        public void Dispose()
        {
            _trustedRoot?.Dispose();
            _responders.Dispose();

            if (_testServer.IsValueCreated)
            {
                _testServer.Value.Result.Dispose();
            }
        }
        public void Dispose_EmptyList_ShouldDoNothing()
        {
            //Setup
            var sut = new DisposableList<IDisposable>();

            //Exercise
            sut.Dispose();

            //Verify
            sut.Should().BeEmpty();
        }
        public override void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }
            _isDisposed = true;

            _cachedTypeInfos?.Dispose();
            _typeLibPointer.Dispose();
        }
        public void Dispose_EmptyList_ShouldDoNothing()
        {
            //Setup
            var sut = new DisposableList <IDisposable>();

            //Exercise
            sut.Dispose();

            //Verify
            sut.Should().BeEmpty();
        }
        protected override bool ReleaseHandle()
        {
            _values?.Dispose();
            if (!IsInvalid)
            {
                bool ret = DeleteProcThreadAttributeList(handle);
                return(base.ReleaseHandle() && ret);
            }

            return(false);
        }
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                _names?.Dispose();
                _access_map?.Close();
                _obj_name?.Close();
                _handle?.Close();
                disposedValue = true;
            }
        }
        public void Dispose()
        {
            _trustedTestCertWithPrivateKey?.Dispose();
            _trustedTestCertWithoutPrivateKey?.Dispose();
            _trustedTimestampRoot?.Dispose();
            _responders.Dispose();

            if (_testServer.IsValueCreated)
            {
                _testServer.Value.Result.Dispose();
            }
        }
示例#14
0
        private IEnumerable <NtObject> CreateDirectoriesAndObject()
        {
            if (Close)
            {
                throw new ArgumentException("Can't use CreateDirectories and Close at the same time");
            }

            DisposableList <NtObject> objects = new DisposableList <NtObject>();

            string[]      path_parts = ResolvePath().Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
            StringBuilder builder    = new StringBuilder();
            bool          finished   = false;

            if (Root == null)
            {
                builder.Append(@"\");
            }

            try
            {
                for (int i = 0; i < path_parts.Length - 1; ++i)
                {
                    builder.Append(path_parts[i]);
                    NtDirectory dir = null;
                    try
                    {
                        dir = NtDirectory.Create(builder.ToString(), Root, DirectoryAccessRights.MaximumAllowed);
                    }
                    catch (NtException)
                    {
                    }

                    if (dir != null)
                    {
                        objects.Add(dir);
                    }
                    builder.Append(@"\");
                }
                objects.Add((NtObject)CreateObject(ResolvePath(), AttributeFlags, Root, SecurityQualityOfService, SecurityDescriptor));
                finished = true;
            }
            finally
            {
                if (!finished)
                {
                    objects.Dispose();
                    objects.Clear();
                }
            }
            return(objects.ToArray());
        }
        public void Dispose_ListWithManyItems_ShouldDisposeAllItems(
            IEnumerable<IDisposable> items)
        {
            //Setup
            var sut = new DisposableList<IDisposable>();
            sut.AddRange(items);

            //Exercise
            sut.Dispose();

            //Verify
            sut.Should().NotBeEmpty();
            sut.ForEach(item => Mock.Get(item).Verify(x => x.Dispose()));
        }
        public override void Dispose()
        {
            _trustedAuthorTestCert?.Dispose();
            _trustedRepositoryTestCert?.Dispose();
            _trustedServerRoot?.Dispose();
            _responders.Dispose();

            if (_testServer.IsValueCreated)
            {
                _testServer.Value.Result.Dispose();
            }

            base.Dispose();
        }
示例#17
0
        public void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }
            _isDisposed = true;

            _vbeExtensions?.Dispose();
            _cachedReferencedTypeInfos?.Dispose();
            (_container as IDisposable)?.Dispose();

            _typeInfoPointer.Dispose();
            _typeInfoAlternatePointer?.Dispose();
        }
        public void Dispose_ListWithManyItems_ShouldDisposeAllItems(
            IEnumerable <IDisposable> items)
        {
            //Setup
            var sut = new DisposableList <IDisposable>();

            sut.AddRange(items);

            //Exercise
            sut.Dispose();

            //Verify
            sut.Should().NotBeEmpty();
            sut.ForEach(item => Mock.Get(item).Verify(x => x.Dispose()));
        }
        public void Dispose()
        {
            if (!_isDisposed)
            {
                _defaultCertificate.Dispose();
                _lifetimeSigningCertificate.Dispose();
                _expiredCertificate.Dispose();
                _notYetValidCertificate.Dispose();
                _rsaSsaPssCertificate.Dispose();
                _nonSelfSignedCertificate.Dispose();
                _selfIssuedCertificate.Dispose();
                _rootCertificate.Dispose();
                _cyclicChain.Dispose();

                GC.SuppressFinalize(this);

                _isDisposed = true;
            }
        }
        /// <summary>
        /// This acquires a lock of a sequency of strings. To avoid deadlocks, the strings are deduplicated and sorted.
        /// </summary>
        /// <param name="semaphoreNames">The strings to lock.</param>
        /// <param name="timeout">
        /// A timeout to apply while acquiring each semaphore. This is not a timeout applied to all semaphores.
        /// </param>
        /// <returns>A disposable which releases all semaphores.</returns>
        public async Task <IDisposable> AcquireAsync(IEnumerable <string> semaphoreNames, TimeSpan timeout)
        {
            var disposables       = new DisposableList();
            var semaphoreNameList = semaphoreNames.OrderBy(x => x).Distinct().ToList();

            try
            {
                foreach (var semaphoreName in semaphoreNameList)
                {
                    disposables.Add(await AcquireAsync(semaphoreName, timeout));
                }
            }
            catch
            {
                disposables.Dispose();
                throw;
            }

            return(disposables);
        }
示例#21
0
        public void Dispose()
        {
            _trustedTestCert?.Dispose();
            _trustedTestCertWithInvalidEku?.Dispose();
            _trustedTestCertExpired?.Dispose();
            _trustedTestCertNotYetValid?.Dispose();
            _trustedTimestampRoot?.Dispose();
            _trustedTestCertChain?.Dispose();
            _revokedTestCertChain?.Dispose();
            _revocationUnknownTestCertChain?.Dispose();
            _crlServer?.Stop();
            _crlServer?.Dispose();
            _testDirectory?.Dispose();
            _responders.Dispose();

            if (_testServer.IsValueCreated)
            {
                _testServer.Value.Result.Dispose();
            }
        }
        public void ShouldCreateTest()
        {
            DisposableList <IDisposable> disposableList;
            MockFactory mockFactory;
            IDisposable mockDisposable;

            mockFactory    = new MockFactory();
            mockDisposable = mockFactory.CreateInstance <IDisposable>();

            Expect.On(mockDisposable).One.Method(m => m.Dispose());

            disposableList = new DisposableList <IDisposable>();

            Assert.IsEmpty(disposableList);

            disposableList.Add(mockDisposable);

            Assert.IsNotEmpty(disposableList);

            disposableList.Dispose();
        }
示例#23
0
        public void Dispose()
        {
            _trustedTestCert?.Dispose();
            _trustedTestCertExpired?.Dispose();
            _trustedTestCertNotYetValid?.Dispose();
            _trustedServerRoot?.Dispose();
            _responders.Dispose();

            if (_trustedTestCertificateWithReissuedCertificate != null)
            {
                foreach (var certificate in _trustedTestCertificateWithReissuedCertificate)
                {
                    certificate.Dispose();
                }
            }

            if (_testServer.IsValueCreated)
            {
                _testServer.Value.Result.Dispose();
            }
        }
示例#24
0
        /// <summary>
        /// IDisposable implementation
        /// </summary>
        /// <param name="disposing">true if invoked from Dispose() method</param>
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            // dispose managed state (managed objects).
            if (disposing)
            {
                m_rgCleanUpList.Dispose();
            }

            // cleanup unmanaged resources
            if (_nativeHandle != IntPtr.Zero)
            {
                NativeMethodsTraining.OrtReleaseTrainingParameters(_nativeHandle);
                _nativeHandle = IntPtr.Zero;
            }
            _disposed = true;
        }
示例#25
0
        public void Dispose()
        {
            _trustedTimestampRoot?.Dispose();

            if (_testServer.IsValueCreated)
            {
                _testServer.Value.Result.Dispose();
            }

            if (_defaultAuthorSigningCertficate.IsValueCreated)
            {
                _defaultAuthorSigningCertficate.Value.Result.Dispose();
            }

            if (_defaultRepositorySigningCertficate.IsValueCreated)
            {
                _defaultRepositorySigningCertficate.Value.Result.Dispose();
            }

            _responders.Dispose();
        }
示例#26
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (_names != null)
                {
                    _names.Dispose();
                }
                if (_access_map != null)
                {
                    _access_map.Close();
                }
                if (_obj_name != null)
                {
                    _obj_name.Close();
                }
                if (_handle != null)
                {
                    _handle.Close();
                }

                disposedValue = true;
            }
        }
示例#27
0
 private void ClearListView()
 {
     _processes?.Dispose();
     _processes = new DisposableList <NtProcess>();
     listViewProcesses.Items.Clear();
 }
示例#28
0
 public void CleanupTest()
 {
     _trash.Dispose();
 }
 public virtual void Dispose()
 {
     _handles.Dispose();
 }
 private void SelectSecurityCheckForm_Disposed(object sender, EventArgs e)
 {
     _tokens.Dispose();
 }
示例#31
0
        /// <summary>
        /// Updates the model inside an existing dacpac. All other parts of the package (the refactor log, pre/post deployment scripts,
        /// contributors to use etc) stay the same. 
        /// </summary>
        /// <param name="dacpacPath"></param>
        public void UpdateDacpacModelWithFilter(string dacpacPath)
        {
            DisposableList disposables = new DisposableList();

            try
            {
                TSqlModel model = disposables.Add(new TSqlModel(dacpacPath, DacSchemaModelStorageType.Memory));
                TSqlModel filteredModel = disposables.Add(CreateFilteredModel(model));

                // Note that the package must be opened in ReadWrite mode - this will fail if this isn't specified
                DacPackage package = disposables.Add(DacPackage.Load(dacpacPath, DacSchemaModelStorageType.Memory, FileAccess.ReadWrite));
                package.UpdateModel(filteredModel, new PackageMetadata());
            }
            finally
            {
                disposables.Dispose();
            }
        }
示例#32
0
        /// <summary>
        /// Creates a new dacpac based on the filtered model. This implementation loads from and saves to
        /// disk, but the API supports loading from and saving to a memory stream. This can be useful if you
        /// want to support a scenario where you load a dacpac, filter its model, then immediately deploy the filtered
        /// model to a database. 
        /// </summary>
        public void CreateFilteredDacpac(string dacpacPath, string filteredDacpacPath)
        {
            DisposableList disposables = new DisposableList();
            try
            {
                TSqlModel model = disposables.Add(new TSqlModel(dacpacPath, DacSchemaModelStorageType.Memory));
                TSqlModel filteredModel = disposables.Add(CreateFilteredModel(model));

                DacPackageExtensions.BuildPackage(
                    filteredDacpacPath,
                    filteredModel,
                    new PackageMetadata(), // Describes the dacpac.
                    new PackageOptions());  // Use this to specify the deployment contributors, refactor log to include in package

            }
            finally
            {
                // Models and DacPackage objects are disposable - either use a "using" statement or dispose of them in a finally block.
                // In these examples we'd end up with a large amount of indentation and to avoid that I'm using a try/finally block.
                disposables.Dispose();
            }
        }
示例#33
0
 public void Dispose()
 {
     WorkingObjects.Dispose();
     m_detector.Dispose();
 }
 void IDisposable.Dispose()
 {
     _root_dse?.Dispose();
     _resource_manager?.Dispose();
     _context.Dispose();
 }
 public void CleanupTest()
 {
     _trash.Dispose();
     DeleteIfExists(_dacpacPath);
 }