public CompareWindow(SaveMeta src, SaveMeta dst, string devName, Action toDoIfUserWantsDst, Action finalw)
 {
     InitializeComponent();
     srcItem.GiveMeta(src);
     dstItem.GiveMeta(dst);
     ifDst           = toDoIfUserWantsDst;
     final           = finalw;
     title.Content   = $"This save slot is already in use in {devName}";
     srcDesc.Content = $"currently in {devName}";
 }
Beispiel #2
0
        private void SD2toSD1_Click(object sender, RoutedEventArgs e)
        {
            if (CannotCopy(SD2s))
            {
                return;
            }
            TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Indeterminate;
            IStorageDevice sd          = storageDevices[StorageDevice2.SelectedIndex];
            SaveMeta       currentmeta = sd2Saves[SD2s.SelectedIndex];

            NamedStream[] files = sd.ReadSave(currentmeta.directory);
            CopySave(currentmeta, GetMetaFromID(sd1Saves, GetGameID(currentmeta.directory)), files, storageDevices[StorageDevice1.SelectedIndex], 1);
        }
Beispiel #3
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();
            }
        }
Beispiel #4
0
 public void GiveMeta(SaveMeta a)
 {
     if (a != null)
     {
         this.GameName.Content  = a.name;
         this.GameInfo.Content  = a.info;
         this.GameInfo2.Content = a.info2;
         this.GameDate.Content  = a.timeModified.ToString();
         if (a.thumbnail != null)
         {
             this.MissingIcon.Visibility = Visibility.Hidden;
             this.GamePic.Source         = a.thumbnail;
         }
     }
     else
     {
         this.GameName.Content  = "Corrupted data (no PARAM.SFO)";
         this.GameInfo.Content  = "";
         this.GameInfo2.Content = "";
         this.GameDate.Content  = "???";
     }
 }
Beispiel #5
0
 public SaveListItem(SaveMeta b)
 {
     InitializeComponent();
     GiveMeta(b);
 }
Beispiel #6
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);
            }
        }