├── .gitignore
├── Audio
├── Audio.vbproj
└── Program.vb
├── BasicComputerGames
├── 01_AceyDucey
│ ├── 01_AceyDucey.vbproj
│ └── Program.vb
├── 02_Amazing
│ ├── 02_Amazing.vbproj
│ └── Program.vb
├── 30_Cube
│ ├── 30_Cube.vbproj
│ └── Program.vb
└── README.md
├── ClassLibrary1
├── Class1.cs
└── ClassLibrary1.csproj
├── ClearScript
├── README.md
└── VbScriptRepl
│ ├── VbScriptRepl.vb
│ └── VbScriptRepl.vbproj
├── CompareFolders
├── CompareFolders.vbproj
└── Program.vb
├── CompilerApiBook
└── CompileHelloWorld
│ ├── CompileHelloWorld.vbproj
│ ├── Dialect.Qb.vb
│ ├── IDialect.vb
│ ├── Program.bas
│ ├── Program.vb
│ ├── Raw.vb
│ ├── Token.vb
│ └── Tokens.vb
├── ConsoleApp1
├── Byref.vb
├── ConsoleApp1.vbproj
├── HttpClientDownloadWithProgress.vb
├── Inline.vb
├── Module1.vb
├── Module2.vb
├── Program.Late.vb
├── Program.vb
└── TestClass.vb
├── FileSystemWatcherSample
├── FileSystemWatcherSample.vbproj
├── My Project
│ └── launchSettings.json
└── Program.vb
├── FormExGenerator
├── FormExGenerator.vb
├── FormExGenerator.vbproj
└── README.md
├── GUI
├── FNA_Gameloop
│ ├── Content
│ │ └── FNATexture.png
│ ├── FAudio.dll
│ ├── FNA3D.dll
│ ├── FNA_Gameloop.vbproj
│ ├── Program.vb
│ ├── README.md
│ ├── SDL2.dll
│ └── libtheorafile.dll
├── OpenTk_Gameloop
│ ├── OpenTk_Gameloop.vbproj
│ ├── Program.vb
│ └── README.md
├── README.md
├── Raylib_Gameloop
│ ├── Program.vb
│ ├── README.md
│ └── Raylib_Gameloop.vbproj
├── SDL2_Gameloop
│ ├── Program.vb
│ ├── README.md
│ ├── SDL2.dll
│ └── SDL2_Gameloop.vbproj
├── Silk_Gameloop
│ ├── Program.vb
│ ├── README.md
│ └── Silk_Gameloop.vbproj
└── WinForms_GameLoop
│ ├── ApplicationEvents.vb
│ ├── Form1.Designer.vb
│ ├── Form1.resx
│ ├── Form1.vb
│ ├── My Project
│ ├── Application.Designer.vb
│ └── Application.myapp
│ ├── Screen.vb
│ └── WinForms_GameLoop.vbproj
├── GameLoop1
├── ApplicationEvents.vb
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── GameLoop1.vbproj
└── My Project
│ ├── Application.Designer.HighDpi.vb
│ ├── Application.Designer.vb
│ └── Application.myapp
├── GameLoop2
├── ApplicationEvents.vb
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── GameLoop2.vbproj
└── My Project
│ ├── Application.Designer.vb
│ └── Application.myapp
├── InsaneSourceGeneration
├── InsaneSourceGeneration.vbproj
├── Program.BAS
├── Program.vb
└── Program_Generated.vb
├── Json101
├── Json101.vbproj
└── Program.vb
├── LICENSE
├── OLC
├── Other
│ ├── CaveDiver
│ │ ├── CaveDiver.vbproj
│ │ └── Program.vb
│ ├── EmbeddingLua_Part1
│ │ ├── EmbeddingLua_Part1.vbproj
│ │ ├── My Project
│ │ │ └── launchSettings.json
│ │ ├── Program.vb
│ │ └── VideoExample.lua
│ ├── Images
│ │ ├── Snake.png
│ │ ├── Synth1.png
│ │ ├── Synth2.png
│ │ ├── Synth3.png
│ │ ├── Synth4.png
│ │ └── Tetris.png
│ ├── README.md
│ ├── Snake
│ │ ├── Program.vb
│ │ └── Snake.vbproj
│ ├── Synth1
│ │ ├── Program.vb
│ │ ├── Synth1.vbproj
│ │ └── olcNoiseMaker.vb
│ ├── Synth2
│ │ ├── Program.vb
│ │ ├── Synth2.vbproj
│ │ └── olcNoiseMaker.vb
│ ├── Synth3
│ │ ├── Program.vb
│ │ ├── Synth3.vbproj
│ │ └── olcNoiseMaker.vb
│ ├── Synth4
│ │ ├── Program.vb
│ │ ├── Synth4.vbproj
│ │ └── olcNoiseMaker.vb
│ └── Tetris
│ │ ├── Program.vb
│ │ └── Tetris.vbproj
└── README.md
├── PLAYground
├── My Project
│ └── launchSettings.json
├── PLAYground.vbproj
├── ParsePlayMacro.vb
└── Program.vb
├── QB64
├── MarkdownHelp
│ ├── Lexer.vb
│ ├── MarkdownHelp.vbproj
│ ├── Program.vb
│ ├── SyntaxFacts.vb
│ ├── SyntaxKind.vb
│ ├── SyntaxNode.vb
│ ├── SyntaxToken.vb
│ └── Text
│ │ ├── SourceText.vb
│ │ ├── TextLine.vb
│ │ ├── TextLocation.vb
│ │ └── TextSpan.vb
├── ParseWiki
│ ├── ParseWiki.vbproj
│ └── Program.vb
├── Qb64SamplesToMarkdown
│ ├── Program.vb
│ └── Qb64SamplesToMarkdown.vbproj
└── TxtToWiki
│ ├── Program.vb
│ └── TxtToWiki.vbproj
├── QBasic
├── Gorilla
│ ├── ApplicationEvents.vb
│ ├── Form1.Designer.vb
│ ├── Form1.resx
│ ├── Form1.vb
│ ├── Gorilla.vbproj
│ ├── Music.vb
│ ├── My Project
│ │ ├── Application.Designer.HighDpi.vb
│ │ ├── Application.Designer.vb
│ │ ├── Application.myapp
│ │ ├── Resources.Designer.vb
│ │ └── Resources.resx
│ └── Resources
│ │ ├── DBan.png
│ │ ├── LBan.png
│ │ ├── RBan.png
│ │ └── UBan.png
├── Nibbles
│ ├── Music.vb
│ ├── Nibbles.vbproj
│ └── Program.vb
├── README.md
└── RemLine
│ ├── Program.vb
│ ├── RawConversion.vb
│ └── RemLine.vbproj
├── QSortModern
├── Program.vb
└── QSortModern.vbproj
├── README.md
├── Samples.sln
├── ScanMkDn
├── Program.vb
└── ScanMkDn.vbproj
├── Serial
└── PC-To-Centurion
│ ├── PcSide.vbproj
│ └── Program.vb
├── SerialTesting
├── CenturionSide.vbproj
└── Program.vb
├── SortTest
├── Program.vb
└── SortTest.vbproj
├── Sound
├── Libsoundio_Sample
│ ├── Libsoundio_Sample.vbproj
│ ├── Program.vb
│ └── README.md
├── ModExtract
│ ├── ModExtract.vbproj
│ └── Program.vb
├── WaveOut
│ ├── Program.vb
│ └── WaveOut.vbproj
└── WaveOutBuffered
│ ├── Program.vb
│ └── WaveOutBuffered.vbproj
├── SoundBeepPlay
├── AudioPlaybackEngine.vb
├── AutoDisposeFileReader.vb
├── CachedSound.vb
├── CachedSoundSampleProvider.vb
├── EventArgs.vb
├── Player3.vb
├── Program.vb
├── SoundBeepPlay.vbproj
└── SoundGenerator.vb
├── SourceGenerators
├── GeneratedDemo
│ ├── Cars.csv
│ ├── GeneratedDemo.vbproj
│ ├── MainSettings.xmlsettings
│ ├── People.csv
│ ├── Program.vb
│ ├── UseAutoNotifyGenerator.vb
│ ├── UseCsvGenerator.vb
│ ├── UseHelloWorldGenerator.vb
│ ├── UseImplicitInterfacGenerator.vb
│ ├── UseMustacheGenerator.vb
│ ├── UseRecordGenerator.vb
│ └── UseXmlSettingsGenerator.vb
├── ImplicitInterfaceGenerator
│ ├── ImplicitInterfaceGenerator.vb
│ ├── ImplicitInterfaceGenerator.vbproj
│ └── README.md
├── README.md
├── SourceGeneratorSamples
│ ├── AutoNotifyGenerator.vb
│ ├── CsvGenerator.props
│ ├── CsvGenerator.vb
│ ├── HelloWorldGenerator.vb
│ ├── ImplicitInterfaceGenerator.vb
│ ├── MustacheGenerator.vb
│ ├── RecordGenerator.vb
│ ├── SettingsXmlGenerator.vb
│ └── SourceGeneratorSamples.vbproj
├── SourceGenerators.sln
└── TestConsoleApp
│ ├── Program.vb
│ └── TestConsoleApp.vbproj
├── SyntaxTree.vb
├── TestFormsApp
├── ApplicationEvents.vb
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── My Project
│ ├── Application.Designer.HighDpi.vb
│ ├── Application.Designer.vb
│ └── Application.myapp
└── TestFormsApp.vbproj
├── TestNuGetPackages
├── Program.vb
└── TestNuGetPackages.vbproj
├── TinyBASIC
├── Program.vb
└── TinyBASIC.vbproj
├── Transpiler
├── Program.vb
├── RemLine.vb
├── Transpiler.vbproj
└── VbRewriter.vb
├── Tui
├── Program.vb
└── Tui.vbproj
├── Twitter
├── Program.vb
├── Twitter.vbproj
└── TwitterApi.vb
├── UacPrompt
├── ApplicationEvents.vb
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── My Project
│ ├── Application.Designer.vb
│ └── Application.myapp
└── UacPrompt.vbproj
├── WinFormBugs
├── ReparentWinForms
│ ├── ApplicationEvents.vb
│ ├── Community.Windows.FormsEx
│ │ ├── ArrowDirections.vb
│ │ ├── HScrollBarEx.vb
│ │ ├── PanelEx.vb
│ │ ├── ScrollBar.vb
│ │ ├── ScrollBarDarkMode.vb
│ │ └── VScrollBarEx.vb
│ ├── Form1.Designer.vb
│ ├── Form1.resx
│ ├── Form1.vb
│ ├── My Project
│ │ ├── Application.Designer.HighDpi.vb
│ │ ├── Application.Designer.vb
│ │ └── Application.myapp
│ └── ReparentWinForms.vbproj
└── ReparentWinformsFx
│ ├── App.config
│ ├── Form1.Designer.vb
│ ├── Form1.resx
│ ├── Form1.vb
│ ├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
│ └── ReparentWinformsFx.vbproj
├── WinForms
├── Browser
│ ├── ApplicationEvents.vb
│ ├── Browser.vbproj
│ ├── DarkColorTable.vb
│ ├── Form1.Designer.vb
│ ├── Form1.resx
│ ├── Form1.vb
│ └── My Project
│ │ ├── Application.Designer.HighDpi.vb
│ │ ├── Application.Designer.vb
│ │ └── Application.myapp
├── BrowserFx
│ ├── App.config
│ ├── BrowserFx.vbproj
│ ├── My Project
│ │ ├── Application.Designer.vb
│ │ ├── Application.myapp
│ │ ├── AssemblyInfo.vb
│ │ ├── Resources.Designer.vb
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.vb
│ │ └── Settings.settings
│ └── packages.config
└── Webcam
│ ├── ApplicationEvents.vb
│ ├── Form1.Designer.vb
│ ├── Form1.resx
│ ├── Form1.vb
│ ├── My Project
│ ├── Application.Designer.vb
│ └── Application.myapp
│ └── Webcam.vbproj
├── WinFormsApp1
├── ApplicationEvents.vb
├── Community.Windows.FormsEx
│ ├── ArrowDirections.vb
│ ├── ComboBoxEx.vb
│ ├── DarkColorTable.vb
│ ├── DarkMode.vb
│ ├── HScrollBarEx.vb
│ ├── PanelEx.vb
│ ├── ScrollBar.vb
│ ├── ScrollBarDarkMode.vb
│ ├── ScrollBarExPanel.Designer.vb
│ ├── ScrollBarExPanel.vb
│ ├── ToolStripComboBoxEx.vb
│ └── VScrollBarEx.vb
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── My Project
│ ├── Application.Designer.HighDpi.vb
│ ├── Application.Designer.vb
│ └── Application.myapp
└── WinFormsApp1.vbproj
└── WinFormsApp_dotNet6
├── ApplicationEvents.vb
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── My Project
├── Application.Designer.vb
└── Application.myapp
└── WinFormsApp_dotNet6.vbproj
/Audio/Audio.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Audio
6 | net8.0
7 |
8 |
9 |
10 | false
11 | none
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Audio/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Management
3 | Imports NAudio.CoreAudioApi
4 | Imports NAudio.Wave
5 |
6 | Module Program
7 |
8 | Sub Main() 'args As String())
9 |
10 | Console.WriteLine("******* Using WMI ******* ")
11 |
12 | If OperatingSystem.IsWindows Then
13 |
14 | Dim objSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_SoundDevice")
15 | Dim objCollection = objSearcher.Get()
16 | For Each d In objCollection
17 | For Each p In d.Properties
18 | Select Case p.Name
19 | Case "Name"
20 | Console.WriteLine($"{p.Value}")
21 | Case Else
22 | End Select
23 | Next
24 | Next
25 |
26 | End If
27 |
28 | Console.WriteLine("******* Using WaveOut ******* ")
29 |
30 | 'NOTE: The following appears to have been removed between NAudio 1.x and 2.x.
31 | 'For n = -1 To WaveOut.DeviceCount - 1
32 | ' Dim caps = WaveOut.GetCapabilities(n)
33 | ' Console.WriteLine($"{n}: {caps.ProductName}")
34 | 'Next
35 |
36 | Console.WriteLine("******* Using WaveIn ******* ")
37 |
38 | 'NOTE: The following appears to have been removed between NAudio 1.x and 2.x.
39 | 'For n = -1 To WaveIn.DeviceCount - 1
40 | ' Dim caps = WaveIn.GetCapabilities(n)
41 | ' Console.WriteLine($"{n}: {caps.ProductName}")
42 | 'Next
43 |
44 | Console.WriteLine("******* Using DirectSound ******* ")
45 |
46 | For Each dev In DirectSoundOut.Devices
47 | Console.WriteLine($"{dev.Guid} {dev.ModuleName} {dev.Description}")
48 | Next
49 |
50 | Console.WriteLine("******* Using WASAPI ******* ")
51 |
52 | Dim enumerator = New MMDeviceEnumerator
53 | For Each wasapi In enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.All)
54 | Try
55 | Console.WriteLine($"{wasapi.DataFlow} {wasapi.FriendlyName} {wasapi.DeviceFriendlyName} {wasapi.State}")
56 | Catch ex As Runtime.InteropServices.COMException
57 | Console.WriteLine(ex.Message)
58 | End Try
59 | Next
60 |
61 | Console.WriteLine("******* Using ASIO ******* ")
62 |
63 | For Each a In AsioOut.GetDriverNames
64 | Console.WriteLine($"{a}")
65 | Next
66 |
67 | End Sub
68 |
69 | End Module
70 |
--------------------------------------------------------------------------------
/BasicComputerGames/01_AceyDucey/01_AceyDucey.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | AceyDucey
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BasicComputerGames/02_Amazing/02_Amazing.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Amazing
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BasicComputerGames/30_Cube/30_Cube.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | _30_Cube
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BasicComputerGames/README.md:
--------------------------------------------------------------------------------
1 | # BASIC COMPUTER GAMES
2 |
3 | ## What are we doing?
4 |
5 | This project is about migrating the games from the first computer book to sell over a million copies... [BASIC COMPUTER GAMES: MICROCOMPUTER EDITION](https://annarchive.com/files/Basic_Computer_Games_Microcomputer_Edition.pdf)!
6 |
7 | These games were originally written to target MBASIC, the version of Microsoft BASIC prior to [GW-BASIC](https://gw-basic.com) and [QBasic](https://qbasic.com).
8 |
9 | Given the these versions of BASIC are the grandparent, great grandparent and the great-great grandparents of modern VB, the idea
10 | is to convert these projects so that they not only execute but also retain some of this *legacy* that harkens back to these original
11 | dialects of BASIC.
12 |
13 | ## Where can we discuss it?
14 |
15 | Please join us over on our [Discord server](https://discord.gg/Y8EH5fF6WG) for any discussion and conversation around this project.
16 |
17 | ## The games!
18 |
19 | 01 - ACEY-DUCEY
20 | 02 - AMAZING
21 | 30 - CUBE
22 |
--------------------------------------------------------------------------------
/ClassLibrary1/Class1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ClassLibrary1
4 | {
5 | public class Class1
6 | {
7 |
8 | private bool _blah;
9 |
10 | public bool Blah(bool value) {
11 | _blah = value;
12 |
13 | //string a = "2.5";
14 | //int b = (int)a;
15 |
16 | return _blah;
17 |
18 |
19 | }
20 |
21 | public static void InlineIncrementTest()
22 | {
23 |
24 | int value = 1;
25 | Console.WriteLine($"({value}) value=5 = {value=5} ({value})");
26 | Console.WriteLine($"({value}) value++ = {value++} ({value})");
27 | Console.WriteLine($"({value}) value-- = {value--} ({value})");
28 | Console.WriteLine($"({value}) ++value = {++value} ({value})");
29 | Console.WriteLine($"({value}) --value = {--value} ({value})");
30 |
31 | }
32 |
33 | }
34 |
35 | public record A
36 | {
37 | public int A1 { get; init; }
38 | }
39 |
40 | public record B(int A1);
41 | public record C(int A1, int B1);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/ClassLibrary1/ClassLibrary1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ClearScript/README.md:
--------------------------------------------------------------------------------
1 | # ClearScript
2 |
3 | [Microsoft ClearScript](https://microsoft.github.io/ClearScript/) is a library for adding scripting to .NET applications. Supports V8 (Windows, Linux, macOS) and JScript/VBScript (Windows).
4 |
5 | ## Samples
6 |
7 | ### VbScriptRepl
8 |
9 | This sample emulates a REPL simple experience leveraging VBScript implemented in a .NET 6 console application.
10 |
11 |
--------------------------------------------------------------------------------
/ClearScript/VbScriptRepl/VbScriptRepl.vb:
--------------------------------------------------------------------------------
1 | ' Copyright (c) Cory Smith. All rights reserved.
2 | ' Licensed under the MIT license.
3 |
4 | Imports Microsoft.ClearScript
5 | Imports Microsoft.ClearScript.Windows.Core
6 |
7 | Module VbScriptRepl
8 |
9 | Public Sub Main() 'args As String())
10 |
11 | Using engine = New VBScriptEngine(NameOf(VbScriptRepl), Windows.WindowsScriptEngineFlags.EnableDebugging, NullSyncInvoker.Instance)
12 |
13 | engine.AddHostType("Api", GetType(Api))
14 | engine.AddHostObject("Host", New ExtendedHostFunctions())
15 | engine.AddHostObject("Lib", HostItemFlags.GlobalMembers, New HostTypeCollection("mscorlib", "System", "System.Core", "System.Numerics", "ClearScript.Core", "ClearScript.Windows.Core"))
16 | 'engine.SuppressExtensionMethodEnumerication = True
17 | engine.AllowReflection = True
18 |
19 | Initialize(engine)
20 | Execute(engine)
21 |
22 | End Using
23 |
24 | End Sub
25 |
26 | Private Sub Initialize(engine As ScriptEngine)
27 | Try
28 | Dim filename = IO.Path.ChangeExtension("Startup", engine.FileNameExtension)
29 | Dim path = IO.Path.Combine(IO.Path.GetDirectoryName(Environment.ProcessPath), filename)
30 | If IO.File.Exists(path) Then
31 | engine.Execute(New DocumentInfo(New Uri(path)), IO.File.ReadAllText(path))
32 | End If
33 | Catch ex As Exception
34 | Console.WriteLine($"Error: {ex.GetBaseException.Message}")
35 | End Try
36 | End Sub
37 |
38 | Private Sub Execute(engine As ScriptEngine)
39 | Do
40 | Console.Write("> ")
41 | Dim command = Console.ReadLine()
42 | If String.Compare(command, "exit", True) = 0 Then Exit Do
43 | If String.IsNullOrWhiteSpace(command) Then Continue Do
44 | If command.StartsWith("?") Then command = command.Replace("?", "api.print")
45 | Try
46 | Dim result = engine.ExecuteCommand(command)
47 | If result IsNot Nothing Then Console.WriteLine(result)
48 | Catch ex As Exception
49 | Console.WriteLine($"Error {ex.GetBaseException.Message}")
50 | End Try
51 | Loop
52 | End Sub
53 |
54 | End Module
55 |
56 | Public NotInheritable Class Api
57 |
58 | Private Sub New()
59 | End Sub
60 |
61 | Public Shared Sub Print(o As Object)
62 | Console.WriteLine(o)
63 | End Sub
64 |
65 | Public Shared Sub Print(value As Double)
66 | Console.WriteLine(value)
67 | End Sub
68 |
69 | Public Shared Sub Print(value As String)
70 | Console.WriteLine(value)
71 | End Sub
72 |
73 | End Class
--------------------------------------------------------------------------------
/ClearScript/VbScriptRepl/VbScriptRepl.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | ClearScriptExample
6 | net8.0
7 | On
8 |
9 |
10 |
11 |
12 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
13 |
14 |
15 |
16 |
17 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/CompareFolders/CompareFolders.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | CompareFolders
6 | net8.0
7 | On
8 |
9 |
10 |
11 |
12 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
13 |
14 |
15 |
16 |
17 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/CompilerApiBook/CompileHelloWorld/CompileHelloWorld.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | CompileHelloWorld
6 | net8.0
7 | On
8 |
9 |
10 |
11 |
12 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
13 |
14 |
15 |
16 |
17 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | PreserveNewest
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/CompilerApiBook/CompileHelloWorld/IDialect.vb:
--------------------------------------------------------------------------------
1 | Friend Interface IDialect
2 | ReadOnly Property Keywords As List(Of String)
3 | ReadOnly Property Functions As List(Of String)
4 | ReadOnly Property Commands As List(Of String)
5 | ReadOnly Property Variables As List(Of String)
6 | ReadOnly Property Operators As List(Of String)
7 | ReadOnly Property Symbols As List(Of Char)
8 | ReadOnly Property GroupingOperators As List(Of Char)
9 | ReadOnly Property ArithmaticOperators As List(Of Char)
10 | ReadOnly Property RelationalOperators As List(Of String)
11 | ReadOnly Property NumericSuffix As List(Of Char)
12 | ReadOnly Property StringSuffix As List(Of Char)
13 | ReadOnly Property ReservedWords As List(Of String)
14 | ReadOnly Property IgnoreAllWhiteSpace As Boolean
15 | ReadOnly Property SupportsLabels As Boolean
16 | End Interface
--------------------------------------------------------------------------------
/CompilerApiBook/CompileHelloWorld/Program.bas:
--------------------------------------------------------------------------------
1 | ? "Hello World!!!!"
2 |
3 | a = 5
4 | a = a + 1
5 | a = AddNumbers(a, 10)
6 | PRINT a
7 |
8 | Function AddNumbers(a As Integer, b As Integer) As Integer
9 | Return a + b
10 | End Function
--------------------------------------------------------------------------------
/CompilerApiBook/CompileHelloWorld/Raw.vb:
--------------------------------------------------------------------------------
1 | Public Class RawCompilationUnit
2 | Public Property RawStatements As List(Of RawStatement)
3 | End Class
4 |
5 | Public Class RawStatement
6 | Public Property RawTokens As List(Of RawToken)
7 | End Class
8 |
9 | Public Class RawToken
10 | Public Property RawText As String
11 | Public Property Location As Integer
12 | Public Property Length As Integer
13 | End Class
--------------------------------------------------------------------------------
/ConsoleApp1/Byref.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 | Module ByrefTest
5 |
6 | Structure PDQ
7 | Public P As Integer
8 | Public D As Decimal
9 | Public Q As Long
10 | Sub FooBar()
11 | ByrefTest.FooBar(Me)
12 | End Sub
13 | End Structure
14 |
15 | Sub FooBar(ByRef dst As PDQ)
16 | dst.P = 123
17 | End Sub
18 |
19 | Sub Main1()
20 |
21 | 'Dim a As Short = 1
22 | 'Dim b As Short = a + 1
23 |
24 | Dim o As PDQ = Nothing
25 | o.FooBar() ' Call FooBar within the structure...
26 | Console.WriteLine($"{o.P}") ' Output: 0
27 | FooBar(o) ' Call FooBar outside of the structure...
28 | Console.WriteLine($"{o.P}") ' Output: 123
29 | End Sub
30 |
31 | End Module
--------------------------------------------------------------------------------
/ConsoleApp1/ConsoleApp1.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | ConsoleApp1
6 | net8.0
7 | latest
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ConsoleApp1/Module1.vb:
--------------------------------------------------------------------------------
1 | Option Explicit Off
2 | Option Strict Off
3 | Option Infer Off
4 |
5 | Module Module1
6 |
7 | Public Sub Main1()
8 |
9 | Dim a(10) As Integer
10 | Dim b(0 To 10) As Integer
11 | 'Dim c(10 To 10) As Integer
12 |
13 | Dim l = LBound(b)
14 |
15 | FirstName$ = "Cory"
16 | LastName$ = "Smth"
17 | GoTo 30
18 | 20:
19 | System.Console.WriteLine($"{FirstName$} {LastName$}") ' This is a test
20 | End
21 | 30:
22 | LastName$ = "Smith"
23 | GoTo 20
24 |
25 | End Sub
26 |
27 | End Module
28 |
--------------------------------------------------------------------------------
/ConsoleApp1/Module2.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Module Module2
6 |
7 | Sub Main2()
8 |
9 | Dim a = "2.5"
10 | Console.WriteLine(CInt(a))
11 |
12 | End Sub
13 |
14 | End Module
15 |
--------------------------------------------------------------------------------
/ConsoleApp1/Program.Late.vb:
--------------------------------------------------------------------------------
1 | Option Explicit Off
2 | Option Strict Off
3 | Option Infer Off
4 |
5 | Partial Module Program
6 |
7 | Public Function CreateA(value As Integer) As ClassLibrary1.A
8 | #Disable Warning IDE0017 ' Simplify object initialization
9 | Dim newA = New ClassLibrary1.A
10 | #Enable Warning IDE0017 ' Simplify object initialization
11 | newA.A1 = value
12 | Return newA
13 | End Function
14 |
15 | End Module
16 |
--------------------------------------------------------------------------------
/ConsoleApp1/Program.vb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/ConsoleApp1/Program.vb
--------------------------------------------------------------------------------
/ConsoleApp1/TestClass.vb:
--------------------------------------------------------------------------------
1 | Public Interface IPerson
2 | Property FirstName As String
3 | Property LastName As String
4 | Property Birth As Date
5 | Sub WishHappyBirthday()
6 | Function Age() As Integer
7 | End Interface
8 |
9 | Public Class Boss
10 | Implements IPerson
11 |
12 | Private m_whatever, m_birth, m_death As Date
13 |
14 | Public Property FirstName As String
15 | Public Property LastName As String
16 |
17 | 'Public Property Birth As Date
18 |
19 | Public Property Birth As Date Implements IPerson.Birth
20 | Get
21 | Return m_birth
22 | End Get
23 | Set(value As Date)
24 | m_birth = value
25 | End Set
26 | End Property
27 |
28 | Public Shared Sub WishHappyBirthday()
29 | ' Do something
30 | End Sub
31 |
32 | Public Function Age() As Integer
33 | Return m_birth.Year
34 | End Function
35 |
36 | End Class
37 |
38 | Partial Class Boss
39 |
40 | Private Property IPerson_FirstName As String Implements IPerson.FirstName
41 | Get
42 | Return FirstName
43 | End Get
44 | Set(value As String)
45 | FirstName = value
46 | End Set
47 | End Property
48 |
49 | Private Property IPerson_LastName As String Implements IPerson.LastName
50 | Get
51 | Return LastName
52 | End Get
53 | Set(value As String)
54 | LastName = value
55 | End Set
56 | End Property
57 |
58 | 'Private Property IPerson_Birth As Date Implements IPerson.Birth
59 | ' Get
60 | ' Return m_birth
61 | ' End Get
62 | ' Set(value As Date)
63 | ' m_birth = value
64 | ' End Set
65 | 'End Property
66 |
67 | Private Sub IPerson_WishHappyBirthday() Implements IPerson.WishHappyBirthday
68 | Call WishHappyBirthday()
69 | End Sub
70 |
71 | Private Function IPerson_Age() As Integer Implements IPerson.Age
72 | Return Age()
73 | End Function
74 |
75 | End Class
76 |
--------------------------------------------------------------------------------
/FileSystemWatcherSample/FileSystemWatcherSample.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Watcher
6 | net8.0
7 | Watcher
8 |
9 |
10 |
11 | false
12 | none
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/FileSystemWatcherSample/My Project/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "FileSystemWatcherSample": {
4 | "commandName": "Project",
5 | "commandLineArgs": "C:\\test"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/FileSystemWatcherSample/Program.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Imports System.IO
6 |
7 | ' https://docs.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?view=netcore-3.1
8 |
9 | Module Program
10 |
11 | Public Sub Main(args() As String)
12 |
13 | ' If a directory is not specified, exit the program.
14 | If args.Length <> 1 Then
15 | ' Display the proper way to call the program.
16 | Console.WriteLine("Usage: Watcher.exe (directory)")
17 | Return
18 | End If
19 |
20 | ' Create a new FileSystemWatcher and set its properties.
21 | Using watcher As New FileSystemWatcher()
22 |
23 | watcher.Path = args(0)
24 |
25 | ' Watch for changes in LastAccess and LastWrite times, and
26 | ' the renaming of files or directories.
27 | watcher.NotifyFilter = (NotifyFilters.LastAccess Or
28 | NotifyFilters.LastWrite Or
29 | NotifyFilters.FileName Or
30 | NotifyFilters.DirectoryName)
31 |
32 | ' Only watch text files.
33 | watcher.Filter = "*.txt"
34 |
35 | ' Add event handlers.
36 | AddHandler watcher.Changed, AddressOf OnChanged
37 | AddHandler watcher.Created, AddressOf OnChanged
38 | AddHandler watcher.Deleted, AddressOf OnChanged
39 | AddHandler watcher.Renamed, AddressOf OnRenamed
40 |
41 | ' Begin watching.
42 | watcher.EnableRaisingEvents = True
43 |
44 | ' Wait for the user to quit the program.
45 | Console.WriteLine("Press 'q' to quit the sample.")
46 | Do
47 | If Console.KeyAvailable Then
48 | Select Case Console.ReadKey(True).Key
49 | Case ConsoleKey.Q
50 | Exit Do
51 | Case Else
52 | End Select
53 | End If
54 | Loop
55 |
56 | End Using
57 |
58 | End Sub
59 |
60 | ' Define the event handlers.
61 | Private Sub OnChanged(source As Object, e As FileSystemEventArgs)
62 | ' Specify what is done when a file is changed, created, or deleted.
63 | Console.WriteLine($"File: {e.FullPath} {e.ChangeType}")
64 | Select Case e.ChangeType
65 | Case WatcherChangeTypes.Changed
66 | ' What to do when the file is updated...
67 | Case WatcherChangeTypes.Created
68 | ' What to do when the file is created...
69 | Case WatcherChangeTypes.Deleted
70 | ' What to do when the file is deleted...
71 | Case Else
72 | End Select
73 | End Sub
74 |
75 | Private Sub OnRenamed(source As Object, e As RenamedEventArgs)
76 | ' Specify what is done when a file is renamed.
77 | Console.WriteLine($"File: {e.OldFullPath} renamed to {e.FullPath}")
78 | End Sub
79 |
80 | End Module
--------------------------------------------------------------------------------
/FormExGenerator/FormExGenerator.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DualBrain
5 | netstandard2.0
6 | 1.0.0-alpha1
7 | 1.0.0
8 | Cory Smith
9 | FormEx Generator
10 | (c) 2021, Cory Smith
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | PreserveNewest
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | DualBrain.FormExGenerator
30 | true
31 | false
32 | Shiny Stone Digital
33 | VB VisualBasic VB.NET FormEx generator
34 | DualBrain's FormEx Generator
35 | A VB Source Generator that extends WinForms with common behaviors.
36 | Provides FormEx support in VB.
37 | https://github.com/dualbrain/samples
38 | https://github.com/dualbrain/samples
39 | MIT
40 | README.md
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/FormExGenerator/README.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | - Need to find any classes that are decorated with the following attribute:
4 | *
5 | This adds several behaviors and consistent extension points for additional functionality/behaviors such as.
6 | - Prompt for close.
7 | - Adds:
8 | * Handles some standard events - do not repeat usage... see new methods below.
9 | - Load
10 | - FormClosing
11 | - etc.
12 | * Adds the follwing properties:
13 | - IsLoading (Boolean)
14 | - IsNew (Boolean)
15 | - IsDirty (Boolean)
16 | * Adds the following methods:
17 | - UpdateState
18 | - Now that these exists, expects the following methods to exist:
19 | - LoadAsync
20 | - InitializeDataAsync
21 | - ValidateControl(ctrl)
22 | - CreateAsync
23 | - UpdateAsync
24 | - UnloadAsync
25 |
26 | ## Requirements
27 |
28 | - Visual Studio 2019 v16.10.0+
29 | - VB
30 |
31 | ## Getting Started
32 |
33 | Once you have this in your project, you can enjoy common behaviors provided by FormEx!
34 |
35 | Given the following interface:
36 |
37 | ```vb
38 |
39 | Public Class Form1
40 | '...
41 | End Class
42 | ```
43 |
44 | Which results in Visual Studio generating the following:
45 |
46 | ```vb
47 | Public Partial Class Form1
48 |
49 | Private Property IsDirty As Boolean
50 |
51 | Private Sub Form_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded
52 | '...
53 | ' The following line is optional, only included if an existing Loaded method exists.
54 | 'Loaded()
55 | End Sub
56 |
57 | End Class
58 | ```
59 |
60 | ## More
61 |
62 | - You can find the project [here](https://github/dualbrain/samples); please leave feedback, questions, etc. via the [github project](https://github/dualbrain/samples).
63 | - Feel free to reach out to me directly via [twitter](https://twitter.com/dualbrain).
64 | - Even better, join the VB conversation over on [gitter](https://gitter.im/VB-NET).
65 |
--------------------------------------------------------------------------------
/GUI/FNA_Gameloop/Content/FNATexture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/GUI/FNA_Gameloop/Content/FNATexture.png
--------------------------------------------------------------------------------
/GUI/FNA_Gameloop/FAudio.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/GUI/FNA_Gameloop/FAudio.dll
--------------------------------------------------------------------------------
/GUI/FNA_Gameloop/FNA3D.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/GUI/FNA_Gameloop/FNA3D.dll
--------------------------------------------------------------------------------
/GUI/FNA_Gameloop/FNA_Gameloop.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | FNA_Gameloop
6 | net8.0
7 | On
8 | Sub Main
9 | FNA_Gameloop
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | PreserveNewest
23 |
24 |
25 | PreserveNewest
26 |
27 |
28 | PreserveNewest
29 |
30 |
31 | PreserveNewest
32 |
33 |
34 | PreserveNewest
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/GUI/FNA_Gameloop/README.md:
--------------------------------------------------------------------------------
1 | # FNA-XNA
2 |
3 | See: https://fna-xna.github.io/
4 |
5 | This project requires a reference to the FNA project located at:
6 |
7 | https://github.com/FNA-XNA/FNA
8 |
9 | Be sure to use the `Core` project.
10 |
11 | NOTE: I modified the `netstandard2.0;net8.0` to be `net8.0` as `net5.0` is not on my machine and Visual Studio "complains". Note that it will still work if you ignore the complaint, but I just don't like the noise.
12 |
13 | It also requires a several additional DLLs (included) to either be with the
14 | produced executable or in the appropriate DLL path(s).
15 |
16 | You can find the latest versions of these at: https://fna.flibitijibibo.com/archive/fnalibs.tar.bz2
17 |
18 | ## More
19 |
20 | - [FNA WASM](https://github.com/wattsyart/fna-wasm)
21 | - [FNA WASM Builds](https://github.com/clarvalon/FNA-WASM-Build/actions)
22 |
--------------------------------------------------------------------------------
/GUI/FNA_Gameloop/SDL2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/GUI/FNA_Gameloop/SDL2.dll
--------------------------------------------------------------------------------
/GUI/FNA_Gameloop/libtheorafile.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/GUI/FNA_Gameloop/libtheorafile.dll
--------------------------------------------------------------------------------
/GUI/OpenTk_Gameloop/OpenTk_Gameloop.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | OpenTk_Gameloop
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/GUI/OpenTk_Gameloop/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 |
3 | Module Program
4 | Sub Main(args As String())
5 | Console.WriteLine("Hello World!")
6 | End Sub
7 | End Module
8 |
--------------------------------------------------------------------------------
/GUI/OpenTk_Gameloop/README.md:
--------------------------------------------------------------------------------
1 | # OpenTK
2 |
3 | ## Further Research / Exploration
4 |
5 | - [OpenTK](https://opentk.net/)
6 | - [OpenTK (GitHub)](https://github.com/opentk/opentk)
7 | - [OpenTK on SourceForge](https://sourceforge.net/projects/opentk/)
8 | - [The Tao Framework (precursor to OpenTK)](https://sourceforge.net/projects/taoframework/)
9 | - [The Tao OpenGL, OpenAL, GLU, FreeGlut bindings for .NET and Mono](https://github.com/mono/tao)
--------------------------------------------------------------------------------
/GUI/README.md:
--------------------------------------------------------------------------------
1 | # GUI Samples
2 |
3 | I'm in the process of exploring various GUI frameworks as there are several options to choose from.
4 |
5 | ## WINFORMS
6 |
7 | To get things going, we'll start of with Microsoft Windows Forms technology; it's stable, mature and does work pretty well. If it weren't for the fact that it is limited strictly to Windows, this exploration process probably wouldn't be taking place.
8 |
9 | - WinForms_GameLoop
10 |
11 | ## SDL2
12 |
13 | ## FNA-XNA
14 |
15 | ## SILK.NET
16 |
17 | ## GTK#
--------------------------------------------------------------------------------
/GUI/Raylib_Gameloop/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 |
3 | Module Program
4 | Sub Main(args As String())
5 | Console.WriteLine("Hello World!")
6 | End Sub
7 | End Module
8 |
--------------------------------------------------------------------------------
/GUI/Raylib_Gameloop/README.md:
--------------------------------------------------------------------------------
1 | # Raylib
2 |
3 | ## Further Research / Exploration
4 |
5 | - [Raylib](https://www.raylib.com/)
6 | - [Raylib (GitHub)](https://github.com/raysan5/raylib)
7 | - [Raylib-cs (GitHub)](https://github.com/ChrisDill/Raylib-cs)
--------------------------------------------------------------------------------
/GUI/Raylib_Gameloop/Raylib_Gameloop.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Raylib_Gameloop
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/GUI/SDL2_Gameloop/README.md:
--------------------------------------------------------------------------------
1 | # SDL2
2 |
3 | This project requires a reference to the SDL2-CS project located at:
4 |
5 | https://github.com/flibitijibibo/SDL2-CS
6 |
7 | Be sure to use the `Core` project.
8 |
9 | NOTE: It may be necessary to modify this project from `net40` to `net48`.
10 |
11 | It also requires a copy of the SDL2.dll (included) to either be with the
12 | produced executable or in the appropriate DLL path(s).
13 |
14 | ## Further Research / Exploration
15 |
16 | - [SDL - Simple Directmedia Layer](https://www.libsdl.org/)
17 | - [3D Graphics With Draw Pixel - Rotating Cube SDL2 C++ Project](https://www.youtube.com/watch?v=kdRJgYO1BJM)
18 | - [Getting started with 2D graphics in C++ (SDL2)](https://iq.opengenus.org/getting-started-2d-graphics-in-cpp-sdl2/)
19 | - [SDL2: How to properly toggle fullscreen?](https://stackoverflow.com/questions/30629106/sdl2-how-to-properly-toggle-fullscreen)
20 | - [Resize SDL2 window?](https://stackoverflow.com/questions/20735637/resize-sdl2-window)
21 | - [Handling Keyboard and Mouse Events in SDL2](https://gigi.nullneuron.net/gigilabs/handling-keyboard-and-mouse-events-in-sdl2/)
22 | - [Hide Console Window in C# Console Application](https://stackoverflow.com/questions/3853629/hide-console-window-in-c-sharp-console-application)
23 | - [SDL/SDL2 samples and projects](https://github.com/aminosbh/sdl2-samples-and-projects)
--------------------------------------------------------------------------------
/GUI/SDL2_Gameloop/SDL2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/GUI/SDL2_Gameloop/SDL2.dll
--------------------------------------------------------------------------------
/GUI/SDL2_Gameloop/SDL2_Gameloop.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | SDL2_Gameloop
6 | net8.0
7 | On
8 | Sub Main
9 | SDL2_Gameloop
10 |
11 |
12 |
13 |
14 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
15 |
16 |
17 |
18 |
19 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | PreserveNewest
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/GUI/Silk_Gameloop/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 |
3 | Module Program
4 | Sub Main(args As String())
5 | Console.WriteLine("Hello World!")
6 | End Sub
7 | End Module
8 |
--------------------------------------------------------------------------------
/GUI/Silk_Gameloop/README.md:
--------------------------------------------------------------------------------
1 | # Silk.NET
2 |
3 | ## Further Research / Exploration
4 |
5 | - [Silk.NET](https://dotnet.github.io/Silk.NET/)
6 |
--------------------------------------------------------------------------------
/GUI/Silk_Gameloop/Silk_Gameloop.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Silk
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/GUI/WinForms_GameLoop/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application.
12 |
13 | ' Example:
14 | ' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults
15 | '
16 | ' ' Setting the application-wide default Font:
17 | ' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular)
18 | '
19 | ' ' Setting the HighDpiMode for the Application:
20 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
21 | '
22 | ' ' If a splash dialog is used, this sets the minimum display time:
23 | ' e.MinimumSplashScreenDisplayTime = 4000
24 | ' End Sub
25 |
26 | Partial Friend Class MyApplication
27 |
28 | End Class
29 | End Namespace
30 |
--------------------------------------------------------------------------------
/GUI/WinForms_GameLoop/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 |
24 | Private Sub InitializeComponent()
25 | Me.PictureBox1 = New System.Windows.Forms.PictureBox()
26 | Me.Label1 = New System.Windows.Forms.Label()
27 | CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
28 | Me.SuspendLayout()
29 | '
30 | 'PictureBox1
31 | '
32 | Me.PictureBox1.Dock = System.Windows.Forms.DockStyle.Fill
33 | Me.PictureBox1.Location = New System.Drawing.Point(0, 0)
34 | Me.PictureBox1.Margin = New System.Windows.Forms.Padding(9, 10, 9, 10)
35 | Me.PictureBox1.Name = "PictureBox1"
36 | Me.PictureBox1.Size = New System.Drawing.Size(2286, 1440)
37 | Me.PictureBox1.TabIndex = 0
38 | Me.PictureBox1.TabStop = False
39 | '
40 | 'Label1
41 | '
42 | Me.Label1.AutoSize = True
43 | Me.Label1.BackColor = System.Drawing.Color.Black
44 | Me.Label1.ForeColor = System.Drawing.Color.White
45 | Me.Label1.Location = New System.Drawing.Point(69, 48)
46 | Me.Label1.Margin = New System.Windows.Forms.Padding(9, 0, 9, 0)
47 | Me.Label1.Name = "Label1"
48 | Me.Label1.Size = New System.Drawing.Size(123, 48)
49 | Me.Label1.TabIndex = 1
50 | Me.Label1.Text = "Label1"
51 | '
52 | 'Form1
53 | '
54 | Me.AutoScaleDimensions = New System.Drawing.SizeF(20.0!, 48.0!)
55 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
56 | Me.ClientSize = New System.Drawing.Size(2286, 1440)
57 | Me.Controls.Add(Me.Label1)
58 | Me.Controls.Add(Me.PictureBox1)
59 | Me.KeyPreview = True
60 | Me.Margin = New System.Windows.Forms.Padding(9, 10, 9, 10)
61 | Me.Name = "Form1"
62 | Me.Text = "Form1"
63 | CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
64 | Me.ResumeLayout(False)
65 | Me.PerformLayout()
66 |
67 | End Sub
68 |
69 | Friend WithEvents PictureBox1 As PictureBox
70 | Friend WithEvents Label1 As Label
71 | End Class
72 |
--------------------------------------------------------------------------------
/GUI/WinForms_GameLoop/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.WinForms_Gameloop.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/GUI/WinForms_GameLoop/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/GUI/WinForms_GameLoop/WinForms_GameLoop.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | Sub Main
7 | true
8 | WindowsForms
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | True
20 | True
21 | Application.myapp
22 |
23 |
24 |
25 |
26 |
27 | MyApplicationCodeGenerator
28 | Application.Designer.vb
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/GameLoop1/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application.
12 |
13 | ' Example:
14 |
15 | ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode
16 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
17 | ' End Sub
18 |
19 | Partial Friend Class MyApplication
20 |
21 | End Class
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/GameLoop1/GameLoop1.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | GameLoop1
7 | Sub Main
8 | true
9 | WindowsForms
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | false
20 | none
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | True
30 | True
31 | Application.myapp
32 |
33 |
34 |
35 |
36 |
37 | MyApplicationCodeGenerator
38 | Application.Designer.vb
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/GameLoop1/My Project/Application.Designer.HighDpi.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | 'This constant indicates whether the Application Framework is in use.
5 | #Const APPLICATION_FRAMEWORK = True
6 |
7 | #If APPLICATION_FRAMEWORK Then
8 |
9 | #If NET5_0 And Not NET6_0 Then
10 |
11 | Imports System.Collections.ObjectModel
12 |
13 | Namespace My
14 |
15 | Partial Friend Class MyApplication
16 |
17 | Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs)
18 |
19 | Private _highDpiMode As HighDpiMode?
20 |
21 | Friend Shadows Property HighDpiMode As HighDpiMode
22 | Get
23 | Return If(
24 | _highDpiMode Is Nothing,
25 | Application.HighDpiMode,
26 | _highDpiMode.Value)
27 | End Get
28 | Set(value As HighDpiMode)
29 | _highDpiMode = value
30 | End Set
31 | End Property
32 |
33 | ' IMPORTANT:
34 | ' If this method causes an compilation error after you've unchecked 'Application Framework'
35 | ' in the project properties, go to the top of this file and change the value to 'False' in this line:
36 | ' #Const APPLICATION_FRAMEWORK = False
37 |
38 | ' For more about using WinForms without the Application Framework
39 | ' see: https://aka.ms/visualbasic-appframework-net5
40 | Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean
41 | Dim eventArgs = New ApplyHighDpiModeEventArgs(
42 | If(
43 | _highDpiMode Is Nothing,
44 | HighDpiMode.SystemAware,
45 | _highDpiMode.Value))
46 |
47 | RaiseEvent ApplyHighDpiMode(Me, eventArgs)
48 |
49 | Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode)
50 |
51 | Return MyBase.OnInitialize(commandLineArgs)
52 | End Function
53 | End Class
54 |
55 | Public Class ApplyHighDpiModeEventArgs
56 | Inherits EventArgs
57 |
58 | Public Sub New(highDpiMode As HighDpiMode)
59 | Me.HighDpiMode = highDpiMode
60 | End Sub
61 |
62 | Public Property HighDpiMode As HighDpiMode
63 |
64 | End Class
65 |
66 | End Namespace
67 |
68 | #End If ' #If NET5_0 And Not NET6_0
69 | #End If ' #If APPLICATION_FRAMEWORK
70 |
--------------------------------------------------------------------------------
/GameLoop1/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.GameLoop1.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/GameLoop1/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/GameLoop2/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application.
12 |
13 | ' Example:
14 | ' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults
15 | '
16 | ' ' Setting the application-wide default Font:
17 | ' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular)
18 | '
19 | ' ' Setting the HighDpiMode for the Application:
20 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
21 | '
22 | ' ' If a splash dialog is used, this sets the minimum display time:
23 | ' e.MinimumSplashScreenDisplayTime = 4000
24 | ' End Sub
25 |
26 | Partial Friend Class MyApplication
27 |
28 | End Class
29 | End Namespace
30 |
--------------------------------------------------------------------------------
/GameLoop2/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 |
24 | Private Sub InitializeComponent()
25 | Me.SuspendLayout()
26 | '
27 | 'Form1
28 | '
29 | Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!)
30 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
31 | Me.ClientSize = New System.Drawing.Size(800, 450)
32 | Me.KeyPreview = True
33 | Me.Name = "Form1"
34 | Me.Text = "Form1"
35 | Me.ResumeLayout(False)
36 |
37 | End Sub
38 |
39 | End Class
40 |
--------------------------------------------------------------------------------
/GameLoop2/GameLoop2.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | Sub Main
7 | true
8 | WindowsForms
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | True
20 | True
21 | Application.myapp
22 |
23 |
24 |
25 |
26 |
27 | MyApplicationCodeGenerator
28 | Application.Designer.vb
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/GameLoop2/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.GameLoop2.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/GameLoop2/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/InsaneSourceGeneration/InsaneSourceGeneration.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | InsaneSourceGeneration
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/InsaneSourceGeneration/Program.BAS:
--------------------------------------------------------------------------------
1 |
2 | Name$ = "Cory"
3 |
4 | PRINT Name$ + " HELLO WORLD";
--------------------------------------------------------------------------------
/InsaneSourceGeneration/Program.vb:
--------------------------------------------------------------------------------
1 | Module Program
2 | 'Sub Main(args As String())
3 | ' Console.WriteLine("Hello World!")
4 | 'End Sub
5 | End Module
6 |
--------------------------------------------------------------------------------
/InsaneSourceGeneration/Program_Generated.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Partial Module Program
6 |
7 | Sub Main()
8 | 'Name$ = "Cory"
9 | Dim Name = "Cory"
10 | 'Print Name$ + " HELLO WORLD";
11 | Console.Write(Name + " HELLO WORLD")
12 | End Sub
13 |
14 | End Module
15 |
--------------------------------------------------------------------------------
/Json101/Json101.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Json101
6 | net8.0
7 | On
8 | On
9 | On
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Cory Smith
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/OLC/Other/CaveDiver/CaveDiver.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | CaveDiver
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OLC/Other/EmbeddingLua_Part1/EmbeddingLua_Part1.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | EmbeddingLua_Part1
6 | net8.0
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | PreserveNewest
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/OLC/Other/EmbeddingLua_Part1/My Project/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "EmbeddingLua_Part1": {
4 | "commandName": "Project"
5 | },
6 | "WSL": {
7 | "commandName": "WSL2",
8 | "distributionName": ""
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/OLC/Other/EmbeddingLua_Part1/VideoExample.lua:
--------------------------------------------------------------------------------
1 | --PlayerTitle = "Squire"
2 | --PlayerName = "Ciaran"
3 | --PlayerFamily = "Wirral"
4 | --PlayerLevel = 20
5 |
6 | --player = {}
7 | --player["Title"] = "Squire"
8 | --player["Name"] = "Ciaran"
9 | --player["Family"] = "Wirral"
10 | --player["Level"] = 20
11 |
12 | players = {}
13 | players[0] = { Title="Squire", Name="Ciaran", Family="Wirral", Level=20 }
14 | players[1] = { Title="Lord", Name="Diego", Family="Brazil", Level=50 }
15 |
16 | function AddStuff(a, b)
17 | print("[LUA] AddStuff("..a..", "..b..") called \n")
18 | return a + b
19 | end
20 |
21 | function GetPlayer(n)
22 | return players[n]
23 | end
24 |
25 | function DoAThing(a, b)
26 | print("[LUA] DoAThing("..a..", "..b..") called \n")
27 | c = HostFunction(a + 10, b * 3)
28 | return c
29 | end
--------------------------------------------------------------------------------
/OLC/Other/Images/Snake.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/OLC/Other/Images/Snake.png
--------------------------------------------------------------------------------
/OLC/Other/Images/Synth1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/OLC/Other/Images/Synth1.png
--------------------------------------------------------------------------------
/OLC/Other/Images/Synth2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/OLC/Other/Images/Synth2.png
--------------------------------------------------------------------------------
/OLC/Other/Images/Synth3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/OLC/Other/Images/Synth3.png
--------------------------------------------------------------------------------
/OLC/Other/Images/Synth4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/OLC/Other/Images/Synth4.png
--------------------------------------------------------------------------------
/OLC/Other/Images/Tetris.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/OLC/Other/Images/Tetris.png
--------------------------------------------------------------------------------
/OLC/Other/README.md:
--------------------------------------------------------------------------------
1 | # One Lone Coder - Other
2 |
3 | These examples are, for the most part, pre-olcConsoleGameEngine.
4 |
5 | ## Sound Synthesizer Part 1 - Waveforms
6 |
7 | 
8 |
9 | ## Sound Synthesizer Part 2 - Oscillators & Envelopes
10 |
11 | 
12 |
13 | ## Sound Synthesizer Part 3 - Instruments & Polyphony
14 |
15 | 
16 |
17 | ## Sound Synthesizer Part 4 - WaveOut API & Sequencing
18 |
19 | 
20 |
21 | ## FIRST PERSON SHOOTER... on the command line?
22 |
23 | (todo)
24 |
25 | ## TETRIS From Scratch
26 |
27 | 
28 |
29 | ## SNAKE From Scratch
30 |
31 | 
32 |
--------------------------------------------------------------------------------
/OLC/Other/Snake/Snake.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Snake
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OLC/Other/Synth1/Synth1.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Synth1
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OLC/Other/Synth2/Synth2.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Synth2
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OLC/Other/Synth3/Synth3.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Synth3
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OLC/Other/Synth4/Synth4.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Synth4
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OLC/Other/Tetris/Tetris.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Tetris
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OLC/README.md:
--------------------------------------------------------------------------------
1 | # One Lone Coder examples... in VB!
2 |
3 | I stumbled across [OneLoneCoder](https://github.com/OneLoneCoder) and I couldn't resist the idea of abusing the Command Prompt to act as graphics output device; however, all of his code is written in C++. So the only ways that I could jump in an play with this is to either do it in C++ or, well, rewrite it all in VB. As you can probably guess, I chose the later.
4 |
5 | Now that I've completed the olcConsoleGameEngine-related videos and have a tremendous amount of fun abusing the Command Prompt (as well as essentially completing the process of porting olcConsoleGameEngine for use with VB), I've found that the API design of the olcConsoleConsoleGameEngine/olcPixelGameEngine is pretty straight forward and, well, BASIC.
6 |
7 | Right now the main focus is on the olcPixelGameEngine v1.x (PGE1) which as since been retired and replaced with olcPixelGameEngine v2.x. As I work through his videos (in reverse chronological order), I'll continue to update this repo as I progress.
8 |
9 | - [vbPixelGameEngine](https://github.com/DualBrain/vbPixelGameEngine)
10 | - [vbConsoleGameEngine](https://github.com/DualBrain/vbConsoleGameEngine)
11 | - [Other](Other/)
12 |
13 | ## Further Research / Exploration
14 |
15 | - [OneLoneCoder](https://github.com/OneLoneCoder)
16 | - [David aka Javid9x](https://github.com/javid9x)
17 |
--------------------------------------------------------------------------------
/PLAYground/My Project/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "PLAYground": {
4 | "commandName": "Project",
5 | "workingDirectory": "C:\\GitHub"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/PLAYground/PLAYground.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | PLAYground
6 | net8.0-windows
7 | PLAYground
8 | 0.0.1.0
9 | 0.0.1.0
10 | True
11 | Link
12 |
13 |
14 |
15 | false
16 | none
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/QB64/MarkdownHelp/MarkdownHelp.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | MarkdownHelp
6 | net8.0
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/QB64/MarkdownHelp/SyntaxFacts.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.CompilerServices
2 |
3 | Friend Module SyntaxFacts
4 |
5 | Public Function GetKeywordKind(text As String) As SyntaxKind
6 |
7 | Select Case text.ToLower
8 | Case Else
9 | Return SyntaxKind.IdentifierToken
10 | End Select
11 |
12 | End Function
13 |
14 | Public Function GetText(kind As SyntaxKind) As String
15 |
16 | Select Case kind
17 | Case SyntaxKind.PoundToken : Return "#"
18 | Case SyntaxKind.PlusToken : Return "+"
19 | Case SyntaxKind.MinusToken : Return "-"
20 | Case SyntaxKind.StarToken : Return "*"
21 | Case SyntaxKind.SlashToken : Return "/"
22 | Case SyntaxKind.BackslashToken : Return "\"
23 | Case SyntaxKind.HatToken : Return "^"
24 | Case SyntaxKind.OpenParenToken : Return "("
25 | Case SyntaxKind.CloseParenToken : Return ")"
26 | Case SyntaxKind.OpenBraceToken : Return "{"
27 | Case SyntaxKind.CloseBraceToken : Return "}"
28 | Case SyntaxKind.OpenBracketToken : Return "["
29 | Case SyntaxKind.CloseBracketToken : Return "]"
30 | Case SyntaxKind.EqualToken : Return "="
31 | Case SyntaxKind.LessThanToken : Return "<"
32 | Case SyntaxKind.PeriodToken : Return "."
33 | Case SyntaxKind.ColonToken : Return ":"
34 | Case SyntaxKind.CommaToken : Return ","
35 | Case SyntaxKind.SemicolonToken : Return ";"
36 | Case SyntaxKind.QuestionToken : Return "?"
37 | Case SyntaxKind.GreaterThanEqualToken : Return ">="
38 | Case SyntaxKind.LessThanEqualToken : Return "<="
39 | Case SyntaxKind.LessThanGreaterThanToken : Return "<>"
40 | Case SyntaxKind.GreaterThanToken : Return ">"
41 | Case SyntaxKind.QuestionToken : Return "?"
42 | Case Else
43 | Return Nothing
44 | End Select
45 |
46 | End Function
47 |
48 |
49 | Public Function Is_Keyword(kind As SyntaxKind) As Boolean
50 | Return kind.ToString.EndsWith("Keyword")
51 | End Function
52 |
53 |
54 | Public Function IsToken(kind As SyntaxKind) As Boolean
55 | Return (kind.Is_Keyword OrElse kind.ToString.EndsWith("Token"))
56 | End Function
57 |
58 | End Module
--------------------------------------------------------------------------------
/QB64/MarkdownHelp/SyntaxKind.vb:
--------------------------------------------------------------------------------
1 | Friend Enum SyntaxKind
2 |
3 | BadToken
4 | EndOfFileToken
5 |
6 | ' Tokens
7 | BackslashToken
8 | CloseBraceToken
9 | CloseParenToken
10 | ColonToken
11 | CommaToken
12 | EqualToken
13 | GreaterThanEqualToken
14 | GreaterThanToken
15 | HatToken
16 | IdentifierToken
17 | LessThanEqualToken
18 | LessThanGreaterThanToken
19 | LessThanToken
20 | MinusToken
21 | OpenBraceToken
22 | OpenParenToken
23 | PeriodToken
24 | PlusToken
25 | PoundToken
26 | QuestionToken
27 | SemicolonToken
28 | SlashToken
29 | StarToken
30 | StringToken
31 |
32 | NumberToken
33 | LineBreak
34 | WhiteSpace
35 | OpenBracketToken
36 | CloseBracketToken
37 | End Enum
38 |
--------------------------------------------------------------------------------
/QB64/MarkdownHelp/SyntaxToken.vb:
--------------------------------------------------------------------------------
1 | Imports System.Collections.Immutable
2 |
3 | Friend NotInheritable Class SyntaxToken
4 | Inherits SyntaxNode
5 |
6 | Public Sub New(kind As SyntaxKind, position As Integer, text As String, value As Object)
7 | Me.Kind = kind
8 | Me.Position = position
9 | Me.Text = text
10 | IsMissing = text Is Nothing
11 | Me.Value = value
12 | End Sub
13 |
14 | Public Overrides ReadOnly Property Kind As SyntaxKind
15 | Public ReadOnly Property Position As Integer
16 | Public ReadOnly Property Text As String
17 | Public ReadOnly Property Value As Object
18 |
19 | Public Overrides ReadOnly Property Span As TextSpan
20 | Get
21 | Return New TextSpan(Position, If(Text?.Length, 0))
22 | End Get
23 | End Property
24 |
25 | Public Overrides ReadOnly Property FullSpan As TextSpan
26 | Get
27 | Dim start = Span.Start
28 | Dim [end] = Span.End
29 | Return TextSpan.FromBounds(start, [end])
30 | End Get
31 | End Property
32 |
33 | 'Public Overrides Function GetChildren() As IEnumerable(Of SyntaxNode)
34 | ' Return Array.Empty(Of SyntaxNode)
35 | 'End Function
36 |
37 | '''
38 | ''' A token is missing if it was inserted by the parser and doesn't appear in source
39 | '''
40 | '''
41 | Public ReadOnly Property IsMissing As Boolean
42 |
43 | End Class
--------------------------------------------------------------------------------
/QB64/MarkdownHelp/Text/TextLine.vb:
--------------------------------------------------------------------------------
1 | Friend NotInheritable Class TextLine
2 |
3 | Public Sub New(text As SourceText, start As Integer, length As Integer, lengthIncludingLineBreak As Integer)
4 | Me.Text = text
5 | Me.Start = start
6 | Me.Length = length
7 | Me.LengthIncludingLineBreak = lengthIncludingLineBreak
8 | End Sub
9 |
10 | Public ReadOnly Property Text As SourceText
11 | Public ReadOnly Property Start As Integer
12 | Public ReadOnly Property Length As Integer
13 | Public ReadOnly Property LengthIncludingLineBreak As Integer
14 |
15 | Public ReadOnly Property [End] As Integer
16 | Get
17 | Return Start + Length
18 | End Get
19 | End Property
20 |
21 | Public ReadOnly Property Span As TextSpan
22 | Get
23 | Return New TextSpan(Start, Length)
24 | End Get
25 | End Property
26 |
27 | Public ReadOnly Property SpanIncludingLineBreak As TextSpan
28 | Get
29 | Return New TextSpan(Start, LengthIncludingLineBreak)
30 | End Get
31 | End Property
32 |
33 | Public Overrides Function ToString() As String
34 | Return Text.ToString(Span)
35 | End Function
36 |
37 | End Class
--------------------------------------------------------------------------------
/QB64/MarkdownHelp/Text/TextLocation.vb:
--------------------------------------------------------------------------------
1 | Friend Structure TextLocation
2 |
3 | Sub New(text As SourceText, span As TextSpan)
4 | Me.Text = text
5 | Me.Span = span
6 | End Sub
7 |
8 | Public ReadOnly Property Text As SourceText
9 | Public ReadOnly Property Span As TextSpan
10 |
11 | Public ReadOnly Property FileName As String
12 | Get
13 | Return Text.FileName
14 | End Get
15 | End Property
16 |
17 | Public ReadOnly Property StartLine As Integer
18 | Get
19 | Return Text.GetLineIndex(Span.Start)
20 | End Get
21 | End Property
22 |
23 | Public ReadOnly Property EndLine As Integer
24 | Get
25 | Return Text.GetLineIndex(Span.End)
26 | End Get
27 | End Property
28 |
29 | Public ReadOnly Property StartCharacter As Integer
30 | Get
31 | Return Span.Start - Text.Lines(StartLine).Start
32 | End Get
33 | End Property
34 |
35 | Public ReadOnly Property EndCharacter As Integer
36 | Get
37 | Return Span.End - Text.Lines(StartLine).Start
38 | End Get
39 | End Property
40 |
41 | End Structure
--------------------------------------------------------------------------------
/QB64/MarkdownHelp/Text/TextSpan.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Public Structure TextSpan
6 |
7 | Sub New(start As Integer, length As Integer)
8 | Me.Start = start
9 | Me.Length = length
10 | End Sub
11 |
12 | Public ReadOnly Property Start As Integer
13 | Public ReadOnly Property Length As Integer
14 |
15 | Public ReadOnly Property [End] As Integer
16 | Get
17 | Return Start + Length
18 | End Get
19 | End Property
20 |
21 | Public Shared Function FromBounds(start As Integer, [end] As Integer) As TextSpan
22 | Dim length = [end] - start
23 | Return New TextSpan(start, length)
24 | End Function
25 |
26 | Public Function OverlapsWith(span As TextSpan) As Boolean
27 | Return Start < span.End AndAlso
28 | [End] > span.Start
29 | End Function
30 |
31 | Public Overrides Function ToString() As String
32 | Return $"{Start}...{[End]}"
33 | End Function
34 |
35 | End Structure
--------------------------------------------------------------------------------
/QB64/ParseWiki/ParseWiki.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | ParseWiki
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/QB64/Qb64SamplesToMarkdown/Qb64SamplesToMarkdown.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Qb64SamplesToMarkdown
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/QB64/TxtToWiki/Program.vb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/QB64/TxtToWiki/Program.vb
--------------------------------------------------------------------------------
/QB64/TxtToWiki/TxtToWiki.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | TxtToWiki
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/QBasic/Gorilla/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application.
12 |
13 | ' Example:
14 |
15 | ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode
16 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
17 | ' End Sub
18 |
19 | Partial Friend Class MyApplication
20 |
21 | End Class
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/QBasic/Gorilla/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Me.components = New System.ComponentModel.Container()
26 | Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
27 | Me.PictureBox1 = New System.Windows.Forms.PictureBox()
28 | CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
29 | Me.SuspendLayout()
30 | '
31 | 'Timer1
32 | '
33 | Me.Timer1.Enabled = True
34 | Me.Timer1.Interval = 10
35 | '
36 | 'PictureBox1
37 | '
38 | Me.PictureBox1.Location = New System.Drawing.Point(350, 200)
39 | Me.PictureBox1.Name = "PictureBox1"
40 | Me.PictureBox1.Size = New System.Drawing.Size(100, 50)
41 | Me.PictureBox1.TabIndex = 1
42 | Me.PictureBox1.TabStop = False
43 | '
44 | 'Form1
45 | '
46 | Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!)
47 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
48 | Me.ClientSize = New System.Drawing.Size(800, 450)
49 | Me.Controls.Add(Me.PictureBox1)
50 | Me.Name = "Form1"
51 | Me.Text = "Form1"
52 | CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
53 | Me.ResumeLayout(False)
54 |
55 | End Sub
56 |
57 | Friend WithEvents Timer1 As Timer
58 | Friend WithEvents PictureBox1 As PictureBox
59 | End Class
60 |
--------------------------------------------------------------------------------
/QBasic/Gorilla/Gorilla.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | Gorilla
7 | Sub Main
8 | true
9 | WindowsForms
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | false
20 | none
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | True
34 | True
35 | Application.myapp
36 |
37 |
38 | True
39 | True
40 | Resources.resx
41 |
42 |
43 |
44 |
45 |
46 | My.Resources
47 | VbMyResourcesResXFileCodeGenerator
48 | Resources.Designer.vb
49 |
50 |
51 |
52 |
53 |
54 | MyApplicationCodeGenerator
55 | Application.Designer.vb
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/QBasic/Gorilla/My Project/Application.Designer.HighDpi.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | 'This constant indicates whether the Application Framework is in use.
5 | #Const APPLICATION_FRAMEWORK = True
6 |
7 | #If APPLICATION_FRAMEWORK Then
8 |
9 | #If NET5_0 And Not NET6_0 Then
10 |
11 | Imports System.Collections.ObjectModel
12 |
13 | Namespace My
14 |
15 | Partial Friend Class MyApplication
16 |
17 | Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs)
18 |
19 | Private _highDpiMode As HighDpiMode?
20 |
21 | Friend Shadows Property HighDpiMode As HighDpiMode
22 | Get
23 | Return If(
24 | _highDpiMode Is Nothing,
25 | Application.HighDpiMode,
26 | _highDpiMode.Value)
27 | End Get
28 | Set(value As HighDpiMode)
29 | _highDpiMode = value
30 | End Set
31 | End Property
32 |
33 | ' IMPORTANT:
34 | ' If this method causes an compilation error after you've unchecked 'Application Framework'
35 | ' in the project properties, go to the top of this file and change the value to 'False' in this line:
36 | ' #Const APPLICATION_FRAMEWORK = False
37 |
38 | ' For more about using WinForms without the Application Framework
39 | ' see: https://aka.ms/visualbasic-appframework-net5
40 | Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean
41 | Dim eventArgs = New ApplyHighDpiModeEventArgs(
42 | If(
43 | _highDpiMode Is Nothing,
44 | HighDpiMode.SystemAware,
45 | _highDpiMode.Value))
46 |
47 | RaiseEvent ApplyHighDpiMode(Me, eventArgs)
48 |
49 | Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode)
50 |
51 | Return MyBase.OnInitialize(commandLineArgs)
52 | End Function
53 | End Class
54 |
55 | Public Class ApplyHighDpiModeEventArgs
56 | Inherits EventArgs
57 |
58 | Public Sub New(highDpiMode As HighDpiMode)
59 | Me.HighDpiMode = highDpiMode
60 | End Sub
61 |
62 | Public Property HighDpiMode As HighDpiMode
63 |
64 | End Class
65 |
66 | End Namespace
67 |
68 | #End If ' #If NET5_0 And Not NET6_0
69 | #End If ' #If APPLICATION_FRAMEWORK
70 |
--------------------------------------------------------------------------------
/QBasic/Gorilla/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = true
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = false
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.Gorilla.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/QBasic/Gorilla/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | true
6 | 0
7 | true
8 | 0
9 | false
10 |
--------------------------------------------------------------------------------
/QBasic/Gorilla/Resources/DBan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/QBasic/Gorilla/Resources/DBan.png
--------------------------------------------------------------------------------
/QBasic/Gorilla/Resources/LBan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/QBasic/Gorilla/Resources/LBan.png
--------------------------------------------------------------------------------
/QBasic/Gorilla/Resources/RBan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/QBasic/Gorilla/Resources/RBan.png
--------------------------------------------------------------------------------
/QBasic/Gorilla/Resources/UBan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/QBasic/Gorilla/Resources/UBan.png
--------------------------------------------------------------------------------
/QBasic/Nibbles/Nibbles.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Nibbles
6 | net8.0-windows
7 | Nibbles
8 | 0.0.1.0
9 | 0.0.1.0
10 | True
11 | Link
12 |
13 |
14 |
15 | false
16 | none
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/QBasic/README.md:
--------------------------------------------------------------------------------
1 | # QBasic
2 |
3 | Microsoft QBasic (or more specifically Microsoft QuickBasic and it's baby brother) is a direct precursor to modern VB.
4 |
5 | There were several examples that shipped with MS-DOS 5.0 (along with QBasic 1.0) and this section serves to pay honor to those by migrating them to .NET with minimal structural changes in an effort to respect the original material.
6 |
7 | - Gorilla
8 | - Nibbles
9 | - RemLine
10 |
11 | NOTE: These projects leverage the QB.Compatibility library that can be found seperately in my repos.
12 |
--------------------------------------------------------------------------------
/QBasic/RemLine/RemLine.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | RemLine
6 | net8.0-windows
7 | RemLine
8 | 0.0.1.0
9 | 0.0.1.0
10 | True
11 | Link
12 |
13 |
14 |
15 | false
16 | none
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/QSortModern/Program.vb:
--------------------------------------------------------------------------------
1 | ' https://youtu.be/OKc2hAmMOY4?si=vYLl5nRcOvpeW-W_
2 | '
3 | ' qsort [] = []
4 | ' qsort (x:xs) = qsort smaller ++ [x] ++ qsort larger
5 | ' where
6 | ' smaller = filter (<=x) xs
7 | ' larger = filter (>x) xs
8 |
9 | Module Program
10 |
11 | Sub Main()
12 | Dim list = {3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5}.ToList
13 | Dim sortedList = QSort(list)
14 | For Each item In sortedList
15 | Console.Write(item & " ")
16 | Next
17 | End Sub
18 |
19 | Function QSort(Of T As IComparable)(list As IEnumerable(Of T)) As IEnumerable(Of T)
20 | If If(list?.Count, 0) <= 1 Then Return list
21 | Dim x = list(0), xs = list.Skip(1)
22 | Dim smaller = From y In xs Where y.CompareTo(x) <= 0
23 | Dim larger = From y In xs Where y.CompareTo(x) > 0
24 | Return QSort(smaller).Concat({x}).Concat(QSort(larger))
25 | End Function
26 |
27 | End Module
--------------------------------------------------------------------------------
/QSortModern/QSortModern.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | QSortModern
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ScanMkDn/ScanMkDn.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | ScanMkDn
6 | net8.0
7 | true
8 | true
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Serial/PC-To-Centurion/PcSide.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | PcSide
6 | net9.0
7 | true
8 | true
9 | latest
10 | On
11 | On
12 | On
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Serial/PC-To-Centurion/Program.vb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/Serial/PC-To-Centurion/Program.vb
--------------------------------------------------------------------------------
/SerialTesting/CenturionSide.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | CenturionSide
6 | net9.0
7 | true
8 | true
9 | latest
10 | On
11 | On
12 | On
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/SortTest/Program.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Module Program
6 |
7 | Sub Main(args As String())
8 | 'Create an array of 1000 numbers
9 | Dim x1(1000) As Double
10 | Dim x2(1000) As Double
11 | 'Add some random numbers to the Array
12 | Randomize(Timer)
13 | For i = 0 To 999
14 | x1(i) = Rnd(1000)
15 | x2(i) = x1(i)
16 | Next
17 | Print("Quick Sort in VB! ..............")
18 | 'Get start time in milliseconds
19 | Dim startTime = Timer()
20 | 'Run the sort function on the array
21 | Sort(x1, 1000) 'sorts an array of 10 numbers
22 | 'Get the end time in milliseconds
23 | Dim endTime = Timer()
24 | 'Convert total runtime to seconds
25 | Dim time_in_secs = (endTime - startTime) / 1000
26 | Print($"Time: {time_in_secs}")
27 | Print("\n----------------------------------\n")
28 | Print("Bubble Sort in VB! ..............")
29 | 'Get start time in milliseconds
30 | startTime = Timer()
31 | 'Run the sort function on the array
32 | Bubble_Sort(x2, 1000) 'sorts an array of 10 numbers
33 | 'Get the end time in milliseconds
34 | endTime = Timer()
35 | 'Convert total runtime to seconds
36 | time_in_secs = (endTime - startTime) / 1000
37 | Print($"Time: {time_in_secs}")
38 | Print("\n\n")
39 | Console.ReadLine() 'This will prevent the window from closing when the program ends
40 | End Sub
41 |
42 | Private Sub Print(value As String)
43 | If value.Contains("\n") Then value = value.Replace("\n", vbCrLf)
44 | Console.WriteLine(value)
45 | End Sub
46 |
47 | Sub Sort(ByRef arr() As Double, n As Integer)
48 | For i = 0 To n - 1
49 | For j = i To n - 1
50 | If arr(j) < arr(i) Then
51 | Dim temp = arr(i)
52 | arr(i) = arr(j)
53 | arr(j) = temp
54 | End If
55 | Next
56 | Next
57 | End Sub
58 |
59 | Sub Bubble_Sort(ByRef item() As Double, itemCount As Integer)
60 | Dim counter = itemCount - 1 'rcbasic arrays start at 0 so the last index will be 1 less
61 | 'label doLoop
62 | Dim hasChanged As Boolean
63 | Do
64 | hasChanged = False
65 | Dim i = 0 'rcbasic arrays start at index 0
66 | While i < counter
67 | If item(i) > item(i + 1) Then
68 | Dim temp = item(i)
69 | item(i) = item(i + 1)
70 | item(i + 1) = temp
71 | hasChanged = True
72 | End If
73 | i += 1
74 | End While
75 |
76 | counter -= 1
77 | Loop While hasChanged
78 | End Sub
79 |
80 | End Module
--------------------------------------------------------------------------------
/SortTest/SortTest.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | SortTest
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Sound/Libsoundio_Sample/Libsoundio_Sample.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Libsoundio_Sample
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Sound/Libsoundio_Sample/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 |
3 | Module Program
4 | Sub Main(args As String())
5 | Console.WriteLine("Hello World!")
6 | End Sub
7 | End Module
8 |
--------------------------------------------------------------------------------
/Sound/Libsoundio_Sample/README.md:
--------------------------------------------------------------------------------
1 | # Libsoundio
2 |
3 | - [Libsoundio (GitHub)](https://github.com/andrewrk/libsoundio)
4 | - [playmidi project (SDL2)](https://github.com/nlaredo/playmidi)
--------------------------------------------------------------------------------
/Sound/ModExtract/ModExtract.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | ModExtract
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Sound/WaveOut/WaveOut.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | WaveOut
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Sound/WaveOutBuffered/WaveOutBuffered.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | WaveOutBuffered
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/SoundBeepPlay/AudioPlaybackEngine.vb:
--------------------------------------------------------------------------------
1 | 'Option Explicit On
2 | 'Option Infer On
3 | 'Option Strict On
4 |
5 | 'Imports NAudio.Wave
6 | 'Imports NAudio.Wave.SampleProviders
7 |
8 | 'Class AudioPlaybackEngine
9 | ' Implements IDisposable
10 |
11 | ' Private ReadOnly _outputDevice As IWavePlayer
12 | ' Private ReadOnly _mixer As MixingSampleProvider
13 |
14 | ' Public Sub New(Optional sampleRate As Integer = 44100, Optional channelCount As Integer = 2)
15 | ' _outputDevice = New WaveOutEvent
16 | ' _mixer = New MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channelCount))
17 | ' _mixer.ReadFully = True
18 | ' _outputDevice.Init(_mixer)
19 | ' _outputDevice.Play()
20 | ' End Sub
21 |
22 | ' Public Sub PlaySound(fileName As String)
23 | ' Dim input = New AudioFileReader(fileName)
24 | ' AddMixerInput(New AutoDisposeFileReader(input))
25 | ' End Sub
26 |
27 | ' Public Sub PlaySound(s As IO.Stream)
28 | ' Dim input = New AudioFileReader(fileName)
29 | ' AddMixerInput(New AutoDisposeFileReader(input))
30 | ' End Sub
31 |
32 | ' Private Function ConvertToRightChannelCount(input As ISampleProvider) As ISampleProvider
33 | ' If input.WaveFormat.Channels = _mixer.WaveFormat.Channels Then
34 | ' Return input
35 | ' End If
36 | ' If input.WaveFormat.Channels = 1 AndAlso _mixer.WaveFormat.Channels = 2 Then
37 | ' Return New MonoToStereoSampleProvider(input)
38 | ' End If
39 | ' Throw New NotImplementedException("Not yet implemented this channel count conversion")
40 | ' End Function
41 |
42 | ' Public Sub PlaySound(sound As CachedSound)
43 | ' AddMixerInput(New CachedSoundSampleProvider(sound))
44 | ' End Sub
45 |
46 | ' Private Sub AddMixerInput(input As ISampleProvider)
47 | ' _mixer.AddMixerInput(ConvertToRightChannelCount(input))
48 | ' End Sub
49 |
50 | ' Public Sub Dispose() Implements IDisposable.Dispose
51 | ' _outputDevice.Dispose()
52 | ' End Sub
53 |
54 | ' Public Shared ReadOnly Instance As New AudioPlaybackEngine(44100, 2)
55 |
56 | 'End Class
--------------------------------------------------------------------------------
/SoundBeepPlay/AutoDisposeFileReader.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Infer On
3 | Option Strict On
4 |
5 | Imports NAudio.Wave
6 |
7 | Class AutoDisposeFileReader
8 | Implements ISampleProvider
9 |
10 | Private ReadOnly m_reader As AudioFileReader
11 | Private m_isDisposed As Boolean
12 |
13 | Public Sub New(reader As AudioFileReader)
14 | m_reader = reader
15 | WaveFormat = reader.WaveFormat
16 | End Sub
17 |
18 | Public Function Read(buffer As Single(), offset As Integer, count As Integer) As Integer Implements ISampleProvider.Read
19 | If m_isDisposed Then
20 | Return 0
21 | End If
22 | Dim r = m_reader.Read(buffer, offset, count)
23 | If r = 0 Then
24 | m_reader.Dispose()
25 | m_isDisposed = True
26 | End If
27 | Return r
28 | End Function
29 |
30 | Public Property WaveFormat As WaveFormat Implements ISampleProvider.WaveFormat
31 |
32 | End Class
--------------------------------------------------------------------------------
/SoundBeepPlay/CachedSound.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Infer On
3 | Option Strict On
4 |
5 | Imports NAudio.Wave
6 |
7 | Class CachedSound
8 |
9 | Public Property AudioData As Single()
10 |
11 | Public Property WaveFormat As WaveFormat
12 |
13 | Public Sub New(audioFileName As String)
14 | Using audioFileReader = New AudioFileReader(audioFileName)
15 | ' TODO: could add resampling in here if required
16 | WaveFormat = audioFileReader.WaveFormat
17 | Dim wholeFile = New List(Of Single)(CInt(Fix((audioFileReader.Length / 4))))
18 | Dim readBuffer = New Single(audioFileReader.WaveFormat.SampleRate * audioFileReader.WaveFormat.Channels - 1) {}
19 | Do
20 | Dim samplesRead = audioFileReader.Read(readBuffer, 0, readBuffer.Length)
21 | If samplesRead > 0 Then
22 | wholeFile.AddRange(readBuffer.Take(samplesRead))
23 | Else
24 | Exit Do
25 | End If
26 | Loop
27 | AudioData = wholeFile.ToArray()
28 | End Using
29 | End Sub
30 |
31 | End Class
--------------------------------------------------------------------------------
/SoundBeepPlay/CachedSoundSampleProvider.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Infer On
3 | Option Strict On
4 |
5 | Imports NAudio.Wave
6 |
7 | Class CachedSoundSampleProvider
8 | Implements ISampleProvider
9 |
10 | Private ReadOnly m_cachedSound As CachedSound
11 | Private m_position As Long
12 |
13 | Public Sub New(cachedSound As CachedSound)
14 | m_cachedSound = cachedSound
15 | End Sub
16 |
17 | Public Function Read(buffer As Single(), offset As Integer, count As Integer) As Integer Implements ISampleProvider.Read
18 | Dim availableSamples = m_cachedSound.AudioData.Length - m_position
19 | Dim samplesToCopy = Math.Min(availableSamples, count)
20 | Array.Copy(m_cachedSound.AudioData, m_position, buffer, offset, samplesToCopy)
21 | m_position += samplesToCopy
22 | Return CInt(Fix(samplesToCopy))
23 | End Function
24 |
25 | Public ReadOnly Property WaveFormat As WaveFormat Implements ISampleProvider.WaveFormat
26 | Get
27 | Return m_cachedSound.WaveFormat
28 | End Get
29 | End Property
30 |
31 | End Class
32 |
--------------------------------------------------------------------------------
/SoundBeepPlay/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 |
3 | Imports Audio
4 |
5 | Imports NAudio.Wave
6 |
7 | Module Program
8 |
9 | 'Private WithEvents WaveOut As IWavePlayer
10 | 'Private ReadOnly m_mixer As New SampleProviders.MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(44100, 2))
11 |
12 | Private WithEvents Player As New Player3()
13 |
14 | Private ReadOnly streams As New Dictionary(Of Integer, IO.Stream)
15 |
16 | Private ReadOnly m_stack As New Stack(Of IO.Stream)
17 |
18 | Sub Main() 'args As String())
19 |
20 | Do
21 | If Console.KeyAvailable Then
22 | Dim k = Console.ReadKey(True)
23 | Select Case k.Key
24 | Case ConsoleKey.B
25 | m_stack.Push(New SoundGenerator(44100, 800, 4.55).Stream)
26 | 'If streams.Count = 0 Then
27 | PlayNext()
28 | 'End If
29 | Case ConsoleKey.Escape
30 | Exit Do
31 | Case Else
32 | End Select
33 | End If
34 | Loop
35 |
36 | End Sub
37 |
38 | Private Sub PlayNext()
39 |
40 | If m_stack.Count > 0 Then
41 |
42 | Dim s = m_stack.Pop
43 |
44 | Dim id = 0
45 | Do
46 | If streams.ContainsKey(id) Then
47 | id += 1
48 | Else
49 | Exit Do
50 | End If
51 | Loop
52 |
53 | streams.Add(id, s)
54 | Player.Play(id, streams(id))
55 |
56 | End If
57 |
58 | End Sub
59 |
60 | Private Sub Player_AudioFinished(sender As Object, e As AudioEventArgs2) Handles Player.AudioFinished
61 | Console.WriteLine("Finished")
62 | If e.LogIndex IsNot Nothing Then
63 | Dim id = CInt(e.LogIndex)
64 | If streams.ContainsKey(id) Then
65 | streams(id).Close()
66 | streams(id) = Nothing
67 | streams.Remove(id)
68 | End If
69 | PlayNext()
70 | End If
71 | End Sub
72 |
73 | Private Sub Player_Clock(sender As Object, e As ClockEventArgs2) Handles Player.Clock
74 | Console.WriteLine(e.Clock)
75 | End Sub
76 |
77 | Private Sub Player_AudioClosed(sender As Object, e As AudioEventArgs2) Handles Player.AudioClosed
78 | Console.WriteLine("Closed")
79 | End Sub
80 |
81 | Private Sub Player_AudioStarted(sender As Object, e As AudioEventArgs2) Handles Player.AudioStarted
82 | Console.WriteLine("Started")
83 | End Sub
84 |
85 | End Module
--------------------------------------------------------------------------------
/SoundBeepPlay/SoundBeepPlay.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | SoundBeepPlay
6 | net8.0-windows
7 | SoundBeepPlay
8 | 0.0.1.0
9 | 0.0.1.0
10 | True
11 | Link
12 |
13 |
14 |
15 | false
16 | none
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/Cars.csv:
--------------------------------------------------------------------------------
1 | Brand, Model, Year, cc, Favorite
2 | Fiat, Punto, 2008, 12.3, No
3 | Ford, Wagon, 1956, 20.3, No
4 | BMW, "335", 2014, 20.3, Yes
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/GeneratedDemo.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/MainSettings.xmlsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 | False
4 | 1234
5 | Hello World!
6 |
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/People.csv:
--------------------------------------------------------------------------------
1 | Name, address, 11Age
2 | "Luca Bol", "23 Bell Street", 90
3 | "john doe", "32 Carl street", 45
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/Program.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Module Program
6 |
7 | Public Sub Main()
8 |
9 | Console.WriteLine("Running HelloWorld:
10 | ")
11 | UseHelloWorldGenerator.Run()
12 |
13 | Console.WriteLine("
14 |
15 | Running AutoNotify:
16 | ")
17 | UseAutoNotifyGenerator.Run()
18 |
19 | Console.WriteLine("
20 |
21 | Running XmlSettings:
22 | ")
23 | UseXmlSettingsGenerator.Run()
24 |
25 | Console.WriteLine("
26 |
27 | Running CsvGenerator:
28 | ")
29 | UseCsvGenerator.Run()
30 |
31 | Console.WriteLine("
32 |
33 | Running MustacheGenerator:
34 | ")
35 | UseMustacheGenerator.Run()
36 |
37 | Console.WriteLine("
38 |
39 | Running RecordGenerator:
40 | ")
41 | UseRecordGenerator.Run()
42 |
43 | End Sub
44 |
45 | End Module
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/UseAutoNotifyGenerator.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Imports AutoNotify
6 |
7 | ' The view model we'd like to augment
8 | Partial Public Class ExampleViewModel
9 |
10 |
11 | Private _text As String = "private field text"
12 |
13 |
14 | Private _amount As Integer = 5
15 |
16 | End Class
17 |
18 | Public Module UseAutoNotifyGenerator
19 |
20 | Public Sub Run()
21 |
22 | Dim vm As New ExampleViewModel()
23 |
24 | ' we didn't explicitly create the 'Text' property, it was generated for us
25 | Dim text = vm.Text
26 | Console.WriteLine($"Text = {text}")
27 |
28 | ' Properties can have differnt names generated based on the PropertyName argument of the attribute
29 | Dim count = vm.Count
30 | Console.WriteLine($"Count = {count}")
31 |
32 | ' the viewmodel will automatically implement INotifyPropertyChanged
33 | AddHandler vm.PropertyChanged, Sub(o, e) Console.WriteLine($"Property {e.PropertyName} was changed")
34 | vm.Text = "abc"
35 | vm.Count = 123
36 |
37 | ' Try adding fields to the ExampleViewModel class above and tagging them with the attribute
38 | ' You'll see the matching generated properties visibile in IntelliSense in realtime
39 |
40 | End Sub
41 |
42 | End Module
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/UseCsvGenerator.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Imports CSV
6 |
7 | Friend Class UseCsvGenerator
8 |
9 | Public Shared Sub Run()
10 |
11 | Console.WriteLine("## CARS")
12 |
13 | 'Cars.All.ToList().ForEach(Sub(c) Console.WriteLine(c.Brand & vbTab & c.Model & vbTab & c.Year & vbTab & c.Cc & vbTab & c.Favorite))
14 | For Each car In Cars.All
15 | Console.WriteLine($"{car.Brand}{vbTab}{car.Model}{vbTab}{car.Year}{vbTab}{car.Cc}{vbTab}{car.Favorite}")
16 | Next
17 |
18 | Console.WriteLine(vbCr & "## PEOPLE")
19 | People.All.ToList().ForEach(Sub(p) Console.WriteLine(p.Name & vbTab & p.Address & vbTab & p._11Age))
20 |
21 | End Sub
22 |
23 | End Class
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/UseHelloWorldGenerator.vb:
--------------------------------------------------------------------------------
1 | Public Module UseHelloWorldGenerator
2 |
3 | Public Sub Run()
4 | ' The static call below is generated at build time, and will list the syntax trees used in the compilation
5 | HelloWorldGenerated.HelloWorld.SayHello()
6 | End Sub
7 |
8 | End Module
9 |
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/UseImplicitInterfacGenerator.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | 'Imports ImplicitInterfacGenerator
6 |
7 | Public Interface IPerson
8 | Property FirstName As String
9 | Property LastName As String
10 | 'Property Birth As Date
11 |
12 | Sub WishHappyBirthday()
13 | Function Age() As Integer
14 |
15 | 'Event ThisHappened(sender As Object, e As EventArgs)
16 |
17 | 'Interface WhatInTheSamH
18 | ' Sub Dude()
19 | 'End Interface
20 |
21 | 'Class EvenMoreWtf
22 | ' Public Property Here As Integer
23 | 'End Class
24 |
25 | 'Structure HolyWtf
26 | ' Public Item1 As Integer
27 | 'End Structure
28 |
29 | End Interface
30 |
31 | '
32 | Public Class Boss
33 | Implements IPerson
34 |
35 | ' This is what we start with...
36 |
37 | Public Property FirstName As String
38 | Public Property LastName As String
39 |
40 | Public Sub WishHappyBirthday()
41 | ' Do something
42 | End Sub
43 |
44 | Public Function Age() As Integer
45 | Return 1
46 | End Function
47 |
48 | End Class
49 |
50 | 'Partial Class Boss
51 |
52 | ' Private Event IPerson_ThisHappened(sender As Object, e As EventArgs) Implements IPerson.ThisHappened
53 |
54 | ' Private Property IPerson_FirstName As String Implements IPerson.FirstName
55 | ' Get
56 | ' Return Me.FirstName
57 | ' End Get
58 | ' Set(value As String)
59 | ' Me.FirstName = value
60 | ' End Set
61 | ' End Property
62 |
63 | ' Private Property IPerson_LastName As String Implements IPerson.LastName
64 | ' Get
65 | ' Return Me.LastName
66 | ' End Get
67 | ' Set(value As String)
68 | ' Me.LastName = value
69 | ' End Set
70 | ' End Property
71 |
72 | ' Private Property IPerson_Birth As Date Implements IPerson.Birth
73 | ' Get
74 | ' Throw New NotImplementedException
75 | ' End Get
76 | ' Set(value As Date)
77 | ' Throw New NotImplementedException
78 | ' End Set
79 | ' End Property
80 |
81 | ' Private Sub IPerson_WishHappyBirthday() Implements IPerson.WishHappyBirthday
82 | ' WishHappyBirthday()
83 | ' End Sub
84 |
85 | ' Private Function IPerson_Age() As Integer Implements IPerson.Age
86 | ' Return Age()
87 | ' End Function
88 |
89 | 'End Class
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/UseMustacheGenerator.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Imports GeneratedDemo.UseMustacheGenerator
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Friend Class UseMustacheGenerator
14 |
15 | Public Shared Sub Run()
16 | Console.WriteLine(Mustache.Constants.Lottery)
17 | Console.WriteLine(Mustache.Constants.HR)
18 | Console.WriteLine(Mustache.Constants.HTML)
19 | Console.WriteLine(Mustache.Constants.Section)
20 | Console.WriteLine(Mustache.Constants.NestedSection)
21 | End Sub
22 |
23 | ' Mustache templates and hashes from the manual at https://mustache.github.io/mustache.1.html...
24 | Public Const t1 As String = "
25 | Hello {{name}}
26 | You have just won {{value}} dollars!
27 | {{#in_ca}}
28 | Well, {{taxed_value}} dollars, after taxes.
29 | {{/in_ca}}
30 | "
31 | Public Const h1 As String = "
32 | {
33 | ""name"": ""Chris"",
34 | ""value"": 10000,
35 | ""taxed_value"": 5000,
36 | ""in_ca"": true
37 | }
38 | "
39 | Public Const t2 As String = "
40 | * {{name}}
41 | * {{age}}
42 | * {{company}}
43 | * {{{company}}}
44 | "
45 | Public Const h2 As String = "
46 | {
47 | ""name"": ""Chris"",
48 | ""company"": ""GitHub""
49 | }
50 | "
51 | Public Const t3 As String = "
52 | Shown
53 | {{#person}}
54 | Never shown!
55 | {{/person}}
56 | "
57 | Public Const h3 As String = "
58 | {
59 | ""person"": false
60 | }
61 | "
62 | Public Const t4 As String = "
63 | {{#repo}}
64 | {{name}}
65 | {{/repo}}
66 | "
67 | Public Const h4 As String = "
68 | {
69 | ""repo"": [
70 | { ""name"": ""resque"" },
71 | { ""name"": ""hub"" },
72 | { ""name"": ""rip"" }
73 | ]
74 | }
75 | "
76 | Public Const t5 As String = "
77 | {{#repo}}
78 | {{name}}
79 | {{#nested}}
80 | NestedName: {{name}}
81 | {{/nested}}
82 | {{/repo}}
83 | "
84 | Public Const h5 As String = "
85 | {
86 | ""repo"": [
87 | { ""name"": ""resque"", ""nested"":[{""name"":""nestedResque""}] },
88 | { ""name"": ""hub"" },
89 | { ""name"": ""rip"" }
90 | ]
91 | }
92 | "
93 |
94 | End Class
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/UseRecordGenerator.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Imports RecordGenerator
6 |
7 |
8 | Public Class Person
9 | Public Property FirstName As String
10 | Public Property LastName As String
11 | Public Property Birth As String
12 | Public Property Test As String
13 | End Class
14 |
15 |
16 | Public Class Animal
17 | Public Property Name As String
18 | End Class
19 |
20 | Public Module UseRecordGenerator
21 |
22 | Public Sub Run()
23 |
24 | Dim p1 = New Person() With {.FirstName = "Cory", .LastName = "Smith"}
25 | Dim p2 = New Person() With {.FirstName = "Bill", .LastName = "Gates"}
26 |
27 | Dim p3 = p2.Clone()
28 |
29 | Dim p4 = New Person() With {.FirstName = "Bill", .LastName = "Gates"} ', .Birth = Today}
30 |
31 | 'Dim p5 = New Person()
32 | 'With p5
33 | ' .FirstName = "Bill"
34 | ' .LastName = "Gates"
35 | ' .Birth = Today
36 | 'End With
37 |
38 | 'Dim p6 = New Person()
39 | 'p6.FirstName = "Bill"
40 | 'p6.LastName = "Gates"
41 | 'p6.Birth = Today
42 |
43 | Dim h = p1.GetHashCode()
44 |
45 | If p1 = p2 Then
46 | Console.WriteLine("p1 = p2")
47 | End If
48 | If p1 <> p3 Then
49 | Console.WriteLine("p1 <> p3")
50 | End If
51 |
52 | Console.WriteLine(p1)
53 | Console.WriteLine(p3)
54 |
55 | Dim a1 = New Animal With {.Name = "Dog"}
56 |
57 | Dim h2 = a1.GetHashCode()
58 |
59 | Console.WriteLine(a1)
60 |
61 | 'If p1 = a1 Then
62 | ' Console.WriteLine("p1 = a1")
63 | 'End If
64 | 'If p1 <> a1 Then
65 | ' Console.WriteLine("p1 <> a1")
66 | 'End If
67 |
68 | End Sub
69 |
70 | End Module
--------------------------------------------------------------------------------
/SourceGenerators/GeneratedDemo/UseXmlSettingsGenerator.vb:
--------------------------------------------------------------------------------
1 | Imports AutoSettings
2 |
3 | Public Module UseXmlSettingsGenerator
4 |
5 | Public Sub Run()
6 |
7 | ' This XmlSettings generator makes a static property in the XmlSettings class for each .xmlsettings file
8 |
9 | ' here we have the 'Main' settings file from MainSettings.xmlsettings
10 | ' the name is determined by the 'name' attribute of the root settings element
11 | Dim main As XmlSettings.MainSettings = XmlSettings.Main
12 | Console.WriteLine($"Reading settings from {main.GetLocation()}")
13 |
14 | ' settings are strongly typed and can be read directly from the static instance
15 | Dim firstRun As Boolean = XmlSettings.Main.FirstRun
16 | Console.WriteLine($"Setting firstRun = {firstRun}")
17 |
18 | Dim cacheSize As Integer = XmlSettings.Main.CacheSize
19 | Console.WriteLine($"Setting cacheSize = {cacheSize}")
20 |
21 | ' Try adding some keys to the settings file and see the settings become available to read from
22 |
23 | End Sub
24 |
25 | End Module
--------------------------------------------------------------------------------
/SourceGenerators/ImplicitInterfaceGenerator/ImplicitInterfaceGenerator.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DualBrain
5 | netstandard2.0
6 | 1.0.0-alpha4
7 | 1.0.0
8 | Cory Smith
9 | Implicit Interface Generator
10 | (c) 2021, Cory Smith
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | PreserveNewest
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | DualBrain.ImplicitInterfaceGenerator
30 | true
31 | false
32 | Shiny Stone Digital
33 | VB VisualBasic VB.NET interface source generator
34 | DualBrain's Implicit Interface Generator
35 | A VB Source Generator that extends VB by with implicit interface support by automatically aligning the interface with similarly matching methods, properties and/or fields.
36 | Provides implicit interface support in VB.
37 | https://github.com/dualbrain/samples
38 | https://github.com/dualbrain/samples
39 | MIT
40 | README.md
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/SourceGenerators/ImplicitInterfaceGenerator/README.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | VB currently provides what is called explicit interface implementations; meaning when you implement an interface you must explicitly specify which methods, properties, etc. are going to handle the interface definition. Implicit interface implementations will attempt to infer the *wiring* between the interface and the class based on a set of predefined rules. This package will do this by creating a backing partial class that handles this *wiring* automatically for any methods, properties, etc. that can be implicitly aligned.
4 |
5 | ## Requirements
6 |
7 | - Visual Studio 2019 v16.10.0+
8 | - VB
9 |
10 | ## Getting Started
11 |
12 | Once you have this in your project, you can enjoy explicit (what you have now) and implicit (what this provides) interface implementations!
13 |
14 | Given the following interface:
15 |
16 | ```vb
17 | Public Interface IPerson
18 | Property Name As String
19 | End Interface
20 | ```
21 |
22 | You could create an employee class:
23 |
24 | ```vb
25 | Public Class Employee
26 | Implements IPerson
27 |
28 | Public Property Name As String
29 |
30 | End Class
31 | ```
32 |
33 | Which results in Visual Studio seeing this as completely legal code because the generator automatically creates:
34 |
35 | ```vb
36 | Public Partial Class Employee
37 |
38 | Private Property IPerson_Name As String Implements IPerson.Name
39 | Get
40 | Return Name
41 | End Get
42 | Set(value As String)
43 | Name = value
44 | End Set
45 | End Property
46 |
47 | End Class
48 | ```
49 |
50 | The implicit implementation follows these rules:
51 |
52 | - If the interface is explicity defined, skip.
53 | - A method will map to a similarly named method with matching param signature.
54 | - A property will first attempt to map to a similarly named property with matching param signature.
55 | - If a property can't be determined, will attempt to map to a similarly named field; but only if it doesn't have params.
56 |
57 | If unable to determine a map, that mapping will not be generated; which results in Visual Studio notifying the user that the interface has not been defined.
58 |
59 | ## Events
60 |
61 | Events are not handled as I haven't figured out a way to not cause double raising of events by "wrapping" an event. So, for the time being, Events must be interfaced explicitly.
62 |
63 | ## More
64 |
65 | - You can find the project [here](https://github/dualbrain/samples); please leave feedback, questions, etc. via the [github project](https://github/dualbrain/samples).
66 | - Feel free to reach out to me directly via [twitter](https://twitter.com/dualbrain).
67 | - Even better, join the VB conversation over on [gitter](https://gitter.im/VB-NET).
68 |
--------------------------------------------------------------------------------
/SourceGenerators/SourceGeneratorSamples/CsvGenerator.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SourceGenerators/SourceGeneratorSamples/HelloWorldGenerator.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Infer On
3 | Option Strict On
4 |
5 | Imports System.Text
6 |
7 | Imports Microsoft.CodeAnalysis
8 | Imports Microsoft.CodeAnalysis.Text
9 |
10 | Namespace SourceGeneratorSamples
11 |
12 |
13 | Public Class HelloWorldGenerator
14 | Implements ISourceGenerator
15 |
16 | Public Sub Initialize(context As GeneratorInitializationContext) Implements ISourceGenerator.Initialize
17 | ' No initialization required
18 | End Sub
19 |
20 | Public Sub Execute(context As GeneratorExecutionContext) Implements ISourceGenerator.Execute
21 |
22 | ' begin creating the source we'll inject into the users compilation
23 |
24 | Dim sourceBuilder = New StringBuilder("Option Explicit On
25 | Option Strict On
26 | Option Infer On
27 |
28 | Namespace Global.HelloWorldGenerated
29 |
30 | Public Module HelloWorld
31 |
32 | Public Sub SayHello()
33 |
34 | Console.WriteLine(""Hello from generated code!"")
35 | Console.WriteLine(""The following syntax trees existed in the compilation that created this program:"")
36 | ")
37 |
38 | ' for testing... let's include a comment with the current date/time.
39 | sourceBuilder.AppendLine($" ' Generated at {DateTime.Now}")
40 |
41 | ' using the context, get a list of syntax trees in the users compilation
42 | ' add the filepath of each tree to the class we're building
43 |
44 | For Each tree In context.Compilation.SyntaxTrees
45 | sourceBuilder.AppendLine($" Console.WriteLine("" - {tree.FilePath}"")")
46 | Next
47 |
48 | ' finish creating the source to inject
49 |
50 | sourceBuilder.Append("
51 |
52 | End Sub
53 |
54 | End Module
55 |
56 | End Namespace")
57 |
58 | ' inject the created source into the users compilation
59 |
60 | context.AddSource("HelloWorldGenerated", SourceText.From(sourceBuilder.ToString(), Encoding.UTF8))
61 |
62 | End Sub
63 |
64 | End Class
65 |
66 | End Namespace
--------------------------------------------------------------------------------
/SourceGenerators/SourceGeneratorSamples/SourceGeneratorSamples.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | $(GetTargetPathDependsOn);GetDependencyTargetPaths
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/SourceGenerators/SourceGenerators.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30022.13
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "GeneratedDemo", "GeneratedDemo\GeneratedDemo.vbproj", "{08612C19-D039-44D1-9030-D192CEAF05BB}"
7 | EndProject
8 | Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "SourceGeneratorSamples", "SourceGeneratorSamples\SourceGeneratorSamples.vbproj", "{90BDB1C3-E353-448C-8A29-E5B2EF10670B}"
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 | {08612C19-D039-44D1-9030-D192CEAF05BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {08612C19-D039-44D1-9030-D192CEAF05BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {08612C19-D039-44D1-9030-D192CEAF05BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {08612C19-D039-44D1-9030-D192CEAF05BB}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {90BDB1C3-E353-448C-8A29-E5B2EF10670B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {90BDB1C3-E353-448C-8A29-E5B2EF10670B}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {90BDB1C3-E353-448C-8A29-E5B2EF10670B}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {90BDB1C3-E353-448C-8A29-E5B2EF10670B}.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 = {623C84B6-B8A4-4F29-8E68-4ED37D4529D5}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/SourceGenerators/TestConsoleApp/TestConsoleApp.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 |
7 |
8 |
9 |
10 | all
11 | runtime; build; native; contentfiles; analyzers; buildtransitive
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SyntaxTree.vb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DualBrain/Samples/d5b195fa7d4c1a8570c55a33e9fb18598f391ba3/SyntaxTree.vb
--------------------------------------------------------------------------------
/TestFormsApp/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application.
12 |
13 | ' Example:
14 |
15 | ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode
16 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
17 | ' End Sub
18 |
19 | Partial Friend Class MyApplication
20 |
21 | End Class
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/TestFormsApp/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Me.SuspendLayout()
26 | '
27 | 'Form1
28 | '
29 | Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!)
30 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
31 | Me.ClientSize = New System.Drawing.Size(800, 450)
32 | Me.Name = "Form1"
33 | Me.Text = "Form1"
34 | Me.ResumeLayout(False)
35 |
36 | End Sub
37 |
38 | End Class
39 |
--------------------------------------------------------------------------------
/TestFormsApp/Form1.vb:
--------------------------------------------------------------------------------
1 | Public Class Form1
2 |
3 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
4 |
5 |
6 |
7 |
8 | End Sub
9 |
10 | End Class
11 |
--------------------------------------------------------------------------------
/TestFormsApp/My Project/Application.Designer.HighDpi.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | 'This constant indicates whether the Application Framework is in use.
5 | #Const APPLICATION_FRAMEWORK = True
6 |
7 | #If APPLICATION_FRAMEWORK Then
8 |
9 | #If NET5_0 And Not NET6_0 Then
10 |
11 | Imports System.Collections.ObjectModel
12 |
13 | Namespace My
14 |
15 | Partial Friend Class MyApplication
16 |
17 | Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs)
18 |
19 | Private _highDpiMode As HighDpiMode?
20 |
21 | Friend Shadows Property HighDpiMode As HighDpiMode
22 | Get
23 | Return If(
24 | _highDpiMode Is Nothing,
25 | Application.HighDpiMode,
26 | _highDpiMode.Value)
27 | End Get
28 | Set(value As HighDpiMode)
29 | _highDpiMode = value
30 | End Set
31 | End Property
32 |
33 | ' IMPORTANT:
34 | ' If this method causes an compilation error after you've unchecked 'Application Framework'
35 | ' in the project properties, go to the top of this file and change the value to 'False' in this line:
36 | ' #Const APPLICATION_FRAMEWORK = False
37 |
38 | ' For more about using WinForms without the Application Framework
39 | ' see: https://aka.ms/visualbasic-appframework-net5
40 | Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean
41 | Dim eventArgs = New ApplyHighDpiModeEventArgs(
42 | If(
43 | _highDpiMode Is Nothing,
44 | HighDpiMode.SystemAware,
45 | _highDpiMode.Value))
46 |
47 | RaiseEvent ApplyHighDpiMode(Me, eventArgs)
48 |
49 | Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode)
50 |
51 | Return MyBase.OnInitialize(commandLineArgs)
52 | End Function
53 | End Class
54 |
55 | Public Class ApplyHighDpiModeEventArgs
56 | Inherits EventArgs
57 |
58 | Public Sub New(highDpiMode As HighDpiMode)
59 | Me.HighDpiMode = highDpiMode
60 | End Sub
61 |
62 | Public Property HighDpiMode As HighDpiMode
63 |
64 | End Class
65 |
66 | End Namespace
67 |
68 | #End If ' #If NET5_0 And Not NET6_0
69 | #End If ' #If APPLICATION_FRAMEWORK
70 |
--------------------------------------------------------------------------------
/TestFormsApp/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.TestFormsApp.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/TestFormsApp/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | TestFormsApp
7 | Sub Main
8 | true
9 | WindowsForms
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | all
21 | runtime; build; native; contentfiles; analyzers; buildtransitive
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | True
33 | True
34 | Application.myapp
35 |
36 |
37 |
38 |
39 |
40 | MyApplicationCodeGenerator
41 | Application.Designer.vb
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/TestNuGetPackages/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 |
3 | Module Program
4 | Sub Main() 'args As String())
5 | Console.WriteLine("Hello World!")
6 | End Sub
7 | End Module
8 |
9 | Public Interface IPerson
10 | Property Name As String
11 | Function Test1(a As Integer, b As Integer, byref c As integer) As Integer
12 | Property Title As string
13 | End Interface
14 |
15 | Public Class Employee
16 | Implements IPerson
17 |
18 | Public Property Name() As String
19 |
20 | Public Property Title() As String
21 |
22 | Public shared Function Test1(a As Integer, b As Integer, byref c As Integer) As Integer
23 | c=a+b
24 | Return c
25 | End Function
26 |
27 | End Class
--------------------------------------------------------------------------------
/TestNuGetPackages/TestNuGetPackages.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | TestNuGetPackages
6 | net8.0
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/TinyBASIC/TinyBASIC.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | TinyBASIC
6 | net8.0
7 |
8 |
9 |
10 | false
11 | none
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Transpiler/Transpiler.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Transpiler
6 | net8.0
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Tui/Tui.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Tui
6 | net8.0
7 | On
8 |
9 |
10 |
11 |
12 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
13 |
14 |
15 |
16 |
17 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Twitter/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 |
3 | Module Program
4 |
5 | Sub Main() 'args As String())
6 |
7 | 'Console.WriteLine("Hello World!")
8 |
9 | Dim consumerKey As String = Nothing
10 | Dim consumerKeySecret As String = Nothing
11 | Dim accessToken As String = Nothing
12 | Dim accessTokenSecret As String = Nothing
13 |
14 | Dim twitter = New TwitterApi(consumerKey, consumerKeySecret, accessToken, accessTokenSecret)
15 | Dim response = twitter.Tweet("This is my first automated tweet!")
16 | Console.WriteLine(response)
17 |
18 | End Sub
19 |
20 | End Module
21 |
--------------------------------------------------------------------------------
/Twitter/Twitter.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | Twitter
6 | net8.0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/UacPrompt/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application.
12 |
13 | ' Example:
14 | ' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults
15 | '
16 | ' ' Setting the application-wide default Font:
17 | ' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular)
18 | '
19 | ' ' Setting the HighDpiMode for the Application:
20 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
21 | '
22 | ' ' If a splash dialog is used, this sets the minimum display time:
23 | ' e.MinimumSplashScreenDisplayTime = 4000
24 | ' End Sub
25 |
26 | Partial Friend Class MyApplication
27 |
28 | End Class
29 | End Namespace
30 |
--------------------------------------------------------------------------------
/UacPrompt/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 |
24 | Private Sub InitializeComponent()
25 | Me.Button1 = New System.Windows.Forms.Button()
26 | Me.SuspendLayout()
27 | '
28 | 'Button1
29 | '
30 | Me.Button1.Location = New System.Drawing.Point(124, 121)
31 | Me.Button1.Name = "Button1"
32 | Me.Button1.Size = New System.Drawing.Size(225, 69)
33 | Me.Button1.TabIndex = 0
34 | Me.Button1.Text = "Button1"
35 | Me.Button1.UseVisualStyleBackColor = True
36 | '
37 | 'Form1
38 | '
39 | Me.AutoScaleDimensions = New System.Drawing.SizeF(20.0!, 48.0!)
40 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
41 | Me.ClientSize = New System.Drawing.Size(800, 450)
42 | Me.Controls.Add(Me.Button1)
43 | Me.Name = "Form1"
44 | Me.Text = "Form1"
45 | Me.ResumeLayout(False)
46 |
47 | End Sub
48 |
49 | Friend WithEvents Button1 As Button
50 | End Class
51 |
--------------------------------------------------------------------------------
/UacPrompt/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Namespace My
15 |
16 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
17 | ' or if you encounter build errors in this file, go to the Project Designer
18 | ' (go to Project Properties or double-click the My Project node in
19 | ' Solution Explorer), and make changes on the Application tab.
20 | '
21 | Partial Friend Class MyApplication
22 |
23 |
24 | Public Sub New()
25 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
26 | Me.IsSingleInstance = False
27 | Me.EnableVisualStyles = True
28 | Me.SaveMySettingsOnExit = True
29 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
30 | End Sub
31 |
32 |
33 | Protected Overrides Sub OnCreateMainForm()
34 | Me.MainForm = Form1
35 | End Sub
36 | End Class
37 | End Namespace
38 |
--------------------------------------------------------------------------------
/UacPrompt/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/UacPrompt/UacPrompt.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net7.0-windows
6 | Sub Main
7 | true
8 | WindowsForms
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | True
20 | True
21 | Application.myapp
22 |
23 |
24 |
25 |
26 |
27 | MyApplicationCodeGenerator
28 | Application.Designer.vb
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinForms/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application.
12 |
13 | ' Example:
14 |
15 | ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode
16 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
17 | ' End Sub
18 |
19 | Partial Friend Class MyApplication
20 |
21 | End Class
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinForms/Community.Windows.FormsEx/ArrowDirections.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Namespace Global.Community.Windows.FormsEx
6 |
7 | Friend Enum ArrowDirections
8 | Left
9 | Up
10 | Right
11 | Down
12 | End Enum
13 |
14 | End Namespace
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinForms/Community.Windows.FormsEx/ScrollBarDarkMode.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Namespace Global.Community.Windows.FormsEx
6 |
7 | '''
8 | ''' Themed color, could be in properties...
9 | '''
10 | '''
11 | Friend Class ScrollBarDarkMode
12 | Public Shared ReadOnly Background As Color = Color.FromArgb(50, 50, 50)
13 | Public Shared ReadOnly Border As Color = Color.FromArgb(50, 50, 50)
14 | Public Shared ReadOnly Thumb As Color = Color.FromArgb(120, 120, 120)
15 | Public Shared ReadOnly ThumbHover As Color = Color.FromArgb(160, 160, 160)
16 | End Class
17 |
18 | End Namespace
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinForms/Form1.vb:
--------------------------------------------------------------------------------
1 | Public Class Form1
2 |
3 | Sub New()
4 |
5 | ' This call is required by the designer.
6 | InitializeComponent()
7 |
8 | ' Add any initialization after the InitializeComponent() call.
9 |
10 | WrapControls
11 |
12 | 'ResumeLayout(False)
13 |
14 | 'ResumeLayout(True)
15 | 'PerformLayout()
16 |
17 | End Sub
18 |
19 | Private Sub WrapControls()
20 | Controls.Add(New Community.Windows.FormsEx.PanelEx(ListBox1) With {.BorderColor = Color.Silver})
21 | End Sub
22 |
23 | Protected Overrides Sub OnLoad(e As EventArgs)
24 | MyBase.OnLoad(e)
25 | End Sub
26 |
27 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
28 |
29 | For x = 1 To 100
30 | ListBox1.Items.Add(x)
31 | Next
32 |
33 | End Sub
34 |
35 | End Class
36 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinForms/My Project/Application.Designer.HighDpi.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | 'This constant indicates whether the Application Framework is in use.
5 | #Const APPLICATION_FRAMEWORK = True
6 |
7 | #If APPLICATION_FRAMEWORK Then
8 |
9 | #If NET5_0 And Not NET6_0 Then
10 |
11 | Imports System.Collections.ObjectModel
12 |
13 | Namespace My
14 |
15 | Partial Friend Class MyApplication
16 |
17 | Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs)
18 |
19 | Private _highDpiMode As HighDpiMode?
20 |
21 | Friend Shadows Property HighDpiMode As HighDpiMode
22 | Get
23 | Return If(
24 | _highDpiMode Is Nothing,
25 | Application.HighDpiMode,
26 | _highDpiMode.Value)
27 | End Get
28 | Set(value As HighDpiMode)
29 | _highDpiMode = value
30 | End Set
31 | End Property
32 |
33 | ' IMPORTANT:
34 | ' If this method causes an compilation error after you've unchecked 'Application Framework'
35 | ' in the project properties, go to the top of this file and change the value to 'False' in this line:
36 | ' #Const APPLICATION_FRAMEWORK = False
37 |
38 | ' For more about using WinForms without the Application Framework
39 | ' see: https://aka.ms/visualbasic-appframework-net5
40 | Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean
41 | Dim eventArgs = New ApplyHighDpiModeEventArgs(
42 | If(
43 | _highDpiMode Is Nothing,
44 | HighDpiMode.SystemAware,
45 | _highDpiMode.Value))
46 |
47 | RaiseEvent ApplyHighDpiMode(Me, eventArgs)
48 |
49 | Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode)
50 |
51 | Return MyBase.OnInitialize(commandLineArgs)
52 | End Function
53 | End Class
54 |
55 | Public Class ApplyHighDpiModeEventArgs
56 | Inherits EventArgs
57 |
58 | Public Sub New(highDpiMode As HighDpiMode)
59 | Me.HighDpiMode = highDpiMode
60 | End Sub
61 |
62 | Public Property HighDpiMode As HighDpiMode
63 |
64 | End Class
65 |
66 | End Namespace
67 |
68 | #End If ' #If NET5_0 And Not NET6_0
69 | #End If ' #If APPLICATION_FRAMEWORK
70 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinForms/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.ReparentWinForms.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinForms/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinForms/ReparentWinForms.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | ReparentWinForms
7 | Sub Main
8 | true
9 | WindowsForms
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | UserControl
21 |
22 |
23 | True
24 | True
25 | Application.myapp
26 |
27 |
28 | UserControl
29 |
30 |
31 | UserControl
32 |
33 |
34 |
35 |
36 |
37 | MyApplicationCodeGenerator
38 | Application.Designer.vb
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinformsFx/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinformsFx/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Me.ListBox1 = New System.Windows.Forms.ListBox()
26 | Me.RichTextBox1 = New System.Windows.Forms.RichTextBox()
27 | Me.SuspendLayout()
28 | '
29 | 'ListBox1
30 | '
31 | Me.ListBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
32 | Me.ListBox1.FormattingEnabled = True
33 | Me.ListBox1.Location = New System.Drawing.Point(12, 12)
34 | Me.ListBox1.Name = "ListBox1"
35 | Me.ListBox1.Size = New System.Drawing.Size(212, 158)
36 | Me.ListBox1.TabIndex = 0
37 | '
38 | 'RichTextBox1
39 | '
40 | Me.RichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None
41 | Me.RichTextBox1.Location = New System.Drawing.Point(297, 13)
42 | Me.RichTextBox1.Name = "RichTextBox1"
43 | Me.RichTextBox1.Size = New System.Drawing.Size(301, 159)
44 | Me.RichTextBox1.TabIndex = 1
45 | Me.RichTextBox1.Text = ""
46 | '
47 | 'Form1
48 | '
49 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
50 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
51 | Me.ClientSize = New System.Drawing.Size(800, 450)
52 | Me.Controls.Add(Me.RichTextBox1)
53 | Me.Controls.Add(Me.ListBox1)
54 | Me.Name = "Form1"
55 | Me.Text = "Form1"
56 | Me.ResumeLayout(False)
57 |
58 | End Sub
59 |
60 | Friend WithEvents ListBox1 As ListBox
61 | Friend WithEvents RichTextBox1 As RichTextBox
62 | End Class
63 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinformsFx/Form1.vb:
--------------------------------------------------------------------------------
1 | Public Class Form1
2 |
3 | Sub New()
4 |
5 | ' This call is required by the designer.
6 | InitializeComponent()
7 |
8 | ' Add any initialization after the InitializeComponent() call.
9 |
10 | ResumeLayout(False)
11 |
12 | Controls.Remove(ListBox1)
13 | Controls.Add(New PanelEx(ListBox1) With {.BorderColor = Color.Pink})
14 |
15 | Controls.Remove(RichTextBox1)
16 | Controls.Add(New PanelEx(RichTextBox1) With {.BorderColor = Color.Pink})
17 |
18 | ResumeLayout(True)
19 | PerformLayout()
20 |
21 | End Sub
22 |
23 | End Class
24 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinformsFx/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.ReparentWinformsFx.Form1
36 | End Sub
37 | End Class
38 | End Namespace
39 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinformsFx/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | 0
10 | true
11 |
12 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinformsFx/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinformsFx/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My.Resources
16 |
17 | 'This class was auto-generated by the StronglyTypedResourceBuilder
18 | 'class via a tool like ResGen or Visual Studio.
19 | 'To add or remove a member, edit your .ResX file then rerun ResGen
20 | 'with the /str option, or rebuild your VS project.
21 | '''
22 | ''' A strongly-typed resource class, for looking up localized strings, etc.
23 | '''
24 | _
28 | Friend Module Resources
29 |
30 | Private resourceMan As Global.System.Resources.ResourceManager
31 |
32 | Private resourceCulture As Global.System.Globalization.CultureInfo
33 |
34 | '''
35 | ''' Returns the cached ResourceManager instance used by this class.
36 | '''
37 | _
38 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
39 | Get
40 | If Object.ReferenceEquals(resourceMan, Nothing) Then
41 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ReparentWinformsFx.Resources", GetType(Resources).Assembly)
42 | resourceMan = temp
43 | End If
44 | Return resourceMan
45 | End Get
46 | End Property
47 |
48 | '''
49 | ''' Overrides the current thread's CurrentUICulture property for all
50 | ''' resource lookups using this strongly typed resource class.
51 | '''
52 | _
53 | Friend Property Culture() As Global.System.Globalization.CultureInfo
54 | Get
55 | Return resourceCulture
56 | End Get
57 | Set(ByVal value As Global.System.Globalization.CultureInfo)
58 | resourceCulture = value
59 | End Set
60 | End Property
61 | End Module
62 | End Namespace
63 |
--------------------------------------------------------------------------------
/WinFormBugs/ReparentWinformsFx/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/WinForms/Browser/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application.
12 |
13 | ' Example:
14 |
15 | ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode
16 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
17 | ' End Sub
18 |
19 | Partial Friend Class MyApplication
20 |
21 | End Class
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/WinForms/Browser/Browser.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | Browser
7 | Sub Main
8 | true
9 | WindowsForms
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | True
25 | True
26 | Application.myapp
27 |
28 |
29 |
30 |
31 |
32 | MyApplicationCodeGenerator
33 | Application.Designer.vb
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/WinForms/Browser/My Project/Application.Designer.HighDpi.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | 'This constant indicates whether the Application Framework is in use.
5 | #Const APPLICATION_FRAMEWORK = True
6 |
7 | #If APPLICATION_FRAMEWORK Then
8 |
9 | #If NET5_0 And Not NET6_0 Then
10 |
11 | Imports System.Collections.ObjectModel
12 |
13 | Namespace My
14 |
15 | Partial Friend Class MyApplication
16 |
17 | Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs)
18 |
19 | Private _highDpiMode As HighDpiMode?
20 |
21 | Friend Shadows Property HighDpiMode As HighDpiMode
22 | Get
23 | Return If(
24 | _highDpiMode Is Nothing,
25 | Application.HighDpiMode,
26 | _highDpiMode.Value)
27 | End Get
28 | Set(value As HighDpiMode)
29 | _highDpiMode = value
30 | End Set
31 | End Property
32 |
33 | ' IMPORTANT:
34 | ' If this method causes an compilation error after you've unchecked 'Application Framework'
35 | ' in the project properties, go to the top of this file and change the value to 'False' in this line:
36 | ' #Const APPLICATION_FRAMEWORK = False
37 |
38 | ' For more about using WinForms without the Application Framework
39 | ' see: https://aka.ms/visualbasic-appframework-net5
40 | Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean
41 | Dim eventArgs = New ApplyHighDpiModeEventArgs(
42 | If(
43 | _highDpiMode Is Nothing,
44 | HighDpiMode.SystemAware,
45 | _highDpiMode.Value))
46 |
47 | RaiseEvent ApplyHighDpiMode(Me, eventArgs)
48 |
49 | Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode)
50 |
51 | Return MyBase.OnInitialize(commandLineArgs)
52 | End Function
53 | End Class
54 |
55 | Public Class ApplyHighDpiModeEventArgs
56 | Inherits EventArgs
57 |
58 | Public Sub New(highDpiMode As HighDpiMode)
59 | Me.HighDpiMode = highDpiMode
60 | End Sub
61 |
62 | Public Property HighDpiMode As HighDpiMode
63 |
64 | End Class
65 |
66 | End Namespace
67 |
68 | #End If ' #If NET5_0 And Not NET6_0
69 | #End If ' #If APPLICATION_FRAMEWORK
70 |
--------------------------------------------------------------------------------
/WinForms/Browser/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.Browser.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/WinForms/Browser/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/WinForms/BrowserFx/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WinForms/BrowserFx/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.BrowserFx.Form1
36 | End Sub
37 | End Class
38 | End Namespace
39 |
--------------------------------------------------------------------------------
/WinForms/BrowserFx/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | 0
10 | true
11 |
12 |
--------------------------------------------------------------------------------
/WinForms/BrowserFx/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/WinForms/BrowserFx/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My.Resources
16 |
17 | 'This class was auto-generated by the StronglyTypedResourceBuilder
18 | 'class via a tool like ResGen or Visual Studio.
19 | 'To add or remove a member, edit your .ResX file then rerun ResGen
20 | 'with the /str option, or rebuild your VS project.
21 | '''
22 | ''' A strongly-typed resource class, for looking up localized strings, etc.
23 | '''
24 | _
28 | Friend Module Resources
29 |
30 | Private resourceMan As Global.System.Resources.ResourceManager
31 |
32 | Private resourceCulture As Global.System.Globalization.CultureInfo
33 |
34 | '''
35 | ''' Returns the cached ResourceManager instance used by this class.
36 | '''
37 | _
38 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
39 | Get
40 | If Object.ReferenceEquals(resourceMan, Nothing) Then
41 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("BrowserFx.Resources", GetType(Resources).Assembly)
42 | resourceMan = temp
43 | End If
44 | Return resourceMan
45 | End Get
46 | End Property
47 |
48 | '''
49 | ''' Overrides the current thread's CurrentUICulture property for all
50 | ''' resource lookups using this strongly typed resource class.
51 | '''
52 | _
53 | Friend Property Culture() As Global.System.Globalization.CultureInfo
54 | Get
55 | Return resourceCulture
56 | End Get
57 | Set(ByVal value As Global.System.Globalization.CultureInfo)
58 | resourceCulture = value
59 | End Set
60 | End Property
61 | End Module
62 | End Namespace
63 |
--------------------------------------------------------------------------------
/WinForms/BrowserFx/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/WinForms/BrowserFx/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/WinForms/Webcam/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application.
12 |
13 | ' Example:
14 | ' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults
15 | '
16 | ' ' Setting the application-wide default Font:
17 | ' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular)
18 | '
19 | ' ' Setting the HighDpiMode for the Application:
20 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
21 | '
22 | ' ' If a splash dialog is used, this sets the minimum display time:
23 | ' e.MinimumSplashScreenDisplayTime = 4000
24 | ' End Sub
25 |
26 | Partial Friend Class MyApplication
27 |
28 | End Class
29 | End Namespace
30 |
--------------------------------------------------------------------------------
/WinForms/Webcam/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 |
24 | Private Sub InitializeComponent()
25 | Button1 = New Button()
26 | PictureBox1 = New PictureBox()
27 | CType(PictureBox1, ComponentModel.ISupportInitialize).BeginInit()
28 | SuspendLayout()
29 | '
30 | ' Button1
31 | '
32 | Button1.Location = New Point(29, 19)
33 | Button1.Margin = New Padding(1, 1, 1, 1)
34 | Button1.Name = "Button1"
35 | Button1.Size = New Size(79, 22)
36 | Button1.TabIndex = 0
37 | Button1.Text = "Button1"
38 | Button1.UseVisualStyleBackColor = True
39 | '
40 | ' PictureBox1
41 | '
42 | PictureBox1.Dock = DockStyle.Fill
43 | PictureBox1.Location = New Point(0, 0)
44 | PictureBox1.Margin = New Padding(1, 1, 1, 1)
45 | PictureBox1.Name = "PictureBox1"
46 | PictureBox1.Size = New Size(933, 444)
47 | PictureBox1.TabIndex = 1
48 | PictureBox1.TabStop = False
49 | '
50 | ' Form1
51 | '
52 | AutoScaleDimensions = New SizeF(7F, 15F)
53 | AutoScaleMode = AutoScaleMode.Font
54 | ClientSize = New Size(933, 444)
55 | Controls.Add(Button1)
56 | Controls.Add(PictureBox1)
57 | Margin = New Padding(4, 3, 4, 3)
58 | Name = "Form1"
59 | Text = "Webcam Example"
60 | CType(PictureBox1, ComponentModel.ISupportInitialize).EndInit()
61 | ResumeLayout(False)
62 | End Sub
63 |
64 | Friend WithEvents Button1 As Button
65 | Friend WithEvents PictureBox1 As PictureBox
66 | End Class
67 |
--------------------------------------------------------------------------------
/WinForms/Webcam/Form1.vb:
--------------------------------------------------------------------------------
1 | Imports OpenCvSharp
2 |
3 | Public Class Form1
4 |
5 | Private ReadOnly m_capture As VideoCapture
6 | Private ReadOnly m_frame As Mat
7 | Private m_image As Bitmap
8 |
9 | Sub New()
10 |
11 | ' This call is required by the designer.
12 | InitializeComponent()
13 |
14 | ' Add any initialization after the InitializeComponent() call.
15 | m_frame = New Mat()
16 | m_capture = New VideoCapture(0)
17 | m_capture.Open(0)
18 |
19 | End Sub
20 |
21 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
22 |
23 | End Sub
24 |
25 | Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
26 |
27 | If (m_capture.IsOpened()) Then
28 | m_capture.Read(m_frame)
29 | 'm_image = BitmapConverter.ToBitmap(m_frame)
30 | m_image = MatToBitmap(m_frame)
31 | PictureBox1.Image?.Dispose()
32 | PictureBox1.Image = m_image
33 | End If
34 | End Sub
35 |
36 | Private Shared Function MatToBitmap(mat As Mat) As Bitmap
37 | Using ms = mat.ToMemoryStream()
38 | Return Image.FromStream(ms)
39 | End Using
40 | End Function
41 |
42 | End Class
43 |
--------------------------------------------------------------------------------
/WinForms/Webcam/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.Webcam.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/WinForms/Webcam/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/WinForms/Webcam/Webcam.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | Sub Main
7 | true
8 | WindowsForms
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | True
25 | True
26 | Application.myapp
27 |
28 |
29 |
30 |
31 |
32 | MyApplicationCodeGenerator
33 | Application.Designer.vb
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/WinFormsApp1/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application.
12 |
13 | ' Example:
14 |
15 | ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode
16 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
17 | ' End Sub
18 |
19 | Partial Friend Class MyApplication
20 |
21 | End Class
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/WinFormsApp1/Community.Windows.FormsEx/ArrowDirections.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Namespace Global.Community.Windows.FormsEx
6 |
7 | Friend Enum ArrowDirections
8 | Left
9 | Up
10 | Right
11 | Down
12 | End Enum
13 |
14 | End Namespace
--------------------------------------------------------------------------------
/WinFormsApp1/Community.Windows.FormsEx/DarkMode.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Imports System.Runtime.InteropServices
6 |
7 | Namespace Global.Community.Windows.FormsEx
8 |
9 | Public NotInheritable Class DarkMode
10 |
11 | Private Sub New()
12 | End Sub
13 |
14 |
15 | Private Shared Function DwmSetWindowAttribute(hwnd As IntPtr, attr As Integer, ByRef attrValue As Integer, attrSize As Integer) As Integer
16 | End Function
17 |
18 | Private Const DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 As Integer = 19
19 | Private Const DWMWA_USE_IMMERSIVE_DARK_MODE As Integer = 20
20 |
21 | Public Shared Function IsWindows10(Optional build As Integer = -1) As Boolean
22 | Dim windowsMajor = Environment.OSVersion.Version.Major
23 | Dim windowsBuild = Environment.OSVersion.Version.Build
24 | Return windowsMajor >= 10 AndAlso windowsBuild >= build
25 | End Function
26 |
27 | Public Shared Function ToggleImmersiveDarkMode(handle As IntPtr, enabled As Boolean) As Boolean
28 | If RuntimeInformation.IsOSPlatform(OSPlatform.Windows) Then
29 | If IsWindows10(17763) Then
30 | Dim attribute = DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1
31 | If IsWindows10(18985) Then
32 | attribute = DWMWA_USE_IMMERSIVE_DARK_MODE
33 | End If
34 | Dim useImmersiveDarkMode = If(enabled, 1, 0)
35 | Return DwmSetWindowAttribute(handle, attribute, useImmersiveDarkMode, 4) = 0
36 | End If
37 | End If
38 | Return False
39 | End Function
40 |
41 | End Class
42 |
43 | End Namespace
--------------------------------------------------------------------------------
/WinFormsApp1/Community.Windows.FormsEx/ScrollBarDarkMode.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Strict On
3 | Option Infer On
4 |
5 | Namespace Global.Community.Windows.FormsEx
6 |
7 | '''
8 | ''' Themed color, could be in properties...
9 | '''
10 | '''
11 | Friend Class ScrollBarDarkMode
12 | Public Shared ReadOnly Background As Color = Color.FromArgb(50, 50, 50)
13 | Public Shared ReadOnly Border As Color = Color.FromArgb(50, 50, 50)
14 | Public Shared ReadOnly Thumb As Color = Color.FromArgb(120, 120, 120)
15 | Public Shared ReadOnly ThumbHover As Color = Color.FromArgb(160, 160, 160)
16 | End Class
17 |
18 | End Namespace
--------------------------------------------------------------------------------
/WinFormsApp1/Community.Windows.FormsEx/ToolStripComboBoxEx.vb:
--------------------------------------------------------------------------------
1 | Option Explicit On
2 | Option Infer On
3 | Option Strict On
4 |
5 | Namespace Global.Community.Windows.FormsEx
6 |
7 | Public Class ToolStripComboBoxEx
8 | Inherits ToolStripControlHost
9 |
10 | Public Sub New()
11 | MyBase.New(New ComboBoxEx With {.BorderDrawMode = ComboBoxEx.ControlBorderDrawMode.InternalFaded, .FlatStyle = FlatStyle.Flat})
12 | End Sub
13 |
14 | End Class
15 |
16 | End Namespace
--------------------------------------------------------------------------------
/WinFormsApp1/My Project/Application.Designer.HighDpi.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | 'This constant indicates whether the Application Framework is in use.
5 | #Const APPLICATION_FRAMEWORK = True
6 |
7 | #If APPLICATION_FRAMEWORK Then
8 |
9 | #If NET5_0 And Not NET6_0 Then
10 |
11 | Imports System.Collections.ObjectModel
12 |
13 | Namespace My
14 |
15 | Partial Friend Class MyApplication
16 |
17 | Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs)
18 |
19 | Private _highDpiMode As HighDpiMode?
20 |
21 | Friend Shadows Property HighDpiMode As HighDpiMode
22 | Get
23 | Return If(
24 | _highDpiMode Is Nothing,
25 | Application.HighDpiMode,
26 | _highDpiMode.Value)
27 | End Get
28 | Set(value As HighDpiMode)
29 | _highDpiMode = value
30 | End Set
31 | End Property
32 |
33 | ' IMPORTANT:
34 | ' If this method causes an compilation error after you've unchecked 'Application Framework'
35 | ' in the project properties, go to the top of this file and change the value to 'False' in this line:
36 | ' #Const APPLICATION_FRAMEWORK = False
37 |
38 | ' For more about using WinForms without the Application Framework
39 | ' see: https://aka.ms/visualbasic-appframework-net5
40 | Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean
41 | Dim eventArgs = New ApplyHighDpiModeEventArgs(
42 | If(
43 | _highDpiMode Is Nothing,
44 | HighDpiMode.SystemAware,
45 | _highDpiMode.Value))
46 |
47 | RaiseEvent ApplyHighDpiMode(Me, eventArgs)
48 |
49 | Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode)
50 |
51 | Return MyBase.OnInitialize(commandLineArgs)
52 | End Function
53 | End Class
54 |
55 | Public Class ApplyHighDpiModeEventArgs
56 | Inherits EventArgs
57 |
58 | Public Sub New(highDpiMode As HighDpiMode)
59 | Me.HighDpiMode = highDpiMode
60 | End Sub
61 |
62 | Public Property HighDpiMode As HighDpiMode
63 |
64 | End Class
65 |
66 | End Namespace
67 |
68 | #End If ' #If NET5_0 And Not NET6_0
69 | #End If ' #If APPLICATION_FRAMEWORK
70 |
--------------------------------------------------------------------------------
/WinFormsApp1/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.WinFormsApp1.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/WinFormsApp1/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/WinFormsApp1/WinFormsApp1.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | WinFormsApp1
7 | Sub Main
8 | true
9 | WindowsForms
10 |
11 |
12 |
13 | x86
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | True
29 | True
30 | Application.myapp
31 |
32 |
33 |
34 |
35 |
36 | MyApplicationCodeGenerator
37 | Application.Designer.vb
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/WinFormsApp_dotNet6/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 | Imports Microsoft.VisualBasic.ApplicationServices
2 |
3 | Namespace My
4 | ' The following events are available for MyApplication:
5 | ' Startup: Raised when the application starts, before the startup form is created.
6 | ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7 | ' UnhandledException: Raised if the application encounters an unhandled exception.
8 | ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9 | ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10 |
11 | ' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application.
12 |
13 | ' Example:
14 | ' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults
15 | '
16 | ' ' Setting the application-wide default Font:
17 | ' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular)
18 | '
19 | ' ' Setting the HighDpiMode for the Application:
20 | ' e.HighDpiMode = HighDpiMode.PerMonitorV2
21 | '
22 | ' ' If a splash dialog is used, this sets the minimum display time:
23 | ' e.MinimumSplashScreenDisplayTime = 4000
24 | ' End Sub
25 |
26 | Partial Friend Class MyApplication
27 |
28 | End Class
29 | End Namespace
30 |
--------------------------------------------------------------------------------
/WinFormsApp_dotNet6/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 |
24 | Private Sub InitializeComponent()
25 | components = New System.ComponentModel.Container()
26 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
27 | Me.ClientSize = New System.Drawing.Size(800, 450)
28 | Me.Text = "Form1"
29 | End Sub
30 |
31 | End Class
32 |
--------------------------------------------------------------------------------
/WinFormsApp_dotNet6/Form1.vb:
--------------------------------------------------------------------------------
1 | Public Class Form1
2 |
3 | End Class
4 |
--------------------------------------------------------------------------------
/WinFormsApp_dotNet6/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | Me.HighDpiMode = HighDpiMode.DpiUnaware
32 | End Sub
33 |
34 | _
35 | Protected Overrides Sub OnCreateMainForm()
36 | Me.MainForm = Global.WinFormsApp_dotNet6.Form1
37 | End Sub
38 | End Class
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/WinFormsApp_dotNet6/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/WinFormsApp_dotNet6/WinFormsApp_dotNet6.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | Sub Main
7 | true
8 | WindowsForms
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | True
20 | True
21 | Application.myapp
22 |
23 |
24 |
25 |
26 |
27 | MyApplicationCodeGenerator
28 | Application.Designer.vb
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------