-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWindow1.xaml.vb
1944 lines (1644 loc) · 84.3 KB
/
Window1.xaml.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports System.ComponentModel
Imports System.IO
Imports System.Threading
Imports Microsoft.Win32
Imports System.Security.Cryptography
Imports System.Windows.Threading
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports MaterialDesignThemes.Wpf
Public Class Window1
Private ReadOnly secondWindow As MainWindow
Private starting_config As String
Public Videolaunch As String
Private firstLine As String = String.Empty
Private secondLine As String = String.Empty
Private thirdLine As String = String.Empty
Private fourLine As String = String.Empty
Private fifthLine As String = String.Empty
Private sixthLine As String = String.Empty
Private seventhLine As String = String.Empty
Private eighthLine As String = String.Empty
Private ninthLine As String = String.Empty
Private tenthLine As String = String.Empty
Private Line11 As String = String.Empty
Private Line12 As String = String.Empty
Private Line13 As String = String.Empty
Private Line14 As String = String.Empty
Private Line15 As String = String.Empty
Private Line16 As String = String.Empty
Private Line17 As String = String.Empty
Private Line18 As String = String.Empty
Private zt As String
Private Parametertext As String
Public musicfile As String
Public backgroundfile As String
Public startimgfile As String
Public trademarkfile As String
Private ReadOnly appDirectory As String = AppDomain.CurrentDomain.BaseDirectory 'System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
Private ReadOnly ThemsDirectory As String = appDirectory & "\Thems"
Private folders() As String = Directory.GetDirectories(ThemsDirectory)
'Public Shared Function ComputeFileHash(ByVal filePath As String) As String
' Dim hashProvider As New MD5CryptoServiceProvider()
' Dim fileStream As Stream = File.OpenRead(filePath)
' Dim hash As Byte() = hashProvider.ComputeHash(fileStream)
' fileStream.Close()
' Return String.Concat(hash.Select(Function(b) b.ToString("x2")))
'End Function
'Public Shared Function AreFilesSame(ByVal filePath1 As String, ByVal filePath2 As String) As Boolean
' Dim hash1 As String = ComputeFileHash(filePath1)
' Dim hash2 As String = ComputeFileHash(filePath2)
' Return hash1.Equals(hash2)
'End Function
Private Sub Window1_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
ver.Text = "当前程序版本:" & Version
kdtkyd6666.Stop()
For i As Integer = 1 To folders.Length()
Console.WriteLine(i - 1)
Dim myString As String = folders(i - 1)
'查找最后一个 "\" 的位置
Dim lastBackslashIndex As Integer = myString.LastIndexOf("\")
If lastBackslashIndex <> -1 Then '确保找到了 "\" 符号
'截取 "\" 后面的全部字符
Dim result As String = myString.Substring(lastBackslashIndex + 1)
Console.WriteLine(result) '输出结果
Dim newItem As New ListBoxItem With {
.Content = result
}
List1.Items.Add(newItem)
Dim newItem1 As New ComboBoxItem With {
.Content = result
}
comboBox.Items.Add(newItem1)
End If
Next
AddHandler List1.SelectionChanged, AddressOf MySelectionChanged
Dim filePath As String = appDirectory & "\settings.ini"
Dim configPath As String = appDirectory & "\product.config"
Console.WriteLine(starting_config)
If File.Exists(configPath) Then
Using reader As New StreamReader(configPath)
starting_config = reader.ReadLine()
Parametertext = reader.ReadLine()
Line17 = reader.ReadLine()
Line18 = reader.ReadLine()
Console.WriteLine(starting_config)
End Using
End If
If File.Exists(appDirectory & "\file.sr") Then
Using reader As New StreamReader(appDirectory & "\file.sr")
'backgroundfile = reader.ReadLine()
'startimgfile = reader.ReadLine()
'trademarkfile = reader.ReadLine()
musicfile = reader.ReadLine()
End Using
End If
textBox.Text = musicfile
Console.WriteLine(starting_config)
windowname.Text = starting_config
cstext.Text = Parametertext
MySelectionChanged()
If File.Exists(filePath) Then
Using reader As New StreamReader(filePath)
firstLine = reader.ReadLine()
secondLine = reader.ReadLine()
thirdLine = reader.ReadLine()
fourLine = reader.ReadLine()
fifthLine = reader.ReadLine()
sixthLine = reader.ReadLine()
seventhLine = reader.ReadLine()
eighthLine = reader.ReadLine()
ninthLine = reader.ReadLine()
tenthLine = reader.ReadLine()
Line11 = reader.ReadLine()
Line12 = reader.ReadLine()
Line13 = reader.ReadLine()
Line14 = reader.ReadLine()
Line15 = reader.ReadLine()
'Line16 = reader.ReadLine()
End Using
_1.Text = fourLine
_2.Text = fifthLine
_3.Text = sixthLine
_4.Text = seventhLine
_5.Text = eighthLine
End If
_filepath.Text = secondLine
Dim selectedItem As ListBoxItem = List1.SelectedItem
If File.Exists(ThemsDirectory & "\" & selectedItem.Content & "\file.sr") Then
Using reader As New StreamReader(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\file.sr")
backgroundfile = reader.ReadLine()
trademarkfile = reader.ReadLine()
startimgfile = reader.ReadLine()
Line16 = reader.ReadLine()
End Using
End If
Try
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & backgroundfile
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & startimgfile
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & trademarkfile
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
sname.Text = selectedItem.Content
zt = ThemsDirectory & "\" & selectedItem.Content & "\text.ini"
Catch ex As Exception
messagebox("你是不偷偷去目录把主题配置文件改成了一个不存在的值?这TM让我们怎么读取!如果不是请截图以下报错反馈!" & vbCrLf & ex.ToString, "错的是你,而不是我们!")
End Try
'If Line16 = "True" Then
' 'Dim filePath1 As String = ThemsDirectory & "\" & selectedItem.Content & "\text.ini"
' 'If File.Exists(filePath1) Then
' ' Console.WriteLine("文件存在")
' 'Else
' ' MsgBox("读取配置时发生错误 " & secondLine & "没有找到主题下的text.ini,请查看文件是否存在,或者取消勾选文字跟随主题", vbExclamation)
' 'End If
'Else
'End If
If Line17 = "True" Then
cs_Copy.IsChecked = True
cstext_Copy.IsEnabled = False
Else
cs_Copy.IsChecked = False
cstext_Copy.IsEnabled = True
End If
If ninthLine = "True" Then
checkBox.IsChecked = True
comboBox.IsEnabled = False
Else
checkBox.IsChecked = False
comboBox.IsEnabled = True
Dim founded = False
For Each item As Object In comboBox.Items ' 遍历ComboBox的所有项
Dim comboBoxItem As ComboBoxItem = TryCast(item, ComboBoxItem) ' 将项转换为ComboBoxItem类型
If comboBoxItem IsNot Nothing AndAlso comboBoxItem.Content.ToString() = ninthLine.ToString() Then ' 判断Content属性是否为"测试"
comboBox.SelectedItem = comboBoxItem ' 选中该项
founded = True
Exit For ' 退出循环
End If
Next
'If founded = True Then
'End If
If founded = False Then
MsgBox("读取配置时发生错误 " & secondLine & "没有找到所配置的主题,请重新配置启动时要显示的主题,或勾选【启动时随机选择主题】", vbExclamation)
End If
End If
If tenthLine = "True" Then
checkBox1.IsChecked = True
textBox.IsEnabled = False
button1.IsEnabled = False
Else
checkBox1.IsChecked = False
textBox.IsEnabled = True
button1.IsEnabled = True
End If
'If Line11 = "False" Then
' MP4114.IsChecked = True
' sname_Copy.IsEnabled = False
' namesave_Copy.IsEnabled = False
' kdtkyd6666.Visibility = Visibility.Hidden
'Else
' MP4114.IsChecked = False
' sname_Copy.IsEnabled = True
' namesave_Copy.IsEnabled = True
' kdtkyd6666.Visibility = Visibility.Visible
'End If
cstext_Copy.Text = Line18
If Line12 = "True" Then
cs.IsChecked = True
cstext.IsEnabled = True
Else
cs.IsChecked = False
cstext.IsEnabled = False
End If
If Line13 = "True" Then
ckjczq.IsChecked = True
Else
ckjczq.IsChecked = False
End If
If Line15 = "True" Then
cjmode.IsChecked = True
Else
cjmode.IsChecked = False
End If
End Sub
Private Sub MySelectionChanged()
Try
'获取当前选中的 ListBoxItem
Dim selectedItem As ListBoxItem = List1.SelectedItem
'zt = ThemsDirectory & "\" & selectedItem.Content & "\text.ini"
Dim bimg As String = Nothing
Dim simg As String = Nothing
Dim timg As String = Nothing
If selectedItem IsNot Nothing Then
If File.Exists(ThemsDirectory & "\" & selectedItem.Content & "\file.sr") Then
Using reader As New StreamReader(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\file.sr")
bimg = reader.ReadLine()
timg = reader.ReadLine()
simg = reader.ReadLine()
Line16 = reader.ReadLine()
End Using
End If
If File.Exists(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\mp4.sr") Then
Using reader As New StreamReader(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\mp4.sr")
Videolaunch = reader.ReadLine()
End Using
End If
If Videolaunch = "False" Then
MP4114.IsChecked = True
sname_Copy.IsEnabled = False
sname_Copy1.IsEnabled = False
namesave_Copy.IsEnabled = False
MP4114_Copy.IsEnabled = False
MP4114_Copy1.IsEnabled = False
kdtkyd6666.Visibility = Visibility.Hidden
Else
If Videolaunch = "False1" Then
MP4114_Copy.IsChecked = False
MP4114_Copy1.IsChecked = True
End If
If Videolaunch = "TrueWindow" Then
MP4114_Copy.IsChecked = True
Else
If Videolaunch = "TrueWindow1" Then
MP4114_Copy.IsChecked = True
MP4114_Copy1.IsChecked = True
End If
End If
MP4114.IsChecked = False
sname_Copy.IsEnabled = True
sname_Copy1.IsEnabled = True
namesave_Copy.IsEnabled = True
MP4114_Copy.IsEnabled = True
MP4114_Copy1.IsEnabled = True
kdtkyd6666.Source = New Uri(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\startmp4.mp4")
kdtkyd6666.Stop()
kdtkyd6666.Visibility = Visibility.Visible
End If
If Line16 = "True" Then
ff.IsChecked = True
_1.IsEnabled = False
_2.IsEnabled = False
_3.IsEnabled = False
_4.IsEnabled = False
_5.IsEnabled = False
_1_1.IsEnabled = True
_2_2.IsEnabled = True
_3_3.IsEnabled = True
_4_4.IsEnabled = True
_5_5.IsEnabled = True
Try
'MsgBox(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\text.ini")
Using reader As New StreamReader(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\text.ini")
_1_1.Text = reader.ReadLine()
_2_2.Text = reader.ReadLine()
_3_3.Text = reader.ReadLine()
_4_4.Text = reader.ReadLine()
_5_5.Text = reader.ReadLine()
End Using
Catch ex As Exception
MsgBox("读取配置时发生错误 " & secondLine & "没有找到主题下的text.ini,请查看文件是否存在,或者取消勾选文字跟随主题", vbExclamation)
End Try
Else
_1.IsEnabled = True
_2.IsEnabled = True
_3.IsEnabled = True
_4.IsEnabled = True
_5.IsEnabled = True
ff.IsChecked = False
_1_1.IsEnabled = False
_2_2.IsEnabled = False
_3_3.IsEnabled = False
_4_4.IsEnabled = False
_5_5.IsEnabled = False
_1.Text = fourLine
_2.Text = fifthLine
_3.Text = sixthLine
_4.Text = seventhLine
_5.Text = eighthLine
End If
tbackground.Text = bimg
tstartimg.Text = simg
ttrademark.Text = timg
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & bimg
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & simg
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & timg
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
sname.Text = selectedItem.Content
If Line16 = "True" Then
zt = ThemsDirectory & "\" & selectedItem.Content & "\text.ini"
If File.Exists(ThemsDirectory & "\" & selectedItem.Content & "\text.ini") Then
Using reader As New StreamReader(zt)
_1_1.Text = reader.ReadLine()
_2_2.Text = reader.ReadLine()
_3_3.Text = reader.ReadLine()
_4_4.Text = reader.ReadLine()
_5_5.Text = reader.ReadLine()
End Using
End If
End If
cuowu.Visibility = Visibility.Hidden
tbackground.IsEnabled = True
ttrademark.IsEnabled = True
tstartimg.IsEnabled = True
xbacoground.IsEnabled = True
xtrademark.IsEnabled = True
xstartimg.IsEnabled = True
sname.IsEnabled = True
namesave.IsEnabled = True
sname_Copy.IsEnabled = True
namesave_Copy.IsEnabled = True
sname_Copy1.IsEnabled = True
namesave_Copy2.IsEnabled = True
'_1_1.IsEnabled = True
'_2_2.IsEnabled = True
'_3_3.IsEnabled = True
'_4_4.IsEnabled = True
'_5_5.IsEnabled = True
namesave_Copy1.IsEnabled = True
MP4114.IsEnabled = True
'MP4114_Copy.IsEnabled = True
'MP4114_Copy1.IsEnabled = True
ff.IsEnabled = True
If selectedItem.Content = "default" Or selectedItem.Content = "Default" Or selectedItem.Content = "DEFAULT" Then
namesave.IsEnabled = False
End If
Else
cuowu.Visibility = Visibility.Visible
tbackground.IsEnabled = False
ttrademark.IsEnabled = False
tstartimg.IsEnabled = False
xbacoground.IsEnabled = False
xtrademark.IsEnabled = False
xstartimg.IsEnabled = False
sname.IsEnabled = False
namesave.IsEnabled = False
sname_Copy.IsEnabled = False
namesave_Copy.IsEnabled = False
sname_Copy1.IsEnabled = False
namesave_Copy2.IsEnabled = False
_1_1.IsEnabled = False
_2_2.IsEnabled = False
_3_3.IsEnabled = False
_4_4.IsEnabled = False
_5_5.IsEnabled = False
namesave_Copy1.IsEnabled = False
MP4114.IsEnabled = False
MP4114_Copy.IsEnabled = False
MP4114_Copy1.IsEnabled = False
ff.IsEnabled = False
End If
Catch ex As Exception
cuowu.Visibility = Visibility.Visible
tbackground.IsEnabled = False
ttrademark.IsEnabled = False
tstartimg.IsEnabled = False
xbacoground.IsEnabled = False
xtrademark.IsEnabled = False
xstartimg.IsEnabled = False
sname.IsEnabled = False
namesave.IsEnabled = False
sname_Copy.IsEnabled = False
namesave_Copy.IsEnabled = False
sname_Copy1.IsEnabled = False
namesave_Copy2.IsEnabled = False
_1_1.IsEnabled = False
_2_2.IsEnabled = False
_3_3.IsEnabled = False
_4_4.IsEnabled = False
_5_5.IsEnabled = False
namesave_Copy1.IsEnabled = False
MP4114.IsEnabled = False
MP4114_Copy.IsEnabled = False
MP4114_Copy1.IsEnabled = False
ff.IsEnabled = False
End Try
GC.Collect()
'...
End Sub
Private Sub xbacoground_Click(sender As Object, e As RoutedEventArgs) Handles xbacoground.Click
image1.Source = Nothing
yuanshen.Source = Nothing
image2.Source = Nothing
kdtkyd6666.Source = Nothing
GC.Collect()
Dim selectedItem As ListBoxItem = List1.SelectedItem
Dim openFileDialog As New OpenFileDialog With {
.Filter = "image Files (*.png;*.jpg;*.jpge;*.bmp)|*.png;*.jpg;*.jpge;*.bmp",
.FilterIndex = 1,
.Multiselect = False,
.Title = "选择 image 文件"
}
Dim result As Boolean = openFileDialog.ShowDialog()
If result = True Then
Try
If ComparePaths(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\" & tbackground.Text, openFileDialog.FileName) = False Then
Dim selectedFilePath As String = openFileDialog.FileName
tbackground.Text = System.IO.Path.GetFileName(openFileDialog.FileName)
SharedV.Saving = False
GC.Collect()
GC.WaitForPendingFinalizers()
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
File.Delete(background)
File.Copy(selectedFilePath, background, True)
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
' If File.Exists(ThemsDirectory & "\" & List1.SelectedItem.ToString() & "\file.sr") Then
File.Delete(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\file.sr")
Using reader As New StreamWriter(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\file.sr")
reader.WriteLine(tbackground.Text)
reader.WriteLine(ttrademark.Text)
reader.WriteLine(tstartimg.Text)
End Using
' End If
SharedV.Saving = True
cg114()
Else
MsgBox("不是,哥们,你选文件自己干嘛?", vbExclamation)
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
End If
Catch ex As Exception
errormsgbox = "替换失败,因为" & vbCrLf & vbCrLf & ex.ToString
SharedV.Saving = True
End Try
Else
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
End If
End Sub
Public Async Sub cg114()
If errormsgbox = "ok" Then
SnackbarOne.IsActive = True
Await Task.Delay(3000)
SnackbarOne.IsActive = False
End If
End Sub
Private Sub refreshh_Click(sender As Object, e As RoutedEventArgs) Handles refreshh.Click
List1.Items.Clear()
comboBox.Items.Clear()
folders = Directory.GetDirectories(ThemsDirectory)
For i As Integer = 1 To folders.Length()
Console.WriteLine(i - 1)
Dim myString As String = folders(i - 1)
'查找最后一个 "\" 的位置
Dim lastBackslashIndex As Integer = myString.LastIndexOf("\")
If lastBackslashIndex <> -1 Then '确保找到了 "\" 符号
'截取 "\" 后面的全部字符
Dim result As String = myString.Substring(lastBackslashIndex + 1)
Console.WriteLine(result) '输出结果
Dim newItem As New ListBoxItem With {
.Content = result
}
List1.Items.Add(newItem)
Dim newItem1 As New ComboBoxItem With {
.Content = result
}
comboBox.Items.Add(newItem1)
End If
Next
End Sub
Private Sub xstartimg_Click(sender As Object, e As RoutedEventArgs) Handles xstartimg.Click
image1.Source = Nothing
yuanshen.Source = Nothing
image2.Source = Nothing
kdtkyd6666.Source = Nothing
GC.Collect()
Dim openFileDialog As New OpenFileDialog With {
.Filter = "image Files (*.png;*.jpg;*.jpge;*.bmp)|*.png;*.jpg;*.jpge;*.bmp",
.FilterIndex = 1,
.Multiselect = False,
.Title = "选择 image 文件"
}
Dim result As Boolean = openFileDialog.ShowDialog()
If result = True Then
Try
Dim selectedItem As ListBoxItem = List1.SelectedItem
If ComparePaths(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\" & tstartimg.Text, openFileDialog.FileName) = False Then
tstartimg.Text = System.IO.Path.GetFileName(openFileDialog.FileName)
Dim selectedFilePath As String = openFileDialog.FileName
errormsgbox = "ok"
GC.Collect()
GC.WaitForPendingFinalizers()
'Dim selectedItem As ListBoxItem = List1.SelectedItem
'这一行要改
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
'删除的变量要改
File.Delete(StartIMG)
'目标路径要改
File.Copy(selectedFilePath, StartIMG, True)
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
'If File.Exists(ThemsDirectory & "\" & List1.SelectedItem.ToString() & "\file.sr") Then
File.Delete(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\file.sr")
Using reader As New StreamWriter(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\file.sr")
reader.WriteLine(tbackground.Text)
reader.WriteLine(ttrademark.Text)
reader.WriteLine(tstartimg.Text)
End Using
'End If
SharedV.Saving = True
cg114()
Else
MsgBox("不是,哥们,你选文件自己干嘛?", vbExclamation)
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
End If
Catch ex As Exception
errormsgbox = "替换失败,因为" & vbCrLf & vbCrLf & ex.ToString
Errorbox("替换失败,因为" & vbCrLf & vbCrLf & ex.ToString)
SharedV.Saving = True
'Dim window2 As New Window2
'SharedV.Saving = False
'window2.Show()
End Try
Else
Dim selectedItem As ListBoxItem = List1.SelectedItem
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
End If
End Sub
Private Sub xtrademark_Click(sender As Object, e As RoutedEventArgs) Handles xtrademark.Click
image1.Source = Nothing
yuanshen.Source = Nothing
image2.Source = Nothing
kdtkyd6666.Source = Nothing
GC.Collect()
Dim openFileDialog As New OpenFileDialog With {
.Filter = "image Files (*.png;*.jpg;*.jpge;*.bmp)|*.png;*.jpg;*.jpge;*.bmp",
.FilterIndex = 1,
.Multiselect = False,
.Title = "选择 image 文件"
}
Dim result As Boolean = openFileDialog.ShowDialog()
If result = True Then
Try
Dim selectedItem As ListBoxItem = List1.SelectedItem
If ComparePaths(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\" & ttrademark.Text, openFileDialog.FileName) = False Then
ttrademark.Text = System.IO.Path.GetFileName(openFileDialog.FileName)
Dim selectedFilePath As String = openFileDialog.FileName
errormsgbox = "ok"
GC.Collect()
GC.WaitForPendingFinalizers()
'Dim selectedItem As ListBoxItem = List1.SelectedItem
'这一行要改
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
'删除的变量要改
File.Delete(trademark)
'目标路径要改
File.Copy(selectedFilePath, trademark, True)
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
'MsgBox(ThemsDirectory & "\" & List1.SelectedItem.ToString & "\file.sr")
' If File.Exists(ThemsDirectory & "\" & List1.SelectedItem.ToString & "\file.sr") Then
File.Delete(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\file.sr")
Using reader As New StreamWriter(ThemsDirectory & "\" & selectedItem.Content.ToString() & "\file.sr")
reader.WriteLine(tbackground.Text)
reader.WriteLine(ttrademark.Text)
reader.WriteLine(tstartimg.Text)
End Using
' End If
SharedV.Saving = True
cg114()
Else
MsgBox("不是,哥们,你选文件自己干嘛?", vbExclamation)
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
End If
Catch ex As Exception
errormsgbox = "替换失败,因为" & vbCrLf & vbCrLf & ex.ToString
Errorbox("替换失败,因为" & vbCrLf & vbCrLf & ex.ToString)
SharedV.Saving = True
'Dim window2 As New Window2
'SharedV.Saving = False
'window2.Show()
End Try
Else
Dim selectedItem As ListBoxItem = List1.SelectedItem
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
End If
End Sub
Private Async Sub add_Click(sender As Object, e As RoutedEventArgs) Handles add.Click
AddTextTip.Text = "添加新的主题(默认复制默认主题)"
Dim YesOrNo = Await DialogHost.Show(AddDialog.DialogContent, "Add")
If YesOrNo Then
Dim input As String = NewHot.Text()
Console.WriteLine(input)
If input = "" Then
Errorbox("无法创建新主题:你需要输入文字")
Else
Dim NewWholeName As String = ThemsDirectory & "\" & input
If Directory.Exists(NewWholeName) Then
MsgBox("同名称的主题已经存在,请先删除旧的主题,或更换名称后重试。", vbInformation, "无法创建新主题")
Else
errormsgbox = "ok"
Directory.CreateDirectory(NewWholeName)
Try
For Each filePath As String In Directory.GetFiles(ThemsDirectory & "\" & "DEFAULT")
Dim fileName As String = Path.GetFileName(filePath)
Dim destFilePath As String = Path.Combine(NewWholeName, fileName)
File.Copy(filePath, destFilePath, True) ' 第三个参数表示覆盖已存在的文件
Next
SharedV.Saving = True
cg114()
Catch ex As Exception
SharedV.Saving = True
errormsgbox = "无法复制主题模板,可能是 DEFAULT 主题被删除。你可能需要重新安装本工具再进行重试。"
Directory.Delete(NewWholeName)
Errorbox("无法复制主题模板,可能是 DEFAULT 主题被删除。你可能需要重新安装本工具再进行重试。")
'Dim window4 As New Window2
'window4.Show()
End Try
End If
End If
End If
List1.Items.Clear()
comboBox.Items.Clear()
folders = Directory.GetDirectories(ThemsDirectory)
For i As Integer = 1 To folders.Length()
Console.WriteLine(i - 1)
Dim myString As String = folders(i - 1)
'查找最后一个 "\" 的位置
Dim lastBackslashIndex As Integer = myString.LastIndexOf("\")
If lastBackslashIndex <> -1 Then '确保找到了 "\" 符号
'截取 "\" 后面的全部字符
Dim result As String = myString.Substring(lastBackslashIndex + 1)
Console.WriteLine(result) '输出结果
Dim newItem As New ListBoxItem With {
.Content = result
}
List1.Items.Add(newItem)
Dim newItem1 As New ComboBoxItem With {
.Content = result
}
comboBox.Items.Add(newItem1)
End If
Next
End Sub
Private Async Sub del_Click(sender As Object, e As RoutedEventArgs) Handles del.Click
Dim selectedItem As ListBoxItem = List1.SelectedItem
If selectedItem Is Nothing Then
messagebox("请先选择一个主题", "不能删除")
ElseIf selectedItem.Content = "default" Or selectedItem.Content = "Default" Or selectedItem.Content = "DEFAULT" Then
messagebox("你不能删除默认主题", "不能删除")
Else
image1.Source = Nothing
yuanshen.Source = Nothing
image2.Source = Nothing
kdtkyd6666.Source = Nothing
GC.Collect()
DialogText.Text = "真的要删除主题 " & selectedItem.Content & " 吗?这是不可恢复的噢!>﹏<"
MessageGood.Content = "确认"
MessageBad.Content = "取消"
Dim ConfirmToDel = Await DialogHost.Show(MessageDialog.DialogContent, "Msg")
If ConfirmToDel IsNot Nothing And ConfirmToDel.ToString() = "True" Then
'Dim ISOK = MsgBox("真的要删除主题 " & selectedItem.Content & " 吗?这是不可恢复的噢!>﹏<", vbYesNo, "删除确认")
'If ISOK = 6 Then
SharedV.Saving = False
errormsgbox = "ok"
image1.Source = Nothing
image2.Source = Nothing
yuanshen.Source = Nothing
kdtkyd6666.Source = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
Try
Directory.Delete(ThemsDirectory & "\" & selectedItem.Content, True)
Catch ex As Exception
errormsgbox = "错误,无法删除该主题,报错如下" & ex.ToString
Errorbox("错误,无法删除该主题,报错如下" & ex.ToString)
End Try
List1.Items.Clear()
comboBox.Items.Clear()
folders = Directory.GetDirectories(ThemsDirectory)
For i As Integer = 1 To folders.Length()
Console.WriteLine(i - 1)
Dim myString As String = folders(i - 1)
'查找最后一个 "\" 的位置
Dim lastBackslashIndex As Integer = myString.LastIndexOf("\")
If lastBackslashIndex <> -1 Then '确保找到了 "\" 符号
'截取 "\" 后面的全部字符
Dim result As String = myString.Substring(lastBackslashIndex + 1)
Console.WriteLine(result) '输出结果
Dim newItem As New ListBoxItem With {
.Content = result
}
List1.Items.Add(newItem)
Dim newItem1 As New ComboBoxItem With {
.Content = result
}
comboBox.Items.Add(newItem1)
End If
Next
cuowu.Visibility = Visibility.Visible
tbackground.IsEnabled = False
ttrademark.IsEnabled = False
tstartimg.IsEnabled = False
xbacoground.IsEnabled = False
xtrademark.IsEnabled = False
xstartimg.IsEnabled = False
sname.IsEnabled = False
namesave.IsEnabled = False
sname_Copy.IsEnabled = False
namesave_Copy.IsEnabled = False
sname_Copy1.IsEnabled = False
namesave_Copy2.IsEnabled = False
_1_1.IsEnabled = False
_2_2.IsEnabled = False
_3_3.IsEnabled = False
_4_4.IsEnabled = False
_5_5.IsEnabled = False
SharedV.Saving = True
cg114()
Else
Dim StartIMG = ThemsDirectory & "\" & selectedItem.Content & "\" & tstartimg.Text
Dim trademark = ThemsDirectory & "\" & selectedItem.Content & "\" & ttrademark.Text
Dim background = ThemsDirectory & "\" & selectedItem.Content & "\" & tbackground.Text
Dim startmp4 = ThemsDirectory & "\" & selectedItem.Content & "\startmp4.mp4"
image1.Source = New BitmapImage(New Uri(background, UriKind.Absolute))
yuanshen.Source = New BitmapImage(New Uri(StartIMG, UriKind.Absolute))
image2.Source = New BitmapImage(New Uri(trademark, UriKind.Absolute))
kdtkyd6666.Source = New Uri(startmp4, UriKind.Absolute)
End If
End If
End Sub
Private Sub namesave_Click(sender As Object, e As RoutedEventArgs) Handles namesave.Click
image1.Source = Nothing
yuanshen.Source = Nothing
image2.Source = Nothing
kdtkyd6666.Source = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
Try
changename()
Catch ex As Exception
errormsgbox = "替换失败,因为" & vbCrLf & vbCrLf & ex.ToString
Errorbox("替换失败,因为" & vbCrLf & vbCrLf & ex.ToString)
SharedV.Saving = True
End Try
End Sub
Private Sub changename()