-
Notifications
You must be signed in to change notification settings - Fork 51
/
DonorsListView.cs
163 lines (146 loc) · 5.54 KB
/
DonorsListView.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace AndroidSideloader
{
public partial class DonorsListViewForm : Form
{
private bool mouseDown;
private Point lastLocation;
public DonorsListViewForm()
{
InitializeComponent();
Donors.initDonorGames();
List<ListViewItem> DGameList = new List<ListViewItem>();
foreach (string[] release in Donors.donorGames)
{
ListViewItem DGame = new ListViewItem(release);
DGameList.Add(DGame);
}
ListViewItem[] arr = DGameList.ToArray();
DonorsListView.BeginUpdate();
DonorsListView.Items.Clear();
DonorsListView.Items.AddRange(arr);
DonorsListView.EndUpdate();
}
public static string DonorsLocal = MainForm.donorApps;
public static bool ifuploads = false;
public static string newAppsForList = "";
private void DonorsListViewForm_Load(object sender, EventArgs e)
{
MainForm.updatesNotified = true;
if (MainForm.updates && MainForm.newapps)
{
bothdet.Visible = true;
}
else if (MainForm.updates && !MainForm.newapps)
{
upddet.Visible = true;
}
else
{
newdet.Visible = true;
}
foreach (ListViewItem listItem in DonorsListView.Items)
{
if (listItem.SubItems[Donors.UpdateOrNew].Text.Contains("Update"))
{
listItem.BackColor = Color.FromArgb(0, 79, 97);
}
}
}
private async void DonateButton_Click(object sender, EventArgs e)
{
if (DonorsListView.CheckedItems.Count > 0)
{
bool uncheckednewapps = false;
foreach (ListViewItem listItem in DonorsListView.Items)
{
if (!listItem.Checked)
{
if (listItem.SubItems[Donors.UpdateOrNew].Text.Contains("New"))
{
uncheckednewapps = true;
newAppsForList += listItem.SubItems[Donors.GameNameIndex].Text + ";" + listItem.SubItems[Donors.PackageNameIndex].Text + "\n";
}
}
}
if (uncheckednewapps)
{
NewApps NewAppForm = new NewApps();
_ = NewAppForm.ShowDialog();
Hide();
}
else
{
Hide();
}
int count = DonorsListView.CheckedItems.Count;
_ = new string[count];
for (int i = 0; i < count; i++)
{
ulong vcode = Convert.ToUInt64(DonorsListView.CheckedItems[i].SubItems[Donors.VersionCodeIndex].Text);
if (DonorsListView.CheckedItems[i].SubItems[Donors.UpdateOrNew].Text.Contains("Update"))
{
await Program.form.extractAndPrepareGameToUploadAsync(DonorsListView.CheckedItems[i].SubItems[Donors.GameNameIndex].Text, DonorsListView.CheckedItems[i].SubItems[Donors.PackageNameIndex].Text, vcode, true);
}
else
{
await Program.form.extractAndPrepareGameToUploadAsync(DonorsListView.CheckedItems[i].SubItems[Donors.GameNameIndex].Text, DonorsListView.CheckedItems[i].SubItems[Donors.PackageNameIndex].Text, vcode, false);
}
ifuploads = true;
}
}
if (ifuploads)
{
MainForm.doUpload();
}
Close();
}
private void DonorsListView_ItemChecked(object sender, ItemCheckedEventArgs e)
{
SkipButton.Enabled = DonorsListView.CheckedItems.Count == 0;
DonateButton.Enabled = !SkipButton.Enabled;
}
private void SkipButton_Click(object sender, EventArgs e)
{
bool uncheckednewapps = false;
foreach (ListViewItem listItem in DonorsListView.Items)
{
if (!listItem.Checked)
{
if (listItem.SubItems[Donors.UpdateOrNew].Text.Contains("New"))
{
uncheckednewapps = true;
newAppsForList += listItem.SubItems[Donors.GameNameIndex].Text + ";" + listItem.SubItems[Donors.PackageNameIndex].Text + "\n";
}
}
}
if (uncheckednewapps)
{
NewApps NewAppForm = new NewApps();
_ = NewAppForm.ShowDialog();
}
Close();
}
private void DonorsListViewForm_MouseDown(object sender, MouseEventArgs e)
{
mouseDown = true;
lastLocation = e.Location;
}
private void DonorsListViewForm_MouseMove(object sender, MouseEventArgs e)
{
if (mouseDown)
{
Location = new Point(
Location.X - lastLocation.X + e.X, Location.Y - lastLocation.Y + e.Y);
Update();
}
}
private void DonorsListViewForm_MouseUp(object sender, MouseEventArgs e)
{
mouseDown = false;
}
}
}