-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathAppList.cs
84 lines (76 loc) · 2.64 KB
/
AppList.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Brake
{
public partial class AppList : Form
{
public Thread crackThread;
private static Container xml;
private CrackProcess crackProcess;
public AppList()
{
InitializeComponent();
xml = Brake.Container.getContainer();
AppHelper.getIPAs(xml.Config.ipaDir);
var items = listView1.Items;
int i = 0;
foreach (IPAInfo info in xml.IPAItems)
{
ListViewItem item = new ListViewItem(info.AppName + " (" + info.AppVersion + ")");
item.Tag = i;
listView1.Items.Add(item);
i++;
}
listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void beginCrackProcess()
{
crackProcess.Show();
crackThread = new Thread(new ThreadStart(crackProcess.runQueue));
crackThread.Start();
//cp.beginCracking();
}
private void crack(List<int> list)
{
if ((crackThread != null) && (crackThread.IsAlive))
{
MessageBox.Show("Already cracking an app, please wait!");
return;
}
crackProcess = new CrackProcess();
foreach (int tag in list)
{
IPAInfo info = xml.IPAItems[tag];
Console.WriteLine("selected " + info.AppBundle + " " + info.Location);
crackProcess.queueIPA(info);
}
beginCrackProcess();
}
private void crackButton_Click(object sender, EventArgs e)
{
List<int> list = listView1.SelectedItems.Cast<ListViewItem>().Select(x => (int) x.Tag).ToList();
crack(list);
}
private void form_closing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
private void crackAllButton_Click(object sender, EventArgs e)
{
List<int> list = listView1.Items.Cast<ListViewItem>().Select(x => (int)x.Tag).ToList();
crack(list);
}
}
}