Esempio n. 1
0
        private void ExportProfiles_Click(object sender, RoutedEventArgs e)
        {
            var(stableExists, stableJson)   = SSHToProfileConverter.GenerateSettings(App.WtSettings);
            var(previewExists, previewJson) = SSHToProfileConverter.GenerateSettings(App.WtPreviewSettings);
            var backupPaths = new List <string>();

            if (stableExists)
            {
                backupPaths.Add(App.BackupFile(App.WtSettings, "stable-"));
                File.WriteAllText(App.WtSettings, stableJson);
            }

            if (previewExists)
            {
                backupPaths.Add(App.BackupFile(App.WtPreviewSettings, "preview-"));
                File.WriteAllText(App.WtPreviewSettings, previewJson);
            }

            var message = "Successfully exported all know SSH hosts into Windows Terminal profiles.\nA backup from your old config(s) can be found here:";

            foreach (var path in backupPaths)
            {
                message += $"\n\n - {path}";
            }

            MessageBox.Show(message, "Profiles exported", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Esempio n. 2
0
        private void ExportProfiles_Click(object sender, RoutedEventArgs e)
        {
            var exporter = new SSHToProfileConverter();
            var json     = exporter.GenerateSettings();


            var backupPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Path.GetFileName(exporter.WtSettings) + ".bak");

            File.Copy(exporter.WtSettings, backupPath, true);
            File.WriteAllText(exporter.WtSettings, json);
            MessageBox.Show($"Successfully exported all know SSH hosts into Windows Terminal profiles.\nA backup from your old config has been created at\n\n{backupPath}", "Profiles exported", MessageBoxButton.OK, MessageBoxImage.Information);
        }