X Tutup
Skip to content

Commit aabe781

Browse files
committed
sVB 3.5.5 and Sahla-En 1.0.4
1 parent 36db84b commit aabe781

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+8254
-582
lines changed

SBCompiler/SBCompiler/CodeGenerator.vb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ Namespace Microsoft.SmallVisualBasic
110110
))
111111

112112
Dim info = ProgramInfo.GetProperties(
113-
IO.Path.Combine(IO.Path.GetDirectoryName(_directory), "app.json")
113+
IO.Path.Combine(IO.Path.GetDirectoryName(_directory), "app.json"),
114+
_outputName
114115
)
115116

116117
asm.SetCustomAttribute(New CustomAttributeBuilder(

SBCompiler/SBCompiler/NativeResourceUpdater.vb

Lines changed: 208 additions & 206 deletions
Large diffs are not rendered by default.

SBCompiler/SBCompiler/ProgramInfo.vb

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,45 @@
22
Imports System.Runtime.Serialization
33
Imports System.Runtime.Serialization.Json
44

5-
<DataContract>
6-
Public Class ProgramInfo
7-
<DataMember> Public Property Title As String = "My App"
8-
<DataMember> Public Property Description As String = "This app is created by Small Visual Basic."
9-
<DataMember> Public Property Company As String = "Modern VB"
10-
<DataMember> Public Property Product As String = "My App"
11-
<DataMember> Public Property Copyright As String = "Copyright @" & Now.Year
12-
<DataMember> Public Property Trademark As String
13-
<DataMember> Public Property Version As String = "1.0.0.0"
5+
Namespace Microsoft.SmallVisualBasic
6+
<DataContract> Public Class ProgramInfo
7+
<DataMember> Public Property Title As String = "My App"
8+
<DataMember> Public Property Description As String = "This app is created by Small Visual Basic."
9+
<DataMember> Public Property Company As String = "Modern VB"
10+
<DataMember> Public Property Product As String = "My App"
11+
<DataMember> Public Property Copyright As String = "Copyright @" & Now.Year
12+
<DataMember> Public Property Trademark As String = ""
13+
<DataMember> Public Property Version As String = "1.0.0.0"
1414

15-
Public Shared Function GetProperties(filePath As String) As ProgramInfo
16-
If File.Exists(filePath) Then
17-
Try
18-
Dim serializer As New DataContractJsonSerializer(GetType(ProgramInfo))
19-
Using fs As New FileStream(filePath, FileMode.Open, FileAccess.Read)
20-
Return CType(serializer.ReadObject(fs), ProgramInfo)
15+
Public Shared Function GetProperties(filePath As String, appName As String) As ProgramInfo
16+
If File.Exists(filePath) Then
17+
Try
18+
Using fs As New FileStream(filePath, FileMode.Open, FileAccess.Read)
19+
Dim serializer As New DataContractJsonSerializer(GetType(ProgramInfo))
20+
Return CType(serializer.ReadObject(fs), ProgramInfo)
21+
End Using
22+
Catch ex As Exception
23+
End Try
24+
25+
Else
26+
Dim info As New ProgramInfo() With {.Product = appName, .Title = appName}
27+
' Writting the Json file manually to apply formatting
28+
Using writer As New System.IO.StreamWriter(filePath, False)
29+
writer.WriteLine("{")
30+
writer.WriteLine(" ""Title"": """ & info.Title & """,")
31+
writer.WriteLine(" ""Description"": """ & info.Description & """,")
32+
writer.WriteLine(" ""Company"": """ & info.Company & """,")
33+
writer.WriteLine(" ""Product"": """ & info.Product & """,")
34+
writer.WriteLine(" ""Copyright"": """ & info.Copyright & """,")
35+
writer.WriteLine(" ""Trademark"": """ & info.Trademark & """,")
36+
writer.WriteLine(" ""Version"": """ & info.Version & """")
37+
writer.WriteLine("}")
2138
End Using
22-
Catch ex As Exception
23-
End Try
24-
End If
39+
Return info
40+
End If
2541

26-
Return New ProgramInfo
27-
End Function
28-
End Class
42+
Return New ProgramInfo() With {.Product = appName, .Title = appName}
43+
End Function
44+
End Class
2945

46+
End Namespace
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Me.Icon = "s.ico"
2+
LblMhmd.Text = ""
3+
LblMhmd.Append("Copyrights @")
4+
LblMhmd.AppendLink("Eng. M. Hamdy", "www.github.com/VBAndCs")
5+
X = LblSVB.Text
6+
LblSVB.Text = ""
7+
LblSVB.AppendBoldLink(X, "https://marketplace.visualstudio.com/items?itemName=ModernVBNET.sVBInstaller")
8+
9+
X = LblKP.Text
10+
LblKP.Text = ""
11+
LblKP.AppendBoldLink(X, "https://www.amazon.com/dp/B0DNX2ZR4D")
12+
13+
X = LblSamples.Text
14+
LblSamples.Text = ""
15+
LblSamples.AppendBoldLink(X, "%USERPROFILE%\Documents\Sahla-En Samples")
16+
17+
18+
Sub Form_OnKeyDown()
19+
If Event.LastKey = Keys.Escape Then
20+
Me.Close()
21+
EndIf
22+
EndSub
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
'@Form Hints:
2+
'#FrmAbout{
3+
' Label1: Label
4+
' Label3: Label
5+
' Label4: Label
6+
' LblMhmd: Label
7+
' Label6: Label
8+
' Label7: Label
9+
' Label9: Label
10+
' LblSamples: Label
11+
' LblKP: Label
12+
' LblSVB: Label
13+
' Label10: Label
14+
'}
15+
16+
Me = "frmabout"
17+
Label1 = "frmabout.label1"
18+
Label3 = "frmabout.label3"
19+
Label4 = "frmabout.label4"
20+
LblMhmd = "frmabout.lblmhmd"
21+
Label6 = "frmabout.label6"
22+
Label7 = "frmabout.label7"
23+
Label9 = "frmabout.label9"
24+
LblSamples = "frmabout.lblsamples"
25+
LblKP = "frmabout.lblkp"
26+
LblSVB = "frmabout.lblsvb"
27+
Label10 = "frmabout.label10"
28+
_path = Program.Directory + "\frmabout.xaml"
29+
FrmAbout = Forms.LoadForm("FrmAbout", _path)
30+
Form.SetArgsArr(frmabout, Stack.PopValue("_frmabout_argsArr"))
31+
'#Events{
32+
' FrmAbout: OnKeyDown
33+
'}
34+
35+
' FrmAbout Events:
36+
Control.HandleEvents(FrmAbout)
37+
Control.OnKeyDown = Form_OnKeyDown
38+
39+
40+
Form.Show(Me)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Canvas Background="#FFFEF4D5" Name="FrmAbout" Width="922.992125984255" Height="568.031496062992" FlowDirection="LeftToRight" AutomationProperties.HelpText="About Sahla" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib"><Canvas.Tag><s:Boolean>False</s:Boolean></Canvas.Tag><Label Width="279.370078740157" MinWidth="0" MaxWidth="Infinity" Height="268.031496062992" MinHeight="0" MaxHeight="Infinity" Visibility="Visible" IsEnabled="True" Canvas.Left="317.48031496063" Canvas.Top="177.637795275591" AutomationProperties.Name="Label1"><Label.Background><ImageBrush ImageSource="\Prpgrammer.png" /></Label.Background><TextBlock TextWrapping="Wrap" /></Label><Label Foreground="#FF0000FF" FontSize="25" FontWeight="Bold" Width="238.110236220473" MinWidth="0" MaxWidth="Infinity" Height="49.1338582677166" MinHeight="0" MaxHeight="Infinity" Visibility="Visible" IsEnabled="True" Canvas.Left="343.937007874016" Canvas.Top="113.385826771654" AutomationProperties.Name="Label3"><TextBlock Text="A Very Small Basic Programming Langauge" TextWrapping="Wrap" /></Label><Label Foreground="#FF690303" FontSize="19" FontWeight="Bold" Width="298.582677165354" MinWidth="0" MaxWidth="Infinity" Height="396.850393700788" MinHeight="0" MaxHeight="Infinity" FlowDirection="LeftToRight" Visibility="Visible" IsEnabled="True" Canvas.Left="11.3385826771654" Canvas.Top="166.299212598425" AutomationProperties.Name="Label4"><TextBlock Text="Sahla, can simplify coding for children. Currently, it has an Arabic and English dialects, but it is easy to create more dialects, allowing kids to program in their native tongue starting at age of 6, and following this gradual learning path to professionalism: &#xA;Native Sahla → &#xA;English Sahla → &#xA;Small Basic → &#xA;Small Visual Basic → &#xA;Visual Basic .NET → &#xA;C#.&#xA;" TextWrapping="Wrap" /></Label><Label Foreground="#FF0000FF" FontSize="20" FontWeight="Bold" Name="LblMhmd" Width="287.244094488188" MinWidth="0" MaxWidth="Infinity" Height="41.5748031496063" MinHeight="0" MaxHeight="Infinity" Visibility="Visible" IsEnabled="True" Canvas.Left="317.48031496063" Canvas.Top="453.543307086614" AutomationProperties.Name="LblMhmd"><TextBlock Text="Copyrights @Eng. M. Hamdy" TextWrapping="Wrap" /></Label><Label FontSize="18" FontWeight="Bold" Width="169.329160104987" MinWidth="0" MaxWidth="Infinity" Height="38.8390551181102" MinHeight="0" MaxHeight="Infinity" FlowDirection="LeftToRight" Visibility="Visible" IsEnabled="True" Canvas.Left="377.952755905512" Canvas.Top="487.55905511811" AutomationProperties.Name="Label6"><TextBlock Text="Developed using:" TextWrapping="Wrap" /></Label><Label FontFamily="Trebuchet MS" FontSize="26" FontStretch="Normal" FontStyle="Normal" FontWeight="Normal" Width="230.551181102362" MinWidth="0" MaxWidth="Infinity" Height="37.7952755905512" MinHeight="0" MaxHeight="Infinity" Visibility="Visible" IsEnabled="True" Canvas.Left="351.496062992126" Canvas.Top="517.795275590551" Typography.StandardLigatures="True" Typography.ContextualLigatures="True" Typography.DiscretionaryLigatures="False" Typography.HistoricalLigatures="False" Typography.AnnotationAlternates="0" Typography.ContextualAlternates="True" Typography.HistoricalForms="False" Typography.Kerning="True" Typography.CapitalSpacing="False" Typography.CaseSensitiveForms="False" Typography.StylisticSet1="False" Typography.StylisticSet2="False" Typography.StylisticSet3="False" Typography.StylisticSet4="False" Typography.StylisticSet5="False" Typography.StylisticSet6="False" Typography.StylisticSet7="False" Typography.StylisticSet8="False" Typography.StylisticSet9="False" Typography.StylisticSet10="False" Typography.StylisticSet11="False" Typography.StylisticSet12="False" Typography.StylisticSet13="False" Typography.StylisticSet14="False" Typography.StylisticSet15="False" Typography.StylisticSet16="False" Typography.StylisticSet17="False" Typography.StylisticSet18="False" Typography.StylisticSet19="False" Typography.StylisticSet20="False" Typography.Fraction="Normal" Typography.SlashedZero="False" Typography.MathematicalGreek="False" Typography.EastAsianExpertForms="False" Typography.Variants="Normal" Typography.Capitals="Normal" Typography.NumeralStyle="Normal" Typography.NumeralAlignment="Normal" Typography.EastAsianWidths="Normal" Typography.EastAsianLanguage="Normal" Typography.StandardSwashes="0" Typography.ContextualSwashes="0" Typography.StylisticAlternates="0" AutomationProperties.Name="Label7"><Label.Foreground><LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" ColorInterpolationMode="SRgbLinearInterpolation" SpreadMethod="Pad" Opacity="1"><LinearGradientBrush.GradientStops><GradientStop Color="#FF000000" Offset="0" /><GradientStop Color="#FFFF0000" Offset="1" /><GradientStop Color="#FF07FF07" Offset="0.49391450700494044" /></LinearGradientBrush.GradientStops><LinearGradientBrush.RelativeTransform><TransformGroup><TransformGroup.Children><RotateTransform Angle="-90" CenterX="0.5" CenterY="0.5" /></TransformGroup.Children></TransformGroup></LinearGradientBrush.RelativeTransform></LinearGradientBrush></Label.Foreground><TextBlock Text="Small Visual Basic" TextWrapping="Wrap" /></Label><Label Width="308" MinWidth="18.8976377952756" MaxWidth="Infinity" Height="100" MinHeight="18.8976377952756" MaxHeight="Infinity" Visibility="Visible" IsEnabled="True" Canvas.Left="302.362204724409" Canvas.Top="7.55905511811024" Panel.ZIndex="-1" AutomationProperties.Name="Label9"><Label.Background><ImageBrush ImageSource="\Sahla.jpg" /></Label.Background><TextBlock TextWrapping="Wrap" /></Label><Label FontSize="21" FontWeight="Bold" Name="LblSamples" Width="192.755905511811" MinWidth="18.8976377952756" MaxWidth="Infinity" Height="37.7952755905512" MinHeight="18.8976377952756" MaxHeight="Infinity" Visibility="Visible" IsEnabled="True" Canvas.Left="672.755905511811" Canvas.Top="260.787401574803" AutomationProperties.Name="LblSamples"><TextBlock Text="Samples Folder" TextWrapping="Wrap" /></Label><Label FontSize="21" FontWeight="Bold" Name="LblKP" Width="306.141732283465" MinWidth="18.8976377952756" MaxWidth="Infinity" Height="37.7952755905512" MinHeight="18.8976377952756" MaxHeight="Infinity" Visibility="Visible" IsEnabled="True" Canvas.Left="616.062992125984" Canvas.Top="389.244923331952" AutomationProperties.Name="LblKP"><TextBlock Text="Kid Programmr - Book Series" TextWrapping="Wrap" /></Label><Label FontSize="21" FontWeight="Bold" Name="LblSVB" Width="283.464566929134" MinWidth="18.8976377952756" MaxWidth="Infinity" Height="41.5748031496063" MinHeight="18.8976377952756" MaxHeight="Infinity" FlowDirection="LeftToRight" Visibility="Visible" IsEnabled="True" Canvas.Left="631.181102362205" Canvas.Top="325.03937007874" AutomationProperties.Name="LblSVB"><TextBlock Text="Small Visual Basic Installer" TextWrapping="Wrap" /></Label><Label Foreground="#FFFF0000" FontSize="26" FontStyle="Normal" FontWeight="Bold" Name="Label10" Width="151.181102362205" MinWidth="18.8976377952756" MaxWidth="Infinity" Height="49.1338582677165" MinHeight="18.8976377952756" MaxHeight="Infinity" FlowDirection="LeftToRight" Visibility="Visible" IsEnabled="True" Canvas.Left="680.314960629921" Canvas.Top="188.976377952756" AutomationProperties.Name="Label10"><TextBlock Text="Resources:" TextWrapping="Wrap"><TextBlock.TextDecorations><TextDecoration Location="Underline" /></TextBlock.TextDecorations></TextBlock></Label><Control Name="__FORM__PROPS__" Tag="{x:Null}" MinWidth="0" MaxWidth="Infinity" MinHeight="0" MaxHeight="Infinity" ToolTip="{x:Null}" Canvas.Left="Auto" Canvas.Top="Auto" /></Canvas>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Me.Icon = "s.ico"
2+
EditorTextBox = Me.ArgsArr
3+
RdoDown.Checked = True
4+
TxtFind.Text = Text.Trim(EditorTextBox.SelectedText)
5+
6+
Sub BtnFind_OnClick()
7+
Find()
8+
EndSub
9+
10+
Sub BtnReplace_OnClick()
11+
Replace()
12+
EndSub
13+
14+
Function Find()
15+
_text = EditorTextBox.Text
16+
_find = TxtFind.Text
17+
18+
If ChkCase.Checked = False Then
19+
_text = _text.LowerCase
20+
_find = _find.LowerCase
21+
EndIf
22+
23+
goBack = RdoUp.Checked
24+
pos = EditorTextBox.SelectionStart
25+
If goBack = False Then
26+
pos = pos + EditorTextBox.SelectionLength
27+
EndIf
28+
29+
While True
30+
pos = _text.GetIndexOf(_find, pos, goBack)
31+
32+
If pos = 0 Then
33+
Sound.PlayBellRing()
34+
Return False
35+
36+
ElseIf ChkWord.Checked Then
37+
nextPos = pos + _find.Length
38+
prevChar = _text[pos - 1]
39+
nextChar = _text[nextPos]
40+
41+
If Chars.IsDigit(prevChar) Or
42+
Chars.IsDigit(nextChar) Or
43+
Chars.IsLetter(prevChar) Or
44+
Chars.IsLetter(nextChar) Then
45+
46+
If goBack Then
47+
pos = pos - 1
48+
Else
49+
pos = nextPos
50+
EndIf
51+
52+
ContinueLoop
53+
EndIf
54+
EndIf
55+
56+
ExitLoop
57+
Wend
58+
59+
EditorTextBox.Select(pos, _find.Length)
60+
EditorTextBox.Focus()
61+
62+
Return True
63+
EndFunction
64+
65+
Function Replace()
66+
If EditorTextBox.SelectionLength = 0 Then
67+
If Find() = False Then
68+
Sound.PlayBellRing()
69+
Return False
70+
EndIf
71+
EndIf
72+
73+
74+
_text = EditorTextBox.SelectedText
75+
_find = TxtFind.Text
76+
77+
If ChkCase.Checked = False Then
78+
_text = _text.LowerCase
79+
_find = _find.LowerCase
80+
EndIf
81+
82+
If _text = _find Then
83+
EditorTextBox.SelectedText = TxtReplace.Text
84+
Return True
85+
Else
86+
EditorTextBox.SelectionLength = 0
87+
Return Replace()
88+
EndIf
89+
EndFunction
90+
91+
Sub BtnReplaceAll_OnClick()
92+
While Replace()
93+
Wend
94+
EndSub
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
'@Form Hints:
2+
'#FrmFind{
3+
' Label1: Label
4+
' TxtFind: TextBox
5+
' RdoUp: RadioButton
6+
' RdoDown: RadioButton
7+
' BtnFind: Button
8+
' BtnReplace: Button
9+
' ChkWord: CheckBox
10+
' ChkCase: CheckBox
11+
' TxtReplace: TextBox
12+
' Label2: Label
13+
' BtnReplaceAll: Button
14+
'}
15+
16+
Me = "frmfind"
17+
Label1 = "frmfind.label1"
18+
TxtFind = "frmfind.txtfind"
19+
RdoUp = "frmfind.rdoup"
20+
RdoDown = "frmfind.rdodown"
21+
BtnFind = "frmfind.btnfind"
22+
BtnReplace = "frmfind.btnreplace"
23+
ChkWord = "frmfind.chkword"
24+
ChkCase = "frmfind.chkcase"
25+
TxtReplace = "frmfind.txtreplace"
26+
Label2 = "frmfind.label2"
27+
BtnReplaceAll = "frmfind.btnreplaceall"
28+
_path = Program.Directory + "\FrmFind.xaml"
29+
FrmFind = Forms.LoadForm("FrmFind", _path)
30+
Form.SetArgsArr(frmfind, Stack.PopValue("_frmfind_argsArr"))
31+
'#Events{
32+
' BtnFind: OnClick
33+
' BtnReplace: OnClick
34+
' BtnReplaceAll: OnClick
35+
'}
36+
37+
' BtnFind Events:
38+
Control.HandleEvents(BtnFind)
39+
Control.OnClick = BtnFind_OnClick
40+
41+
' BtnReplace Events:
42+
Control.HandleEvents(BtnReplace)
43+
Control.OnClick = BtnReplace_OnClick
44+
45+
' BtnReplaceAll Events:
46+
Control.HandleEvents(BtnReplaceAll)
47+
Control.OnClick = BtnReplaceAll_OnClick
48+
49+
50+
Form.Show(Me)

Samples/Sahla Programming Language/Sahla-En/FrmFind.xaml

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
Me.Icon = "s.ico"
2+
CmbFont.AddItem(Global.FontNames)
3+
CmbSize.AddItem({
4+
8, 9, 10, 11, 12,
5+
14, 16, 18, 20, 22, 24, 26, 28,
6+
32, 36, 40, 44, 48, 56, 64, 72
7+
})
8+
9+
Ops = Global.Ops
10+
CmbFont.Text = Ops!FontName
11+
CmbSize.Text = Ops!FontSize
12+
ChkBold.Checked = Ops!Bold
13+
ChkItalic.Checked = Ops!Italic
14+
ChkUnderlined.Checked = Ops!Underlined
15+
LblForeColor.BackColor = Ops!ForeColor
16+
LblBackColor.BackColor = Ops!BackColor
17+
18+
Sub LblBackColor_OnClick()
19+
LblBackColor.ChooseBackColor()
20+
TxtPreview.BackColor = LblBackColor.BackColor
21+
EndSub
22+
23+
Sub LblForeColor_OnClick()
24+
LblForeColor.ChooseBackColor()
25+
TxtPreview.ForeColor = LblForeColor.BackColor
26+
EndSub
27+
28+
Sub ChkBold_OnCheck()
29+
TxtPreview.FontBold = ChkBold.Checked
30+
EndSub
31+
32+
Sub ChkItalic_OnCheck()
33+
TxtPreview.FontItalic = ChkItalic.Checked
34+
EndSub
35+
36+
Sub ChkUnderlined_OnCheck()
37+
TxtPreview.Underlined = ChkUnderlined.Checked
38+
EndSub
39+
40+
Sub CmbFont_OnSelection()
41+
TxtPreview.FontName = CmbFont.SelectedItem
42+
EndSub
43+
44+
Sub CmbSize_OnSelection()
45+
TxtPreview.FontSize = CmbSize.SelectedItem
46+
EndSub
47+
48+
Sub CmbSize_OnLostFocus()
49+
size = CmbSize.Text
50+
If Text.IsNumeric(size) = False Or size <= 0 Or size > 100 Then
51+
CmbSize.Error = "Invalid font size."
52+
Else
53+
CmbSize.Error = ""
54+
TxtPreview.FontSize = CmbSize.Text
55+
EndIf
56+
EndSub
57+
58+
Sub CmbFont_OnLostFocus()
59+
If CmbFont.SelectedIndex = 0 Then
60+
CmbFont.Error = "You must choose a defined font name."
61+
Else
62+
CmbFont.Error = ""
63+
EndIf
64+
EndSub
65+
66+
Sub BtnOk_OnClick()
67+
If Me.Validate() = False Then
68+
Return
69+
EndIf
70+
71+
Ops!FontName = CmbFont.Text
72+
Ops!FontSize = CmbSize.Text
73+
Ops!Bold = ChkBold.Checked
74+
Ops!Italic = ChkItalic.Checked
75+
Ops!Underlined = ChkUnderlined.Checked
76+
Ops!ForeColor = LblForeColor.BackColor
77+
Ops!BackColor = LblBackColor.BackColor
78+
Ops!FirstTime = False
79+
Global.Ops = Ops
80+
81+
Global.SaveSettings(Ops)
82+
Me.DialogResult = DialogResults.OK
83+
Me.Close()
84+
EndSub
85+
86+
Sub BtnCancel_OnClick()
87+
Me.Close()
88+
EndSub

0 commit comments

Comments
 (0)
X Tutup