public void Perform() { var dialog = new OpenFileDialog { Title = "Select file to build a tag cloud", CheckFileExists = false, Multiselect = false, DefaultExt = "txt", InitialDirectory = @"C:\Users\Public\Documents", Filter = "Текстовый документ |*.txt;*.doc;*.docx" }; var res = dialog.ShowDialog(); if (res != DialogResult.OK) { return; } SettingsForm.For(spiralParams).ShowDialog(); textReader.ReadAllText(dialog.FileName) .Then(text => textHandler.GetHandledWords(text)) .Then(handledWords => tagCloudBuilder.Build(handledWords)) .Then(tagCloud => cloudVisualizer.PrintTagCloud(tagCloud)) .OnFail(message => MessageBox.Show(message)); }
public void Perform() { var result = SettingsForm.For(spiralParams).ShowDialog(); if (result != DialogResult.OK) { return; } var text = textReader.ReadAllText(@"..\..\..\Examples\example.txt"); var handledWords = textHandler.GetHandledWords(text); var tagCloud = tagCloudBuilder.Build(handledWords); cloudVisualizer.PrintTagCloud(tagCloud); }
public void Perform() { var result = SettingsForm.For(spiralParams).ShowDialog(); if (result != DialogResult.OK) { return; } textReader.ReadAllText(@"..\..\..\Examples\example.txt") .Then(text => textHandler.GetHandledWords(text)) .Then(handledWords => tagCloudBuilder.Build(handledWords)) .Then(tagCloud => cloudVisualizer.PrintTagCloud(tagCloud)) .OnFail(message => MessageBox.Show(message)); }
public EnvCryptDat Load(DatFromFileLoaderOptions options) { if (!_myFile.Exists(options.DatFilePath)) { return(new EnvCryptDat() { Categories = new List <Category>() }); } var xmlFromFile = _xmlReader.ReadAllText(options.DatFilePath); if (string.IsNullOrWhiteSpace(xmlFromFile)) { throw new EnvCryptException("key file is empty: {0}", options.DatFilePath); } var xmlPoco = _xmlSerializationUtils.Deserialize(xmlFromFile); return(_xmlToPocoMapper.Map(xmlPoco)); }
public TKey Load(TLoadDetails keyFileDetails) { if (keyFileDetails == null || string.IsNullOrWhiteSpace(keyFileDetails.FilePath)) { throw new EnvCryptException("key file path cannot be empty"); } if (!_myFile.Exists(keyFileDetails.FilePath)) { throw new EnvCryptException("key file does not exist: {0}", keyFileDetails); } var xmlFromFile = _xmlReader.ReadAllText(keyFileDetails.FilePath); if (string.IsNullOrWhiteSpace(xmlFromFile)) { throw new EnvCryptException("key file is empty: {0}", keyFileDetails); } var xmlPoco = _xmlSerializationUtils.Deserialize(xmlFromFile); return(MapToKeyPoco(xmlPoco)); }