Пример #1
0
 public FileSystemChannel(FileSystemChannelSettings settings, IMessageSerializer formatter)
     : base(formatter)
 {
     if (settings == null) throw new ArgumentNullException("settings");
     if (settings.InboxPath.IsNullOrBlank()) throw new ArgumentException("Inbox Path not specified.");
     if (settings.OutboxPath.IsNullOrBlank()) throw new ArgumentException("Outbox Path not specified.");
     if (settings.ArchivePath.IsNullOrBlank()) throw new ArgumentException("Archive Path not specified.");
     if (settings.ErrorPath.IsNullOrBlank()) throw new ArgumentException("Error Path not specified.");
     if (settings.Extension.IsNullOrBlank()) throw new ArgumentException("File Extension not specified.");
     Settings = settings;
 }
Пример #2
0
        public FileSystemChannel(string inboxPath, IMessageSerializer serializer, string fileExtension = ".txt")
            : base(serializer)
        {
            if (inboxPath.IsNullOrBlank()) throw new ArgumentNullException("inboxPath");

            DirectoryInfo parentDirectory = Directory.GetParent(inboxPath);

            Settings = new FileSystemChannelSettings();
            Settings.InboxPath = inboxPath;
            Settings.OutboxPath = Path.Combine(parentDirectory.FullName, "Outbox");
            Settings.ArchivePath = Path.Combine(parentDirectory.FullName, "Archived");
            Settings.ErrorPath = Path.Combine(parentDirectory.FullName, "Error");
            Settings.ErrorPath = Path.Combine(parentDirectory.FullName, "Error");
            Settings.Extension = fileExtension;
        }