Exemplo n.º 1
0
        private void CustomBackup_Click(object sender, RoutedEventArgs e)
        {
            GameEntry           game   = gamesLst.SelectedItem as GameEntry;
            ManualArchiveWindow manual = new ManualArchiveWindow(game, this);

            if ((bool)manual.ShowDialog())
            {
                List <DetectedFile> selected_files = manual.getSelectedFiles();
                DateTime            right_now      = DateTime.Now;

                if (selected_files.Count > 0)
                {
                    string initial_directory;
                    if (last_archive_create == null)
                    {
                        initial_directory = Core.settings.backup_path;
                    }
                    else
                    {
                        initial_directory = last_archive_create;
                    }
                    ArchiveID archive = new ArchiveID(game.id, selected_files[0]);

                    StringBuilder initial_name = new StringBuilder(archive.ToString());

                    initial_name.Append(Core.owner_seperator + right_now.ToString().Replace('/', '-').Replace(':', '-'));

                    Microsoft.Win32.SaveFileDialog save = new Microsoft.Win32.SaveFileDialog();
                    save.Title            = Strings.GetLabelString("WhereSaveArchive");
                    save.AddExtension     = true;
                    save.InitialDirectory = initial_directory;
                    save.FileName         = initial_name.ToString();
                    ;
                    save.DefaultExt      = "gb7";
                    save.Filter          = Strings.GetLabelString("Gb7FileDescription") + " (*.gb7)|*.gb7";
                    save.OverwritePrompt = true;

                    if ((bool)save.ShowDialog(this))
                    {
                        string file = save.FileName;
                        beginBackup(game, selected_files, file, null);
                        last_archive_create = Path.GetDirectoryName(file);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void CustomBackup_Click(object sender, RoutedEventArgs e)
        {
            GameEntry game = gamesLst.SelectedItem as GameEntry;
            ManualArchiveWindow manual = new ManualArchiveWindow(game, this);
            if ((bool)manual.ShowDialog()) {

                List<DetectedFile> selected_files = manual.getSelectedFiles();
                DateTime right_now = DateTime.Now;

                if (selected_files.Count > 0) {
                    string initial_directory;
                    if (last_archive_create == null) {
                        initial_directory = Core.settings.backup_path;
                    } else {
                        initial_directory = last_archive_create;
                    }
                    ArchiveID archive = new ArchiveID(game.id, selected_files[0]);

                    StringBuilder initial_name = new StringBuilder(archive.ToString());

                    initial_name.Append(Core.owner_seperator + right_now.ToString().Replace('/', '-').Replace(':', '-'));

                    Microsoft.Win32.SaveFileDialog save = new Microsoft.Win32.SaveFileDialog();
                    save.Title = Strings.GetLabelString("WhereSaveArchive");
                    save.AddExtension = true;
                    save.InitialDirectory = initial_directory;
                    save.FileName = initial_name.ToString();
                    ;
                    save.DefaultExt = "gb7";
                    save.Filter = Strings.GetLabelString("Gb7FileDescription") + " (*.gb7)|*.gb7";
                    save.OverwritePrompt = true;

                    if ((bool)save.ShowDialog(this)) {
                        string file = save.FileName;
                        beginBackup(game, selected_files, file, null);
                        last_archive_create = Path.GetDirectoryName(file);
                    }
                }
            }
        }