-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.vb
More file actions
148 lines (120 loc) · 4.1 KB
/
Form1.vb
File metadata and controls
148 lines (120 loc) · 4.1 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
Imports System.IO
Imports System.Diagnostics
Public Class Form1
Private getFiles() As String
Private adb As adb = New adb(AddressOf AddCmd_, AddressOf AddLog_)
Private Sub AddLog_(m As String)
If m <> "" Then
TextBox1.Text &= m & vbNewLine
End If
End Sub
Private Sub AddCmd_(m As String)
If m <> "" Then
TextBox2.Text &= m & vbNewLine
End If
End Sub
Private Sub Form1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
getFiles = CType(e.Data.GetData(DataFormats.FileDrop), String())
Me.Cursor = Cursors.WaitCursor
If adb.SerchProcess = False Then
adb.Start()
End If
Select Case ComboBox3.SelectedIndex
Case 0
adbpush()
Case 1
install()
Case 2
install("-r ")
End Select
Me.Cursor = Cursors.Default
End Sub
Private Sub Form1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) = False Then
Return
End If
Dim FilePath() As String = CType(e.Data.GetData(DataFormats.FileDrop), String())
For idx As Integer = 0 To FilePath.Length - 1
If Not File.Exists(FilePath(idx)) Then
Return
End If
If ComboBox3.SelectedIndex <> 0 Then
If String.Compare(Path.GetExtension(FilePath(idx)), ".apk", True) <> 0 Then
Return
End If
End If
Next idx
e.Effect = DragDropEffects.Copy
End Sub
Private Sub SetPushDirCMB()
With ComboBox1.Items
.Clear()
.Add("/data/local/tmp")
.Add("/data/local")
.Add("/data/root")
.Add("/system/app")
.Add("/system/etc")
.Add("/system/lib")
.Add("/system/framework")
.Add("/system/xbin")
.Add("/system/vendor")
.Add("/system/usr")
.Add("/system/lib/hw")
.Add("/system/lib/egl")
End With
ComboBox1.SelectedIndex = 0
End Sub
Private Sub SetAnyCMB()
With ComboBox2.Items
.Clear()
.Add("0777")
.Add("0666")
.Add("0755")
.Add("0644")
End With
With ComboBox3.Items
.Clear()
.Add("ファイル転送")
.Add("インストール")
.Add("アップデート")
End With
ComboBox2.SelectedIndex = 0
ComboBox3.SelectedIndex = 0
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ArgCmd As String = Microsoft.VisualBasic.Command()
SetPushDirCMB()
SetAnyCMB()
If adb.SerchProcess = False Then
adb.Start()
End If
If ArgCmd.Length > 0 Then
ArgCmd = ArgCmd.Replace("""", "")
If File.Exists(ArgCmd) Then
getFiles = {ArgCmd}
adbpush()
End If
End If
End Sub
Private Sub adbpush()
If ComboBox1.Text = "" Then
MessageBox.Show("push先どこ?")
Return
End If
adb.Push(getFiles, ComboBox1.Text, ComboBox2.Text)
End Sub
Private Sub install(Optional ByVal m As String = "")
adb.Install(getFiles, m)
End Sub
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
Dim b As Boolean = (ComboBox3.SelectedIndex = 0)
ComboBox1.Enabled = b
ComboBox2.Enabled = b
End Sub
Private Sub TextBox1_DoubleClick(sender As Object, e As System.EventArgs) Handles TextBox1.DoubleClick
TextBox1.Text = ""
End Sub
Private Sub TextBox2_DoubleClick(sender As Object, e As System.EventArgs) Handles TextBox2.DoubleClick
TextBox2.Text = ""
End Sub
End Class