public void SetCreateDateTest() { var fileSystem = new FileSystem(); var fileAttributeSetter = new FileAttributeSetter(fileSystem) { CreateDateTime = DateTime.Parse("2004-09-14 09:14 AM"), IsRecurse = true, IsIgnoreErrors = true, FileSearch = "*.*", DirectorySearch = "*", Root = @"D:\Projects\Really Bad\ReallyBad.Libraries", }; fileAttributeSetter.Execute(); fileAttributeSetter.Root = @"D:\Projects\Really Bad\FileOrganizer"; fileAttributeSetter.Execute(); }
/// <summary> /// Creates an <see cref="IAttributeSetter" /> for the given /// <see cref="Type" />. /// </summary> /// <param name="attributeType">The <see cref="Type" /> for which an <see cref="IAttributeSetter" /> should be created.</param> /// <returns> /// An <see cref="IAttributeSetter" /> for the given <see cref="Type" />. /// </returns> private IAttributeSetter CreateAttributeSetter(Type attributeType) { if (AttributeSetters.ContainsKey(attributeType)) { return (IAttributeSetter) AttributeSetters[attributeType]; } IAttributeSetter attributeSetter = null; if (attributeType.IsEnum) { attributeSetter = new EnumAttributeSetter(); } else if (attributeType == typeof(Encoding)) { attributeSetter = new EncodingAttributeSetter(); } else if (attributeType == typeof(FileInfo)) { attributeSetter = new FileAttributeSetter(); } else if (attributeType == typeof(DirectoryInfo)) { attributeSetter = new DirectoryAttributeSetter(); } else if (attributeType == typeof(PathSet)) { attributeSetter = new PathSetAttributeSetter(); } else if (attributeType == typeof(Uri)) { attributeSetter = new UriAttributeSetter(); } else { attributeSetter = new ConvertableAttributeSetter(); } if (attributeSetter != null) { AttributeSetters.Add(attributeType, attributeSetter); } return attributeSetter; }