WriteWarning() public static method

The write warning.
public static WriteWarning ( string message ) : void
message string /// The message. ///
return void
示例#1
0
        /// <summary>
        /// The data.
        /// </summary>
        /// <param name="connection">
        /// The connection.
        /// </param>
        private void DATA(Connection connection)
        {
            // Check command order
            if (connection.Session.Sender == null || connection.Session.MailFrom == null ||
                connection.Session.Recipients.Count == 0)
            {
                connection.Send("503 Bad sequence of commands");
                return;
            }

            string file = null;

            try
            {
                Stream networkStream = new NetworkStream(connection.Client, false);

                var output = new List <string>();

                using (var reader = new StreamReader(networkStream))
                {
                    string line;
                    connection.Send("354 Start mail input; end with <CRLF>.<CRLF>").AsyncWaitHandle.WaitOne();

                    while ((line = reader.ReadLine()) != ".")
                    {
                        // reverse any dot-stuffing per RFC 2821, section 4.5.2
                        if (line.StartsWith(".") && line.Length > 1)
                        {
                            line = line.Substring(1);
                        }

                        output.Add(line);
                    }

                    reader.Close();
                }

                file = _messageFileService.SaveMessage(output);
            }
            catch (IOException e)
            {
                Logger.WriteWarning(
                    "IOException received in Processor.DATA while reading message.  Closing connection.  Message: " + e.Message,
                    connection.ConnectionId);
                connection.Close();
                return;
            }

            OnMessageReceived(connection, file);

            connection.Send("250 OK");
        }
示例#2
0
        private void TryMigrateMessages()
        {
            try
            {
                var      current = AppDomain.CurrentDomain.BaseDirectory;
                string[] files   = Directory.GetFiles(current, MessageFileSearchPattern);

                if (!files.Any())
                {
                    return;
                }

                foreach (var f in files)
                {
                    var destFileName = Path.Combine(BasePath, Path.GetFileName(f));
                    Logger.WriteWarning(string.Format("Migrating message from {0} to new path {1}.", f, destFileName));
                    File.Move(f, destFileName);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteError("Failure attempting to migrate old messages to new location", ex);
            }
        }