-
Notifications
You must be signed in to change notification settings - Fork 33
/
modUsingEverything.bas
104 lines (90 loc) · 4.49 KB
/
modUsingEverything.bas
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
Attribute VB_Name = "modUsingEverything"
Option Explicit
' Provide a mechanism to add a using for everything pertinent to every CS file.
Private Everything As String
Private Const VB6Compat As String = "Microsoft.VisualBasic.Compatibility.VB6"
' Returns preamble for every CS file generated.
Public Function UsingEverything(Optional ByVal PackageName As String = "") As String
Dim List As String, Path As String, Name As String
Dim E As String, L As Variant
Dim R As String, N As String, M As String
E = ""
R = "": N = vbCrLf: M = ""
If PackageName <> "" Then
' R = R & N & "package " & PackagePrefix & PackageName & ";"
R = R & N & ""
End If
If Everything = "" Then
E = E & M & "using VB6 = " & VB6Compat & ";"
E = E & N & "using System.Runtime.InteropServices;"
E = E & N & "using static VBExtension;"
E = E & N & "using static VBConstants;"
E = E & N & "using Microsoft.VisualBasic;"
E = E & N & "using System;"
E = E & N & "using System.Windows;"
E = E & N & "using System.Windows.Controls;"
E = E & N & "using static System.DateTime;"
E = E & N & "using static System.Math;"
E = E & N & "using System.Linq;"
E = E & N & "using static Microsoft.VisualBasic.Globals;"
E = E & N & "using static Microsoft.VisualBasic.Collection;"
E = E & N & "using static Microsoft.VisualBasic.Constants;"
E = E & N & "using static Microsoft.VisualBasic.Conversion;"
E = E & N & "using static Microsoft.VisualBasic.DateAndTime;"
E = E & N & "using static Microsoft.VisualBasic.ErrObject;"
E = E & N & "using static Microsoft.VisualBasic.FileSystem;"
E = E & N & "using static Microsoft.VisualBasic.Financial;"
E = E & N & "using static Microsoft.VisualBasic.Information;"
E = E & N & "using static Microsoft.VisualBasic.Interaction;"
E = E & N & "using static Microsoft.VisualBasic.Strings;"
E = E & N & "using static Microsoft.VisualBasic.VBMath;"
E = E & N & "using System.Collections.Generic;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.ColorConstants;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.DrawStyleConstants;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.FillStyleConstants;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.GlobalModule;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.Printer;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.PrinterCollection;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.PrinterObjectConstants;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.ScaleModeConstants;"
E = E & N & "using static Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6.SystemColorConstants;"
E = E & N & "using ADODB;"
E = E & N & "using System;"
E = E & N & "using System.Collections.Generic;"
E = E & N & "using System.Linq;"
E = E & N & "using System.Text;"
E = E & N & "using System.Threading.Tasks;"
E = E & N & "using System.Windows;"
E = E & N & "using System.Windows.Controls;"
E = E & N & "using System.Windows.Data;"
E = E & N & "using System.Windows.Documents;"
E = E & N & "using System.Windows.Input;"
E = E & N & "using System.Windows.Media;"
E = E & N & "using System.Windows.Media.Imaging;"
E = E & N & "using System.Windows.Shapes;"
E = E & N
E = E & N & "using " & AssemblyName & ".Forms;"
Path = FilePath(vbpFile)
For Each L In Split(VBPModules(vbpFile), vbCrLf)
If L <> "" Then
Name = ModuleName(ReadEntireFile(Path & L))
E = E & N & "using static " & PackagePrefix & Name & ";"
End If
Next
For Each L In Split(VBPForms(vbpFile), vbCrLf)
If L <> "" Then
Name = ModuleName(ReadEntireFile(Path & L))
E = E & N & "using static " & AssemblyName & ".Forms." & Name & ";"
End If
Next
For Each L In Split(VBPClasses(vbpFile), vbCrLf)
If L <> "" Then
Name = ModuleName(ReadEntireFile(Path & L))
E = E & N & "using static " & AssemblyName & ".Classes." & Name & ";"
End If
Next
Everything = E
End If
R = Everything & N & R
UsingEverything = R
End Function