public CopyWorker(IFileSystem fileSystem, IFileHelper fileHelper, IContext uiContext, IBackgroundWorker backgroundWorker, IUniqueCharsGenerator charsGenerator) { if (fileSystem == null) { throw new ArgumentNullException("fileSystem"); } if (fileHelper == null) { throw new ArgumentNullException("fileHelper"); } if (uiContext == null) { throw new ArgumentNullException("uiContext"); } if (backgroundWorker == null) { throw new ArgumentNullException("backgroundWorker"); } if (charsGenerator == null) { throw new ArgumentNullException("charsGenerator"); } _fileSystem = fileSystem; _fileHelper = fileHelper; _uiContext = uiContext; _backgroundWorker = backgroundWorker; _charsGenerator = charsGenerator; }
public string GenerateUniqueFileName(AppFile file, IUniqueCharsGenerator generator, UniqueCharsPosition position) { if (file == null) { throw new ArgumentNullException("file"); } if (generator == null) { throw new ArgumentNullException("generator"); } string uniqueID = generator.Generate(); StringBuilder sb = new StringBuilder(); if (position == UniqueCharsPosition.Prefix) { sb.AppendFormat("{0}_", uniqueID); } sb.AppendFormat("{0}", file.FileNameWithoutExtension); if (position == UniqueCharsPosition.Suffix) { sb.AppendFormat("_{0}", uniqueID); } sb.AppendFormat("{0}", file.FileExtension); return(sb.ToString()); }
public string GenerateUniqueFileName(AppFile file, IUniqueCharsGenerator generator, UniqueCharsPosition position) { if (file == null) { throw new ArgumentNullException("file"); } if (generator == null) { throw new ArgumentNullException("generator"); } string uniqueID = generator.Generate(); StringBuilder sb = new StringBuilder(); if (position == UniqueCharsPosition.Prefix) { sb.AppendFormat("{0}_", uniqueID); } sb.AppendFormat("{0}", file.FileNameWithoutExtension); if (position == UniqueCharsPosition.Suffix) { sb.AppendFormat("_{0}", uniqueID); } sb.AppendFormat("{0}", file.FileExtension); return sb.ToString(); }
public CopyWorker(IFileSystem fileSystem, IFileHelper fileHelper, IContext uiContext, IBackgroundWorker backgroundWorker, IUniqueCharsGenerator charsGenerator) { if (fileSystem == null) throw new ArgumentNullException("fileSystem"); if (fileHelper == null) throw new ArgumentNullException("fileHelper"); if (uiContext == null) throw new ArgumentNullException("uiContext"); if (backgroundWorker == null) throw new ArgumentNullException("backgroundWorker"); if (charsGenerator == null) throw new ArgumentNullException("charsGenerator"); _fileSystem = fileSystem; _fileHelper = fileHelper; _uiContext = uiContext; _backgroundWorker = backgroundWorker; _charsGenerator = charsGenerator; }