public void Run() { var settings = settingsProvider.GetSettings(); var file = fileInfoProvider.GetFileInfo(settings.InputFilePath); var textReader = textReaderSelector.GetTextReader(file); var rawWords = textReader.ReadWords(file).ToList(); var preparedWords = wordProcessor.PrepareWords(rawWords).ToList(); var sizedWords = wordSizeSetter.GetSizedWords(preparedWords, settings.PictureConfig).ToList(); var bitmap = tagCloudGenerator.GetTagCloudBitmap(sizedWords); imageFormat.SaveImage(bitmap, settings.OutputFilePath); }
/// <summary> /// copy a file - the containing folder will be created if it does not exist /// </summary> /// <param name="sourceFileName">source pathname</param> /// <param name="destinationFileName">destination pathname</param> /// <param name="allowOverwrite">set to true to overwrite an existing file</param> public void FileCopy(string sourceFileName, string destinationFileName, bool allowOverwrite) { if (!MtpPath.IsMtpPath(sourceFileName) && !MtpPath.IsMtpPath(destinationFileName)) { _fileUtilities.FileCopy(sourceFileName, destinationFileName, allowOverwrite); } else { var sourceFileInfo = _fileInfoProvider.GetFileInfo(sourceFileName); using (var sourceStream = OpenReadStream(sourceFileName)) { using (var destinationStream = OpenWriteStream(destinationFileName, sourceFileInfo.Length, allowOverwrite)) { _streamHelper.Copy(sourceStream, destinationStream); } } } }
public string GetFileInfo(IFileInfoProvider provider, string columnName, ShellItem item) { string retVal = string.Empty; ShellAPI.STATSTG info = provider.GetFileInfo(); switch (columnName) { case "Size": #region Size { retVal = GetSizeString(info.cbSize); } #endregion break; case "Date Created": #region Date Created { DateTime dateTime = ShellAPI.FileTimeToDateTime(info.ctime); string time = dateTime.ToLongTimeString(); retVal = string.Format("{0} {1}", dateTime.ToShortDateString(), time.Remove(time.Length - 3, 3)); } #endregion break; case "Date Modified": #region Date Modified { DateTime dateTime = ShellAPI.FileTimeToDateTime(info.mtime); string time = dateTime.ToLongTimeString(); retVal = string.Format("{0} {1}", dateTime.ToShortDateString(), time.Remove(time.Length - 3, 3)); } #endregion break; } return(retVal); }