-
Notifications
You must be signed in to change notification settings - Fork 1
/
ebootlogos.vb
219 lines (204 loc) · 9.34 KB
/
ebootlogos.vb
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
Public Class ebootlogos
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Result
BootLogo = FileOpenDialog("*.png", "Desktop")
If BootLogo = "" Then Exit Sub
'check folder exists
If Directory_Exists(tempPath) = False Then Create_Directory(tempPath)
'copy new file
Result = File_Copy(BootLogo, tempPath & "\BootLogoCustom.png", True)
If File_Exists(BootLogo) = True Then
'get file size
Dim Bmp As Bitmap = Bitmap.FromFile(BootLogo)
If GetFileSize(BootLogo) > 100000 And Bmp.Width > 320 And Bmp.Height > 480 Then
MsgBox("The Image's file size is too big, and the image size is larger than 320 x 480 pixels", MsgBoxStyle.Information)
Exit Sub
End If
If GetFileSize(BootLogo) > 100000 Then
MsgBox("Image File size is too large", MsgBoxStyle.Information)
Exit Sub
End If
'get dimensions
If Bmp.Width > 320 Or Bmp.Height > 480 Then
MsgBox("Image must not be larger than 320 x 480 pixels", MsgBoxStyle.Information)
Exit Sub
End If
If Bmp.Height = 320 And Bmp.Height = 480 Then
picBootLogo.SizeMode = PictureBoxSizeMode.StretchImage
End If
If Bmp.Width < 320 And Bmp.Height < 480 Then
picBootLogo.SizeMode = PictureBoxSizeMode.CenterImage
End If
If Bmp.Height > 463 Or Bmp.Width > 107 Then
picBootLogo.SizeMode = PictureBoxSizeMode.StretchImage
End If
Me.picBootLogo2.Visible = False
Me.picBootLogo.ImageLocation = tempPath & "\BootLogoCustom.png"
BootLogo = "BootLogoCustom.png"
End If
End Sub
Private Function FileOpenDialog(ByVal strExtension As String, ByVal strInitDir As String) As String
Dim oFileDialog As New System.Windows.Forms.OpenFileDialog()
'Dim strfilter As String = BuildFilter(strExtension)
FileOpenDialog = ""
With oFileDialog
.Filter = "PNG Image File (*.png) |*.png;"
.DefaultExt = strExtension
.InitialDirectory = strInitDir
.ShowDialog()
If Windows.Forms.DialogResult.OK Then
FileOpenDialog = .FileName
ElseIf Windows.Forms.DialogResult.Cancel Then
End If
End With
End Function
Private Sub arrow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arrow.Click
Expert.MdiParent = MDIMain
Expert.Show()
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Result
RecoveryLogo = FileOpenDialog("*.png", "Desktop")
If RecoveryLogo = "" Then Exit Sub
'check folder exists
If Directory_Exists(tempPath) = False Then Create_Directory(tempPath)
'copy new file
Result = File_Copy(RecoveryLogo, tempPath & "\RecoveryLogoCustom.png", True)
If File_Exists(RecoveryLogo) = True Then
'get file size
Dim Bmp As Bitmap = Bitmap.FromFile(RecoveryLogo)
If GetFileSize(RecoveryLogo) > 100000 And Bmp.Width > 320 And Bmp.Height > 480 Then
MsgBox("The Image's file size is too big, and the image size is larger than 320 x 480 pixels", MsgBoxStyle.Information)
Exit Sub
End If
If GetFileSize(RecoveryLogo) > 102400 Then
MsgBox("Image File size is too large", MsgBoxStyle.Information)
Exit Sub
End If
'get dimensions
If Bmp.Width > 320 Or Bmp.Height > 480 Then
MsgBox("Image must not be larger than 320 x 480 pixels", MsgBoxStyle.Information)
Exit Sub
End If
If Bmp.Height = 320 And Bmp.Height = 480 Then
picRecoveryLogo.SizeMode = PictureBoxSizeMode.StretchImage
End If
If Bmp.Width < 320 And Bmp.Height < 480 Then
picRecoveryLogo.SizeMode = PictureBoxSizeMode.CenterImage
End If
If Bmp.Height > 463 Or Bmp.Width > 107 Then
picRecoveryLogo.SizeMode = PictureBoxSizeMode.StretchImage
End If
'463, 107
Me.picRecoveryLogo2.Visible = False
Me.picRecoveryLogo.ImageLocation = tempPath & "\RecoveryLogoCustom.png"
RecoveryLogo = "RecoveryLogoCustom.png"
picRecoveryLogo2.SizeMode = PictureBoxSizeMode.CenterImage
End If
End Sub
Private Sub ebootlogos_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IPSWVersion = "4.0" Or IPSWVersion = "4.0.1" Or IPSWVersion = "4.0.2" Or IPSWVersion = "4.1" Then
chkVerbose.Visible = True
Else
chkVerbose.Visible = False
End If
Expert.buildcheck.Hide()
Expert.cpcheck.Hide()
Expert.uncheck.Hide()
Expert.generalcheck.Hide()
Expert.logocheck.Hide()
'load images if already selected
If BootLogo = "BootLogoCustom.png" Then
Me.picBootLogo2.Visible = False
Me.picBootLogo.ImageLocation = tempPath & "\BootLogoCustom.png"
End If
If RecoveryLogo = "RecoveryLogoCustom.png" Then
Me.picRecoveryLogo2.Visible = False
Me.picRecoveryLogo.ImageLocation = tempPath & "\RecoveryLogoCustom.png"
End If
If iPhoneModel = "iPod Touch 3G" Or iPod2GModel = "MC" Or NORFlashDisabled = True Then
picBootLogo.Visible = False
picBootLogo2.Visible = False
picRecoveryLogo.Visible = False
picRecoveryLogo2.Visible = False
chkVerbose.Visible = False
UseCustomRecoveryLogo = False
UseCustomBootLogo = False
chkUseCustomBootLogo.Checked = False
chkUseCustomRecoveryLogo.Checked = False
Button2.Enabled = False
Button1.Enabled = False
Else
picBootLogo.Visible = True
picBootLogo2.Visible = True
picRecoveryLogo.Visible = True
picRecoveryLogo2.Visible = True
chkVerbose.Visible = True
UseCustomRecoveryLogo = True
UseCustomBootLogo = True
chkUseCustomBootLogo.Checked = True
chkUseCustomRecoveryLogo.Checked = True
Button2.Enabled = True
Button1.Enabled = True
End If
If iPhoneModel = "iPod Touch 2G" Then
chkVerbose.Visible = False
End If
End Sub
Private Sub logo2_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logo2.MouseEnter
logo2.Image = My.Resources.Flakeselect
End Sub
Private Sub logo2_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logo2.MouseLeave
logo2.Image = My.Resources.Flake
End Sub
Private Sub arrow_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arrow.MouseEnter
arrow.Image = My.Resources.Arrowhilite
End Sub
Private Sub arrow_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles arrow.MouseDown
arrow.Image = My.Resources.arrowpress
End Sub
Private Sub arrow_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arrow.MouseLeave
arrow.Image = My.Resources.Arrow
End Sub
Private Sub arrow_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles arrow.MouseUp
arrow.Image = My.Resources.Arrowhilite
End Sub
Private Sub chkUseCustomBootLogo_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkUseCustomBootLogo.CheckedChanged
If iPhoneModel = "iPod Touch 3G" Or iPod2GModel = "MC" Then
chkUseCustomRecoveryLogo.Checked = False
chkUseCustomBootLogo.Checked = False
Button1.Enabled = False
Button2.Enabled = False
End If
If chkUseCustomBootLogo.Checked = True Then
picBootLogo2.Image = My.Resources.Flake
UseCustomBootLogo = True
Button1.Enabled = True
Else
UseCustomBootLogo = False
Button1.Enabled = False
End If
End Sub
Private Sub chkUseCustomRecoveryLogo_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkUseCustomRecoveryLogo.CheckedChanged
If iPhoneModel = "iPod Touch 3G" Or iPod2GModel = "MC" Then
chkUseCustomRecoveryLogo.Checked = False
chkUseCustomBootLogo.Checked = False
Button1.Enabled = False
End If
If chkUseCustomRecoveryLogo.Checked = True Then
UseCustomRecoveryLogo = True
Else
UseCustomRecoveryLogo = False
End If
End Sub
Private Sub chkVerbose_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkVerbose.CheckedChanged
If chkVerbose.Checked = True Then
chkUseCustomBootLogo.Checked = True
UseCustomBootLogo = True
VerboseMode = True
Else
VerboseMode = False
End If
End Sub
End Class