Exemplo n.º 1
0
        /// <summary>
        /// Invokes specified operation.
        /// </summary>
        /// <param name="operation">The operation to be invoked.</param>
        /// <returns>The invoking result.</returns>
        /// <exception cref="ObjectDisposedException">This instance has been disposed.</exception>
        public async Task <AliceToolsOutput> InvokeAsync(IAliceToolsOperation operation)
        {
            if (_disposedValue)
            {
                throw new ObjectDisposedException("AliceToolsProxy");
            }
            await _semaphore.WaitAsync();

            try
            {
                return(await InvokeCoreAsync(operation, _startInfo).ConfigureAwait(false));
            }
            finally
            {
                _semaphore.Release();
            }
        }
Exemplo n.º 2
0
 private async Task <AliceToolsOutput> InvokeCoreAsync(IAliceToolsOperation operation, ProcessStartInfo startInfo)
 {
     startInfo = EnsureOperationAndUpdateStartInfo(operation, startInfo);
     return(await ProcessRunAsync(startInfo).ConfigureAwait(false));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Invokes specified operation, and convert the output to the wapper of specified <typeparamref name="TOutput"/> by <paramref name="converter"/>.
        /// </summary>
        /// <typeparam name="TOutput">Output type.</typeparam>
        /// <param name="operation">The operation to be invoked.</param>
        /// <param name="converter">The convert for output convertion.</param>
        /// <returns>The wapper of <typeparamref name="TOutput"/> result.</returns>
        /// <exception cref="ObjectDisposedException">This instance has been disposed.</exception>
        public async Task <OutputConvertionResult <TOutput> > InvokeAsync <TOutput>(IAliceToolsOperation operation, AliceToolsOutputConverter <TOutput> converter)
        {
            AliceToolsOutput output = await InvokeAsync(operation).ConfigureAwait(false);

            return(await converter.ConvertToWapperAsync(output).ConfigureAwait(false));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Invokes specified operation, and convert the output to the specified <typeparamref name="TOutput"/> by <paramref name="converter"/>.
        /// </summary>
        /// <typeparam name="TOutput">Output type.</typeparam>
        /// <param name="operation">The operation to be invoked.</param>
        /// <param name="converter">The convert for output convertion.</param>
        /// <param name="allowPartlySuccessful">Specifies that whether the <paramref name="converter"/> should convert the partly successful result.</param>
        /// <returns>The <typeparamref name="TOutput"/> result.</returns>
        /// <exception cref="ObjectDisposedException">This instance has been disposed.</exception>
        public async Task <TOutput> InvokeAsync <TOutput>(IAliceToolsOperation operation, AliceToolsOutputConverter <TOutput> converter, bool allowPartlySuccessful = false)
        {
            AliceToolsOutput output = await InvokeAsync(operation).ConfigureAwait(false);

            return(await converter.ConvertAsync(output, allowPartlySuccessful).ConfigureAwait(false));
        }