Skip to content

Commit acd2198

Browse files
committed
Src Add DotNet 5.0
1 parent b92d123 commit acd2198

File tree

10 files changed

+1098
-0
lines changed

10 files changed

+1098
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30804.86
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "PigObjFsDemo", "PigObjFsDemo\PigObjFsDemo.vbproj", "{417FD863-751D-4B28-BDF6-175D84AFC644}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{417FD863-751D-4B28-BDF6-175D84AFC644}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{417FD863-751D-4B28-BDF6-175D84AFC644}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{417FD863-751D-4B28-BDF6-175D84AFC644}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{417FD863-751D-4B28-BDF6-175D84AFC644}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {1891F9E8-E9D2-4631-8759-B676987106FC}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<RootNamespace>PigObjFsDemo</RootNamespace>
6+
<TargetFramework>net5.0</TargetFramework>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<Reference Include="PigObjFsLib">
11+
<HintPath>..\..\PigObjFsLib\PigObjFsLib\bin\Debug\net5.0\PigObjFsLib.dll</HintPath>
12+
</Reference>
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
Imports System
2+
Imports PigObjFsLib
3+
Module Program
4+
Public goFS As New pFileSystemObject
5+
Sub Main(args As String())
6+
Do While True
7+
Console.WriteLine("*******************")
8+
Console.WriteLine("Main menu")
9+
Console.WriteLine("*******************")
10+
Console.WriteLine("Press Q to Exit")
11+
Console.WriteLine("Press A to pFileSystemObject")
12+
Console.WriteLine("Press B to pTextStream")
13+
Console.WriteLine("*******************")
14+
Select Case Console.ReadKey().Key
15+
Case ConsoleKey.Q
16+
Exit Do
17+
Case ConsoleKey.A
18+
Do While True
19+
Console.WriteLine("*******************")
20+
Console.WriteLine("Menu pFileSystemObject")
21+
Console.WriteLine("*******************")
22+
Console.WriteLine("Press Q to Up")
23+
Console.WriteLine("Press A to GetFile")
24+
Console.WriteLine("Press B to GetFolder")
25+
Console.WriteLine("Press C to FileExists")
26+
Console.WriteLine("Press D to FolderExists")
27+
Console.WriteLine("Press E to CreateFolder")
28+
Console.WriteLine("*******************")
29+
Select Case Console.ReadKey().Key
30+
Case ConsoleKey.Q
31+
Exit Do
32+
Case ConsoleKey.A
33+
Dim strFilePath As String
34+
Console.WriteLine("#################")
35+
Console.WriteLine("Enter the file path, such as " & GetCurrDirFristFile())
36+
strFilePath = Console.ReadLine()
37+
If strFilePath = "" Then
38+
strFilePath = GetCurrDirFristFile()
39+
End If
40+
Dim oFile As pFile = goFS.GetFile(strFilePath)
41+
Console.WriteLine("DateCreated: " & oFile.DateCreated)
42+
Console.WriteLine("DateLastModified: " & oFile.DateLastModified)
43+
Console.WriteLine("Name: " & oFile.Name)
44+
Console.WriteLine("Path: " & oFile.Path)
45+
Console.WriteLine("#################")
46+
Case ConsoleKey.B
47+
Dim strFolderPath As String
48+
Console.WriteLine("#################")
49+
Console.WriteLine("Enter the file folder, such as " & goFS.AppPath)
50+
strFolderPath = Console.ReadLine()
51+
If strFolderPath = "" Then
52+
strFolderPath = goFS.AppPath
53+
End If
54+
Dim oFolder As pFolder = goFS.GetFolder(strFolderPath)
55+
Console.WriteLine("DateCreated: " & oFolder.DateCreated)
56+
Console.WriteLine("DateLastModified: " & oFolder.DateLastModified)
57+
Console.WriteLine("Name: " & oFolder.Name)
58+
Console.WriteLine("Path: " & oFolder.Path)
59+
Console.WriteLine("#################")
60+
Case ConsoleKey.C
61+
Dim strFilePath As String
62+
Console.WriteLine("#################")
63+
Console.WriteLine("Enter the file path, such as " & GetCurrDirFristFile())
64+
strFilePath = Console.ReadLine()
65+
If strFilePath = "" Then
66+
strFilePath = GetCurrDirFristFile()
67+
End If
68+
Console.WriteLine("FileExists: " & goFS.FileExists(strFilePath))
69+
Console.WriteLine("#################")
70+
Case ConsoleKey.D
71+
Dim strFolderPath As String
72+
Console.WriteLine("#################")
73+
Console.WriteLine("Enter the file folder, such as " & goFS.AppPath)
74+
strFolderPath = Console.ReadLine()
75+
If strFolderPath = "" Then
76+
strFolderPath = goFS.AppPath
77+
End If
78+
Console.WriteLine("FolderExists: " & goFS.FolderExists(strFolderPath))
79+
Console.WriteLine("#################")
80+
Case ConsoleKey.E
81+
Dim strFolderPath As String, strDefaPath As String
82+
Console.WriteLine("#################")
83+
With goFS
84+
strDefaPath = .AppPath & "a" & .OsPathSep & "b"
85+
Console.WriteLine("Enter the file folder, such as " & strDefaPath)
86+
End With
87+
strFolderPath = Console.ReadLine()
88+
If strFolderPath = "" Then
89+
strFolderPath = strDefaPath
90+
End If
91+
goFS.CreateFolder(strFolderPath)
92+
Console.Write("CreateFolder: ")
93+
If goFS.LastErr = "" Then
94+
Console.WriteLine("OK")
95+
Else
96+
Console.WriteLine(goFS.LastErr)
97+
End If
98+
Console.WriteLine("#################")
99+
End Select
100+
Loop
101+
Case ConsoleKey.B
102+
Do While True
103+
Console.WriteLine("*******************")
104+
Console.WriteLine("Menu pTextStream")
105+
Console.WriteLine("*******************")
106+
Console.WriteLine("Press Q to Up")
107+
Console.WriteLine("Press A to Read File")
108+
Console.WriteLine("Press B to Write File")
109+
Console.WriteLine("*******************")
110+
Select Case Console.ReadKey().Key
111+
Case ConsoleKey.Q
112+
Exit Do
113+
Case ConsoleKey.A
114+
Dim strFilePath As String
115+
Console.WriteLine("#################")
116+
Console.WriteLine("Enter the file path, such as " & GetCurrDirFristFile())
117+
strFilePath = Console.ReadLine()
118+
If strFilePath = "" Then
119+
strFilePath = GetCurrDirFristFile()
120+
End If
121+
If goFS.FileExists(strFilePath) = False Then
122+
Console.WriteLine(strFilePath & " not found.")
123+
Else
124+
Dim oTextStream As pTextStream
125+
Console.WriteLine("OpenTextFile(" & strFilePath & ")...")
126+
oTextStream = goFS.OpenTextFile(strFilePath, pFileSystemObject.pIOMode.ForReading, False)
127+
If goFS.LastErr <> "" Then
128+
Console.WriteLine(goFS.LastErr)
129+
Else
130+
Do While Not oTextStream.AtEndOfStream
131+
Console.WriteLine(oTextStream.ReadLine)
132+
Loop
133+
oTextStream.Close()
134+
End If
135+
End If
136+
Console.WriteLine("#################")
137+
Case ConsoleKey.B
138+
Dim strFilePath As String, strDefaFile As String
139+
Console.Write("Enter the file path, such as ")
140+
If goFS.IsWindows = True Then
141+
strDefaFile = "C:\Temp\TestPigFsDemo.txt"
142+
Else
143+
strDefaFile = "/Temp/TestPigFsDemo.txt"
144+
End If
145+
Console.WriteLine(strDefaFile)
146+
strFilePath = Console.ReadLine()
147+
If strFilePath = "" Then
148+
strFilePath = strDefaFile
149+
End If
150+
Dim oTextStream As pTextStream
151+
Console.WriteLine("OpenTextFile(" & strFilePath & ")...")
152+
oTextStream = goFS.OpenTextFile(strFilePath, pFileSystemObject.pIOMode.ForWriting, True)
153+
If goFS.LastErr <> "" Then
154+
Console.WriteLine(goFS.LastErr)
155+
Else
156+
oTextStream.WriteLine("WriteLine")
157+
oTextStream.WriteBlankLines(2)
158+
oTextStream.Close()
159+
Console.WriteLine("OK")
160+
End If
161+
End Select
162+
Loop
163+
End Select
164+
165+
Loop
166+
End Sub
167+
168+
Public Function GetCurrDirFristFile() As String
169+
Dim oFolder As pFolder
170+
oFolder = goFS.GetFolder(goFS.AppPath)
171+
GetCurrDirFristFile = ""
172+
For Each objFile In oFolder.Files
173+
If Not objFile Is Nothing Then
174+
GetCurrDirFristFile = objFile.Path
175+
Exit For
176+
End If
177+
Next
178+
End Function
179+
180+
End Module
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30804.86
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "PigObjFsLib", "PigObjFsLib\PigObjFsLib.vbproj", "{180B3389-7BF4-426B-9EAA-9CE7B784F666}"
7+
EndProject
8+
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "PigObjFsDemo", "..\PigObjFsDemo\PigObjFsDemo\PigObjFsDemo.vbproj", "{BA0168BA-A1EC-44AC-855F-E3F7AE929F8C}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{180B3389-7BF4-426B-9EAA-9CE7B784F666}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{180B3389-7BF4-426B-9EAA-9CE7B784F666}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{180B3389-7BF4-426B-9EAA-9CE7B784F666}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{180B3389-7BF4-426B-9EAA-9CE7B784F666}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{BA0168BA-A1EC-44AC-855F-E3F7AE929F8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{BA0168BA-A1EC-44AC-855F-E3F7AE929F8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{BA0168BA-A1EC-44AC-855F-E3F7AE929F8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{BA0168BA-A1EC-44AC-855F-E3F7AE929F8C}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {8E6D7788-72A2-4E83-9E94-487F40F5A4D7}
30+
EndGlobalSection
31+
EndGlobal

0 commit comments

Comments
 (0)