//export hasła do tymczasowego pliku Html
        private static void ExecuteExportToHtml(List <DictionaryPasswordElement> elements)
        {
            var dictionaryPasswordElements = new ObservableCollection <DictionaryPasswordElement>(elements);

            var textDocumentAdv = HtmlParsing.ParsowanieHtml(dictionaryPasswordElements);

            using (var t = File.Create(Path.GetTempPath() + @"\temp.html"))
            {
                HTMLExporting.ConvertToHtml(textDocumentAdv, t);
            }
        }
Esempio n. 2
0
        //zapis jako... zanalizowanego hasła do pliku
        private void ExecuteSaveAsCommand()
        {
            if (_recognizePasswordListObservableCollection.Count <= 0)
            {
                return;
            }

            var saveFileDialog = new SaveFileDialog
            {
                DefaultExt = ".txt",
                Filter     =
                    "JSON (*.json)|*.json|" +
                    "html (*.html)|*.html|" +
                    "Plain text (*.txt)|*.txt",

                Title = "Zapis"
            };

            var result = saveFileDialog.ShowDialog();

            if (result != true)
            {
                return;
            }
            switch (saveFileDialog.FilterIndex)
            {
            case 1:
                File.WriteAllText(saveFileDialog.FileName,
                                  JsonConvert.SerializeObject(_recognizePasswordListObservableCollection,
                                                              Formatting.Indented));
                break;

            case 2:
                HTMLExporting.ConvertToHtml(HtmlParsing.ParsowanieHtml(_recognizePasswordListObservableCollection), File.Create(saveFileDialog.FileName));
                break;

            default:
                File.WriteAllText(saveFileDialog.FileName, ConvertToTxt(_recognizePasswordListObservableCollection));
                break;
            }
        }
Esempio n. 3
0
        //save page text to dictionary
        private void ExecuteSavePageCommand()
        {
            var dictionaryParagraph = GenerateDictionaryParagrapsFromDocumentAdv(_documentAdv);

            var saveFileDialog = new SaveFileDialog
            {
                DefaultExt = ".txt",
                Filter     =
                    "JSON (*.json)|*.json|" +
                    "html (*.html)|*.html|" +
                    "Plain text (*.txt)|*.txt",

                Title = "Zapis tekstu"
            };

            var result = saveFileDialog.ShowDialog();

            if (result != true)
            {
                return;
            }
            switch (saveFileDialog.FilterIndex)
            {
            case 1:
                File.WriteAllText(saveFileDialog.FileName, JsonConvert.SerializeObject(dictionaryParagraph, Formatting.Indented));
                break;

            case 2:
                HTMLExporting.ConvertToHtml(_documentAdv, File.Create(saveFileDialog.FileName));
                break;

            default:
                File.WriteAllText(saveFileDialog.FileName, dictionaryParagraph);
                break;
            }
        }