Exemple #1
0
        /// <summary>
        /// Returns a value indicates that if the specified alice-tools is available.
        /// </summary>
        /// <returns><c>true</c> if alice-tools is available; Otherwise, <c>false</c>.</returns>
        public bool Test()
        {
            try
            {
                AliceToolsOutput msg = InvokeAsync(GetVersionOperationInner.Default).Result;
                if (msg.State != AliceToolsState.Successful)
                {
                    return(false);
                }
                Version version = VersionReaderInner.Defalut.Convert(msg);
                if (version == null)
                {
                    return(false);
                }
                Version        = version;
                AliceToolsPath = new FileInfo(_startInfo.FileName).FullName;
                return(true);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch
            {
                return(false);
            }
#pragma warning restore CA1031 // Do not catch general exception types
        }
Exemple #2
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));
        }
Exemple #3
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));
        }