예제 #1
0
        private void SD2Delete_Click(object sender, RoutedEventArgs e)
        {
            if (SD2s.SelectedIndex == -1)
            {
                return;
            }
            SaveMeta         srcMeta = sd2Saves[SD2s.SelectedIndex];
            IStorageDevice   sd      = storageDevices[StorageDevice2.SelectedIndex];
            MessageBoxResult a       = MessageBox.Show($"Delete {GetGameID(srcMeta.directory)} save file from {sd.GetDeviceName()}?", "Warning", MessageBoxButton.YesNo);

            if (a == MessageBoxResult.Yes)
            {
                sd.DeleteSave(GetGameID(srcMeta.directory));
                MessageBox.Show("Save file deleted");
                UpdateStorageDeviceItems();
            }
        }
예제 #2
0
        public void CopySave(SaveMeta srcMeta, SaveMeta otherMeta, NamedStream[] files, IStorageDevice dest, int updateDevice)
        {
            SetMgrEnabled(false);
            string id = GetGameID(srcMeta.directory);

            if (dest.HasSave(id))
            {
                if (otherMeta == null)
                {
                    MessageBoxResult a = MessageBox.Show("Save data in destination directory is corrupted (no PARAM.SFO file). Overwrite?", "", MessageBoxButton.YesNo);
                    if (a == MessageBoxResult.Yes)
                    {
                        dest.DeleteSave(GetGameID(srcMeta.directory));
                        dest.WriteSave(GetGameID(srcMeta.directory), files);
                        MessageBox.Show("Copied");
                    }
                    SetMgrEnabled(true);
                }
                else
                {
                    CompareWindow a = new CompareWindow(otherMeta, srcMeta, dest.GetDeviceName(),
                                                        delegate
                    {
                        try
                        {
                            dest.DeleteSave(GetGameID(srcMeta.directory));
                            dest.WriteSave(GetGameID(srcMeta.directory), files);
                            MessageBox.Show("Copied");
                        }
                        catch (IOException)
                        {
                            MessageBox.Show("Copy operation failed");
                        }

                        foreach (NamedStream b in files)
                        {
                            b.stream.Dispose();
                        }
                    },
                                                        delegate
                    {
                        TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;
                        SetMgrEnabled(true);
                        UpdateStorageDeviceItems(updateDevice);
                    });
                    a.Show();
                }

                /*MessageBoxResult a = MessageBox.Show($"Destination already has a {GetGameID(srcMeta.directory)} save file. Overwrite?", "Warning", MessageBoxButton.YesNo);
                 * if (a == MessageBoxResult.No)
                 * {
                 *  SD1s.IsEnabled = true;
                 *  SD2s.IsEnabled = true;
                 *  return;
                 * }
                 * else
                 * {
                 *  dest.DeleteSave(GetGameID(srcMeta.directory));
                 * }*/
            }
            else
            {
                try
                {
                    dest.WriteSave(GetGameID(srcMeta.directory), files);
                    MessageBox.Show("Copied");
                }
                catch (IOException)
                {
                    MessageBox.Show("Copy operation failed");
                }

                foreach (NamedStream b in files)
                {
                    b.stream.Dispose();
                }
                TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;
                SetMgrEnabled(true);
                UpdateStorageDeviceItems(updateDevice);
            }
        }