void RefreshArchiveLocation()
        {
            var templateService = new TemplateProcessingService();

            var archivePath = templateService.ProcessTemplate(LocationPattern);
            ArchiveLocation = new DirectoryInfo(archivePath);

            if (!ArchiveLocation.Exists)
                ArchiveLocation.Create();
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            if (Archive != null)
                Archive.Attach(this);
            
            var templateService = new TemplateProcessingService();

            var fileDirectoryPath = templateService.ProcessTemplate(FileLocationPattern);
            var fileName = templateService.ProcessTemplate(FileNamePattern);

            LogFile = new FileInfo(Path.Combine(fileDirectoryPath, fileName));

            Directory.CreateDirectory(fileDirectoryPath);

            if(FileLockingStrategy == null)
            {
                Logger.Warning(() => "File Locking Strategy not specified, Single Process Locking will be used for " + SinkLocation.ToString());
                FileLockingStrategy = SingleProcessLockingStrategy.Instance;
            }

            if (BeforeInitialized != null)
                BeforeInitialized(this, EventArgs.Empty);
        }