/// <summary>
        /// Build a connection to the shield queues service bus for the current protection process.
        /// </summary>
        /// <param name="externalConnection"></param>
        /// <param name="withLogger"></param>
        /// <returns></returns>
        private QueueConnection InstanceQueueConnector(QueueConnectionExternalModel externalConnection, bool withLogger)
        {
            try
            {
                var connection = new QueueConnection(externalConnection.TaskId);

                if (!withLogger)
                {
                    return(connection);
                }

                if (Parent.CustomLogger is null)
                {
                    throw new Exception("The \"WithLogger\" method cannot be called if a custom logger has not been provided in the shield client.");
                }

                Parent.CustomLogger?.LogDebug("The current logger has been configured as the output of the connection logs.");

                connection.On(externalConnection.OnLogger, (message, level, time) => OnCustomLog(time.ToString(CultureInfo.InvariantCulture), message, level));

                return(connection);
            }
            catch (Exception ex)
            {
                Parent.CustomLogger?.LogCritical("An error occurred while creating the connection to the shield server for the current process.");
                throw new Exception($"An error occurred while creating the connection to the shield server for the current process: {ex.Message}");
            }
        }
 public ProtectionResult ProtectSingleFile(string projectKey, string fileBlob,
                                           QueueConnectionExternalModel queueConnection, ApplicationConfigurationDto configuration, string queueMethod)
 => ProtectSingleFile(projectKey, fileBlob, queueConnection.TaskId, configuration, queueMethod);
 /// <summary>
 /// Build a connection to the shield bus for the current protection process with current logger.
 /// </summary>
 /// <param name="externalConnection"></param>
 /// <returns></returns>
 public QueueConnection InstanceQueueConnectorWithLogger(QueueConnectionExternalModel externalConnection)
 => InstanceQueueConnector(externalConnection, true);
 /// <summary>
 /// Build a connection to the shield bus for the current protection process.
 /// </summary>
 /// <param name="externalConnection"></param>
 /// <returns></returns>
 public QueueConnection InstanceQueueConnector(QueueConnectionExternalModel externalConnection)
 => InstanceQueueConnector(externalConnection, false);