-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathForm1.vb
More file actions
1913 lines (1744 loc) · 97.5 KB
/
Copy pathForm1.vb
File metadata and controls
1913 lines (1744 loc) · 97.5 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
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
'============================================================================
'
' PKeyConfigReader
' Copyright (C) 2013 - 2015 Visual Software Corporation
'
' Author: ASV93
' File: Form1.vb
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License along
' with this program; if not, write to the Free Software Foundation, Inc.,
' 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'
'============================================================================
Imports System.Xml
Imports Microsoft.Office.Interop
Imports System.Text
Imports System.Reflection
Public Class Form1
Dim VSTools As VSSharedSource = New VSSharedSource
Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs
Dim ShellEXE As String
Dim AutoOpen As String
Dim LongMode As Integer
Dim BGColor As Color = Color.FromArgb(0, 174, 219)
Dim HoverColor As Color = Color.FromArgb(0, 204, 219)
Dim PressedColor As Color = Color.FromArgb(0, 144, 219)
Dim pidconfigdata As String
Dim loadfromstring As Integer = 0
Dim IgnoreReservePN As Integer
Dim FileNameXML As String
Dim SelectedLV As ListView
Dim WorkShetNumber As Integer = 1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
Button5_Click(sender, e)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
SaveFileDialog1.FileName = ""
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName = "" Then
Else
'SAVE
If MetroTabControl1.SelectedIndex = 0 Then
'SAVE PKEYCONFIG PAGE
FileNameXML = SaveFileDialog1.FileName
Panel3.Visible = True
Timer3.Enabled = True
MetroTabControl1.Enabled = False
Panel2.Enabled = False
exporttoxlsworker.RunWorkerAsync(ListView1)
ElseIf MetroTabControl1.SelectedIndex = 1 Then
'SAVE INFORMATION PAGE
FileNameXML = SaveFileDialog1.FileName
Panel3.Visible = True
Timer3.Enabled = True
MetroTabControl1.Enabled = False
Panel2.Enabled = False
exporttoxlsworker.RunWorkerAsync(ListView3)
ElseIf MetroTabControl1.SelectedIndex = 2 Then
'SAVE POLICIES PAGE
FileNameXML = SaveFileDialog1.FileName
Panel3.Visible = True
Timer3.Enabled = True
MetroTabControl1.Enabled = False
Panel2.Enabled = False
exporttoxlsworker.RunWorkerAsync(ListView2)
ElseIf MetroTabControl1.SelectedIndex = 3 Then
'SAVE EDITIONMATRIX PAGE
FileNameXML = SaveFileDialog1.FileName
Panel3.Visible = True
Timer3.Enabled = True
MetroTabControl1.Enabled = False
Panel2.Enabled = False
exporttoxlsworker.RunWorkerAsync(ListView4)
ElseIf MetroTabControl1.SelectedIndex = 4 Then
'SAVE UPGRADEMATRIX PAGE
Try
Dim xls As New Excel.Application
Dim sheet As Excel.Worksheet
Dim i As Integer
xls.Workbooks.Add()
sheet = xls.ActiveWorkbook.Worksheets(1)
Dim col As Integer = 1
For j As Integer = 0 To ListView5.Columns.Count - 1
sheet.Cells(1, col) = ListView5.Columns(j).Text.ToString
col = col + 1
Next
For i = 0 To ListView5.Items.Count - 1
Dim subitemscount As String = ""
Dim columnscount As String = ListView5.Columns.Count
Dim currentccount As Object = 1
Dim currentsubcount As Integer = 0
While currentccount <= columnscount
sheet.Cells(i + 2, currentccount) = ListView5.Items.Item(i).SubItems(currentsubcount).Text
currentccount = Val(currentccount) + 1
currentsubcount = Val(currentsubcount) + 1
End While
Next
Dim xlWorkSheet1 As Excel.Worksheet
xlWorkSheet1 = CType(xls.ActiveWorkbook.Worksheets.Add(), Excel.Worksheet)
xlWorkSheet1.Name = "VersionRanges"
xlWorkSheet1.Move(After:=sheet) 'Move the new sheet after the original
xlWorkSheet1.Select() 'Select the sheet and enter data
sheet = xls.ActiveWorkbook.Worksheets(2)
Dim col1 As Integer = 1
For j As Integer = 0 To ListView6.Columns.Count - 1
sheet.Cells(1, col1) = ListView6.Columns(j).Text.ToString
col1 = col1 + 1
Next
For i = 0 To ListView6.Items.Count - 1
Dim subitemscount As String = ""
Dim columnscount As String = ListView6.Columns.Count
Dim currentccount As Object = 1
Dim currentsubcount As Integer = 0
While currentccount <= columnscount
sheet.Cells(i + 2, currentccount) = ListView6.Items.Item(i).SubItems(currentsubcount).Text
currentccount = Val(currentccount) + 1
currentsubcount = Val(currentsubcount) + 1
End While
Next
xls.ActiveWorkbook.SaveAs(SaveFileDialog1.FileName)
xls.Workbooks.Close()
xls.Quit()
Catch ex As Exception
MetroFramework.MetroMessageBox.Show(Me, "Error saving the file: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Else
MetroFramework.MetroMessageBox.Show(Me, "Please select a valid tabpage to export", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End If
End Sub
Function ExportToExcel(ByVal FileName As String, SelectedLV As ListView, WorkShetNumber As Integer)
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MetroTabControl1.SelectedIndex = 0
MetroTabControl1.SelectedIndex = 1
MetroTabControl1.SelectedIndex = 2
MetroTabControl1.SelectedIndex = 0
Control.CheckForIllegalCrossThreadCalls = False
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) = True Then
Me.Text = Me.Text & " (Administrator)"
End If
Label3.Text = "Registered to: " & Environment.UserName
If My.Application.Info.CompanyName = "Visual Software" Then
If Now.Year > 2013 Then
linklabel1.Text = My.Application.Info.AssemblyName & " © 2013-" & Now.Year & " " & My.Application.Info.CompanyName
Else
linklabel1.Text = My.Application.Info.AssemblyName & " © 2013" & " " & My.Application.Info.CompanyName
End If
Else
MetroFramework.MetroMessageBox.Show(Me, "Error, This application has been modified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End
End If
Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly().Location)
label8.Text = "Version " & myFileVersionInfo.ProductVersion
Try
If IO.File.Exists(My.Application.Info.DirectoryPath & "\Setup.upd") = True Then
If IO.File.Exists(My.Application.Info.DirectoryPath & "\Setup.exe") = True Then
IO.File.Delete(My.Application.Info.DirectoryPath & "\Setup.exe")
Else
End If
My.Computer.FileSystem.RenameFile(My.Application.Info.DirectoryPath & "\Setup.upd", "Setup.exe")
End If
Catch ex As Exception
End Try
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF2.dat") = True Then
Dim reader As String
reader = (IO.File.ReadAllText(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF2.dat"))
If reader = "1" Then
CheckBox2.Checked = True
End If
Else
End If
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF3.dat") = True Then
Dim reader As String
reader = (IO.File.ReadAllText(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF3.dat"))
If reader = "1" Then
CheckBox3.Checked = True
End If
Else
End If
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF4.dat") = True Then
Dim reader As String
reader = (IO.File.ReadAllText(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF4.dat"))
If reader = "1" Then
CheckBox4.Checked = True
End If
Else
End If
If IO.File.Exists(My.Application.Info.DirectoryPath & "\pidgenx.dll") = False Then
Dim NewPIDGenX() As Byte = My.Resources.pidgenx
My.Computer.FileSystem.WriteAllBytes(My.Application.Info.DirectoryPath & "\pidgenx.dll", NewPIDGenX, False)
End If
If My.Application.CommandLineArgs.Count = 0 Then
'No args
Else
'Args
For i As Integer = 0 To CommandLineArgs.Count - 1
ShellEXE = ShellEXE & " " & CommandLineArgs(i)
Next
If ShellEXE.Contains("-dev") Then
If CommandLineArgs.Count = 1 Then
Else
OpenFileDialog1.FileName = CommandLineArgs(1)
Button5_Click(sender, e)
End If
Else
OpenFileDialog1.FileName = ShellEXE
Button5_Click(sender, e)
End If
End If
End Sub
Function Base64Decoder(ByVal SourceText As String) As String
Dim decodedBytes As Byte()
decodedBytes = Convert.FromBase64String(SourceText)
Dim decodedText As String
decodedText = Encoding.UTF8.GetString(decodedBytes)
Return decodedText
End Function
Function getthefuckingoutput(ByVal InputXML As String) As String
Dim xmlDocument As System.Xml.XmlDocument = New System.Xml.XmlDocument()
xmlDocument.Load(OpenFileDialog1.FileName)
Dim innerText As String = xmlDocument.SelectSingleNode("/*[local-name()='licenseGroup']/*[local-name()='license']/*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='pkeyConfigData']").InnerText
Return Base64Decoder(innerText)
End Function
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
End
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
Process.Start("http://visualsoftware.wordpress.com")
End Sub
Private Sub DonateToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DonateToolStripMenuItem.Click
VSTools.OpenDonationPage()
End Sub
Private Sub VisualSoftCorpToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles VisualSoftCorpToolStripMenuItem.Click
Process.Start("https://www.twitter.com/VisualSoftCorp")
End Sub
Private Sub ASV93ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ASV93ToolStripMenuItem.Click
Process.Start("https://www.twitter.com/ASV93")
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If BackgroundWorker1.IsBusy = True Then
Else
BackgroundWorker1.RunWorkerAsync()
End If
End Sub
Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Panel1.Visible = True
Button4.Enabled = False
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
If OpenFileDialog1.FileName = "" Then
Else
Dim typeofxrm As String = IO.File.ReadAllText(OpenFileDialog1.FileName)
If typeofxrm.Contains("pkeyConfigData") = True Then
lastloadedxrm.Text = OpenFileDialog1.FileName
Form2.Button2_Click(sender, e)
MetroTabControl1.SelectedIndex = 0
If CheckBox2.Checked = True Then
ListView1.Columns.Clear()
Else
ListView1.Clear()
End If
Dim DecryptedXML As String = getthefuckingoutput(OpenFileDialog1.FileName)
'LOAD
Try
Dim PartNumber As String
Dim EulaType As String
Dim IsValid As String
Dim Start As String
Dim EndS As String
Dim doc As New XmlDocument
DecryptedXML = DecryptedXML.Replace("<09>", "")
If DecryptedXML.Contains("ProductFamilyCode") Then
'LONGHORN XML
ListView1.Columns.Add("ActConfigID")
ListView1.Columns.Add("RefGroupID")
ListView1.Columns.Add("ProductFamily")
ListView1.Columns.Add("ProductFamilyCode")
ListView1.Columns.Add("ProductName")
ListView1.Columns.Add("ProductVersion")
ListView1.Columns.Add("ProductVersionCode")
ListView1.Columns.Add("ProductDescription")
ListView1.Columns.Add("ProductKeyType")
ListView1.Columns.Add("IsRandomized")
ListView1.Columns.Add("PartNumber")
ListView1.Columns.Add("EULAType")
ListView1.Columns.Add("IsValid")
ListView1.Columns.Add("Start")
ListView1.Columns.Add("End")
ListView1.Columns.Add("Total Keys")
Else
ListView1.Columns.Add("ActConfigID")
ListView1.Columns.Add("RefGroupID")
ListView1.Columns.Add("EditionID")
ListView1.Columns.Add("ProductDescription")
ListView1.Columns.Add("ProductKeyType")
ListView1.Columns.Add("IsRandomized")
ListView1.Columns.Add("PartNumber")
ListView1.Columns.Add("EULAType")
ListView1.Columns.Add("IsValid")
ListView1.Columns.Add("Start")
ListView1.Columns.Add("End")
ListView1.Columns.Add("Total Keys")
End If
doc.LoadXml(DecryptedXML)
Dim doc1 As New XmlDocument
doc1.LoadXml(DecryptedXML)
Dim GTotalKeys As String = ""
Dim LHXML As Integer = 0
Dim nodes As XmlNodeList = doc.SelectNodes("/*[local-name()='ProductKeyConfiguration']/*[local-name()='Configurations']/*[local-name()='Configuration']") '("ProductKeyConfiguration/Configurations/Configuration")
For Each node As XmlNode In nodes
Dim PKEYRED As New ListViewItem
If DecryptedXML.Contains("ProductFamilyCode") Then
'LONGHORN XML
LHXML = 1
Dim ActConfigId As String = node.SelectSingleNode("*[local-name()='ActConfigId']").InnerText
Dim RefGroupId As String = node.SelectSingleNode("*[local-name()='RefGroupId']").InnerText
Dim ProductFamily As String = node.SelectSingleNode("*[local-name()='ProductFamily']").InnerText
Dim ProductFamilyCode As String = node.SelectSingleNode("*[local-name()='ProductFamilyCode']").InnerText
Dim ProductName As String = node.SelectSingleNode("*[local-name()='ProductName']").InnerText
Dim ProductVersion As String = node.SelectSingleNode("*[local-name()='ProductVersion']").InnerText
Dim ProductVersionCode As String = node.SelectSingleNode("*[local-name()='ProductVersionCode']").InnerText
Dim ProductDescription As String = node.SelectSingleNode("*[local-name()='ProductDescription']").InnerText
Dim ProductKeyType As String = node.SelectSingleNode("*[local-name()='ProductKeyType']").InnerText
Dim IsRandomized As String = node.SelectSingleNode("*[local-name()='IsRandomized']").InnerText
PKEYRED.Text = ActConfigId
PKEYRED.SubItems.Add(RefGroupId)
PKEYRED.SubItems.Add(ProductFamily)
PKEYRED.SubItems.Add(ProductFamilyCode)
PKEYRED.SubItems.Add(ProductName)
PKEYRED.SubItems.Add(ProductVersion)
PKEYRED.SubItems.Add(ProductVersionCode)
PKEYRED.SubItems.Add(ProductDescription)
PKEYRED.SubItems.Add(ProductKeyType)
PKEYRED.SubItems.Add(IsRandomized)
Else
Dim ActConfigId As String = node.SelectSingleNode("*[local-name()='ActConfigId']").InnerText
Dim RefGroupId As String = node.SelectSingleNode("*[local-name()='RefGroupId']").InnerText
Dim EditionId As String = node.SelectSingleNode("*[local-name()='EditionId']").InnerText
Dim ProductDescription As String = node.SelectSingleNode("*[local-name()='ProductDescription']").InnerText
Dim ProductKeyType As String = node.SelectSingleNode("*[local-name()='ProductKeyType']").InnerText
Dim IsRandomized As String = node.SelectSingleNode("*[local-name()='IsRandomized']").InnerText
PKEYRED.Text = ActConfigId
PKEYRED.SubItems.Add(RefGroupId)
PKEYRED.SubItems.Add(EditionId)
PKEYRED.SubItems.Add(ProductDescription)
PKEYRED.SubItems.Add(ProductKeyType)
PKEYRED.SubItems.Add(IsRandomized)
End If
PartNumber = ""
EulaType = ""
IsValid = ""
Start = ""
EndS = ""
Dim TotalKeys As String = ""
Dim nodes2 As XmlNodeList = doc1.SelectNodes("/*[local-name()='ProductKeyConfiguration']/*[local-name()='KeyRanges']/*[local-name()='KeyRange']")
For Each node1 As XmlNode In nodes2
Dim newnode As String = node1.SelectSingleNode("*[local-name()='RefActConfigId']").InnerText
If newnode = PKEYRED.Text Then
If LongMode = 1 Then
'LONG MODE
Try
If PartNumber = "" Then
PartNumber = node1.SelectSingleNode("*[local-name()='PartNumber']").InnerText
Else
PartNumber = PartNumber & vbCrLf & node1.SelectSingleNode("*[local-name()='PartNumber']").InnerText
End If
Catch ex As Exception
End Try
Try
If EulaType = "" Then
EulaType = node1.SelectSingleNode("*[local-name()='EulaType']").InnerText
Else
EulaType = EulaType & vbCrLf & node1.SelectSingleNode("*[local-name()='EulaType']").InnerText
End If
Catch ex As Exception
End Try
Try
If IsValid = "" Then
IsValid = node1.SelectSingleNode("*[local-name()='IsValid']").InnerText
Else
IsValid = IsValid & vbCrLf & node1.SelectSingleNode("*[local-name()='IsValid']").InnerText
End If
Catch ex As Exception
End Try
Try
If Start = "" Then
Start = node1.SelectSingleNode("*[local-name()='Start']").InnerText
Else
Start = Start & vbCrLf & node1.SelectSingleNode("*[local-name()='Start']").InnerText
End If
Catch ex As Exception
End Try
Try
If EndS = "" Then
EndS = node1.SelectSingleNode("*[local-name()='End']").InnerText
Else
EndS = EndS & vbCrLf & node1.SelectSingleNode("*[local-name()='End']").InnerText
End If
Catch ex As Exception
End Try
Else
Dim PKEYREDEX As New ListViewItem
Dim PNEX As String
Dim ETEX As String
Dim IVEX As String
Dim STEX As String
Dim EDEX As String
'PARTNUMBER
Try
If PartNumber = "" Then
PartNumber = node1.SelectSingleNode("*[local-name()='PartNumber']").InnerText
PKEYRED.SubItems.Add(PartNumber)
Else
PNEX = node1.SelectSingleNode("*[local-name()='PartNumber']").InnerText
PKEYREDEX.SubItems.Add(" ")
PKEYREDEX.SubItems.Add(" ")
PKEYREDEX.SubItems.Add(" ")
PKEYREDEX.SubItems.Add(" ")
PKEYREDEX.SubItems.Add(" ")
If LHXML = 1 Then
PKEYREDEX.SubItems.Add(" ")
PKEYREDEX.SubItems.Add(" ")
PKEYREDEX.SubItems.Add(" ")
PKEYREDEX.SubItems.Add(" ")
End If
PKEYREDEX.SubItems.Add(PNEX)
End If
Catch ex As Exception
End Try
'EULATYPE
Try
If node1.SelectSingleNode("*[local-name()='EulaType']").InnerText = "" Then
EulaType = "Unknown"
ETEX = "Unknown"
End If
If EulaType = "" Then
EulaType = node1.SelectSingleNode("*[local-name()='EulaType']").InnerText
PKEYRED.SubItems.Add(EulaType)
Else
ETEX = node1.SelectSingleNode("*[local-name()='EulaType']").InnerText
PKEYREDEX.SubItems.Add(ETEX)
End If
Catch ex As Exception
PKEYRED.SubItems.Add(EulaType)
PKEYREDEX.SubItems.Add(ETEX)
End Try
'ISVALID
Try
If IsValid = "" Then
IsValid = node1.SelectSingleNode("*[local-name()='IsValid']").InnerText
PKEYRED.SubItems.Add(IsValid)
Else
IVEX = node1.SelectSingleNode("*[local-name()='IsValid']").InnerText
PKEYREDEX.SubItems.Add(IVEX)
End If
Catch ex As Exception
End Try
Try
If Start = "" Then
Start = node1.SelectSingleNode("*[local-name()='Start']").InnerText
PKEYRED.SubItems.Add(Start)
Else
STEX = node1.SelectSingleNode("*[local-name()='Start']").InnerText
PKEYREDEX.SubItems.Add(STEX)
End If
Catch ex As Exception
End Try
Try
If EndS = "" Then
EndS = node1.SelectSingleNode("*[local-name()='End']").InnerText
PKEYRED.SubItems.Add(EndS)
Dim calc As String = Val(EndS - Start) + 1
PKEYRED.SubItems.Add(calc)
TotalKeys = Val(calc)
ListView1.Items.Add(PKEYRED)
Else
EDEX = node1.SelectSingleNode("*[local-name()='End']").InnerText
PKEYREDEX.SubItems.Add(EDEX)
PKEYRED.SubItems.Add(EndS)
Dim calc As String = Val(EDEX - STEX) + 1
PKEYREDEX.SubItems.Add(calc)
If IgnoreReservePN = 1 Then
If PNEX.Contains("res") = True Then
ListView1.Items.Add(PKEYREDEX)
Else
TotalKeys = Val(TotalKeys) + Val(calc)
ListView1.Items.Add(PKEYREDEX)
End If
Else
TotalKeys = Val(TotalKeys) + Val(calc)
ListView1.Items.Add(PKEYREDEX)
End If
End If
Catch ex As Exception
End Try
End If
Else
'no matches
End If
Next
Dim TotalKeysEntry As New ListViewItem
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
If LHXML = 1 Then
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
TotalKeysEntry.SubItems.Add(" ")
End If
TotalKeysEntry.SubItems.Add("[SUBTOTAL]")
TotalKeysEntry.SubItems.Add(TotalKeys)
ListView1.Items.Add(TotalKeysEntry)
GTotalKeys = Val(GTotalKeys) + Val(TotalKeys)
Next
Dim GTotalKeysEntry As New ListViewItem
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
If LHXML = 1 Then
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
GTotalKeysEntry.SubItems.Add(" ")
End If
GTotalKeysEntry.SubItems.Add("[TOTAL]")
GTotalKeysEntry.SubItems.Add(GTotalKeys)
ListView1.Items.Add(GTotalKeysEntry)
Catch ex As Exception
MetroFramework.MetroMessageBox.Show(Me, "ERROR: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
ElseIf typeofxrm.Contains("<InvalidRanges") Then
loadfromstring = 0
Button12_Click(sender, e)
ElseIf typeofxrm.Contains("VersionRanges") Then
'UpgradeMatrix
loadfromstring = 0
Button14_Click(sender, e)
ElseIf typeofxrm.Contains("TmiMatrix") Then
'EditionMatrix
loadfromstring = 0
Button13_Click(sender, e)
Else
MetroTabControl1.SelectedIndex = 1
ListView1.Clear()
End If
Button8_Click(sender, e)
End If
End Sub
Private Sub Form1_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim MyFiles() As String
Dim i As Integer
' Assign the files to an array.
MyFiles = e.Data.GetData(DataFormats.FileDrop)
' Loop through the array and add the files to the list.
For i = 0 To MyFiles.Length - 1
OpenFileDialog1.FileName = MyFiles(i)
Next
Button5_Click(sender, e)
End If
End Sub
Private Sub Form1_DragEnter(sender As Object, e As DragEventArgs) Handles MyBase.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.All
End If
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Panel1.Visible = False
Button4.Enabled = True
If CheckBox2.Checked = True Then
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF2.dat") = True Then
IO.File.Delete(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF2.dat")
Else
End If
IO.File.WriteAllText(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF2.dat", "1")
Else
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF2.dat") = True Then
IO.File.Delete(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF2.dat")
Else
End If
End If
If CheckBox3.Checked = True Then
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF3.dat") = True Then
IO.File.Delete(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF3.dat")
Else
End If
IO.File.WriteAllText(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF3.dat", "1")
Else
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF3.dat") = True Then
IO.File.Delete(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF3.dat")
Else
End If
End If
If CheckBox4.Checked = True Then
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF4.dat") = True Then
IO.File.Delete(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF4.dat")
Else
End If
IO.File.WriteAllText(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF4.dat", "1")
Else
If IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF4.dat") = True Then
IO.File.Delete(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "PKEYCONF4.dat")
Else
End If
End If
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
End Sub
Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
Timer1.Enabled = False
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
If OpenFileDialog1.FileName = "" Then
Else
If CheckBox2.Checked = True Then
ListView3.Columns.Clear()
Else
ListView3.Clear()
End If
ListView3.Columns.Add("Title")
ListView3.Columns.Add("LicenseType")
ListView3.Columns.Add("LicenseCategory")
ListView3.Columns.Add("LicenseVersion")
ListView3.Columns.Add("LicensorURL")
ListView3.Columns.Add("IssuanceCertificateID")
ListView3.Columns.Add("ProductSKUID")
ListView3.Columns.Add("ApplicationID")
ListView3.Columns.Add("PKeyConfigLicenseID")
ListView3.Columns.Add("ProductName")
ListView3.Columns.Add("PrivateCertificateID")
ListView3.Columns.Add("PublicCertificateID")
ListView3.Columns.Add("WinBranding")
ListView3.Columns.Add("ProductAuthor")
ListView3.Columns.Add("ProductDescription")
ListView3.Columns.Add("PAURL")
ListView3.Columns.Add("ActivationSequence")
ListView3.Columns.Add("ValidationTemplateID")
ListView3.Columns.Add("ValURL")
ListView3.Columns.Add("UXDifferentiator")
ListView3.Columns.Add("Family")
ListView3.Columns.Add("ProductKeyGroupUniqueness")
ListView3.Columns.Add("EnableNotificationMode")
ListView3.Columns.Add("GraceTimerUniqueness")
ListView3.Columns.Add("ValidityTimerUniqueness")
ListView3.Columns.Add("EnableActivationValidation")
ListView3.Columns.Add("ApplicationBitmap")
ListView3.Columns.Add("HWID:ootGrace")
ListView3.Columns.Add("Migratable")
ListView3.Columns.Add("ReferralData")
ListView3.Columns.Add("VLPolicy")
ListView3.Columns.Add("LicensorKeyIndex")
ListView3.Columns.Add("BuildVersion")
ListView3.Columns.Add("EnforceClientClockSync")
ListView3.Columns.Add("ServerAuthorizationTemplate")
ListView3.Columns.Add("ClientIssuanceCertificateID")
ListView3.Columns.Add("DependsOn")
ListView3.Columns.Add("RuleSetData")
ListView3.Columns.Add("RuleSetType")
ListView3.Columns.Add("LicenseNamespace")
ListView3.Columns.Add("PhonePolicy")
ListView3.Columns.Add("DecryptionCertificateID")
ListView3.Columns.Add("AppXLOB")
ListView3.Columns.Add("ProductInstaller")
ListView3.Columns.Add("RightsIssuanceCertificateID")
ListView3.Columns.Add("RightsTemplateID")
ListView3.Columns.Add("ReferralTag")
ListView3.Columns.Add("ResellerURL")
ListView3.Columns.Add("SPCURL")
ListView3.Columns.Add("RACURL")
ListView3.Columns.Add("PKCURL")
ListView3.Columns.Add("EULURL")
'LOAD
Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
doc.Load(OpenFileDialog1.FileName)
Dim checkxrmtype As String = IO.File.ReadAllText(OpenFileDialog1.FileName)
Dim nodes As XmlNodeList
If checkxrmtype.Contains("<rg:licenseGroup") Then
nodes = doc.SelectNodes("/*[local-name()='licenseGroup']/*[local-name()='license']")
Else
nodes = doc.SelectNodes("/*[local-name()='license']")
If checkxrmtype.Contains("<r:allConditions") Then
Else
'LONGHORN XML
End If
End If
'MsgBox("fileloaded")
For Each node As XmlNode In nodes
Dim NONPKEY As New ListViewItem
Dim licname As String = ""
Try
licname = node.SelectSingleNode("*[local-name()='title']").InnerText
Catch ex As Exception
End Try
Dim licenseType As String = ""
Try
licenseType = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='licenseType']").InnerText
Catch ex As Exception
End Try
Dim licenseCategory As String = ""
Try
licenseCategory = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='licenseCategory']").InnerText
Catch ex As Exception
End Try
Dim licenseVersion As String = ""
Try
licenseVersion = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='licenseVersion']").InnerText
Catch ex As Exception
End Try
Dim licensorUrl As String = ""
Try
licensorUrl = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='licensorUrl']").InnerText
Catch ex As Exception
End Try
Dim issuanceCertificateId As String = ""
Try
issuanceCertificateId = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='issuanceCertificateId']").InnerText
Catch ex As Exception
End Try
Dim productSkuId As String = ""
Try
productSkuId = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='productSkuId']").InnerText
Catch ex As Exception
End Try
Dim privateCertificateId As String = ""
Dim applicationId As String = ""
Dim pkeyConfigLicenseId As String = ""
Dim productName As String = ""
Dim publicCertificateId As String = ""
Dim winbranding As String = ""
Dim productAuthor As String = ""
Dim productDescription As String = ""
Dim PAUrl As String = ""
Dim ActivationSequence As String = ""
Dim ValidationTemplateId As String = ""
Dim ValUrl As String = ""
Dim UXDifferentiator As String = ""
Dim Family As String = ""
Dim ProductKeyGroupUniqueness As String = ""
Dim EnableNotificationMode As String = ""
Dim GraceTimerUniqueness As String = ""
Dim ValidityTimerUniqueness = ""
Dim EnableActivationValidation = ""
Try
publicCertificateId = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='publicCertificateId']").InnerText
Catch ex As Exception
End Try
Try
winbranding = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='win:branding']").InnerText
Catch ex As Exception
End Try
Try
privateCertificateId = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='privateCertificateId']").InnerText
Catch ex As Exception
End Try
Try
applicationId = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='applicationId']").InnerText
Catch ex As Exception
End Try
Try
pkeyConfigLicenseId = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='pkeyConfigLicenseId']").InnerText
Catch ex As Exception
End Try
Try
productName = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='productName']").InnerText
Catch ex As Exception
End Try
Try
productAuthor = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='productAuthor']").InnerText
Catch ex As Exception
End Try
Try
productDescription = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='productDescription']").InnerText
Catch ex As Exception
End Try
Try
PAUrl = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='PAUrl']").InnerText
Catch ex As Exception
End Try
Try
ActivationSequence = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='ActivationSequence']").InnerText
Catch ex As Exception
End Try
Try
ValidationTemplateId = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='ValidationTemplateId']").InnerText
Catch ex As Exception
End Try
Try
ValUrl = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='ValUrl']").InnerText
Catch ex As Exception
End Try
Try
UXDifferentiator = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='UXDifferentiator']").InnerText
Catch ex As Exception
End Try
Try
Family = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='Family']").InnerText
Catch ex As Exception
End Try
Try
ProductKeyGroupUniqueness = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='ProductKeyGroupUniqueness']").InnerText
Catch ex As Exception
End Try
Try
EnableNotificationMode = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='EnableNotificationMode']").InnerText
Catch ex As Exception
End Try
Try
GraceTimerUniqueness = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='GraceTimerUniqueness']").InnerText
Catch ex As Exception
End Try
Try
ValidityTimerUniqueness = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='ValidityTimerUniqueness']").InnerText
Catch ex As Exception
End Try
Try
EnableActivationValidation = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='EnableActivationValidation']").InnerText
Catch ex As Exception
End Try
Dim ApplicationBitmap As String = ""
Dim hwidootgrace As String = ""
Dim migratable As String = ""
Dim referraldata As String = ""
Dim vlpolicy As String = ""
Dim licensorkeyindex As String = ""
Dim buildversion As String = ""
Dim enforceclientclocksync As String = ""
Dim serverauthorizationtemplate As String = ""
Dim clientissuancecertificateid As String = ""
Try
ApplicationBitmap = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='ApplicationBitmap']").InnerText
Catch ex As Exception
End Try
Try
hwidootgrace = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='hwid:ootGrace']").InnerText
Catch ex As Exception
End Try
Try
migratable = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='migratable']").InnerText
Catch ex As Exception
End Try
Try
referraldata = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='referralData']").InnerText
Catch ex As Exception
End Try
Try
vlpolicy = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='vl:policy']").InnerText
Catch ex As Exception
End Try
Try
licensorkeyindex = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='licensorKeyIndex']").InnerText
Catch ex As Exception
End Try
Try
buildversion = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='BuildVersion']").InnerText
Catch ex As Exception
End Try
Try
enforceclientclocksync = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='enforceClientClockSync']").InnerText
Catch ex As Exception
End Try
Try
serverauthorizationtemplate = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='serverAuthorizationTemplate']").InnerText
Catch ex As Exception
End Try
Try
clientissuancecertificateid = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='clientIssuanceCertificateId']").InnerText
Catch ex As Exception
End Try
Dim dependson As String = ""
Try
dependson = node.SelectSingleNode("*[local-name()='otherInfo']/*[local-name()='infoTables']/*[local-name()='infoList']/*[@name='DependsOn']").InnerText
Catch ex As Exception
End Try
Dim rulesetdata As String = ""
Try