/// <summary>
 /// Constructor for the file manager.
 /// </summary>
 /// <remarks>This action requires editor rights.</remarks>
 public FileManagerController(ApplicationSettings settings, UserServiceBase userManager, IUserContext context,
     SettingsService settingsService, AttachmentFileHandler attachment)
     : base(settings, userManager, context, settingsService)
 {
     _attachmentHandler = attachment;
     _attachmentPathUtil = new AttachmentPathUtil(settings);
 }
		public void Setup()
		{
			_settings = new ApplicationSettings();
			_settings.AttachmentsFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Attachments");
			_attachmentPathUtil = new AttachmentPathUtil(_settings);

			try
			{
				// Delete any existing attachments folder

				// Remove the files 1st
				if (Directory.Exists(_settings.AttachmentsFolder))
				{
					DirectoryInfo directoryInfo = new DirectoryInfo(_settings.AttachmentsFolder);
					foreach (FileInfo file in directoryInfo.GetFiles())
					{
						File.Delete(file.FullName);
					}

					if (directoryInfo.Exists)
					{
						directoryInfo.Attributes = FileAttributes.Normal;
						directoryInfo.Delete(true);
					}
				}
				Directory.CreateDirectory(_settings.AttachmentsFolder);
			}
			catch (IOException e)
			{
				Assert.Fail("Unable to delete the attachments folder " + _settings.AttachmentsFolder + ", does it have a lock?" + e.ToString());
			}
		}
		private static readonly string[] FilesToExclude = new string[] { "emptyfile.txt", "_installtest.txt" }; // installer/publish files

		#endregion

		#region constructors

		public LocalFileService(ApplicationSettings settings, SettingsService settingsService)
		{
			_applicationSettings = settings;
			_settingsService = settingsService;
			_attachmentPathUtil = new AttachmentPathUtil(settings);
		}