-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewPkgModule.vb
More file actions
77 lines (61 loc) · 2.73 KB
/
ViewPkgModule.vb
File metadata and controls
77 lines (61 loc) · 2.73 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
Imports System.Reflection
Imports System.Text
Imports Microsoft.VisualBasic.ApplicationServices.Development
Imports Microsoft.VisualBasic.CommandLine.Reflection
Imports Microsoft.VisualBasic.ComponentModel
Imports Microsoft.VisualBasic.Net.Protocols.ContentTypes
Imports Microsoft.VisualBasic.Scripting.MetaData
Imports Microsoft.VisualBasic.Text
Imports WeifenLuo.WinFormsUI.Docking
Public Class ViewPkgModule : Implements Viewer
Public Property FilePath As String Implements IFileReference.FilePath
Public ReadOnly Property MimeType As ContentType() Implements IFileReference.MimeType
Get
Throw New NotImplementedException()
End Get
End Property
Public Function View(file As String) As DockContent Implements Viewer.View
FilePath = file
Text = file.FileName
Dim assembly As Assembly = Assembly.UnsafeLoadFrom(file)
Dim packages As Type() = assembly.GetTypes _
.Where(Function(pkg)
Return Not pkg.GetCustomAttribute(Of PackageAttribute) Is Nothing
End Function) _
.ToArray
If packages.Length = 0 Then
TabPage2.Hide()
TabPage2.Visible = False
Controls.Remove(TabPage2)
End If
For Each pkg As Type In packages
Dim name As PackageAttribute = pkg.GetCustomAttribute(Of PackageAttribute)
Dim node As New TreeNode With {.Text = name.Namespace}
For Each method As MethodInfo In pkg.GetMethods
Dim exportApi As ExportAPIAttribute = method.GetCustomAttribute(Of ExportAPIAttribute)
If Not exportApi Is Nothing Then
node.Nodes.Add(exportApi.Name)
End If
Next
TreeView1.Nodes.Add(node)
Next
Dim info As AssemblyInfo = assembly.FromAssembly
txtTitle.Text = info.AssemblyTitle
txtInfo.Text = info.AssemblyDescription
txtCompany.Text = info.AssemblyCompany
txtCopyright.Text = info.AssemblyCopyright
txtProduct.Text = info.AssemblyProduct
txtTrademark.Text = info.AssemblyTrademark
DateTimePicker1.Value = info.BuiltTime
Return Me
End Function
Public Function Save(path As String, encoding As Encoding) As Boolean Implements ISaveHandle.Save
Throw New NotImplementedException()
End Function
Public Function Save(path As String, Optional encoding As Encodings = Encodings.UTF8) As Boolean Implements ISaveHandle.Save
Throw New NotImplementedException()
End Function
Public Function Save(file As IO.Stream, encoding As Encoding) As Boolean Implements ISaveHandle.Save
Throw New NotImplementedException()
End Function
End Class