-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathTransferForm.cs
73 lines (57 loc) · 2.35 KB
/
TransferForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Windows.Forms;
using System.IO;
namespace DOOMSaveManager
{
public partial class TransferForm : Form
{
public DoomEternalSavePath SrcSave;
public DoomEternalSavePath DstSave;
private string[] uids;
public TransferForm() {
InitializeComponent();
}
private void TransferForm_Load(object sender, EventArgs e) {
DoomEternal.EnumerateSaves();
uids = DoomEternal.Saves.GetIdentifiers();
srcComboBox.Items.AddRange(uids);
dstComboBox.Items.AddRange(uids);
if (srcComboBox.Items.Count > 0)
srcComboBox.SelectedIndex = 0;
if (dstComboBox.Items.Count > 0)
dstComboBox.SelectedIndex = 0;
}
private void transferOkBtn_Click(object sender, EventArgs e) {
if (!DoomEternal.Saves.SaveExists(srcComboBox.Text, out SrcSave)) {
MessageBox.Show("Invalid source!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!DoomEternal.Saves.SaveExists(dstComboBox.Text, out DstSave)) {
MessageBox.Show("Invalid destination!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!SrcSave.Exists()) {
MessageBox.Show("Source directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!DstSave.Exists()) {
MessageBox.Show("Destination directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
DialogResult = DialogResult.OK;
}
private void transferCancelBtn_Click(object sender, EventArgs e) {
DialogResult = DialogResult.Cancel;
}
private void srcComboBox_SelectedValueChanged(object sender, EventArgs e) {
dstComboBox.Items.Clear();
dstComboBox.Items.AddRange(uids);
// dstComboBox.Items.Add("savegame.unencrypted");
dstComboBox.Items.Remove(((ComboBox)sender).Text);
if (dstComboBox.Items.Count > 0)
dstComboBox.SelectedIndex = 0;
}
private void dstComboBox_SelectedValueChanged(object sender, EventArgs e) {
}
}
}