-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathselectapkform.cs
More file actions
173 lines (154 loc) · 5.33 KB
/
selectapkform.cs
File metadata and controls
173 lines (154 loc) · 5.33 KB
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
164
165
166
167
168
169
170
171
172
173
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
///CODED BY RAFIG ZARBALIYEV\\\
/// INSTAGRAM @rafok2v9c \\\
namespace APKdevastate
{
public partial class selectapkform : Form
{
private bool isMouseDown = false;
private Point lastLocation;
public string SelectedApkPath { get; private set; }
public selectapkform()
{
InitializeComponent();
this.surusdurmekpaneli.MouseDown += new MouseEventHandler(surusdurmekpaneli_MouseDown);
this.surusdurmekpaneli.MouseMove += new MouseEventHandler(surusdurmekpaneli_MouseMove);
this.surusdurmekpaneli.MouseUp += new MouseEventHandler(surusdurmekpaneli_MouseUp);
this.AllowDrop = true;
this.DragEnter += selectapkform_DragEnter;
this.DragDrop += selectapkform_DragDrop;
this.Load += selectapkform_Load;
}
private void selectapkform_Load(object sender, EventArgs e)
{
if (!IsJavaInstalled())
{
MessageBox.Show(
"Java is not installed on your system!\n\n" +
"APKdevastate requires Java to analyze APK files.\n" +
"Please install Java (JDK or JRE) and try again.\n\n",
"Java Not Found",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
Application.Exit();
}
}
private bool IsJavaInstalled()
{
try
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "java",
Arguments = "-version",
RedirectStandardError = true,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};
using (Process process = Process.Start(startInfo))
{
process.WaitForExit();
return process.ExitCode == 0;
}
}
catch
{
return false;
}
}
private void surusdurmekpaneli_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
isMouseDown = true;
lastLocation = e.Location;
}
}
private void surusdurmekpaneli_MouseMove(object sender, MouseEventArgs e)
{
if (isMouseDown)
{
this.Location = new Point(
(this.Location.X - lastLocation.X) + e.X,
(this.Location.Y - lastLocation.Y) + e.Y
);
}
}
private void surusdurmekpaneli_MouseUp(object sender, MouseEventArgs e)
{
isMouseDown = false;
}
private void pictureBox2_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void pictureBox3_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void yeniproyektbutton_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Title = "Select an APK File";
openFileDialog.Filter = "APK File (*.apk)|*.apk";
openFileDialog.Multiselect = false;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
SelectedApkPath = openFileDialog.FileName;
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}
private void selectapkform_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files.Length == 1 && Path.GetExtension(files[0]).ToLower() == ".apk")
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void selectapkform_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files.Length > 0)
{
string apkPath = files[0];
if (Path.GetExtension(apkPath).ToLower() == ".apk")
{
SelectedApkPath = apkPath;
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
//MessageBox.Show("erro", "erro", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}
}