diff --git a/TestApp/Form1.designer.vb b/TestApp/Form1.designer.vb
index b4a76e6..d0ce245 100644
--- a/TestApp/Form1.designer.vb
+++ b/TestApp/Form1.designer.vb
@@ -27,15 +27,12 @@ Partial Class Form1
'''
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
- Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
- Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
+ Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Me.btnLaunchVA = New System.Windows.Forms.Button()
Me.btnShowInfo = New System.Windows.Forms.Button()
- Me.BindingSourceMathCond = New System.Windows.Forms.BindingSource(Me.components)
Me.pageCountDown = New System.Windows.Forms.TabPage()
Me.lblCountdownOUT = New System.Windows.Forms.Label()
Me.txtCountdownOUT = New System.Windows.Forms.TextBox()
- Me.txtCountdownName = New System.Windows.Forms.TextBox()
Me.lblCountdownSec = New System.Windows.Forms.Label()
Me.lblCountdownName = New System.Windows.Forms.Label()
Me.udCountdown = New System.Windows.Forms.NumericUpDown()
@@ -50,21 +47,6 @@ Partial Class Form1
Me.lblRandomOUT = New System.Windows.Forms.Label()
Me.txtRandomOUT = New System.Windows.Forms.TextBox()
Me.btnRandomInit = New System.Windows.Forms.Button()
- Me.pageMath = New System.Windows.Forms.TabPage()
- Me.btnMathXor = New System.Windows.Forms.Button()
- Me.dgvMath = New System.Windows.Forms.DataGridView()
- Me.DataGridViewTextBoxColumn3 = New System.Windows.Forms.DataGridViewTextBoxColumn()
- Me.DataGridViewTextBoxColumn4 = New System.Windows.Forms.DataGridViewTextBoxColumn()
- Me.btnMathOr = New System.Windows.Forms.Button()
- Me.Label2 = New System.Windows.Forms.Label()
- Me.btnMathAnd = New System.Windows.Forms.Button()
- Me.btnMathAdd = New System.Windows.Forms.Button()
- Me.btnMathMax = New System.Windows.Forms.Button()
- Me.btnMathSub = New System.Windows.Forms.Button()
- Me.btnMathMin = New System.Windows.Forms.Button()
- Me.btnMathMult = New System.Windows.Forms.Button()
- Me.btnMathMod = New System.Windows.Forms.Button()
- Me.btnMathDiv = New System.Windows.Forms.Button()
Me.pageReadStdOut = New System.Windows.Forms.TabPage()
Me.lblReadStdOutResult = New System.Windows.Forms.Label()
Me.txtReadStdOutResult = New System.Windows.Forms.TextBox()
@@ -145,14 +127,12 @@ Partial Class Form1
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.BindingSourceINI = New System.Windows.Forms.BindingSource(Me.components)
- CType(Me.BindingSourceMathCond, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.cboCountdownName = New System.Windows.Forms.ComboBox()
Me.pageCountDown.SuspendLayout()
CType(Me.udCountdown, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pageRandom.SuspendLayout()
CType(Me.udRandomMax, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.udRandomMin, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.pageMath.SuspendLayout()
- CType(Me.dgvMath, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pageReadStdOut.SuspendLayout()
Me.pageSpellText.SuspendLayout()
Me.pageShowText.SuspendLayout()
@@ -190,18 +170,18 @@ Partial Class Form1
'
'pageCountDown
'
+ Me.pageCountDown.Controls.Add(Me.cboCountdownName)
Me.pageCountDown.Controls.Add(Me.lblCountdownOUT)
Me.pageCountDown.Controls.Add(Me.txtCountdownOUT)
- Me.pageCountDown.Controls.Add(Me.txtCountdownName)
Me.pageCountDown.Controls.Add(Me.lblCountdownSec)
Me.pageCountDown.Controls.Add(Me.lblCountdownName)
Me.pageCountDown.Controls.Add(Me.udCountdown)
Me.pageCountDown.Controls.Add(Me.btnCountdownNext)
Me.pageCountDown.Controls.Add(Me.btnCountdownInit)
- Me.pageCountDown.Location = New System.Drawing.Point(4, 40)
+ Me.pageCountDown.Location = New System.Drawing.Point(4, 22)
Me.pageCountDown.Name = "pageCountDown"
Me.pageCountDown.Padding = New System.Windows.Forms.Padding(3)
- Me.pageCountDown.Size = New System.Drawing.Size(828, 342)
+ Me.pageCountDown.Size = New System.Drawing.Size(828, 360)
Me.pageCountDown.TabIndex = 11
Me.pageCountDown.Text = "CountDown"
Me.pageCountDown.UseVisualStyleBackColor = True
@@ -229,17 +209,9 @@ Partial Class Form1
Me.txtCountdownOUT.Size = New System.Drawing.Size(261, 278)
Me.txtCountdownOUT.TabIndex = 36
'
- 'txtCountdownName
- '
- Me.txtCountdownName.Location = New System.Drawing.Point(66, 6)
- Me.txtCountdownName.Name = "txtCountdownName"
- Me.txtCountdownName.Size = New System.Drawing.Size(91, 20)
- Me.txtCountdownName.TabIndex = 35
- Me.txtCountdownName.Text = "Timer1"
- '
'lblCountdownSec
'
- Me.lblCountdownSec.Location = New System.Drawing.Point(233, 8)
+ Me.lblCountdownSec.Location = New System.Drawing.Point(275, 8)
Me.lblCountdownSec.Name = "lblCountdownSec"
Me.lblCountdownSec.Size = New System.Drawing.Size(52, 18)
Me.lblCountdownSec.TabIndex = 34
@@ -255,7 +227,7 @@ Partial Class Form1
'
'udCountdown
'
- Me.udCountdown.Location = New System.Drawing.Point(163, 6)
+ Me.udCountdown.Location = New System.Drawing.Point(205, 6)
Me.udCountdown.Maximum = New Decimal(New Integer() {32000, 0, 0, 0})
Me.udCountdown.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
Me.udCountdown.Name = "udCountdown"
@@ -266,7 +238,7 @@ Partial Class Form1
'
'btnCountdownNext
'
- Me.btnCountdownNext.Location = New System.Drawing.Point(291, 35)
+ Me.btnCountdownNext.Location = New System.Drawing.Point(339, 37)
Me.btnCountdownNext.Name = "btnCountdownNext"
Me.btnCountdownNext.Size = New System.Drawing.Size(125, 23)
Me.btnCountdownNext.TabIndex = 31
@@ -275,7 +247,7 @@ Partial Class Form1
'
'btnCountdownInit
'
- Me.btnCountdownInit.Location = New System.Drawing.Point(291, 6)
+ Me.btnCountdownInit.Location = New System.Drawing.Point(339, 8)
Me.btnCountdownInit.Name = "btnCountdownInit"
Me.btnCountdownInit.Size = New System.Drawing.Size(125, 23)
Me.btnCountdownInit.TabIndex = 30
@@ -292,10 +264,10 @@ Partial Class Form1
Me.pageRandom.Controls.Add(Me.lblRandomOUT)
Me.pageRandom.Controls.Add(Me.txtRandomOUT)
Me.pageRandom.Controls.Add(Me.btnRandomInit)
- Me.pageRandom.Location = New System.Drawing.Point(4, 40)
+ Me.pageRandom.Location = New System.Drawing.Point(4, 22)
Me.pageRandom.Name = "pageRandom"
Me.pageRandom.Padding = New System.Windows.Forms.Padding(3)
- Me.pageRandom.Size = New System.Drawing.Size(828, 342)
+ Me.pageRandom.Size = New System.Drawing.Size(828, 360)
Me.pageRandom.TabIndex = 10
Me.pageRandom.Text = "Random list"
Me.pageRandom.UseVisualStyleBackColor = True
@@ -379,158 +351,6 @@ Partial Class Form1
Me.btnRandomInit.Text = "Initialize"
Me.btnRandomInit.UseVisualStyleBackColor = True
'
- 'pageMath
- '
- Me.pageMath.Controls.Add(Me.btnMathXor)
- Me.pageMath.Controls.Add(Me.dgvMath)
- Me.pageMath.Controls.Add(Me.btnMathOr)
- Me.pageMath.Controls.Add(Me.Label2)
- Me.pageMath.Controls.Add(Me.btnMathAnd)
- Me.pageMath.Controls.Add(Me.btnMathAdd)
- Me.pageMath.Controls.Add(Me.btnMathMax)
- Me.pageMath.Controls.Add(Me.btnMathSub)
- Me.pageMath.Controls.Add(Me.btnMathMin)
- Me.pageMath.Controls.Add(Me.btnMathMult)
- Me.pageMath.Controls.Add(Me.btnMathMod)
- Me.pageMath.Controls.Add(Me.btnMathDiv)
- Me.pageMath.Location = New System.Drawing.Point(4, 40)
- Me.pageMath.Name = "pageMath"
- Me.pageMath.Size = New System.Drawing.Size(828, 342)
- Me.pageMath.TabIndex = 7
- Me.pageMath.Text = "Math functions"
- Me.pageMath.UseVisualStyleBackColor = True
- '
- 'btnMathXor
- '
- Me.btnMathXor.Location = New System.Drawing.Point(398, 82)
- Me.btnMathXor.Name = "btnMathXor"
- Me.btnMathXor.Size = New System.Drawing.Size(39, 23)
- Me.btnMathXor.TabIndex = 43
- Me.btnMathXor.Text = "Xor"
- Me.btnMathXor.UseVisualStyleBackColor = True
- '
- 'dgvMath
- '
- Me.dgvMath.AllowUserToResizeRows = False
- Me.dgvMath.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
- Or System.Windows.Forms.AnchorStyles.Left) _
- Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.dgvMath.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
- Me.dgvMath.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.DataGridViewTextBoxColumn3, Me.DataGridViewTextBoxColumn4})
- Me.dgvMath.Location = New System.Drawing.Point(3, 24)
- Me.dgvMath.Name = "dgvMath"
- Me.dgvMath.RowHeadersWidth = 20
- Me.dgvMath.Size = New System.Drawing.Size(358, 226)
- Me.dgvMath.TabIndex = 30
- '
- 'DataGridViewTextBoxColumn3
- '
- Me.DataGridViewTextBoxColumn3.HeaderText = "Key"
- Me.DataGridViewTextBoxColumn3.Name = "DataGridViewTextBoxColumn3"
- Me.DataGridViewTextBoxColumn3.Width = 80
- '
- 'DataGridViewTextBoxColumn4
- '
- DataGridViewCellStyle3.Format = "0"
- DataGridViewCellStyle3.NullValue = Nothing
- Me.DataGridViewTextBoxColumn4.DefaultCellStyle = DataGridViewCellStyle3
- Me.DataGridViewTextBoxColumn4.HeaderText = "Value"
- Me.DataGridViewTextBoxColumn4.Name = "DataGridViewTextBoxColumn4"
- '
- 'btnMathOr
- '
- Me.btnMathOr.Location = New System.Drawing.Point(355, 82)
- Me.btnMathOr.Name = "btnMathOr"
- Me.btnMathOr.Size = New System.Drawing.Size(39, 23)
- Me.btnMathOr.TabIndex = 42
- Me.btnMathOr.Text = "Or"
- Me.btnMathOr.UseVisualStyleBackColor = True
- '
- 'Label2
- '
- Me.Label2.AutoSize = True
- Me.Label2.Location = New System.Drawing.Point(6, 8)
- Me.Label2.Name = "Label2"
- Me.Label2.Size = New System.Drawing.Size(158, 13)
- Me.Label2.TabIndex = 29
- Me.Label2.Text = "Numeric conditions (int16 value)"
- '
- 'btnMathAnd
- '
- Me.btnMathAnd.Location = New System.Drawing.Point(312, 82)
- Me.btnMathAnd.Name = "btnMathAnd"
- Me.btnMathAnd.Size = New System.Drawing.Size(39, 23)
- Me.btnMathAnd.TabIndex = 41
- Me.btnMathAnd.Text = "And"
- Me.btnMathAnd.UseVisualStyleBackColor = True
- '
- 'btnMathAdd
- '
- Me.btnMathAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.btnMathAdd.Location = New System.Drawing.Point(312, 24)
- Me.btnMathAdd.Name = "btnMathAdd"
- Me.btnMathAdd.Size = New System.Drawing.Size(25, 23)
- Me.btnMathAdd.TabIndex = 31
- Me.btnMathAdd.Text = "+"
- Me.btnMathAdd.UseVisualStyleBackColor = True
- '
- 'btnMathMax
- '
- Me.btnMathMax.Location = New System.Drawing.Point(398, 53)
- Me.btnMathMax.Name = "btnMathMax"
- Me.btnMathMax.Size = New System.Drawing.Size(39, 23)
- Me.btnMathMax.TabIndex = 40
- Me.btnMathMax.Text = "Max"
- Me.btnMathMax.UseVisualStyleBackColor = True
- '
- 'btnMathSub
- '
- Me.btnMathSub.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.btnMathSub.Location = New System.Drawing.Point(343, 24)
- Me.btnMathSub.Name = "btnMathSub"
- Me.btnMathSub.Size = New System.Drawing.Size(25, 23)
- Me.btnMathSub.TabIndex = 32
- Me.btnMathSub.Text = "-"
- Me.btnMathSub.UseVisualStyleBackColor = True
- '
- 'btnMathMin
- '
- Me.btnMathMin.Location = New System.Drawing.Point(355, 53)
- Me.btnMathMin.Name = "btnMathMin"
- Me.btnMathMin.Size = New System.Drawing.Size(39, 23)
- Me.btnMathMin.TabIndex = 39
- Me.btnMathMin.Text = "Min"
- Me.btnMathMin.UseVisualStyleBackColor = True
- '
- 'btnMathMult
- '
- Me.btnMathMult.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.btnMathMult.Location = New System.Drawing.Point(381, 24)
- Me.btnMathMult.Name = "btnMathMult"
- Me.btnMathMult.Size = New System.Drawing.Size(25, 23)
- Me.btnMathMult.TabIndex = 33
- Me.btnMathMult.Text = "*"
- Me.btnMathMult.UseVisualStyleBackColor = True
- '
- 'btnMathMod
- '
- Me.btnMathMod.Location = New System.Drawing.Point(312, 53)
- Me.btnMathMod.Name = "btnMathMod"
- Me.btnMathMod.Size = New System.Drawing.Size(39, 23)
- Me.btnMathMod.TabIndex = 38
- Me.btnMathMod.Text = "Mod"
- Me.btnMathMod.UseVisualStyleBackColor = True
- '
- 'btnMathDiv
- '
- Me.btnMathDiv.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.btnMathDiv.Location = New System.Drawing.Point(412, 24)
- Me.btnMathDiv.Name = "btnMathDiv"
- Me.btnMathDiv.Size = New System.Drawing.Size(25, 23)
- Me.btnMathDiv.TabIndex = 34
- Me.btnMathDiv.Text = "/"
- Me.btnMathDiv.UseVisualStyleBackColor = True
- '
'pageReadStdOut
'
Me.pageReadStdOut.Controls.Add(Me.lblReadStdOutResult)
@@ -540,9 +360,9 @@ Partial Class Form1
Me.pageReadStdOut.Controls.Add(Me.lblReadStdOutName)
Me.pageReadStdOut.Controls.Add(Me.btnReadStdOutExecute)
Me.pageReadStdOut.Controls.Add(Me.lblReadStdOutArgs)
- Me.pageReadStdOut.Location = New System.Drawing.Point(4, 40)
+ Me.pageReadStdOut.Location = New System.Drawing.Point(4, 22)
Me.pageReadStdOut.Name = "pageReadStdOut"
- Me.pageReadStdOut.Size = New System.Drawing.Size(828, 342)
+ Me.pageReadStdOut.Size = New System.Drawing.Size(828, 360)
Me.pageReadStdOut.TabIndex = 6
Me.pageReadStdOut.Text = "Read standard output"
Me.pageReadStdOut.UseVisualStyleBackColor = True
@@ -618,9 +438,9 @@ Partial Class Form1
Me.pageSpellText.Controls.Add(Me.txtSpellTextOUT)
Me.pageSpellText.Controls.Add(Me.txtSpellTextIN)
Me.pageSpellText.Controls.Add(Me.btnSpellTextExecute)
- Me.pageSpellText.Location = New System.Drawing.Point(4, 40)
+ Me.pageSpellText.Location = New System.Drawing.Point(4, 22)
Me.pageSpellText.Name = "pageSpellText"
- Me.pageSpellText.Size = New System.Drawing.Size(828, 342)
+ Me.pageSpellText.Size = New System.Drawing.Size(828, 360)
Me.pageSpellText.TabIndex = 4
Me.pageSpellText.Text = "Spell Text"
Me.pageSpellText.UseVisualStyleBackColor = True
@@ -681,9 +501,9 @@ Partial Class Form1
Me.pageShowText.Controls.Add(Me.lblShowFileTextVar)
Me.pageShowText.Controls.Add(Me.cboShowFileName)
Me.pageShowText.Controls.Add(Me.btnShowFileName)
- Me.pageShowText.Location = New System.Drawing.Point(4, 40)
+ Me.pageShowText.Location = New System.Drawing.Point(4, 22)
Me.pageShowText.Name = "pageShowText"
- Me.pageShowText.Size = New System.Drawing.Size(828, 342)
+ Me.pageShowText.Size = New System.Drawing.Size(828, 360)
Me.pageShowText.TabIndex = 5
Me.pageShowText.Text = "Show file/text"
Me.pageShowText.UseVisualStyleBackColor = True
@@ -755,9 +575,9 @@ Partial Class Form1
Me.pageReadRSS.Controls.Add(Me.lblReadRSSDateMask)
Me.pageReadRSS.Controls.Add(Me.lblReadRSSName)
Me.pageReadRSS.Controls.Add(Me.btnReadRSSExecute)
- Me.pageReadRSS.Location = New System.Drawing.Point(4, 40)
+ Me.pageReadRSS.Location = New System.Drawing.Point(4, 22)
Me.pageReadRSS.Name = "pageReadRSS"
- Me.pageReadRSS.Size = New System.Drawing.Size(828, 342)
+ Me.pageReadRSS.Size = New System.Drawing.Size(828, 360)
Me.pageReadRSS.TabIndex = 2
Me.pageReadRSS.Text = "Read RSS"
Me.pageReadRSS.UseVisualStyleBackColor = True
@@ -869,10 +689,10 @@ Partial Class Form1
Me.pageReadXML.Controls.Add(Me.udReadXMLIndex)
Me.pageReadXML.Controls.Add(Me.lblReadXMLRegEx)
Me.pageReadXML.Controls.Add(Me.btnReadXMLExecute)
- Me.pageReadXML.Location = New System.Drawing.Point(4, 40)
+ Me.pageReadXML.Location = New System.Drawing.Point(4, 22)
Me.pageReadXML.Name = "pageReadXML"
Me.pageReadXML.Padding = New System.Windows.Forms.Padding(3)
- Me.pageReadXML.Size = New System.Drawing.Size(828, 342)
+ Me.pageReadXML.Size = New System.Drawing.Size(828, 360)
Me.pageReadXML.TabIndex = 1
Me.pageReadXML.Text = "Read XML"
Me.pageReadXML.UseVisualStyleBackColor = True
@@ -960,10 +780,10 @@ Partial Class Form1
Me.pageReadFile.Controls.Add(Me.cboReadFileName)
Me.pageReadFile.Controls.Add(Me.lblReadFileRegEx)
Me.pageReadFile.Controls.Add(Me.btnReadFileExecute)
- Me.pageReadFile.Location = New System.Drawing.Point(4, 40)
+ Me.pageReadFile.Location = New System.Drawing.Point(4, 22)
Me.pageReadFile.Name = "pageReadFile"
Me.pageReadFile.Padding = New System.Windows.Forms.Padding(3)
- Me.pageReadFile.Size = New System.Drawing.Size(828, 342)
+ Me.pageReadFile.Size = New System.Drawing.Size(828, 360)
Me.pageReadFile.TabIndex = 0
Me.pageReadFile.Text = "Read file"
Me.pageReadFile.UseVisualStyleBackColor = True
@@ -1025,7 +845,6 @@ Partial Class Form1
Me.TabControl1.Controls.Add(Me.pageShowText)
Me.TabControl1.Controls.Add(Me.pageSpellText)
Me.TabControl1.Controls.Add(Me.pageReadStdOut)
- Me.TabControl1.Controls.Add(Me.pageMath)
Me.TabControl1.Controls.Add(Me.pageRandom)
Me.TabControl1.Controls.Add(Me.pageCountDown)
Me.TabControl1.Location = New System.Drawing.Point(12, 41)
@@ -1044,10 +863,10 @@ Partial Class Form1
Me.pageReadJSON.Controls.Add(Me.Label8)
Me.pageReadJSON.Controls.Add(Me.Label9)
Me.pageReadJSON.Controls.Add(Me.btnReadJSONExecute)
- Me.pageReadJSON.Location = New System.Drawing.Point(4, 40)
+ Me.pageReadJSON.Location = New System.Drawing.Point(4, 22)
Me.pageReadJSON.Name = "pageReadJSON"
Me.pageReadJSON.Padding = New System.Windows.Forms.Padding(3)
- Me.pageReadJSON.Size = New System.Drawing.Size(828, 342)
+ Me.pageReadJSON.Size = New System.Drawing.Size(828, 360)
Me.pageReadJSON.TabIndex = 14
Me.pageReadJSON.Text = "Read JSON"
Me.pageReadJSON.UseVisualStyleBackColor = True
@@ -1124,10 +943,10 @@ Partial Class Form1
Me.pageReadCSV.Controls.Add(Me.Label6)
Me.pageReadCSV.Controls.Add(Me.udReadCSVRow)
Me.pageReadCSV.Controls.Add(Me.btnReadCSVExecute)
- Me.pageReadCSV.Location = New System.Drawing.Point(4, 40)
+ Me.pageReadCSV.Location = New System.Drawing.Point(4, 22)
Me.pageReadCSV.Name = "pageReadCSV"
Me.pageReadCSV.Padding = New System.Windows.Forms.Padding(3)
- Me.pageReadCSV.Size = New System.Drawing.Size(828, 342)
+ Me.pageReadCSV.Size = New System.Drawing.Size(828, 360)
Me.pageReadCSV.TabIndex = 13
Me.pageReadCSV.Text = "Read CSV"
Me.pageReadCSV.UseVisualStyleBackColor = True
@@ -1234,9 +1053,9 @@ Partial Class Form1
Me.pageINI.Controls.Add(Me.Label3)
Me.pageINI.Controls.Add(Me.btnINIRead)
Me.pageINI.Controls.Add(Me.dgvINI)
- Me.pageINI.Location = New System.Drawing.Point(4, 40)
+ Me.pageINI.Location = New System.Drawing.Point(4, 22)
Me.pageINI.Name = "pageINI"
- Me.pageINI.Size = New System.Drawing.Size(828, 342)
+ Me.pageINI.Size = New System.Drawing.Size(828, 360)
Me.pageINI.TabIndex = 12
Me.pageINI.Text = "Read/Write INI"
Me.pageINI.UseVisualStyleBackColor = True
@@ -1315,12 +1134,21 @@ Partial Class Form1
'
'DataGridViewTextBoxColumn2
'
- DataGridViewCellStyle4.Format = "0"
- DataGridViewCellStyle4.NullValue = Nothing
- Me.DataGridViewTextBoxColumn2.DefaultCellStyle = DataGridViewCellStyle4
+ DataGridViewCellStyle1.Format = "0"
+ DataGridViewCellStyle1.NullValue = Nothing
+ Me.DataGridViewTextBoxColumn2.DefaultCellStyle = DataGridViewCellStyle1
Me.DataGridViewTextBoxColumn2.HeaderText = "Value"
Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2"
'
+ 'cboCountdownName
+ '
+ Me.cboCountdownName.FormattingEnabled = True
+ Me.cboCountdownName.Items.AddRange(New Object() {"VxTimer0", "VxTimer1", "VxTimer2", "VxTimer3", "VxTimer4", "VxTimer5", "VxTimer6", "VxTimer7", "VxTimer8", "VxTimer9"})
+ Me.cboCountdownName.Location = New System.Drawing.Point(66, 5)
+ Me.cboCountdownName.Name = "cboCountdownName"
+ Me.cboCountdownName.Size = New System.Drawing.Size(133, 21)
+ Me.cboCountdownName.TabIndex = 38
+ '
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -1333,7 +1161,6 @@ Partial Class Form1
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Form1"
- CType(Me.BindingSourceMathCond, System.ComponentModel.ISupportInitialize).EndInit()
Me.pageCountDown.ResumeLayout(False)
Me.pageCountDown.PerformLayout()
CType(Me.udCountdown, System.ComponentModel.ISupportInitialize).EndInit()
@@ -1341,9 +1168,6 @@ Partial Class Form1
Me.pageRandom.PerformLayout()
CType(Me.udRandomMax, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.udRandomMin, System.ComponentModel.ISupportInitialize).EndInit()
- Me.pageMath.ResumeLayout(False)
- Me.pageMath.PerformLayout()
- CType(Me.dgvMath, System.ComponentModel.ISupportInitialize).EndInit()
Me.pageReadStdOut.ResumeLayout(False)
Me.pageReadStdOut.PerformLayout()
Me.pageSpellText.ResumeLayout(False)
@@ -1373,101 +1197,84 @@ Partial Class Form1
End Sub
Friend WithEvents btnShowInfo As System.Windows.Forms.Button
Friend WithEvents btnLaunchVA As System.Windows.Forms.Button
- Friend WithEvents BindingSourceMathCond As System.Windows.Forms.BindingSource
- Friend WithEvents pageCountDown As System.Windows.Forms.TabPage
- Friend WithEvents lblCountdownOUT As System.Windows.Forms.Label
+ Friend WithEvents pageCountDown As System.Windows.Forms.TabPage
+ Friend WithEvents lblCountdownOUT As System.Windows.Forms.Label
Friend WithEvents txtCountdownOUT As System.Windows.Forms.TextBox
- Friend WithEvents txtCountdownName As System.Windows.Forms.TextBox
- Friend WithEvents lblCountdownSec As System.Windows.Forms.Label
- Friend WithEvents lblCountdownName As System.Windows.Forms.Label
- Friend WithEvents udCountdown As System.Windows.Forms.NumericUpDown
- Friend WithEvents btnCountdownNext As System.Windows.Forms.Button
- Friend WithEvents btnCountdownInit As System.Windows.Forms.Button
- Friend WithEvents pageRandom As System.Windows.Forms.TabPage
- Friend WithEvents lblRandomMax As System.Windows.Forms.Label
- Friend WithEvents udRandomMax As System.Windows.Forms.NumericUpDown
- Friend WithEvents lblRandomMin As System.Windows.Forms.Label
- Friend WithEvents udRandomMin As System.Windows.Forms.NumericUpDown
- Friend WithEvents btnRandomNext As System.Windows.Forms.Button
- Friend WithEvents lblRandomOUT As System.Windows.Forms.Label
- Friend WithEvents txtRandomOUT As System.Windows.Forms.TextBox
- Friend WithEvents btnRandomInit As System.Windows.Forms.Button
- Friend WithEvents pageMath As System.Windows.Forms.TabPage
- Friend WithEvents dgvMath As System.Windows.Forms.DataGridView
- Friend WithEvents DataGridViewTextBoxColumn3 As System.Windows.Forms.DataGridViewTextBoxColumn
- Friend WithEvents DataGridViewTextBoxColumn4 As System.Windows.Forms.DataGridViewTextBoxColumn
- Friend WithEvents pageReadStdOut As System.Windows.Forms.TabPage
- Friend WithEvents lblReadStdOutResult As System.Windows.Forms.Label
- Friend WithEvents txtReadStdOutResult As System.Windows.Forms.TextBox
- Friend WithEvents txtReadStdOutArgs As System.Windows.Forms.TextBox
- Friend WithEvents txtReadStdOutName As System.Windows.Forms.TextBox
- Friend WithEvents lblReadStdOutName As System.Windows.Forms.Label
- Friend WithEvents btnReadStdOutExecute As System.Windows.Forms.Button
- Friend WithEvents lblReadStdOutArgs As System.Windows.Forms.Label
- Friend WithEvents pageSpellText As System.Windows.Forms.TabPage
- Friend WithEvents lblSpellTextOUT As System.Windows.Forms.Label
- Friend WithEvents lblSpellTextIN As System.Windows.Forms.Label
- Friend WithEvents txtSpellTextOUT As System.Windows.Forms.TextBox
- Friend WithEvents txtSpellTextIN As System.Windows.Forms.TextBox
- Friend WithEvents btnSpellTextExecute As System.Windows.Forms.Button
- Friend WithEvents pageShowText As System.Windows.Forms.TabPage
- Friend WithEvents lblShowFileOR As System.Windows.Forms.Label
- Friend WithEvents txtShowFileTextVar As System.Windows.Forms.TextBox
- Friend WithEvents lblShowFileName As System.Windows.Forms.Label
- Friend WithEvents lblShowFileTextVar As System.Windows.Forms.Label
- Friend WithEvents cboShowFileName As System.Windows.Forms.ComboBox
- Friend WithEvents btnShowFileName As System.Windows.Forms.Button
- Friend WithEvents pageReadRSS As System.Windows.Forms.TabPage
- Friend WithEvents txtReadRSSRegEx As System.Windows.Forms.TextBox
- Friend WithEvents lblReadRSSRegEx As System.Windows.Forms.Label
- Friend WithEvents cboReadRSSName As System.Windows.Forms.ComboBox
- Friend WithEvents cboReadRSSDateMask As System.Windows.Forms.ComboBox
- Friend WithEvents lblReadRSSIndex As System.Windows.Forms.Label
- Friend WithEvents cboReadRSSArgs As System.Windows.Forms.ComboBox
- Friend WithEvents udReadRSSIndex As System.Windows.Forms.NumericUpDown
- Friend WithEvents lblReadRSSArgs As System.Windows.Forms.Label
- Friend WithEvents lblReadRSSDateMask As System.Windows.Forms.Label
- Friend WithEvents lblReadRSSName As System.Windows.Forms.Label
- Friend WithEvents btnReadRSSExecute As System.Windows.Forms.Button
- Friend WithEvents pageReadXML As System.Windows.Forms.TabPage
- Friend WithEvents txtReadXMLItemPath As System.Windows.Forms.TextBox
- Friend WithEvents txtReadXMLRegEx As System.Windows.Forms.TextBox
- Friend WithEvents cboReadXMLName As System.Windows.Forms.ComboBox
- Friend WithEvents lblReadXMLItemPath As System.Windows.Forms.Label
- Friend WithEvents lblReadXMLIndex As System.Windows.Forms.Label
- Friend WithEvents lblReadXMLName As System.Windows.Forms.Label
- Friend WithEvents udReadXMLIndex As System.Windows.Forms.NumericUpDown
- Friend WithEvents lblReadXMLRegEx As System.Windows.Forms.Label
- Friend WithEvents btnReadXMLExecute As System.Windows.Forms.Button
- Friend WithEvents pageReadFile As System.Windows.Forms.TabPage
- Friend WithEvents lblReadFileName As System.Windows.Forms.Label
- Friend WithEvents txtReadFileRegEx As System.Windows.Forms.TextBox
- Friend WithEvents cboReadFileName As System.Windows.Forms.ComboBox
- Friend WithEvents lblReadFileRegEx As System.Windows.Forms.Label
- Friend WithEvents btnReadFileExecute As System.Windows.Forms.Button
- Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
- Friend WithEvents Label2 As System.Windows.Forms.Label
- Friend WithEvents btnMathXor As System.Windows.Forms.Button
- Friend WithEvents btnMathOr As System.Windows.Forms.Button
- Friend WithEvents btnMathAnd As System.Windows.Forms.Button
- Friend WithEvents btnMathAdd As System.Windows.Forms.Button
- Friend WithEvents btnMathMax As System.Windows.Forms.Button
- Friend WithEvents btnMathSub As System.Windows.Forms.Button
- Friend WithEvents btnMathMin As System.Windows.Forms.Button
- Friend WithEvents btnMathMult As System.Windows.Forms.Button
- Friend WithEvents btnMathMod As System.Windows.Forms.Button
- Friend WithEvents btnMathDiv As System.Windows.Forms.Button
- Friend WithEvents pageINI As System.Windows.Forms.TabPage
- Friend WithEvents dgvINI As System.Windows.Forms.DataGridView
- Friend WithEvents DataGridViewTextBoxColumn1 As System.Windows.Forms.DataGridViewTextBoxColumn
- Friend WithEvents DataGridViewTextBoxColumn2 As System.Windows.Forms.DataGridViewTextBoxColumn
- Friend WithEvents BindingSourceINI As System.Windows.Forms.BindingSource
- Friend WithEvents btnINIWrite As System.Windows.Forms.Button
- Friend WithEvents Label1 As System.Windows.Forms.Label
- Friend WithEvents txtINISection As System.Windows.Forms.TextBox
- Friend WithEvents cboINIFile As System.Windows.Forms.ComboBox
- Friend WithEvents Label3 As System.Windows.Forms.Label
- Friend WithEvents btnINIRead As System.Windows.Forms.Button
+ Friend WithEvents lblCountdownSec As System.Windows.Forms.Label
+ Friend WithEvents lblCountdownName As System.Windows.Forms.Label
+ Friend WithEvents udCountdown As System.Windows.Forms.NumericUpDown
+ Friend WithEvents btnCountdownNext As System.Windows.Forms.Button
+ Friend WithEvents btnCountdownInit As System.Windows.Forms.Button
+ Friend WithEvents pageRandom As System.Windows.Forms.TabPage
+ Friend WithEvents lblRandomMax As System.Windows.Forms.Label
+ Friend WithEvents udRandomMax As System.Windows.Forms.NumericUpDown
+ Friend WithEvents lblRandomMin As System.Windows.Forms.Label
+ Friend WithEvents udRandomMin As System.Windows.Forms.NumericUpDown
+ Friend WithEvents btnRandomNext As System.Windows.Forms.Button
+ Friend WithEvents lblRandomOUT As System.Windows.Forms.Label
+ Friend WithEvents txtRandomOUT As System.Windows.Forms.TextBox
+ Friend WithEvents btnRandomInit As System.Windows.Forms.Button
+ Friend WithEvents pageReadStdOut As System.Windows.Forms.TabPage
+ Friend WithEvents lblReadStdOutResult As System.Windows.Forms.Label
+ Friend WithEvents txtReadStdOutResult As System.Windows.Forms.TextBox
+ Friend WithEvents txtReadStdOutArgs As System.Windows.Forms.TextBox
+ Friend WithEvents txtReadStdOutName As System.Windows.Forms.TextBox
+ Friend WithEvents lblReadStdOutName As System.Windows.Forms.Label
+ Friend WithEvents btnReadStdOutExecute As System.Windows.Forms.Button
+ Friend WithEvents lblReadStdOutArgs As System.Windows.Forms.Label
+ Friend WithEvents pageSpellText As System.Windows.Forms.TabPage
+ Friend WithEvents lblSpellTextOUT As System.Windows.Forms.Label
+ Friend WithEvents lblSpellTextIN As System.Windows.Forms.Label
+ Friend WithEvents txtSpellTextOUT As System.Windows.Forms.TextBox
+ Friend WithEvents txtSpellTextIN As System.Windows.Forms.TextBox
+ Friend WithEvents btnSpellTextExecute As System.Windows.Forms.Button
+ Friend WithEvents pageShowText As System.Windows.Forms.TabPage
+ Friend WithEvents lblShowFileOR As System.Windows.Forms.Label
+ Friend WithEvents txtShowFileTextVar As System.Windows.Forms.TextBox
+ Friend WithEvents lblShowFileName As System.Windows.Forms.Label
+ Friend WithEvents lblShowFileTextVar As System.Windows.Forms.Label
+ Friend WithEvents cboShowFileName As System.Windows.Forms.ComboBox
+ Friend WithEvents btnShowFileName As System.Windows.Forms.Button
+ Friend WithEvents pageReadRSS As System.Windows.Forms.TabPage
+ Friend WithEvents txtReadRSSRegEx As System.Windows.Forms.TextBox
+ Friend WithEvents lblReadRSSRegEx As System.Windows.Forms.Label
+ Friend WithEvents cboReadRSSName As System.Windows.Forms.ComboBox
+ Friend WithEvents cboReadRSSDateMask As System.Windows.Forms.ComboBox
+ Friend WithEvents lblReadRSSIndex As System.Windows.Forms.Label
+ Friend WithEvents cboReadRSSArgs As System.Windows.Forms.ComboBox
+ Friend WithEvents udReadRSSIndex As System.Windows.Forms.NumericUpDown
+ Friend WithEvents lblReadRSSArgs As System.Windows.Forms.Label
+ Friend WithEvents lblReadRSSDateMask As System.Windows.Forms.Label
+ Friend WithEvents lblReadRSSName As System.Windows.Forms.Label
+ Friend WithEvents btnReadRSSExecute As System.Windows.Forms.Button
+ Friend WithEvents pageReadXML As System.Windows.Forms.TabPage
+ Friend WithEvents txtReadXMLItemPath As System.Windows.Forms.TextBox
+ Friend WithEvents txtReadXMLRegEx As System.Windows.Forms.TextBox
+ Friend WithEvents cboReadXMLName As System.Windows.Forms.ComboBox
+ Friend WithEvents lblReadXMLItemPath As System.Windows.Forms.Label
+ Friend WithEvents lblReadXMLIndex As System.Windows.Forms.Label
+ Friend WithEvents lblReadXMLName As System.Windows.Forms.Label
+ Friend WithEvents udReadXMLIndex As System.Windows.Forms.NumericUpDown
+ Friend WithEvents lblReadXMLRegEx As System.Windows.Forms.Label
+ Friend WithEvents btnReadXMLExecute As System.Windows.Forms.Button
+ Friend WithEvents pageReadFile As System.Windows.Forms.TabPage
+ Friend WithEvents lblReadFileName As System.Windows.Forms.Label
+ Friend WithEvents txtReadFileRegEx As System.Windows.Forms.TextBox
+ Friend WithEvents cboReadFileName As System.Windows.Forms.ComboBox
+ Friend WithEvents lblReadFileRegEx As System.Windows.Forms.Label
+ Friend WithEvents btnReadFileExecute As System.Windows.Forms.Button
+ Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
+ Friend WithEvents pageINI As System.Windows.Forms.TabPage
+ Friend WithEvents dgvINI As System.Windows.Forms.DataGridView
+ Friend WithEvents DataGridViewTextBoxColumn1 As System.Windows.Forms.DataGridViewTextBoxColumn
+ Friend WithEvents DataGridViewTextBoxColumn2 As System.Windows.Forms.DataGridViewTextBoxColumn
+ Friend WithEvents BindingSourceINI As System.Windows.Forms.BindingSource
+ Friend WithEvents btnINIWrite As System.Windows.Forms.Button
+ Friend WithEvents Label1 As System.Windows.Forms.Label
+ Friend WithEvents txtINISection As System.Windows.Forms.TextBox
+ Friend WithEvents cboINIFile As System.Windows.Forms.ComboBox
+ Friend WithEvents Label3 As System.Windows.Forms.Label
+ Friend WithEvents btnINIRead As System.Windows.Forms.Button
Friend WithEvents pageReadCSV As TabPage
Friend WithEvents btnLoadCSVExecute As Button
Friend WithEvents txtReadCSVCol As TextBox
@@ -1487,4 +1294,5 @@ Partial Class Form1
Friend WithEvents Label8 As Label
Friend WithEvents Label9 As Label
Friend WithEvents btnReadJSONExecute As Button
+ Friend WithEvents cboCountdownName As ComboBox
End Class
diff --git a/TestApp/Form1.resx b/TestApp/Form1.resx
index 97e09a1..ea3135e 100644
--- a/TestApp/Form1.resx
+++ b/TestApp/Form1.resx
@@ -117,27 +117,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 9, 12
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
True
diff --git a/TestApp/Form1.vb b/TestApp/Form1.vb
index 52e42d7..e4a30aa 100644
--- a/TestApp/Form1.vb
+++ b/TestApp/Form1.vb
@@ -1,385 +1,322 @@
Partial Public Class Form1
- Dim contextName As String
- Dim state As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
- Dim smallIntValues As Dictionary(Of String, Nullable(Of Int16)) = New Dictionary(Of String, Nullable(Of Int16))
- Dim textValues As Dictionary(Of String, String) = New Dictionary(Of String, String)
- Dim intValues As Dictionary(Of String, Nullable(Of Integer)) = New Dictionary(Of String, Nullable(Of Integer))
- Dim decimalValues As Dictionary(Of String, Nullable(Of Decimal)) = New Dictionary(Of String, Nullable(Of Decimal))
- Dim booleanValues As Dictionary(Of String, Nullable(Of Boolean)) = New Dictionary(Of String, Nullable(Of Boolean))
- Dim extendedValues As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
-
- Dim mathCond As New List(Of EditableKVP(Of Nullable(Of Int16)))
- Dim iniCond As New List(Of EditableKVP(Of String))
-
- Class EditableKVP(Of T) 'standard KeyValuePair is not editable when used in data binding
- Property Key As String
- Property Value As T
- End Class
-
- Public Sub New()
- ' The Me.InitializeComponent call is required for Windows Forms designer support.
- Me.InitializeComponent()
-
- '
- ' TODO : Add constructor code after InitializeComponents
- '
- End Sub
-
- Private Sub clearAllInput()
- smallIntValues.Clear()
- intValues.Clear()
- decimalValues.Clear()
- booleanValues.Clear()
- textValues.Clear()
- extendedValues.Clear()
- End Sub
-
- Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- VAExtensions.VoiceAttack.VA_Init1(state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- Me.Text = String.Format("Test application: {0} ({1})", VAExtensions.VoiceAttack.VA_DisplayName, VAExtensions.VoiceAttack.VA_Id)
-
- BindingSourceMathCond.DataSource = mathCond
- rebindMathGrid()
- BindingSourceINI.DataSource = iniCond
- rebindINIGrid()
- End Sub
-
- Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
- VAExtensions.VoiceAttack.VA_Exit1(state)
- End Sub
-
- Private Sub rebindMathGrid()
- BindingSourceMathCond.ResetBindings(False)
- dgvMath.AutoGenerateColumns = False
- dgvMath.Columns(0).DataPropertyName = "Key"
- dgvMath.Columns(1).DataPropertyName = "Value"
- dgvMath.DataSource = BindingSourceMathCond
- End Sub
-
- Private Sub rebindINIGrid()
- BindingSourceINI.ResetBindings(False)
- dgvINI.AutoGenerateColumns = False
- dgvINI.Columns(0).DataPropertyName = "Key"
- dgvINI.Columns(1).DataPropertyName = "Value"
- dgvINI.DataSource = BindingSourceINI
- End Sub
-
- Private Sub NumericGrid_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles dgvMath.EditingControlShowing
-
- RemoveHandler e.Control.KeyPress, AddressOf NumericGridColumn_KeyPress
- If DirectCast(sender, DataGridView).CurrentCell.ColumnIndex = 1 Then
- Dim tb As TextBox = TryCast(e.Control, TextBox)
- If tb IsNot Nothing Then
- AddHandler tb.KeyPress, AddressOf NumericGridColumn_KeyPress
- End If
- End If
- End Sub
-
- Private Sub NumericGridColumn_KeyPress(sender As Object, e As KeyPressEventArgs)
- If Not Char.IsControl(e.KeyChar) AndAlso Not Char.IsDigit(e.KeyChar) Then
- e.Handled = True
- End If
- End Sub
-
- Private Sub btnShowInfo_Click(sender As Object, e As EventArgs) Handles btnShowInfo.Click
- VAExtensions.VoiceAttack.VA_DisplayInfo()
-
- clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.Config)
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
- End Sub
-
- Private Sub btnLaunchVA_Click(sender As Object, e As EventArgs) Handles btnLaunchVA.Click
- Process.Start("C:\Program Files (x86)\VoiceAttack\VoiceAttack.exe", "-listeningoff")
- End Sub
-
- Private Sub btnReadFileExecute_Click(sender As Object, e As EventArgs) Handles btnReadFileExecute.Click
- clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadFile)
- textValues(VAExtensions.App.KEY_FILE) = cboReadFileName.Text
- If txtReadFileRegEx.TextLength > 0 Then textValues(VAExtensions.App.KEY_REGEX) = txtReadFileRegEx.Text
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
-
- End Sub
+ Dim proxyReplica As New VAProxyReplica
+
+ Dim iniCond As New List(Of EditableKVP(Of String))
+
+ Class EditableKVP(Of T) 'standard KeyValuePair is not editable when used in data binding
+ Property Key As String
+ Property Value As T
+ End Class
+
+ Public Sub New()
+ ' The Me.InitializeComponent call is required for Windows Forms designer support.
+ Me.InitializeComponent()
+
+ '
+ ' TODO : Add constructor code after InitializeComponents
+ '
+ End Sub
+
+ Private Sub clearAllInput()
+ 'proxyReplica.ClearAllInput
+ End Sub
+
+ Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+ VAExtensions.VoiceAttack.VA_Init1(proxyReplica)
+ Me.Text = String.Format("Test application: {0} ({1})", VAExtensions.VoiceAttack.VA_DisplayName, VAExtensions.VoiceAttack.VA_Id)
+
+ BindingSourceINI.DataSource = iniCond
+ rebindINIGrid()
+ End Sub
+
+ Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
+ VAExtensions.VoiceAttack.VA_Exit1(proxyReplica)
+ End Sub
+
+ Private Sub rebindINIGrid()
+ BindingSourceINI.ResetBindings(False)
+ dgvINI.AutoGenerateColumns = False
+ dgvINI.Columns(0).DataPropertyName = "Key"
+ dgvINI.Columns(1).DataPropertyName = "Value"
+ dgvINI.DataSource = BindingSourceINI
+ End Sub
+
+ Private Sub NumericGrid_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs)
+
+ RemoveHandler e.Control.KeyPress, AddressOf NumericGridColumn_KeyPress
+ If DirectCast(sender, DataGridView).CurrentCell.ColumnIndex = 1 Then
+ Dim tb As TextBox = TryCast(e.Control, TextBox)
+ If tb IsNot Nothing Then
+ AddHandler tb.KeyPress, AddressOf NumericGridColumn_KeyPress
+ End If
+ End If
+ End Sub
+
+ Private Sub NumericGridColumn_KeyPress(sender As Object, e As KeyPressEventArgs)
+ If Not Char.IsControl(e.KeyChar) AndAlso Not Char.IsDigit(e.KeyChar) Then
+ e.Handled = True
+ End If
+ End Sub
+
+ Private Sub btnShowInfo_Click(sender As Object, e As EventArgs) Handles btnShowInfo.Click
+ VAExtensions.VoiceAttack.VA_DisplayInfo()
+
+ clearAllInput()
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.Config)
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End If
+ End Sub
+
+ Private Sub btnLaunchVA_Click(sender As Object, e As EventArgs) Handles btnLaunchVA.Click
+ Process.Start("C:\Program Files (x86)\VoiceAttack\VoiceAttack.exe", "-listeningoff")
+ End Sub
+
+ Private Sub btnReadFileExecute_Click(sender As Object, e As EventArgs) Handles btnReadFileExecute.Click
+ clearAllInput()
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadFile)
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, cboReadFileName.Text)
+ If txtReadFileRegEx.TextLength > 0 Then proxyReplica.SetText(VAExtensions.App.KEY_REGEX, txtReadFileRegEx.Text)
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End If
+
+ End Sub
Private Sub btnReadXMLExecute_Click(sender As Object, e As EventArgs) Handles btnReadXMLExecute.Click
clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadXml)
- textValues(VAExtensions.App.KEY_FILE) = cboReadXMLName.Text
- If txtReadXMLRegEx.TextLength > 0 Then textValues(VAExtensions.App.KEY_REGEX) = txtReadXMLRegEx.Text
- If txtReadXMLItemPath.TextLength > 0 Then textValues(VAExtensions.App.KEY_ARGUMENTS) = txtReadXMLItemPath.Text
- If udReadXMLIndex.Value > 0 Then smallIntValues(VAExtensions.App.KEY_INDEX) = Convert.ToInt16(udReadXMLIndex.Value)
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadXml)
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, cboReadXMLName.Text)
+ If txtReadXMLRegEx.TextLength > 0 Then proxyReplica.SetText(VAExtensions.App.KEY_REGEX, txtReadXMLRegEx.Text)
+ If txtReadXMLItemPath.TextLength > 0 Then proxyReplica.SetText(VAExtensions.App.KEY_ARGUMENTS, txtReadXMLItemPath.Text)
+ If udReadXMLIndex.Value > 0 Then proxyReplica.SetSmallInt(VAExtensions.App.KEY_INDEX, Convert.ToInt16(udReadXMLIndex.Value))
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub btnReadJSONExecute_Click(sender As Object, e As EventArgs) Handles btnReadJSONExecute.Click
clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadJSON)
- textValues(VAExtensions.App.KEY_FILE) = cboReadJSONName.Text
- If txtReadJSONRegEx.TextLength > 0 Then textValues(VAExtensions.App.KEY_REGEX) = txtReadJSONRegEx.Text
- If txtReadJSONItemPath.TextLength > 0 Then textValues(VAExtensions.App.KEY_ARGUMENTS) = txtReadJSONItemPath.Text
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadJSON)
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, cboReadJSONName.Text)
+ If txtReadJSONRegEx.TextLength > 0 Then proxyReplica.SetText(VAExtensions.App.KEY_REGEX, txtReadJSONRegEx.Text)
+ If txtReadJSONItemPath.TextLength > 0 Then proxyReplica.SetText(VAExtensions.App.KEY_ARGUMENTS, txtReadJSONItemPath.Text)
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub btnShowFileName_Click(sender As Object, e As EventArgs) Handles btnShowFileName.Click
- clearAllInput()
- If cboShowFileName.Text.Length > 0 Then
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ShowFile)
- textValues(VAExtensions.App.KEY_FILE) = cboShowFileName.Text
- ElseIf txtShowFileTextVar.TextLength > 0 Then
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ShowText)
- textValues("CustomName1") = txtShowFileTextVar.Text
- End If
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End If
- End Sub
-
- Private Sub btnReadRSSExecute_Click(sender As Object, e As EventArgs) Handles btnReadRSSExecute.Click
- clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadRSS)
- textValues(VAExtensions.App.KEY_FILE) = cboReadRSSName.Text
- textValues(VAExtensions.App.KEY_ARGUMENTS) = cboReadRSSArgs.Text
- If txtReadXMLRegEx.TextLength > 0 Then textValues(VAExtensions.App.KEY_REGEX) = txtReadXMLRegEx.Text
- If cboReadRSSDateMask.Text.Length > 0 AndAlso cboReadRSSDateMask.Text <> "" Then textValues(VAExtensions.App.KEY_RSSFORMAT) = cboReadRSSDateMask.Text
- If udReadRSSIndex.Value > 0 Then smallIntValues(VAExtensions.App.KEY_INDEX) = Convert.ToInt16(udReadRSSIndex.Value)
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
- End Sub
-
- Private Sub btnReadStdOutExecute_Click(sender As Object, e As EventArgs) Handles btnReadStdOutExecute.Click
- clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadStdOut)
- textValues(VAExtensions.App.KEY_FILE) = txtReadStdOutName.Text
- textValues(VAExtensions.App.KEY_ARGUMENTS) = txtReadStdOutArgs.Text
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- txtReadStdOutResult.Text = String.Format("Success:{0}{0}{1}", Environment.NewLine, textValues(VAExtensions.App.KEY_RESULT))
- End If
-
- End Sub
-
- Private Sub btnSpellTextExecute_Click(sender As Object, e As EventArgs) Handles btnSpellTextExecute.Click
- clearAllInput()
- txtSpellTextOUT.Clear()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.SpellText)
- textValues(VAExtensions.App.KEY_SPELL) = txtSpellTextIN.Text
-
- Dim result As String
- Do
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Exit Do
- Else
- result = textValues(VAExtensions.App.KEY_RESULT)
- txtSpellTextOUT.AppendText(String.Format("{1} ({2}){0}", Environment.NewLine, result, smallIntValues(VAExtensions.App.KEY_SPELLASCII)))
- End If
-
- Loop Until String.IsNullOrEmpty(result)
- End Sub
-
- Private Sub btnMath_Click(sender As Object, e As EventArgs) Handles btnMathXor.Click, btnMathSub.Click, btnMathOr.Click, btnMathMult.Click, btnMathMod.Click, btnMathMin.Click, btnMathMax.Click, btnMathDiv.Click, btnMathAnd.Click, btnMathAdd.Click
-
-
- clearAllInput()
-
- Dim mathContext As VAExtensions.ContextFactory.Contexts
- If sender Is btnMathAdd Then
- mathContext = VAExtensions.ContextFactory.Contexts.MathAdd
- ElseIf sender Is btnMathSub Then
- mathContext = VAExtensions.ContextFactory.Contexts.MathSubtract
- ElseIf sender Is btnMathMult Then
- mathContext = VAExtensions.ContextFactory.Contexts.MathMultiply
- ElseIf sender Is btnMathDiv Then
- mathContext = VAExtensions.ContextFactory.Contexts.MathDivide
- ElseIf sender Is btnMathMod Then
- mathContext = VAExtensions.ContextFactory.Contexts.MathMod
- ElseIf sender Is btnMathMin Then
- mathContext = VAExtensions.ContextFactory.Contexts.MathMin
- ElseIf sender Is btnMathMax Then
- mathContext = VAExtensions.ContextFactory.Contexts.MathMax
- ElseIf sender Is btnMathAnd Then
- mathContext = VAExtensions.ContextFactory.Contexts.BitAnd
- ElseIf sender Is btnMathOr Then
- mathContext = VAExtensions.ContextFactory.Contexts.BitOr
- ElseIf sender Is btnMathXor Then
- mathContext = VAExtensions.ContextFactory.Contexts.BitXOr
- End If
-
- contextName = VAExtensions.EnumInfoAttribute.GetTag(mathContext)
- For Each kvp As EditableKVP(Of Nullable(Of Int16)) In mathCond
- If Not String.IsNullOrEmpty(kvp.Key) AndAlso kvp.Value.HasValue Then smallIntValues.Add(kvp.Key, kvp.Value)
- Next
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- MessageBox.Show(smallIntValues(VAExtensions.App.KEY_RESULT).Value.ToString, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
- End Sub
-
- Private Sub btnRandomInit_Click(sender As Object, e As EventArgs) Handles btnRandomInit.Click
- clearAllInput()
- txtRandomOUT.Clear()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.RandomInit)
- smallIntValues(VAExtensions.App.KEY_RANGEMIN) = CType(udRandomMin.Value, Short?)
- smallIntValues(VAExtensions.App.KEY_RANGEMAX) = CType(udRandomMax.Value, Short?)
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
-
- End Sub
-
- Private Sub btnRandomNext_Click(sender As Object, e As EventArgs) Handles btnRandomNext.Click
- clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.RandomNext)
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- txtRandomOUT.AppendText(String.Format("{1}{0}", Environment.NewLine, smallIntValues(VAExtensions.App.KEY_RESULT)))
- End If
- End Sub
-
- Private Sub btnCountdownInit_Click(sender As Object, e As EventArgs) Handles btnCountdownInit.Click
- clearAllInput()
- txtCountdownOUT.Clear()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.Countdown)
- smallIntValues(txtCountdownName.Text) = CType(udCountdown.Value, Short?)
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
-
- End Sub
-
- Private Sub btnCountdownNext_Click(sender As Object, e As EventArgs) Handles btnCountdownNext.Click
-
- clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.Countdown)
- smallIntValues(txtCountdownName.Text) = CType(udCountdown.Value, Short?)
-
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- If smallIntValues(VAExtensions.App.KEY_RESULT).Value > 0 Then
- txtCountdownOUT.AppendText(String.Format("Still running: {1} seconds{0}", Environment.NewLine, smallIntValues(VAExtensions.App.KEY_RESULT)))
- Else
- txtCountdownOUT.AppendText(String.Format("Countdown complete{0}", Environment.NewLine, smallIntValues(VAExtensions.App.KEY_RESULT)))
- End If
- End If
- End Sub
-
- Private Sub btnINIReadWrite_Click(sender As Object, e As EventArgs) _
- Handles btnINIRead.Click, btnINIWrite.Click
-
- If sender Is btnINIRead Then
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadINI)
- Else
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.WriteINI)
- End If
- textValues(VAExtensions.App.KEY_FILE) = cboINIFile.Text
- textValues(VAExtensions.App.KEY_INI_SECTION) = txtINISection.Text
- For Each kvp As EditableKVP(Of String) In iniCond
- If Not String.IsNullOrEmpty(kvp.Key) Then
- textValues(VAExtensions.App.KEY_INI_KEY) = kvp.Key
- If sender Is btnINIWrite Then
- textValues(VAExtensions.App.KEY_ARGUMENTS) = kvp.Value
+ clearAllInput()
+ If cboShowFileName.Text.Length > 0 Then
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ShowFile)
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, cboShowFileName.Text)
+ ElseIf txtShowFileTextVar.TextLength > 0 Then
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ShowText)
+ proxyReplica.SetText(VAExtensions.App.KEY_ARGUMENTS, txtShowFileTextVar.Text)
+ End If
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ End If
+ End Sub
+
+ Private Sub btnReadRSSExecute_Click(sender As Object, e As EventArgs) Handles btnReadRSSExecute.Click
+ clearAllInput()
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadRSS)
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, cboReadRSSName.Text)
+ proxyReplica.SetText(VAExtensions.App.KEY_ARGUMENTS, cboReadRSSArgs.Text)
+ If txtReadXMLRegEx.TextLength > 0 Then proxyReplica.SetText(VAExtensions.App.KEY_REGEX, txtReadXMLRegEx.Text)
+ If cboReadRSSDateMask.Text.Length > 0 AndAlso cboReadRSSDateMask.Text <> "" Then proxyReplica.SetText(VAExtensions.App.KEY_RSSFORMAT, cboReadRSSDateMask.Text)
+ If udReadRSSIndex.Value > 0 Then proxyReplica.SetSmallInt(VAExtensions.App.KEY_INDEX, Convert.ToInt16(udReadRSSIndex.Value))
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End If
+ End Sub
+
+ Private Sub btnReadStdOutExecute_Click(sender As Object, e As EventArgs) Handles btnReadStdOutExecute.Click
+ clearAllInput()
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadStdOut)
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, txtReadStdOutName.Text)
+ proxyReplica.SetText(VAExtensions.App.KEY_ARGUMENTS, txtReadStdOutArgs.Text)
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ txtReadStdOutResult.Text = String.Format("Success:{0}{0}{1}", Environment.NewLine, proxyReplica.GetText(VAExtensions.App.KEY_RESULT))
+ End If
+
+ End Sub
+
+ Private Sub btnSpellTextExecute_Click(sender As Object, e As EventArgs) Handles btnSpellTextExecute.Click
+ clearAllInput()
+ txtSpellTextOUT.Clear()
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.SpellText)
+ proxyReplica.SetText(VAExtensions.App.KEY_SPELL, txtSpellTextIN.Text)
+
+ Dim result As String
+ Do
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Exit Do
+ Else
+ result = proxyReplica.GetText(VAExtensions.App.KEY_RESULT)
+ txtSpellTextOUT.AppendText(String.Format("{1} ({2}){0}", Environment.NewLine, result, proxyReplica.GetSmallInt(VAExtensions.App.KEY_SPELLASCII)))
End If
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ Loop Until String.IsNullOrEmpty(result)
+ End Sub
+
+ Private Sub btnRandomInit_Click(sender As Object, e As EventArgs) Handles btnRandomInit.Click
+ clearAllInput()
+ txtRandomOUT.Clear()
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.RandomInit)
+ proxyReplica.SetSmallInt(VAExtensions.App.KEY_RANGEMIN, CType(udRandomMin.Value, Short?))
+ proxyReplica.SetSmallInt(VAExtensions.App.KEY_RANGEMAX, CType(udRandomMax.Value, Short?))
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End If
+
+ End Sub
+
+ Private Sub btnRandomNext_Click(sender As Object, e As EventArgs) Handles btnRandomNext.Click
+ clearAllInput()
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.RandomNext)
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ txtRandomOUT.AppendText(String.Format("{1}{0}", Environment.NewLine, proxyReplica.GetSmallInt(VAExtensions.App.KEY_RESULT)))
+ End If
+ End Sub
+
+ Private Sub btnCountdownInit_Click(sender As Object, e As EventArgs) Handles btnCountdownInit.Click
+ clearAllInput()
+ txtCountdownOUT.Clear()
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.TimerStart)
+ proxyReplica.SetInt(cboCountdownName.Text, CType(udCountdown.Value, Integer?))
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End If
+
+ End Sub
+
+ Private Sub btnCountdownNext_Click(sender As Object, e As EventArgs) Handles btnCountdownNext.Click
+
+ clearAllInput()
+ Dim resultKey As String = cboCountdownName.Text.replace(VAExtensions.App.KEY_TIMER, VAExtensions.App.KEY_TIMER_RESULT)
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.TimerCheck)
+ proxyReplica.SetInt(cboCountdownName.Text, CType(udCountdown.Value, Integer?))
+
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ If proxyReplica.GetInt(resultKey).HasValue AndAlso proxyReplica.GetInt(resultKey).Value > 0 Then
+ txtCountdownOUT.AppendText(String.Format("Still running: {1} seconds{0}", Environment.NewLine, proxyReplica.GetInt(resultKey)))
Else
- kvp.Value = textValues(VAExtensions.App.KEY_RESULT)
+ txtCountdownOUT.AppendText(String.Format("Countdown complete{0}", Environment.NewLine))
End If
- End If
- Next
- rebindINIGrid()
- End Sub
+ End If
+ End Sub
+
+ Private Sub btnINIReadWrite_Click(sender As Object, e As EventArgs) _
+ Handles btnINIRead.Click, btnINIWrite.Click
+
+ If sender Is btnINIRead Then
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadINI)
+ Else
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.WriteINI)
+ End If
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, cboINIFile.Text)
+ proxyReplica.SetText(VAExtensions.App.KEY_INI_SECTION, txtINISection.Text)
+ For Each kvp As EditableKVP(Of String) In iniCond
+ If Not String.IsNullOrEmpty(kvp.Key) Then
+ proxyReplica.SetText(VAExtensions.App.KEY_INI_KEY, kvp.Key)
+ If sender Is btnINIWrite Then
+ proxyReplica.SetText(VAExtensions.App.KEY_ARGUMENTS, kvp.Value)
+ End If
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Else
+ kvp.Value = proxyReplica.GetText(VAExtensions.App.KEY_RESULT)
+ End If
+ End If
+ Next
+ rebindINIGrid()
+ End Sub
Private Sub btnLoadCSVExecute_Click(sender As Object, e As EventArgs) Handles btnLoadCSVExecute.Click
clearAllInput()
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.LoadCSV)
- textValues(VAExtensions.App.KEY_FILE) = cboReadCSVName.Text
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.LoadCSV)
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, cboReadCSVName.Text)
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
- MessageBox.Show(String.Format("{0} rows and {1} columns", intValues(VAExtensions.App.KEY_ROWSCOUNT), intValues(VAExtensions.App.KEY_COLSCOUNT)), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ MessageBox.Show(String.Format("{0} rows and {1} columns", proxyReplica.GetInt(VAExtensions.App.KEY_ROWSCOUNT), proxyReplica.GetInt(VAExtensions.App.KEY_COLSCOUNT)), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub btnReadCSVExecute_Click(sender As Object, e As EventArgs) Handles btnReadCSVExecute.Click
clearAllInput()
- textValues(VAExtensions.App.KEY_FILE) = cboReadCSVName.Text
+ proxyReplica.SetText(VAExtensions.App.KEY_FILE, cboReadCSVName.Text)
Dim colIndex As Integer
If Int32.TryParse(txtReadCSVCol.Text, colIndex) Then
- intValues(VAExtensions.App.KEY_COL) = colIndex
+ proxyReplica.SetInt(VAExtensions.App.KEY_COL, colIndex)
Else
- textValues(VAExtensions.App.KEY_COL) = txtReadCSVCol.Text
+ proxyReplica.SetText(VAExtensions.App.KEY_COL, txtReadCSVCol.Text)
End If
If optReadCSVByIndex.Checked Then
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadCSV)
- If udReadCSVRow.Value >= 0 Then intValues(VAExtensions.App.KEY_ROW) = Convert.ToInt32(udReadCSVRow.Value)
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.ReadCSV)
+ If udReadCSVRow.Value >= 0 Then proxyReplica.SetInt(VAExtensions.App.KEY_ROW, Convert.ToInt32(udReadCSVRow.Value))
Else
- contextName = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.SearchCSV)
- textValues(VAExtensions.App.KEY_ARGUMENTS) = txtReadCSVSearch.Text
+ proxyReplica.Context = VAExtensions.EnumInfoAttribute.GetTag(VAExtensions.ContextFactory.Contexts.SearchCSV)
+ proxyReplica.SetText(VAExtensions.App.KEY_ARGUMENTS, txtReadCSVSearch.Text)
End If
- VAExtensions.VoiceAttack.VA_Invoke1(contextName, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- If smallIntValues(VAExtensions.App.KEY_ERROR).Value <> 0 Then
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ VAExtensions.VoiceAttack.VA_Invoke1(proxyReplica)
+ If proxyReplica.GetSmallInt(VAExtensions.App.KEY_ERROR).Value <> 0 Then
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
- MessageBox.Show(textValues(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ MessageBox.Show(proxyReplica.GetText(VAExtensions.App.KEY_RESULT), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
diff --git a/TestApp/TestApp.vbproj b/TestApp/TestApp.vbproj
index 24ee16d..0f56413 100644
--- a/TestApp/TestApp.vbproj
+++ b/TestApp/TestApp.vbproj
@@ -89,6 +89,7 @@
Settings.settings
True
+
diff --git a/TestApp/VAProxyReplica.vb b/TestApp/VAProxyReplica.vb
new file mode 100644
index 0000000..0245a7c
--- /dev/null
+++ b/TestApp/VAProxyReplica.vb
@@ -0,0 +1,138 @@
+Public Class VAProxyReplica
+ Public Context As String
+
+ Public SessionState As New Dictionary(Of String, Object)
+
+ Private smallIntValues As Dictionary(Of String, Nullable(Of Int16)) = New Dictionary(Of String, Nullable(Of Int16))
+ Private textValues As Dictionary(Of String, String) = New Dictionary(Of String, String)
+ Private intValues As Dictionary(Of String, Nullable(Of Integer)) = New Dictionary(Of String, Nullable(Of Integer))
+ Private decimalValues As Dictionary(Of String, Nullable(Of Decimal)) = New Dictionary(Of String, Nullable(Of Decimal))
+ Private booleanValues As Dictionary(Of String, Nullable(Of Boolean)) = New Dictionary(Of String, Nullable(Of Boolean))
+ Private dateTimeValues As Dictionary(Of String, Nullable(Of DateTime)) = New Dictionary(Of String, Nullable(Of DateTime))
+ Private extendedValues As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
+
+#Region "Values Get/set"
+
+ Public Function GetText(ByVal variableName As String) As String
+ If textValues.ContainsKey(variableName) Then
+ Return textValues(variableName)
+ Else
+ Return Nothing
+ End If
+ End Function
+
+ Public Sub SetText(ByVal variableName As String, ByVal value As String)
+ If textValues.ContainsKey(variableName) Then textValues.Remove(variableName)
+ If value IsNot Nothing Then textValues.Add(variableName, value)
+ End Sub
+
+ Public Function GetSmallInt(ByVal variableName As String) As Nullable(Of Int16)
+ If smallIntValues.ContainsKey(variableName) Then
+ Return smallIntValues(variableName)
+ Else
+ Return Nothing
+ End If
+ End Function
+
+ Public Sub SetSmallInt(ByVal variableName As String, ByVal value As Nullable(Of Int16))
+ If smallIntValues.ContainsKey(variableName) Then smallIntValues.Remove(variableName)
+ If value.HasValue Then smallIntValues.Add(variableName, value)
+ End Sub
+
+ Public Function GetInt(ByVal variableName As String) As Nullable(Of Int32)
+ If intValues.ContainsKey(variableName) Then
+ Return intValues(variableName)
+ Else
+ Return Nothing
+ End If
+ End Function
+
+ Public Sub SetInt(ByVal variableName As String, ByVal value As Nullable(Of Int32))
+ If intValues.ContainsKey(variableName) Then intValues.Remove(variableName)
+ If value.HasValue Then intValues.Add(variableName, value)
+ End Sub
+
+ Public Function GetDecimal(ByVal variableName As String) As Nullable(Of Decimal)
+ If decimalValues.ContainsKey(variableName) Then
+ Return decimalValues(variableName)
+ Else
+ Return Nothing
+ End If
+ End Function
+
+ Public Sub SetDecimal(ByVal variableName As String, ByVal value As Nullable(Of Decimal))
+ If decimalValues.ContainsKey(variableName) Then decimalValues.Remove(variableName)
+ If value.HasValue Then decimalValues.Add(variableName, value)
+ End Sub
+
+ Public Function GetBoolean(ByVal variableName As String) As Nullable(Of Boolean)
+ If booleanValues.ContainsKey(variableName) Then
+ Return booleanValues(variableName)
+ Else
+ Return Nothing
+ End If
+ End Function
+
+ Public Sub SetBoolean(ByVal variableName As String, ByVal value As Nullable(Of Boolean))
+ If booleanValues.ContainsKey(variableName) Then booleanValues.Remove(variableName)
+ If value.HasValue Then booleanValues.Add(variableName, value)
+ End Sub
+
+ Public Function GetDateTime(ByVal variableName As String) As Nullable(Of DateTime)
+ If dateTimeValues.ContainsKey(variableName) Then
+ Return dateTimeValues(variableName)
+ Else
+ Return Nothing
+ End If
+ End Function
+
+ Public Sub SetDateTime(ByVal variableName As String, ByVal value As Nullable(Of DateTime))
+ If dateTimeValues.ContainsKey(variableName) Then dateTimeValues.Remove(variableName)
+ dateTimeValues.Add(variableName, value)
+ End Sub
+#End Region
+
+#Region "Misc"
+ Public Function ProxyVersion() As System.Version
+ Return New System.Version(4, 0, 0, 0)
+ End Function
+
+ Public Function VAVersion() As System.Version
+ Return New System.Version(1, 5, 7, 3)
+ End Function
+
+ Public Function GetProfileName() As String
+ Return "TestApp profile"
+ End Function
+
+ Public Function CommandExists(ByVal name As String) As Boolean
+ Return True
+ End Function
+
+ Public Sub ExecuteCommand(ByVal name As String)
+ Return
+ End Sub
+
+ Public Sub WriteToLog(ByVal value As String, color As String)
+ Debug.WriteLine(String.Format("[VA LOG {0}({1})]", value, color))
+ End Sub
+
+ Public Function ParseTokens(ByVal name As String) As String
+ Return String.Empty
+ End Function
+#End Region
+
+#Region "** Not included in VA interface"
+ Public Sub ClearAllInput()
+ 'SessionState is left untouched
+ smallIntValues.Clear()
+ textValues.Clear()
+ intValues.Clear()
+ decimalValues.Clear()
+ booleanValues.Clear()
+ dateTimeValues.Clear()
+ extendedValues.Clear()
+ End Sub
+#End Region
+
+End Class
diff --git a/VAExtensions/App.vb b/VAExtensions/App.vb
index 308c39b..357f03e 100644
--- a/VAExtensions/App.vb
+++ b/VAExtensions/App.vb
@@ -22,6 +22,8 @@
Public Const KEY_DB_COLUMNS As String = "VxDBColumns"
Public Const KEY_DB_WHERE As String = "VxDBWhere"
+ Public Const KEY_TIMER As String = "VxTimer" 'VxTimer0, VxTimer1, etc.
+ Public Const KEY_TIMER_RESULT As String = "VxTimerResult" 'VxTimerResult0, VxTimerResult1, etc.
Public Const KEY_RANGEMIN As String = "VxRangeMin" '"VAMathRangeMin"
Public Const KEY_RANGEMAX As String = "VxRangeMax" '"VAMathRangeMax"
diff --git a/VAExtensions/ContextHandlers/ContextFactory.vb b/VAExtensions/ContextHandlers/ContextFactory.vb
index 09dcc1d..81fd5f5 100644
--- a/VAExtensions/ContextHandlers/ContextFactory.vb
+++ b/VAExtensions/ContextHandlers/ContextFactory.vb
@@ -42,22 +42,6 @@
DeleteDB
-
-
- MathAdd
-
- MathSubtract
-
- MathMultiply
-
- MathDivide
-
- MathMod
-
- MathMax
-
- MathMin
-
BitAnd
@@ -65,8 +49,10 @@
BitXOr
-
- Countdown
+
+ TimerStart
+
+ TimerCheck
RandomInit
@@ -81,59 +67,49 @@
SupportedContexts.AddRange(EnumInfoAttribute.ToSimpleList(Of Contexts))
End Sub
- Public Shared Function Create(ByVal contextName As String, ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object)) As ContextHandlerBase
+ Public Shared Function Create(vaProxy As Object) As ContextHandlerBase
Dim result As ContextHandlerBase = Nothing
For Each c As Contexts In SupportedContexts
- If String.Compare(EnumInfoAttribute.GetTag(c), contextName, True) = 0 Then
+ If String.Compare(EnumInfoAttribute.GetTag(c), vaProxy.Context, True) = 0 Then
Select Case c
Case Contexts.Config
- result = New ContextHandlerInfoDialog(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerInfoDialog(c, vaProxy)
Case Contexts.ReadFile
- result = New ContextHandlerReadFile(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerReadFile(c, vaProxy)
Case Contexts.ReadXml
- result = New ContextHandlerReadXML(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerReadXML(c, vaProxy)
Case Contexts.ReadJSON
- result = New ContextHandlerReadJSON(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerReadJSON(c, vaProxy)
Case Contexts.ReadRSS
- result = New ContextHandlerReadRSS(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerReadRSS(c, vaProxy)
Case Contexts.LoadCSV, Contexts.ReadCSV, Contexts.SearchCSV
- result = New ContextHandlerReadCSV(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerReadCSV(c, vaProxy)
Case Contexts.ShowFile, Contexts.ShowText
- result = New ContextHandlerShowFile(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerShowFile(c, vaProxy)
Case Contexts.SpellText
- result = New ContextHandlerSpellText(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerSpellText(c, vaProxy)
Case Contexts.ReadStdOut
- result = New ContextHandlerReadStdOut(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerReadStdOut(c, vaProxy)
Case Contexts.ReadINI
- result = New ContextHandlerReadINI(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerReadINI(c, vaProxy)
Case Contexts.WriteINI
- result = New ContextHandlerWriteINI(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
-
- Case Contexts.MathAdd, Contexts.MathSubtract, Contexts.MathMultiply, Contexts.MathDivide _
- , Contexts.MathMod, Contexts.MathMin, Contexts.MathMax, Contexts.BitAnd, Contexts.BitOr, Contexts.BitXOr
- result = New ContextHandlerMath(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerWriteINI(c, vaProxy)
Case Contexts.RandomInit, Contexts.RandomNext
- result = New ContextHandlerRandom(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- Case Contexts.Countdown
- result = New ContextHandlerCountdown(c, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ result = New ContextHandlerRandom(c, vaProxy)
+ Case Contexts.TimerStart, Contexts.TimerCheck
+ result = New ContextHandlerCountdown(c, vaProxy)
End Select
Exit For
diff --git a/VAExtensions/ContextHandlers/ContextHandlerBase.vb b/VAExtensions/ContextHandlers/ContextHandlerBase.vb
index d0e2708..f1b1d22 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerBase.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerBase.vb
@@ -1,35 +1,15 @@
Public MustInherit Class ContextHandlerBase
- Public Const ERR_CONTEXT As Int16 = 1
- Public Const ERR_IO As Int16 = 2
- Public Const ERR_ARGUMENTS As Int16 = 3
+ Public Const ERR_CONTEXT As Int16 = 1
+ Public Const ERR_IO As Int16 = 2
+ Public Const ERR_ARGUMENTS As Int16 = 3
- Protected m_Context As ContextFactory.Contexts
- Protected m_State As Dictionary(Of String, Object)
- Protected m_smallIntValues As Dictionary(Of String, Nullable(Of Short))
- Protected m_TextValues As Dictionary(Of String, String)
- Protected m_intValues As Dictionary(Of String, Nullable(Of Integer))
- Protected m_decimalValues As Dictionary(Of String, Nullable(Of Decimal))
- Protected m_booleanValues As Dictionary(Of String, Nullable(Of Boolean))
- Protected m_ExtendedValues As Dictionary(Of String, Object)
+ Protected Context As ContextFactory.Contexts
+ Protected VAProxy As Object
- Public Sub New(ByVal context As ContextFactory.Contexts, ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ Me.Context = context
+ Me.VAProxy = vaProxy
+ End Sub
-
- m_Context = context
- m_State = state
- m_smallIntValues = smallIntValues
- m_TextValues = textValues
- m_intValues = intValues
- m_decimalValues = decimalValues
- m_booleanValues = booleanValues
- m_ExtendedValues = extendedValues
- End Sub
-
- Public MustOverride Function Execute() As Boolean
+ Public MustOverride Function Execute() As Boolean
End Class
diff --git a/VAExtensions/ContextHandlers/ContextHandlerCountdown.vb b/VAExtensions/ContextHandlers/ContextHandlerCountdown.vb
index 7e0f782..aa45bf4 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerCountdown.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerCountdown.vb
@@ -1,51 +1,63 @@
Public Class ContextHandlerCountdown
- Inherits ContextHandlerBase
-
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- End Sub
-
-
- Public Overrides Function Execute() As Boolean
-
- If m_smallIntValues.Count = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = "At least a numeric condition is needed to manage the countdown."
- Return False
- Else
- Dim lastRun, thisRun As DateTime, diff As TimeSpan
- Dim result As Integer
- Dim countDown As Short
- Dim countdownName As String
-
- thisRun = Now
- countdownName = "count_" & m_smallIntValues.Keys(0)
- countDown = m_smallIntValues(m_smallIntValues.Keys(0)).Value
-
- If m_State.ContainsKey(countdownName) Then
- lastRun = CType(m_State(countdownName), DateTime)
- diff = thisRun - lastRun
- If diff.TotalSeconds < countDown Then
- result = CInt(countDown - diff.TotalSeconds)
- Else
- m_State(countdownName) = thisRun
- result = 0
+ Inherits ContextHandlerBase
+
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
+ End Sub
+
+ Public Overrides Function Execute() As Boolean
+
+ Dim countDownList As New Dictionary(Of String, Int32)
+ Dim key As String
+ Dim i As Integer
+
+ 'Since the new VAProxy interface expose every possible INT value in the profile, we don't know how many 'VxCountdown' token are present,
+ 'and how many were intended for this specific call; for now, we allow a fixed number of 10
+ For i = 0 To 9
+ key = String.Format("{0}{1}", App.KEY_TIMER, i)
+ If VAProxy.GetInt(key) IsNot Nothing Then
+ countDownList.Add(key, VAProxy.GetInt(key).Value)
End If
- Else
- m_State(countdownName) = thisRun
- result = 0
- End If
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(result)
- End If
-
- Return True
- End Function
+ Next
+
+ If countDownList.Count = 0 Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("At least a numeric condition '{0}' is needed to manage the timer.", App.KEY_TIMER))
+ Return False
+ Else
+ Dim lastRun, thisRun As DateTime, diff As TimeSpan
+ Dim result As Integer
+ Dim timerValue As Integer
+ Dim timerName As String
+
+ thisRun = Now
+ For Each kvp As KeyValuePair(Of String, Int32) In countDownList
+ timerName = kvp.Key
+ timerValue = kvp.Value
+
+ If Context = ContextFactory.Contexts.TimerStart Then
+ VAProxy.SessionState(timerName) = thisRun
+ Else
+ If VAProxy.SessionState.ContainsKey(timerName) Then
+ lastRun = CType(VAProxy.SessionState(timerName), DateTime)
+ diff = thisRun - lastRun
+ If diff.TotalSeconds < timerValue Then
+ result = CInt(timerValue - diff.TotalSeconds)
+ Else
+ VAProxy.SessionState(timerName) = Nothing 'timer expired
+ result = 0
+ End If
+ VAProxy.SetSmallInt(App.KEY_ERROR, 0)
+ VAProxy.SetInt(timerName.Replace(App.KEY_TIMER, App.KEY_TIMER_RESULT), result)
+ Else
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Timer '{0}' is not running.", timerName))
+ Return False
+ End If
+ End If
+ Next
+ End If
+
+ Return True
+ End Function
End Class
diff --git a/VAExtensions/ContextHandlers/ContextHandlerDB.vb b/VAExtensions/ContextHandlers/ContextHandlerDB.vb
index e1b89cc..c2f15a8 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerDB.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerDB.vb
@@ -1,99 +1,90 @@
Public Class ContextHandlerDB
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
End Sub
-
Public Overrides Function Execute() As Boolean
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown database name. Text variable '{0}' not set.", App.KEY_FILE)
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown database name. Text variable '{0}' not set.", App.KEY_FILE))
Return False
End If
- Dim dbFile As String = m_TextValues(App.KEY_FILE)
+ Dim dbFile As String = VAProxy.GetText(App.KEY_FILE)
If Not IO.Path.IsPathRooted(dbFile) Then
dbFile = IO.Path.Combine(App.LibraryFolder, dbFile)
End If
If Not IO.File.Exists(dbFile) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Database '{0}' not found.", dbFile)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Database '{0}' not found.", dbFile))
Return False
End If
Dim db As New SQLiteHelper(dbFile)
Dim table, columns, where As String
- Select Case m_Context
+ Select Case Context
Case ContextFactory.Contexts.ReadDB
- If Not m_TextValues.ContainsKey(App.KEY_DB_TABLE) OrElse Not m_TextValues.ContainsKey(App.KEY_DB_COLUMNS) OrElse Not m_TextValues.ContainsKey(App.KEY_DB_WHERE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = "'Table', 'Columns' and 'Where' arguments are required."
+ If VAProxy.GetText(App.KEY_DB_TABLE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("The '{0}', variable is required.", App.KEY_DB_TABLE))
Return False
Else
- table = m_TextValues(App.KEY_DB_TABLE)
- If m_TextValues.ContainsKey(App.KEY_DB_COLUMNS) Then
- columns = m_TextValues(App.KEY_DB_COLUMNS)
+ table = VAProxy.GetText(App.KEY_DB_TABLE)
+ If VAProxy.GetText(App.KEY_DB_COLUMNS) IsNot Nothing Then
+ columns = VAProxy.GetText(App.KEY_DB_COLUMNS)
Else
columns = "*"
End If
- If m_TextValues.ContainsKey(App.KEY_DB_WHERE) Then
- where = " WHERE " & m_TextValues(App.KEY_DB_WHERE)
+ If VAProxy.GetText(App.KEY_DB_WHERE) IsNot Nothing Then
+ where = " WHERE " & VAProxy.GetText(App.KEY_DB_WHERE)
Else
where = String.Empty
End If
End If
- Dim result As Data.DataTable = db.GetDataTable("SELECT {0} FROM {1}{2}", columns, table, where)
+ Dim result As Data.DataTable = db.GetDataTable("SELECT {0} FROM {1}{2}", columns, table, where)
If result Is Nothing Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Database error: '{0}'.", db.LastMessage)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Database error: '{0}'.", db.LastMessage))
Return False
Else
- m_TextValues(App.KEY_RESULT) = result.Rows(0).Item(0).ToString
+ VAProxy.SetText(App.KEY_RESULT, result.Rows(0).Item(0).ToString)
Return True
End If
Case ContextFactory.Contexts.InsertDB
- If Not m_TextValues.ContainsKey(App.KEY_DB_TABLE) OrElse Not m_TextValues.ContainsKey(App.KEY_DB_COLUMNS) OrElse Not m_TextValues.ContainsKey(App.KEY_ARGUMENTS) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = "'Table', 'Columns' and 'Args' arguments are required."
+ If VAProxy.GetText(App.KEY_DB_TABLE) Is Nothing OrElse VAProxy.GetText(App.KEY_DB_COLUMNS) Is Nothing OrElse VAProxy.GetText(App.KEY_ARGUMENTS) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("The '{0}', '{1}' and '{2}' arguments are required.", App.KEY_DB_TABLE, App.KEY_DB_COLUMNS, App.KEY_ARGUMENTS))
Return False
End If
Dim values As New Dictionary(Of String, String)
Dim tempCol(), tempVal() As String
- tempCol = Split(m_TextValues(App.KEY_DB_COLUMNS), ",")
- tempVal = Split(m_TextValues(App.KEY_ARGUMENTS), ",")
+ tempCol = Split(VAProxy.GetText(App.KEY_DB_COLUMNS), ",")
+ tempVal = Split(VAProxy.GetText(App.KEY_ARGUMENTS), ",")
If tempCol.GetLength(0) <> tempVal.GetLength(0) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = "'Columns' and 'Args' must have teh same number of values."
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("'{0}' and '{2}' must have the same number of values.", App.KEY_DB_COLUMNS, App.KEY_ARGUMENTS))
Return False
End If
For i As Integer = 0 To tempCol.GetUpperBound(0)
values.Add(tempCol(i), tempVal(i))
Next
- If Not db.Insert(m_TextValues(App.KEY_DB_TABLE), values) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Database error: '{0}'.", db.LastMessage)
+ If Not db.Insert(VAProxy.GetText(App.KEY_DB_TABLE), values) Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Database error: '{0}'.", db.LastMessage))
Return False
Else
'Primary key/Auto increment column?
Dim rowID As Integer
- If Integer.TryParse(db.ExecuteScalar(String.Format("SELECT last_insert_rowid() AS rowid FROM {0} LIMIT 1", m_TextValues(App.KEY_DB_TABLE))), rowID) Then
- m_intValues(App.KEY_INDEX) = rowID
+ If Integer.TryParse(db.ExecuteScalar(String.Format("SELECT last_insert_rowid() AS rowid FROM {0} LIMIT 1", VAProxy.GetText(App.KEY_DB_TABLE))), rowID) Then
+ VAProxy.SetInt(App.KEY_INDEX, rowID)
End If
Return True
diff --git a/VAExtensions/ContextHandlers/ContextHandlerINI.vb b/VAExtensions/ContextHandlers/ContextHandlerINI.vb
new file mode 100644
index 0000000..e5d8547
--- /dev/null
+++ b/VAExtensions/ContextHandlers/ContextHandlerINI.vb
@@ -0,0 +1,99 @@
+Public Class ContextHandlerReadINI
+ Inherits ContextHandlerBase
+
+ Private Declare Auto Function GetPrivateProfileString Lib "kernel32.dll" (ByVal lpAppName As String, _
+ ByVal lpKeyName As String, _
+ ByVal lpDefault As String, _
+ ByVal lpReturnedString As System.Text.StringBuilder, _
+ ByVal nSize As Integer, _
+ ByVal lpFileName As String) As Integer
+
+
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
+ End Sub
+
+ Public Overrides Function Execute() As Boolean
+
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
+ Return False
+ End If
+
+ If VAProxy.GetText(App.KEY_INI_SECTION) Is Nothing OrElse VAProxy.GetText(App.KEY_INI_KEY) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Both '{0}' and '{1}' arguments are required.", App.KEY_INI_SECTION, App.KEY_INI_KEY))
+ Return False
+ End If
+
+ Dim iniFile As String = VAProxy.GetText(App.KEY_FILE)
+
+ If Not IO.Path.IsPathRooted(iniFile) Then
+ iniFile = IO.Path.Combine(App.LibraryFolder, iniFile)
+ End If
+
+ If Not IO.File.Exists(iniFile) Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("File '{0}' not found.", iniFile))
+ Return False
+ End If
+
+ Dim resultSB As New Text.StringBuilder(512)
+ Dim result As Integer = GetPrivateProfileString(VAProxy.GetText(App.KEY_INI_SECTION), VAProxy.GetText(App.KEY_INI_KEY), String.Empty, resultSB, resultSB.Capacity, iniFile)
+
+ If result = 0 Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Key '{0}' not found in section '{1}'.", VAProxy.GetText(App.KEY_INI_KEY), VAProxy.GetText(App.KEY_INI_SECTION)))
+ Return False
+ Else
+ VAProxy.SetText(App.KEY_RESULT, resultSB.ToString)
+ Return True
+ End If
+ End Function
+End Class
+
+Public Class ContextHandlerWriteINI
+ Inherits ContextHandlerBase
+
+ Private Declare Auto Function WritePrivateProfileString Lib "kernel32.dll" (ByVal lpAppName As String _
+ , ByVal lpKeyName As String _
+ , ByVal lpString As String _
+ , ByVal lpFileName As String) As Integer
+
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
+ End Sub
+
+ Public Overrides Function Execute() As Boolean
+
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
+ Return False
+ End If
+
+ If VAProxy.GetText(App.KEY_INI_SECTION) Is Nothing OrElse VAProxy.GetText(App.KEY_INI_KEY) Is Nothing OrElse VAProxy.GetText(App.KEY_ARGUMENTS) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("A '{0}', '{1}' and '{2}' arguments are required.", App.KEY_INI_SECTION, App.KEY_INI_KEY, App.KEY_ARGUMENTS))
+ Return False
+ End If
+
+ Dim iniFile As String = VAProxy.GetText(App.KEY_FILE)
+
+ If Not IO.Path.IsPathRooted(iniFile) Then
+ iniFile = IO.Path.Combine(App.LibraryFolder, iniFile)
+ End If
+
+ Dim result As Integer
+ result = WritePrivateProfileString(VAProxy.GetText(App.KEY_INI_SECTION), VAProxy.GetText(App.KEY_INI_KEY), VAProxy.GetText(App.KEY_ARGUMENTS), iniFile)
+ If result = 0 Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, "Error writing INI value.")
+ Return False
+ Else
+ Return True
+ End If
+
+ End Function
+End Class
\ No newline at end of file
diff --git a/VAExtensions/ContextHandlers/ContextHandlerInfoDialog.vb b/VAExtensions/ContextHandlers/ContextHandlerInfoDialog.vb
index cd7a6f2..d0b98d7 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerInfoDialog.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerInfoDialog.vb
@@ -1,20 +1,11 @@
Public Class ContextHandlerInfoDialog
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
+ End Sub
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- End Sub
-
-
- Public Overrides Function Execute() As Boolean
+ Public Overrides Function Execute() As Boolean
Dim f As New InfoForm
f.ShowDialog()
diff --git a/VAExtensions/ContextHandlers/ContextHandlerMath.vb b/VAExtensions/ContextHandlers/ContextHandlerMath.vb
deleted file mode 100644
index 595b379..0000000
--- a/VAExtensions/ContextHandlers/ContextHandlerMath.vb
+++ /dev/null
@@ -1,99 +0,0 @@
-Public Class ContextHandlerMath
- Inherits ContextHandlerBase
-
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- End Sub
-
-
- Public Overrides Function Execute() As Boolean
- Dim factors As New List(Of Integer)
- Dim i, mathResult As Integer
-
- For Each k As String In m_smallIntValues.Keys
- If k <> App.KEY_ERROR AndAlso k <> App.KEY_RESULT AndAlso m_smallIntValues(k).HasValue Then
- factors.Add(m_smallIntValues(k).Value)
- End If
- Next
- If factors.Count < 2 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Not enough values in the m_Conditions list: count={0}.", factors.Count)
- Return False
- End If
-
- Select Case m_Context
- Case ContextFactory.Contexts.MathAdd
- mathResult = factors(0)
- For i = 1 To factors.Count - 1
- mathResult += factors(i)
- Next
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.MathSubtract
- mathResult = factors(0)
- For i = 1 To factors.Count - 1
- mathResult -= factors(i)
- Next
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.MathMultiply
- mathResult = factors(0)
- For i = 1 To factors.Count - 1
- mathResult *= factors(i)
- Next
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.MathDivide
- '(Integer division)
- mathResult = factors(0)
- For i = 1 To factors.Count - 1
- If factors(i) <> 0 Then mathResult \= factors(i)
- Next
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.MathMod
- mathResult = factors(0)
- For i = 1 To factors.Count - 1
- mathResult = mathResult Mod factors(i)
- Next
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.MathMin
- mathResult = factors(0)
- For i = 1 To factors.Count - 1
- If factors(i) < mathResult Then mathResult = factors(i)
- Next
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.MathMax
- mathResult = factors(0)
- For i = 1 To factors.Count - 1
- If factors(i) > mathResult Then mathResult = factors(i)
- Next
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.BitAnd
- mathResult = factors(0) And factors(1)
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.BitOr
- mathResult = factors(0) Or factors(1)
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- Case ContextFactory.Contexts.BitXOr
- mathResult = factors(0) Xor factors(1)
- m_smallIntValues(App.KEY_RESULT) = Convert.ToInt16(mathResult)
-
- End Select
-
- Return True
- End Function
-End Class
diff --git a/VAExtensions/ContextHandlers/ContextHandlerRandom.vb b/VAExtensions/ContextHandlers/ContextHandlerRandom.vb
index ecc3be9..ab150d9 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerRandom.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerRandom.vb
@@ -1,68 +1,59 @@
Public Class ContextHandlerRandom
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
End Sub
-
Public Overrides Function Execute() As Boolean
- Dim numbers() As Int16
- Select Case m_Context
+ Dim numbers() As Int32
+ Select Case Context
Case ContextFactory.Contexts.RandomInit
- If Not m_smallIntValues.ContainsKey(App.KEY_RANGEMIN) OrElse Not m_smallIntValues.ContainsKey(App.KEY_RANGEMAX) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Both min and max range values are needed (set {0} and {1} conditions).", App.KEY_RANGEMIN, App.KEY_RANGEMAX)
+ If VAProxy.GetInt(App.KEY_RANGEMIN) Is Nothing OrElse VAProxy.GetInt(App.KEY_RANGEMAX) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Both min and max range values are needed (set {0} and {1} conditions).", App.KEY_RANGEMIN, App.KEY_RANGEMAX))
Return False
Else
- Dim numberList As New List(Of Int16)
- For n As Int16 = m_smallIntValues(App.KEY_RANGEMIN).Value To m_smallIntValues(App.KEY_RANGEMAX).Value
+ Dim numberList As New List(Of Int32)
+ For n As Int16 = VAProxy.GetInt(App.KEY_RANGEMIN).Value To VAProxy.GetInt(App.KEY_RANGEMAX).Value
numberList.Add(n)
Next
numbers = numberList.OrderBy(Function(s) Guid.NewGuid()).ToArray
- m_State.Remove(App.KEY_RANDOMLIST)
- m_State.Remove(App.KEY_CURRENTIDX)
- m_State.Add(App.KEY_RANDOMLIST, numbers)
+ VAProxy.SessionState.Remove(App.KEY_RANDOMLIST)
+ VAProxy.SessionState.Remove(App.KEY_CURRENTIDX)
+ VAProxy.SessionState.Add(App.KEY_RANDOMLIST, numbers)
End If
Case ContextFactory.Contexts.RandomShuffle
- If Not m_State.ContainsKey(App.KEY_RANDOMLIST) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Random list not initialized (call {0} first).", EnumInfoAttribute.GetTag(ContextFactory.Contexts.RandomInit))
+ If Not VAProxy.SessionState.ContainsKey(App.KEY_RANDOMLIST) Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Random list not initialized (call {0} first).", EnumInfoAttribute.GetTag(ContextFactory.Contexts.RandomInit)))
Return False
Else
- numbers = CType(m_State(App.KEY_RANDOMLIST), Short())
+ numbers = CType(VAProxy.SessionState(App.KEY_RANDOMLIST), Integer())
numbers.OrderBy(Function(s) Guid.NewGuid())
- m_State.Remove(App.KEY_RANDOMLIST)
- m_State.Remove(App.KEY_CURRENTIDX)
- m_State.Add(App.KEY_RANDOMLIST, numbers)
+ VAProxy.SessionState.Remove(App.KEY_RANDOMLIST)
+ VAProxy.SessionState.Remove(App.KEY_CURRENTIDX)
+ VAProxy.SessionState.Add(App.KEY_RANDOMLIST, numbers)
End If
Case ContextFactory.Contexts.RandomNext
- If Not m_State.ContainsKey(App.KEY_RANDOMLIST) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Random list not initialized (call {0} first).", EnumInfoAttribute.GetTag(ContextFactory.Contexts.RandomInit))
+ If Not VAProxy.SessionState.ContainsKey(App.KEY_RANDOMLIST) Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Random list not initialized (call {0} first).", EnumInfoAttribute.GetTag(ContextFactory.Contexts.RandomInit)))
Return False
Else
- numbers = CType(m_State(App.KEY_RANDOMLIST), Short())
+ numbers = CType(VAProxy.SessionState(App.KEY_RANDOMLIST), Integer())
Dim currentIndex As Int16
- If m_State.ContainsKey(App.KEY_CURRENTIDX) Then
- currentIndex = Convert.ToInt16(m_State(App.KEY_CURRENTIDX))
+ If VAProxy.SessionState.ContainsKey(App.KEY_CURRENTIDX) Then
+ currentIndex = Convert.ToInt16(VAProxy.SessionState(App.KEY_CURRENTIDX))
If currentIndex > numbers.GetUpperBound(0) Then currentIndex = 0
Else
currentIndex = 0
End If
- m_smallIntValues(App.KEY_RESULT) = numbers(currentIndex)
+ VAProxy.SetInt(App.KEY_RESULT) = numbers(currentIndex)
currentIndex += 1S
- m_State(App.KEY_CURRENTIDX) = currentIndex
+ VAProxy.SessionState(App.KEY_CURRENTIDX) = currentIndex
End If
End Select
diff --git a/VAExtensions/ContextHandlers/ContextHandlerReadCSV.vb b/VAExtensions/ContextHandlers/ContextHandlerReadCSV.vb
index c38463a..b007383 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerReadCSV.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerReadCSV.vb
@@ -5,55 +5,47 @@ Public Class ContextHandlerReadCSV
Private Shared CSVStorage As New Dictionary(Of String, DataTable)
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
End Sub
Public Overrides Function Execute() As Boolean
Dim newFile As DownloadedFile = Nothing
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
Return False
End If
- Select Case m_Context
+ Select Case Context
Case ContextFactory.Contexts.LoadCSV
Try
- newFile = App.DownloadFile(m_TextValues(App.KEY_FILE))
+ newFile = App.DownloadFile(VAProxy.GetText(App.KEY_FILE))
If newFile.LocalPath.Length = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error retrieving File '{0}'.", m_TextValues(App.KEY_FILE))
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error retrieving File '{0}'.", VAProxy.GetText(App.KEY_FILE)))
Return False
End If
Dim delimiter As String
- If m_TextValues.ContainsKey(App.KEY_DELIMITER) Then
- delimiter = m_TextValues(App.KEY_DELIMITER)
+ If VAProxy.GetText(App.KEY_DELIMITER) IsNot Nothing Then
+ delimiter = VAProxy.GetText(App.KEY_DELIMITER)
Else
delimiter = String.Empty
End If
- If CSVStorage.ContainsKey(m_TextValues(App.KEY_FILE)) Then CSVStorage.Remove(m_TextValues(App.KEY_FILE))
+ If CSVStorage.ContainsKey(VAProxy.GetText(App.KEY_FILE)) Then CSVStorage.Remove(VAProxy.GetText(App.KEY_FILE))
Dim newTable As DataTable = getDataTableFromCSVFile(newFile.LocalPath, delimiter)
If newTable IsNot Nothing Then
- CSVStorage.Add(m_TextValues(App.KEY_FILE), newTable)
+ CSVStorage.Add(VAProxy.GetText(App.KEY_FILE), newTable)
- m_intValues(App.KEY_ROWSCOUNT) = newTable.Rows.Count
- m_intValues(App.KEY_COLSCOUNT) = newTable.Columns.Count
+ VAProxy.SetInt(App.KEY_ROWSCOUNT, newTable.Rows.Count)
+ VAProxy.SetInt(App.KEY_COLSCOUNT, newTable.Columns.Count)
End If
Catch ex As Exception
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error loading file content '{0}' ({1}).", m_TextValues(App.KEY_FILE), ex.Message)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error loading file content '{0}' ({1}).", VAProxy.GetText(App.KEY_FILE), ex.Message))
Return False
End Try
If newFile.IsTemporary Then App.Settings.AddDownloadedFile(newFile)
@@ -64,81 +56,81 @@ Public Class ContextHandlerReadCSV
Dim dataRow As DataRow
Dim dataCol As DataColumn
- If Not CSVStorage.ContainsKey(m_TextValues(App.KEY_FILE)) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("CSV file not loaded. Use '{0}' function first.", EnumInfoAttribute.GetTag(ContextFactory.Contexts.LoadCSV))
+ If Not CSVStorage.ContainsKey(VAProxy.GetText(App.KEY_FILE)) Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("CSV file not loaded. Use '{0}' function first.", EnumInfoAttribute.GetTag(ContextFactory.Contexts.LoadCSV)))
Return False
Else
- table = CSVStorage.Item(m_TextValues(App.KEY_FILE))
+ table = CSVStorage.Item(VAProxy.GetText(App.KEY_FILE))
End If
dataCol = Nothing
- If Not m_intValues.ContainsKey(App.KEY_COL) Then
- If Not m_TextValues.ContainsKey(App.KEY_COL) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("No column specified. variable '{0}' not set.", App.KEY_COL)
+ If VAProxy.GetInt(App.KEY_COL) Is Nothing Then
+ If VAProxy.GetText(App.KEY_COL) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("No column specified. variable '{0}' not set.", App.KEY_COL))
Return False
End If
For i As Integer = 0 To table.Columns.Count - 1
- If String.Compare(table.Columns(i).ColumnName, m_TextValues(App.KEY_COL), True) = 0 Then
+ If String.Compare(table.Columns(i).ColumnName, VAProxy.GetText(App.KEY_COL), True) = 0 Then
dataCol = table.Columns(i)
Exit For
End If
Next
Else
- If m_intValues(App.KEY_COL).Value <= 0 OrElse m_intValues(App.KEY_COL).Value > table.Columns.Count Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Invalid column name/index. The loaded CSV contains '{0}' columns.", table.Columns.Count)
+ If VAProxy.GetInt(App.KEY_COL) <= 0 OrElse VAProxy.GetInt(App.KEY_COL) > table.Columns.Count Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Invalid column name/index. The loaded CSV contains '{0}' columns.", table.Columns.Count))
Return False
End If
- dataCol = table.Columns(m_intValues(App.KEY_COL).Value - 1)
+ dataCol = table.Columns(VAProxy.GetInt(App.KEY_COL) - 1)
End If
If dataCol Is Nothing Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Invalid column name/index. The loaded CSV contains '{0}' columns.", table.Columns.Count)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Invalid column name/index. The loaded CSV contains '{0}' columns.", table.Columns.Count))
Return False
End If
- If m_Context = ContextFactory.Contexts.ReadCSV Then
- If Not m_intValues.ContainsKey(App.KEY_ROW) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("No row specified. variable '{0}' not set.", App.KEY_ROW)
+ If Context = ContextFactory.Contexts.ReadCSV Then
+ If VAProxy.GetInt(App.KEY_ROW) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("No row specified. variable '{0}' not set.", App.KEY_ROW))
Return False
End If
- row = m_intValues(App.KEY_ROW).Value - 1
+ row = VAProxy.GetInt(App.KEY_ROW) - 1
If table.Rows.Count <= row Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Invalid row. The loaded CSV contains '{0}' elements.", table.Rows.Count)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Invalid row. The loaded CSV contains '{0}' elements.", table.Rows.Count))
Return False
End If
dataRow = table.Rows.Item(row)
- m_TextValues(App.KEY_RESULT) = App.LimitResponse(Convert.ToString(dataRow.Item(dataCol.Ordinal)))
+ VAProxy.SetText(App.KEY_RESULT, App.LimitResponse(Convert.ToString(dataRow.Item(dataCol.Ordinal))))
Else
- If Not m_TextValues.ContainsKey(App.KEY_ARGUMENTS) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("No search value specified. variable '{0}' not set.", App.KEY_ARGUMENTS)
+ If VAProxy.GetText(App.KEY_ARGUMENTS) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("No search value specified. variable '{0}' not set.", App.KEY_ARGUMENTS))
Return False
End If
'We need the index here, so we can't use .Select() but we iterate instead
Dim foundIndex As Integer = -1
For i As Integer = 0 To table.Rows.Count - 1
- If String.Compare(Convert.ToString(table.Rows(i).Item(dataCol.Ordinal)), m_TextValues(App.KEY_ARGUMENTS), True) = 0 Then
+ If String.Compare(Convert.ToString(table.Rows(i).Item(dataCol.Ordinal)), VAProxy.GetText(App.KEY_ARGUMENTS), True) = 0 Then
foundIndex = i
Exit For
End If
Next
If foundIndex >= 0 Then
- m_intValues(App.KEY_ROW) = foundIndex + 1
- m_TextValues(App.KEY_RESULT) = m_intValues(App.KEY_ROW).ToString
+ VAProxy.SetInt(App.KEY_ROW, foundIndex + 1)
+ VAProxy.SetText(App.KEY_RESULT, (foundIndex + 1).ToString)
Else
- m_intValues(App.KEY_ROW) = 0
- m_TextValues(App.KEY_RESULT) = "Value not found at specified column"
+ VAProxy.SetInt(App.KEY_ROW, 0)
+ VAProxy.SetText(App.KEY_RESULT, "Value not found at specified column")
End If
End If
End Select
@@ -178,8 +170,8 @@ Public Class ContextHandlerReadCSV
Return csvData
Catch ex As Exception
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error parsing csv file content '{0}' ({1}).", m_TextValues(App.KEY_FILE), ex.Message)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error parsing csv file content '{0}' ({1}).", VAProxy.GetText(App.KEY_FILE), ex.Message))
Return Nothing
End Try
End Function
diff --git a/VAExtensions/ContextHandlers/ContextHandlerReadFile.vb b/VAExtensions/ContextHandlers/ContextHandlerReadFile.vb
index fa480ed..c942b37 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerReadFile.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerReadFile.vb
@@ -1,49 +1,40 @@
Public Class ContextHandlerReadFile
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
End Sub
-
Public Overrides Function Execute() As Boolean
Dim newFile As DownloadedFile = Nothing
Dim regexPattern As String
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
Return False
End If
- If m_TextValues.ContainsKey(App.KEY_REGEX) Then
- regexPattern = m_TextValues(App.KEY_REGEX)
+ If VAProxy.GetText(App.KEY_REGEX) IsNot Nothing Then
+ regexPattern = VAProxy.GetText(App.KEY_REGEX)
Else
regexPattern = String.Empty
End If
Try
- newFile = App.DownloadFile(m_TextValues(App.KEY_FILE))
+ newFile = App.DownloadFile(VAProxy.GetText(App.KEY_FILE))
If newFile.LocalPath.Length = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error retrieving File '{0}'.", m_TextValues(App.KEY_FILE))
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error retrieving File '{0}'.", VAProxy.GetText(App.KEY_FILE)))
Return False
End If
'Dim newFileContent As String = IO.File.ReadAllText(newFile.LocalPath)
Dim newFileContent As String = App.ReadTextFile(newFile.LocalPath)
- m_TextValues(App.KEY_RESULT) = App.LimitResponse(newFileContent, regexPattern)
+ VAProxy.SetText(App.KEY_RESULT, App.LimitResponse(newFileContent, regexPattern))
Catch ex As Exception
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error loading file content '{0}' ({1}).", m_TextValues(App.KEY_FILE), ex.Message)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error loading file content '{0}' ({1}).", VAProxy.GetText(App.KEY_FILE), ex.Message))
End Try
If newFile.IsTemporary Then App.Settings.AddDownloadedFile(newFile)
diff --git a/VAExtensions/ContextHandlers/ContextHandlerReadINI.vb b/VAExtensions/ContextHandlers/ContextHandlerReadINI.vb
deleted file mode 100644
index 2a11152..0000000
--- a/VAExtensions/ContextHandlers/ContextHandlerReadINI.vb
+++ /dev/null
@@ -1,63 +0,0 @@
-Public Class ContextHandlerReadINI
- Inherits ContextHandlerBase
-
- Private Declare Auto Function GetPrivateProfileString Lib "kernel32.dll" (ByVal lpAppName As String, _
- ByVal lpKeyName As String, _
- ByVal lpDefault As String, _
- ByVal lpReturnedString As System.Text.StringBuilder, _
- ByVal nSize As Integer, _
- ByVal lpFileName As String) As Integer
-
-
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- End Sub
-
-
- Public Overrides Function Execute() As Boolean
-
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
- Return False
- End If
-
- If Not m_TextValues.ContainsKey(App.KEY_INI_SECTION) OrElse Not m_TextValues.ContainsKey(App.KEY_INI_KEY) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = "Both a 'Section' and a 'Key' arguments are required."
- Return False
- End If
-
- Dim iniFile As String = m_TextValues(App.KEY_FILE)
-
- If Not IO.Path.IsPathRooted(iniFile) Then
- iniFile = IO.Path.Combine(App.LibraryFolder, iniFile)
- End If
-
- If Not IO.File.Exists(iniFile) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("File '{0}' not found.", iniFile)
- Return False
- End If
-
- Dim resultSB As New Text.StringBuilder(512)
- Dim result As Integer = GetPrivateProfileString(m_TextValues(App.KEY_INI_SECTION), m_TextValues(App.KEY_INI_KEY), String.Empty, resultSB, resultSB.Capacity, iniFile)
-
- If result = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Key '{0}' not found in section '{1}'.", m_TextValues(App.KEY_INI_KEY), m_TextValues(App.KEY_INI_SECTION))
- Return False
- Else
- m_TextValues(App.KEY_RESULT) = resultSB.ToString
- Return True
- End If
- End Function
-End Class
diff --git a/VAExtensions/ContextHandlers/ContextHandlerReadJSON.vb b/VAExtensions/ContextHandlers/ContextHandlerReadJSON.vb
index a357793..882da7a 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerReadJSON.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerReadJSON.vb
@@ -3,47 +3,38 @@
Public Class ContextHandlerReadJSON
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
End Sub
-
Public Overrides Function Execute() As Boolean
Dim newFile As DownloadedFile = Nothing
Dim regexPattern As String
Dim elementPath As String
Dim elementCount As Short
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_CONTEXT
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
Return False
End If
- If m_TextValues.ContainsKey(App.KEY_REGEX) Then
- regexPattern = m_TextValues(App.KEY_REGEX)
+ If VAProxy.GetText(App.KEY_REGEX) IsNot Nothing Then
+ regexPattern = VAProxy.GetText(App.KEY_REGEX)
Else
regexPattern = String.Empty
End If
- If m_TextValues.ContainsKey(App.KEY_ARGUMENTS) AndAlso Not String.IsNullOrEmpty(m_TextValues(App.KEY_ARGUMENTS)) Then
- elementPath = m_TextValues(App.KEY_ARGUMENTS)
+ If Not String.IsNullOrEmpty(VAProxy.GetText(App.KEY_ARGUMENTS)) Then
+ elementPath = VAProxy.GetText(App.KEY_ARGUMENTS)
Else
elementPath = String.Empty
End If
Try
- newFile = App.DownloadFile(m_TextValues(App.KEY_FILE))
+ newFile = App.DownloadFile(VAProxy.GetText(App.KEY_FILE))
If newFile.LocalPath.Length = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error retrieving File '{0}'.", m_TextValues(App.KEY_FILE))
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error retrieving File '{0}'.", VAProxy.GetText(App.KEY_FILE)))
Return False
End If
@@ -51,16 +42,16 @@ Public Class ContextHandlerReadJSON
Dim token As Json.Linq.JToken = jobj.SelectToken(elementPath)
If token IsNot Nothing Then
- m_TextValues(App.KEY_RESULT) = App.LimitResponse(token.ToString, regexPattern)
- m_smallIntValues(App.KEY_INDEX) = elementCount + 1S
+ VAProxy.SetText(App.KEY_RESULT, App.LimitResponse(token.ToString, regexPattern))
+ VAProxy.SetSmallInt(App.KEY_INDEX, elementCount + 1S)
Else
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Element not found: '{0}'", m_TextValues(App.KEY_ARGUMENTS))
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Element not found: '{0}'", elementPath))
End If
Catch ex As Exception
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error reading JSON: {0}", ex.Message)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error reading JSON: {0}", ex.Message))
Return False
End Try
If newFile.IsTemporary Then App.Settings.AddDownloadedFile(newFile)
diff --git a/VAExtensions/ContextHandlers/ContextHandlerReadRSS.vb b/VAExtensions/ContextHandlers/ContextHandlerReadRSS.vb
index 651fdad..b76db74 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerReadRSS.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerReadRSS.vb
@@ -1,97 +1,89 @@
Public Class ContextHandlerReadRSS
- Inherits ContextHandlerBase
+ Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
+ End Sub
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- End Sub
+ Public Overrides Function Execute() As Boolean
+ Dim newFile As DownloadedFile = Nothing
+ Dim regexPattern As String
+ Dim i As Integer, elementCount As Short
+ Dim reader As Xml.XmlReader
+ Dim feed As System.ServiceModel.Syndication.SyndicationFeed
-
- Public Overrides Function Execute() As Boolean
- Dim newFile As DownloadedFile = Nothing
- Dim regexPattern As String
- Dim i As Integer, elementCount As Short
- Dim reader As Xml.XmlReader
- Dim feed As System.ServiceModel.Syndication.SyndicationFeed
-
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_CONTEXT
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
- Return False
- End If
- If Not m_smallIntValues.ContainsKey(App.KEY_INDEX) OrElse Not m_smallIntValues(App.KEY_INDEX).HasValue OrElse m_smallIntValues(App.KEY_INDEX).Value < 1 Then
- elementCount = 1
- Else
- elementCount = m_smallIntValues(App.KEY_INDEX).Value
- End If
- If m_TextValues.ContainsKey(App.KEY_REGEX) Then
- regexPattern = m_TextValues(App.KEY_REGEX)
- Else
- regexPattern = String.Empty
- End If
-
- Try
- newFile = App.DownloadFile(m_TextValues(App.KEY_FILE))
- If newFile.LocalPath.Length = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error retrieving File '{0}'.", m_TextValues(App.KEY_FILE))
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
Return False
- End If
+ End If
+ If VAProxy.GetSmallInt(App.KEY_INDEX) Is Nothing OrElse VAProxy.GetSmallInt(App.KEY_INDEX).Value < 1 Then
+ elementCount = 1
+ Else
+ elementCount = VAProxy.GetSmallInt(App.KEY_INDEX).Value
+ End If
+ If VAProxy.GetText(App.KEY_REGEX) IsNot Nothing Then
+ regexPattern = VAProxy.GetText(App.KEY_REGEX)
+ Else
+ regexPattern = String.Empty
+ End If
- If m_TextValues.ContainsKey(App.KEY_RSSFORMAT) AndAlso Not String.IsNullOrEmpty(m_TextValues(App.KEY_RSSFORMAT)) Then
- DateFixXmlReader.CustomUtcDateTimeFormat = m_TextValues(App.KEY_RSSFORMAT)
- End If
- reader = New DateFixXmlReader(newFile.LocalPath)
- feed = System.ServiceModel.Syndication.SyndicationFeed.Load(reader)
- reader.Close()
+ Try
+ newFile = App.DownloadFile(VAProxy.GetText(App.KEY_FILE))
+ If newFile.LocalPath.Length = 0 Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error retrieving File '{0}'.", VAProxy.GetText(App.KEY_FILE)))
+ Return False
+ End If
- If feed IsNot Nothing AndAlso feed.Items IsNot Nothing Then
- Dim sortedList As IEnumerable(Of System.ServiceModel.Syndication.SyndicationItem) = feed.Items.OrderByDescending(Function(itm) itm.PublishDate)
- Dim itemSummary As System.ServiceModel.Syndication.TextSyndicationContent
+ If Not String.IsNullOrEmpty(VAProxy.GetText(App.KEY_RSSFORMAT)) Then
+ DateFixXmlReader.CustomUtcDateTimeFormat = VAProxy.GetText(App.KEY_RSSFORMAT)
+ End If
+ reader = New DateFixXmlReader(newFile.LocalPath)
+ feed = System.ServiceModel.Syndication.SyndicationFeed.Load(reader)
+ reader.Close()
- i = 1
- For Each item As System.ServiceModel.Syndication.SyndicationItem In sortedList
- If item.Summary IsNot Nothing Then
- itemSummary = item.Summary
- ElseIf item.Content IsNot Nothing AndAlso TypeOf item.Content Is System.ServiceModel.Syndication.TextSyndicationContent Then
- itemSummary = DirectCast(item.Content, System.ServiceModel.Syndication.TextSyndicationContent)
- Else
- itemSummary = New System.ServiceModel.Syndication.TextSyndicationContent("No summary found")
- End If
+ If feed IsNot Nothing AndAlso feed.Items IsNot Nothing Then
+ Dim sortedList As IEnumerable(Of System.ServiceModel.Syndication.SyndicationItem) = feed.Items.OrderByDescending(Function(itm) itm.PublishDate)
+ Dim itemSummary As System.ServiceModel.Syndication.TextSyndicationContent
+ Dim result As String = String.Empty
- If String.IsNullOrEmpty(m_TextValues(App.KEY_ARGUMENTS)) Then
- m_TextValues(App.KEY_RESULT) = item.Title.Text
- ElseIf m_TextValues(App.KEY_ARGUMENTS).ToLower = "title" Then
- m_TextValues(App.KEY_RESULT) = item.Title.Text
- ElseIf m_TextValues(App.KEY_ARGUMENTS).ToLower = "summary" Then
- m_TextValues(App.KEY_RESULT) = itemSummary.Text
- ElseIf m_TextValues(App.KEY_ARGUMENTS).ToLower = "title&summary" Then
- m_TextValues(App.KEY_RESULT) = String.Format("{0}. {1}", item.Title.Text, itemSummary.Text)
- End If
- i += 1
- If i > elementCount Then Exit For
- Next
- m_TextValues(App.KEY_RESULT) = App.LimitResponse(m_TextValues(App.KEY_RESULT), regexPattern)
- m_smallIntValues(App.KEY_INDEX) = elementCount + 1S
- Else
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Element not found: '{0}'", m_TextValues(App.KEY_ARGUMENTS))
- End If
+ i = 1
+ For Each item As System.ServiceModel.Syndication.SyndicationItem In sortedList
+ If item.Summary IsNot Nothing Then
+ itemSummary = item.Summary
+ ElseIf item.Content IsNot Nothing AndAlso TypeOf item.Content Is System.ServiceModel.Syndication.TextSyndicationContent Then
+ itemSummary = DirectCast(item.Content, System.ServiceModel.Syndication.TextSyndicationContent)
+ Else
+ itemSummary = New System.ServiceModel.Syndication.TextSyndicationContent("No summary found")
+ End If
- Catch ex As Exception
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error reading XML: {0}", ex.Message)
- Return False
- End Try
- If newFile.IsTemporary Then App.Settings.AddDownloadedFile(newFile)
+ If String.IsNullOrEmpty(VAProxy.GetText(App.KEY_ARGUMENTS)) Then
+ result = item.Title.Text
+ ElseIf VAProxy.GetText(App.KEY_ARGUMENTS).ToLower = "title" Then
+ result = item.Title.Text
+ ElseIf VAProxy.GetText(App.KEY_ARGUMENTS).ToLower = "summary" Then
+ result = itemSummary.Text
+ ElseIf VAProxy.GetText(App.KEY_ARGUMENTS).ToLower = "title&summary" Then
+ result = String.Format("{0}. {1}", item.Title.Text, itemSummary.Text)
+ End If
+ i += 1
+ If i > elementCount Then Exit For
+ Next
+ VAProxy.SetText(App.KEY_RESULT, App.LimitResponse(result, regexPattern))
+ VAProxy.SetSmallInt(App.KEY_INDEX) = elementCount + 1S
+ Else
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Element not found: '{0}'", VAProxy.GetText(App.KEY_ARGUMENTS)))
+ End If
+
+ Catch ex As Exception
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error reading XML: {0}", ex.Message))
+ Return False
+ End Try
+ If newFile.IsTemporary Then App.Settings.AddDownloadedFile(newFile)
- Return True
- End Function
+ Return True
+ End Function
End Class
diff --git a/VAExtensions/ContextHandlers/ContextHandlerReadStdOut.vb b/VAExtensions/ContextHandlers/ContextHandlerReadStdOut.vb
index 4a179fd..11a78bb 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerReadStdOut.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerReadStdOut.vb
@@ -1,30 +1,21 @@
Public Class ContextHandlerReadStdOut
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
End Sub
-
Public Overrides Function Execute() As Boolean
Dim newFile As DownloadedFile = Nothing
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_CONTEXT
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
Return False
End If
Try
- Dim pName As String = m_TextValues(App.KEY_FILE)
+ Dim pName As String = VAProxy.GetText(App.KEY_FILE)
Dim pInfo As ProcessStartInfo
Dim pOutput As String
Dim p As Process
@@ -33,18 +24,18 @@
pName = IO.Path.Combine(IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly.Location), pName)
End If
pInfo = New ProcessStartInfo(pName) With {.UseShellExecute = False, .CreateNoWindow = True, .RedirectStandardOutput = True}
- If Not String.IsNullOrEmpty(m_TextValues(App.KEY_ARGUMENTS)) Then
- pInfo.Arguments = m_TextValues(App.KEY_ARGUMENTS)
+ If Not String.IsNullOrEmpty(VAProxy.GetText(App.KEY_ARGUMENTS)) Then
+ pInfo.Arguments = VAProxy.GetText(App.KEY_ARGUMENTS)
End If
p = Process.Start(pInfo)
pOutput = p.StandardOutput.ReadToEnd
p.WaitForExit()
- m_TextValues(App.KEY_RESULT) = App.LimitResponse(pOutput)
+ VAProxy.SetText(App.KEY_RESULT, App.LimitResponse(pOutput))
Catch ex As Exception
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error running process '{0}' - {1}.", m_TextValues(App.KEY_FILE), ex.Message)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error running process '{0}' - {1}.", VAProxy.GetText(App.KEY_FILE), ex.Message))
Return False
End Try
diff --git a/VAExtensions/ContextHandlers/ContextHandlerReadXML.vb b/VAExtensions/ContextHandlers/ContextHandlerReadXML.vb
index 654c7f9..951efed 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerReadXML.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerReadXML.vb
@@ -1,52 +1,43 @@
Public Class ContextHandlerReadXML
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
End Sub
-
Public Overrides Function Execute() As Boolean
Dim newFile As DownloadedFile = Nothing
Dim regexPattern As String
Dim elementPath As String()
Dim i As Integer, elementCount As Short
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_CONTEXT
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
Return False
End If
- If m_TextValues.ContainsKey(App.KEY_REGEX) Then
- regexPattern = m_TextValues(App.KEY_REGEX)
+ If VAProxy.GetText(App.KEY_REGEX) IsNot Nothing Then
+ regexPattern = VAProxy.GetText(App.KEY_REGEX)
Else
regexPattern = String.Empty
End If
- If m_TextValues.ContainsKey(App.KEY_ARGUMENTS) AndAlso Not String.IsNullOrEmpty(m_TextValues(App.KEY_ARGUMENTS)) Then
- elementPath = m_TextValues(App.KEY_ARGUMENTS).Split("\"c)
+ If VAProxy.GetText(App.KEY_ARGUMENTS) IsNot Nothing AndAlso VAProxy.GetText(App.KEY_ARGUMENTS).Length > 0 Then
+ elementPath = VAProxy.GetText(App.KEY_ARGUMENTS).Split("\"c)
Else
elementPath = {}
End If
- If Not m_smallIntValues.ContainsKey(App.KEY_INDEX) OrElse Not m_smallIntValues(App.KEY_INDEX).HasValue OrElse m_smallIntValues(App.KEY_INDEX).Value < 1 Then
+ If VAProxy.GetSmallInt(App.KEY_INDEX) Is Nothing OrElse VAProxy.GetSmallInt(App.KEY_INDEX).Value < 1 Then
elementCount = 1
Else
- elementCount = m_smallIntValues(App.KEY_INDEX).Value
+ elementCount = VAProxy.GetSmallInt(App.KEY_INDEX).Value
End If
Try
- newFile = App.DownloadFile(m_TextValues(App.KEY_FILE))
+ newFile = App.DownloadFile(VAProxy.GetText(App.KEY_FILE))
If newFile.LocalPath.Length = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error retrieving File '{0}'.", m_TextValues(App.KEY_FILE))
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error retrieving File '{0}'.", VAProxy.GetText(App.KEY_FILE)))
Return False
End If
@@ -60,19 +51,19 @@
If xElement1 IsNot Nothing AndAlso xElement1.Value IsNot Nothing Then
i = 1
For Each el As Xml.Linq.XElement In xElement1
- m_TextValues(App.KEY_RESULT) = el.Value
+ VAProxy.SetText(App.KEY_RESULT, el.Value)
i += 1
If i > elementCount Then Exit For
Next
- m_TextValues(App.KEY_RESULT) = App.LimitResponse(m_TextValues(App.KEY_RESULT), regexPattern)
- m_smallIntValues(App.KEY_INDEX) = elementCount + 1S
+ VAProxy.SetSmallInt(App.KEY_INDEX, elementCount + 1S)
+ VAProxy.SetText(App.KEY_RESULT, App.LimitResponse(VAProxy.GetText(App.KEY_RESULT), regexPattern))
Else
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Element not found: '{0}'", m_TextValues(App.KEY_ARGUMENTS))
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Element not found: '{0}'", VAProxy.GetText(App.KEY_ARGUMENTS)))
End If
Catch ex As Exception
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error reading XML: {0}", ex.Message)
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error reading XML: {0}", ex.Message))
Return False
End Try
If newFile.IsTemporary Then App.Settings.AddDownloadedFile(newFile)
diff --git a/VAExtensions/ContextHandlers/ContextHandlerShowFile.vb b/VAExtensions/ContextHandlers/ContextHandlerShowFile.vb
index 64ea5c0..3d092c7 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerShowFile.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerShowFile.vb
@@ -1,49 +1,40 @@
Public Class ContextHandlerShowFile
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
End Sub
-
Public Overrides Function Execute() As Boolean
Dim newFile As DownloadedFile = Nothing
Dim textVar As String = Nothing
- If m_Context = ContextFactory.Contexts.ShowFile Then
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_CONTEXT
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
+ If Context = ContextFactory.Contexts.ShowFile Then
+ If VAProxy.GetText(App.KEY_FILE) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE))
Return False
End If
Try
- newFile = App.DownloadFile(m_TextValues(App.KEY_FILE))
+ newFile = App.DownloadFile(VAProxy.GetText(App.KEY_FILE))
If newFile.LocalPath.Length = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error retrieving File '{0}'.", m_TextValues(App.KEY_FILE))
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error retrieving File '{0}'.", VAProxy.GetText(App.KEY_FILE)))
Return False
End If
Catch ex As Exception
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = String.Format("Error loading file content '{0}'.", m_TextValues(App.KEY_FILE))
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_IO)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Error loading file content '{0}'.", VAProxy.GetText(App.KEY_FILE)))
Return False
End Try
- ElseIf m_Context = ContextFactory.Contexts.ShowText Then
- If m_TextValues.Count = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = "At least one text value is needed."
+ ElseIf Context = ContextFactory.Contexts.ShowText Then
+ If VAProxy.GetText(App.KEY_ARGUMENTS) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Text variable '{0}' not set.", App.KEY_ARGUMENTS))
Return False
Else
- textVar = m_TextValues(m_TextValues.Keys(0))
+ textVar = VAProxy.GetText(App.KEY_ARGUMENTS)
End If
End If
diff --git a/VAExtensions/ContextHandlers/ContextHandlerSpellText.vb b/VAExtensions/ContextHandlers/ContextHandlerSpellText.vb
index bfbd51b..dc9fbb2 100644
--- a/VAExtensions/ContextHandlers/ContextHandlerSpellText.vb
+++ b/VAExtensions/ContextHandlers/ContextHandlerSpellText.vb
@@ -1,34 +1,29 @@
Public Class ContextHandlerSpellText
Inherits ContextHandlerBase
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
+ Public Sub New(ByVal context As ContextFactory.Contexts, vaProxy As Object)
+ MyBase.New(context, vaProxy)
+ End Sub
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- End Sub
+ Public Overrides Function Execute() As Boolean
+ If VAProxy.GetText(App.KEY_SPELL) Is Nothing Then
+ VAProxy.SetSmallInt(App.KEY_ERROR, ERR_ARGUMENTS)
+ VAProxy.SetText(App.KEY_RESULT, String.Format("Text value '{0}' not set", App.KEY_SPELL))
+ Return False
+ Else
+ Dim currentText As String = VAProxy.GetText(App.KEY_SPELL)
+ Dim nextText As String
- Public Overrides Function Execute() As Boolean
-
- If Not m_TextValues.ContainsKey(App.KEY_SPELL) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Text value '{0}' not set", App.KEY_SPELL)
- Return False
- Else
- If String.IsNullOrEmpty(m_TextValues(App.KEY_SPELL)) Then
- m_TextValues(App.KEY_RESULT) = String.Empty
- m_smallIntValues(App.KEY_SPELLASCII) = 0
- Else
- m_TextValues(App.KEY_RESULT) = m_TextValues(App.KEY_SPELL).Substring(0, 1)
- m_TextValues(App.KEY_SPELL) = m_TextValues(App.KEY_SPELL).Substring(1, m_TextValues(App.KEY_SPELL).Length - 1)
- m_smallIntValues(App.KEY_SPELLASCII) = Text.Encoding.ASCII.GetBytes(m_TextValues(App.KEY_RESULT))(0)
- End If
+ If currentText.Length = 0 Then
+ VAProxy.SetText(App.KEY_RESULT, String.Empty)
+ VAProxy.SetSmallInt(App.KEY_SPELLASCII, 0)
+ Else
+ nextText = currentText.Substring(0, 1)
+ VAProxy.SetText(App.KEY_RESULT, nextText)
+ VAProxy.SetText(App.KEY_SPELL, currentText.Substring(1, currentText.Length - 1))
+ VAProxy.SetSmallInt(App.KEY_SPELLASCII, Text.Encoding.ASCII.GetBytes(nextText)(0))
+ End If
End If
Return True
diff --git a/VAExtensions/ContextHandlers/ContextHandlerWriteINI.vb b/VAExtensions/ContextHandlers/ContextHandlerWriteINI.vb
deleted file mode 100644
index 1840eb9..0000000
--- a/VAExtensions/ContextHandlers/ContextHandlerWriteINI.vb
+++ /dev/null
@@ -1,53 +0,0 @@
-Public Class ContextHandlerWriteINI
- Inherits ContextHandlerBase
-
- Private Declare Auto Function WritePrivateProfileString Lib "kernel32.dll" (ByVal lpAppName As String _
- , ByVal lpKeyName As String _
- , ByVal lpString As String _
- , ByVal lpFileName As String) As Integer
-
- Public Sub New(ByVal context As ContextFactory.Contexts _
- , ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
-
- MyBase.New(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
- End Sub
-
-
- Public Overrides Function Execute() As Boolean
-
- If Not m_TextValues.ContainsKey(App.KEY_FILE) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = String.Format("Unknown file name. Text variable '{0}' not set.", App.KEY_FILE)
- Return False
- End If
-
- If Not m_TextValues.ContainsKey(App.KEY_INI_SECTION) OrElse Not m_TextValues.ContainsKey(App.KEY_ARGUMENTS) Then
- m_smallIntValues(App.KEY_ERROR) = ERR_ARGUMENTS
- m_TextValues(App.KEY_RESULT) = "A 'Section', 'Key' and 'Args' arguments are required."
- Return False
- End If
-
- Dim iniFile As String = m_TextValues(App.KEY_FILE)
-
- If Not IO.Path.IsPathRooted(iniFile) Then
- iniFile = IO.Path.Combine(App.LibraryFolder, iniFile)
- End If
-
- Dim result As Integer
- result = WritePrivateProfileString(m_TextValues(App.KEY_INI_SECTION), m_TextValues(App.KEY_INI_KEY), m_TextValues(App.KEY_ARGUMENTS), iniFile)
- If result = 0 Then
- m_smallIntValues(App.KEY_ERROR) = ERR_IO
- m_TextValues(App.KEY_RESULT) = "Error writing INI value."
- Return False
- Else
- Return True
- End If
-
- End Function
-End Class
diff --git a/VAExtensions/Profiles/VAExtentions INI Sample-Profile.vap b/VAExtensions/Profiles/VAExtentions INI Sample-Profile.vap
index b23c0ae..93d2a1f 100644
--- a/VAExtensions/Profiles/VAExtentions INI Sample-Profile.vap
+++ b/VAExtensions/Profiles/VAExtentions INI Sample-Profile.vap
@@ -1,10 +1,10 @@
-
+
- f7e6d8e7-9010-4b53-9168-459d88b3a549
+ 13295ad2-edd3-4d7b-bfac-3ba04a01d47f
VAExtentions INI Sample
- fa0fbfbc-b71b-457b-9b6f-cbd340419010
+ d92754f3-17f8-4864-986a-1c78a7906541
read ini
@@ -14,13 +14,13 @@
0
false
- f051ac93-00f0-483e-951c-c8783dddfd88
+ 56ba692d-f3f0-42c0-b159-ab92ae305373
TextSet
0
0
VxFile
- TestData\test.ini
+ TestData\test.ini
0
@@ -51,21 +51,16 @@
0
false
- f820e149-4a2c-46c3-ad7e-4259322a75a0
- TextSet
+ ca81cc23-624c-48e3-956a-274aa344d00b
+ Comment
0
0
- VxINISection
- Colors
-
-
+ \\Section and the key, as in the standard INI format:
0
0
0
0
-
-
0
0
0
@@ -88,21 +83,16 @@
0
false
- 47180360-73ee-493e-985a-8976d70323d1
- TextSet
+ cac2dbe8-f36c-49e3-a219-042dde70bf49
+ Comment
0
0
- VxINIKey
- Sun
-
-
+ \\ [Colors]
0
0
0
0
-
-
0
0
0
@@ -125,24 +115,18 @@
0
false
- bbf8b222-698d-4f22-bd2f-b57c248c65b3
- ExternalInvoke
+ febe2153-1d90-4a79-bf04-5bdbb25bdab6
+ Comment
0
0
- 9571b674-0ce8-4a04-90d3-83519cb66968
-
- VxFile;VxINISection;VxINIKey
- read_ini
- 1
+ \\ Sun=Yellow
+ 0
0
0
0
-
-
0
0
-
0
0
0
@@ -163,22 +147,21 @@
0
false
- 2523ba59-d5bd-482c-b7d6-21f496bf407b
- ConditionStart
+ c7de969b-8bff-4446-a071-67a0845bd7a4
+ Comment
0
0
+ \\ etc.
0
0
0
0
- 6
- 1
- VxError
+ 0
+ 0
0
0
0
-
0
0
0
@@ -196,16 +179,21 @@
0
false
- 1339590d-3e90-4366-9ea5-7d7441f8849a
- Say
+ bb627f81-b9fd-479f-8023-a6d3ae4e62e8
+ TextSet
0
0
- The {TXT:VxINIKey} is {TXT:VxResult}
- 100
+ VxINISection
+ Colors
+
+
+ 0
0
0
0
+
+
0
0
0
@@ -228,17 +216,61 @@
0
false
- 7838a623-5532-4440-bacc-98a4c9924de8
- ConditionEnd
+ 11053849-6528-4071-b0b6-de05340e2e97
+ TextSet
+ 0
+ 0
+
+ VxINIKey
+ Sun
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0001-01-01T00:00:00
+ 0001-01-01T00:00:00
+ false
+
+ false
+ 0
+
+
+ false
+ false
+ 0
+
+ 0
+ false
+ 0a891210-40f0-4d9c-a9d2-d6552d355a87
+ ExternalInvoke
0
0
+ 9571b674-0ce8-4a04-90d3-83519cb66968
+
+ VxFile;VxINISection;VxINIKey
+ read_ini
1
0
0
0
- 4
- 1
+
+
+ 0
+ 0
+
0
0
0
@@ -259,7 +291,7 @@
0
false
- 0afcecdf-f87f-4104-9f43-1a5d7c26679c
+ dbab3862-ab48-4654-8a63-b3197a880ffd
ConditionStart
0
0
@@ -268,10 +300,10 @@
0
0
0
- 9
- 2
+ 10
+ 1
VxError
- 1
+ 0
0
0
@@ -292,7 +324,70 @@
0
false
- 9bf747cc-49c5-46fd-9b5d-5793e76d20fb
+ c40802cc-79b2-4167-8018-400f653d2da0
+ Say
+ 0
+ 0
+
+ The {TXT:VxINIKey} is {TXT:VxResult}
+ 100
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0001-01-01T00:00:00
+ 0001-01-01T00:00:00
+ false
+
+ false
+ 0
+
+
+ false
+ false
+ 0
+
+ 0
+ false
+ 62a92f51-c998-4995-bf18-7e3a80888edf
+ ConditionElse
+ 0
+ 0
+
+ 0
+ 0
+ 0
+ 0
+ 12
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0001-01-01T00:00:00
+ 0001-01-01T00:00:00
+ false
+
+ false
+ 0
+
+
+ false
+ false
+ 0
+
+ 0
+ false
+ f9cc1818-44dd-4048-9eaf-6199f572a543
WriteToLog
0
0
@@ -324,7 +419,7 @@
0
false
- d22b39b6-8d0e-4403-bac9-4d15024898c0
+ 2ea030e8-960a-4825-a1ac-611e26f4a496
ConditionEnd
0
0
@@ -333,8 +428,8 @@
0
0
0
- 7
- 2
+ 8
+ 1
0
0
0
@@ -386,10 +481,14 @@
false
false
false
+ false
+ false
+ false
+ false
false
false
false
- 00000000-0000-0000-0000-000000000000
+ 4f049177-1fbd-4007-b784-c15862074739
0
0
@@ -403,9 +502,10 @@
false
false
false
+ 00000000-0000-0000-0000-000000000000
- e39801dd-0ca2-46c2-b163-23aee679e312
+ 9b5f8eaf-5a8b-4cd8-982b-3ddf214763a7
write ini
@@ -415,13 +515,13 @@
0
false
- d9aa2fe7-ece2-4dc8-ab24-faccdad7e56a
+ 764e04e8-6246-4dad-8fd9-297394e1b3c9
TextSet
0
0
VxFile
- TestData\test.ini
+ TestData\test.ini
0
@@ -452,21 +552,48 @@
0
false
- 23ab588c-830a-475a-b201-ecd525551d8b
- TextSet
+ 182faf92-be01-49ea-a3b5-16dd0b2ed4fa
+ Comment
0
0
- VxINISection
- Colors
-
-
+ \\Section, key and value, as in the standard INI format:
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0001-01-01T00:00:00
+ 0001-01-01T00:00:00
+ false
+
+ false
+ 0
+
+
+ false
+ false
+ 0
+
+ 0
+ false
+ 0aa8b399-e0d5-4db8-90a3-3278a152f48c
+ Comment
+ 0
+ 0
+
+ \\ [Colors]
0
0
0
0
-
-
0
0
0
@@ -489,13 +616,45 @@
0
false
- 16bbc35c-d893-480d-a49a-a021f0fd343e
+ 1eb86819-63c2-4a5b-a919-98201e71b348
+ Comment
+ 0
+ 0
+
+ \\ Sun=Orange
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0001-01-01T00:00:00
+ 0001-01-01T00:00:00
+ false
+
+ false
+ 0
+
+
+ false
+ false
+ 0
+
+ 0
+ false
+ e69bc38d-d70e-4b0d-808d-69dd70b35382
TextSet
0
0
- VxINIKey
- Sun
+ VxINISection
+ Colors
0
@@ -526,13 +685,13 @@
0
false
- ead338a3-6feb-4f5f-bd69-1b672887163c
+ 6ce30552-50bc-4cc2-9e65-8a7e9aacbe85
TextSet
0
0
- VxArgs
- Orange
+ VxINIKey
+ Sun
0
@@ -563,16 +722,16 @@
0
false
- d2da0609-3ff2-43cc-a56d-208302d117f4
- ExternalInvoke
+ 8dba340c-f464-43e4-b1c4-c230bab1f9bb
+ TextSet
0
0
- 9571b674-0ce8-4a04-90d3-83519cb66968
-
- VxFile;VxINISection;VxINIKey;VxArgs
- write_ini
- 1
+ VxArgs
+ Orange
+
+
+ 0
0
0
0
@@ -580,7 +739,6 @@
0
0
-
0
0
0
@@ -601,22 +759,27 @@
0
false
- dea0362f-6757-4e4f-b928-b38817331a8e
- ConditionStart
+ 97bdce28-1d95-4c22-ad7d-4a65d757ae7a
+ ExternalInvoke
0
0
- 0
+ 9571b674-0ce8-4a04-90d3-83519cb66968
+
+ VxFile;VxINISection;VxINIKey;VxArgs
+ write_ini
+ 1
0
0
0
- 7
- 1
- VxError
+
+
+ 0
+ 0
+
0
0
0
-
0
0
0
@@ -634,21 +797,22 @@
0
false
- 1d093ff2-ffba-4b22-b0ad-d915248a3d4c
- Say
+ 644f27f2-4fba-4c01-b464-3644fc283945
+ ConditionStart
0
0
- Value written
- 100
+ 0
0
0
0
- 0
- 0
+ 10
+ 1
+ VxError
0
0
0
+
0
0
0
@@ -666,17 +830,18 @@
0
false
- 7d2e804e-9da1-44d2-8a72-5aebd16f0382
- ConditionEnd
+ 07c959cd-9b7a-4591-83d4-94d4f8eb4ab2
+ Say
0
0
- 1
+ Value written
+ 100
0
0
0
- 5
- 1
+ 0
+ 0
0
0
0
@@ -697,8 +862,8 @@
0
false
- cf39f16c-35c2-43f7-9b24-53397919c7ae
- ConditionStart
+ 7a7c9f40-31c4-42ba-a861-c2e0c06d1618
+ ConditionElse
0
0
@@ -706,13 +871,11 @@
0
0
0
- 10
- 2
- VxError
- 1
+ 12
+ 1
+ 0
0
0
-
0
0
0
@@ -730,7 +893,7 @@
0
false
- 3d7e9240-f4a5-432a-a29e-d52d609a1f49
+ 40d20ca2-7381-4430-ade6-e51efe5b590c
WriteToLog
0
0
@@ -762,7 +925,7 @@
0
false
- cb9ad09f-ec4c-492c-a286-c038f05558a6
+ d691c4e8-bee8-4eb3-a553-14e992ab9e98
ConditionEnd
0
0
@@ -772,7 +935,7 @@
0
0
8
- 2
+ 1
0
0
0
@@ -824,10 +987,14 @@
false
false
false
+ false
+ false
+ false
+ false
false
false
false
- 00000000-0000-0000-0000-000000000000
+ 414854d5-0782-4b26-8cee-ac3e3b9c75dc
0
0
@@ -841,6 +1008,7 @@
false
false
false
+ 00000000-0000-0000-0000-000000000000
false
@@ -871,7 +1039,7 @@
0
0
- 1.5.8.18
+ 1.5.12.21
6
2
false
@@ -887,5 +1055,5 @@
false
false
-
+ d4478844-4b43-4eaa-be25-e03bfee3b1fe
\ No newline at end of file
diff --git a/VAExtensions/VAExtensions.vbproj b/VAExtensions/VAExtensions.vbproj
index 0d5584b..2befd54 100644
--- a/VAExtensions/VAExtensions.vbproj
+++ b/VAExtensions/VAExtensions.vbproj
@@ -22,7 +22,7 @@
true
bin\Debug\
VAExtensions.xml
- 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
AnyCPU
@@ -34,7 +34,7 @@
true
bin\Release\
VAExtensions.xml
- 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
@@ -45,7 +45,7 @@
Binary
- On
+ Off
On
@@ -91,12 +91,10 @@
-
-
-
+
DebugForm.vb
diff --git a/VAExtensions/VoiceAttack.vb b/VAExtensions/VoiceAttack.vb
index 72d2b01..687f2a1 100644
--- a/VAExtensions/VoiceAttack.vb
+++ b/VAExtensions/VoiceAttack.vb
@@ -7,60 +7,59 @@ Public Class VoiceAttack
End Function
Public Shared Function VA_DisplayName() As String
- Return "VA Extensions 1.4"
+ Return "VA Extensions 2.0"
End Function
Public Shared Function VA_DisplayInfo() As String
- Return String.Empty
- End Function
+ Return "A general purpose plugin to extend the base functionalities of VoiceAttack"
+ End Function
- Public Shared Sub VA_Init1(ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
+ Public Shared Sub VA_Init1(vaProxy As Object)
- App.InitValues()
- App.Settings = Settings.Deserialize()
+ Dim v As System.Version = vaProxy.VAVersion()
+ If v.Major < 2 AndAlso v.Minor < 5 Then
+ vaProxy.WriteToLog(String.Format("{0} require VA 1.6 or above (detected {1})", VA_DisplayName, v.ToString), "red")
+ Else
+ App.InitValues()
+ App.Settings = Settings.Deserialize()
+ End If
End Sub
- Public Shared Sub VA_Exit1(ByRef state As Dictionary(Of String, Object))
- App.ClearCachedFiles()
- Settings.Serialize(App.Settings)
- End Sub
+ Public Shared Sub VA_Exit1(vaProxy As Object)
+ App.ClearCachedFiles()
+ Settings.Serialize(App.Settings)
+ End Sub
- Public Shared Sub VA_Invoke1(context As String, ByRef state As Dictionary(Of String, Object) _
- , ByRef smallIntValues As Dictionary(Of String, Nullable(Of Short)) _
- , ByRef textValues As Dictionary(Of String, String) _
- , ByRef intValues As Dictionary(Of String, Nullable(Of Integer)) _
- , ByRef decimalValues As Dictionary(Of String, Nullable(Of Decimal)) _
- , ByRef booleanValues As Dictionary(Of String, Nullable(Of Boolean)) _
- , ByRef extendedValues As Dictionary(Of String, Object))
+ Public Shared Sub VA_StopCommand()
+
+ End Sub
+
+ Public Shared Sub VA_Invoke1(vaProxy As Object)
#If SHOW_DEBUG_UI Then
DebugForm.ShowDebugInfo(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
#End If
- Dim contextHandler As ContextHandlerBase = ContextFactory.Create(context, state, smallIntValues, textValues, intValues, decimalValues, booleanValues, extendedValues)
+ Dim contextHandler As ContextHandlerBase = ContextFactory.Create(vaProxy)
- If contextHandler Is Nothing Then
- smallIntValues(App.KEY_ERROR) = ContextHandlerBase.ERR_CONTEXT
- textValues(App.KEY_RESULT) = String.Format("Unsupported or empty context: '{0}'.", context)
- Exit Sub
- Else
- contextHandler.Execute()
- End If
+ vaProxy.SetSmallInt(App.KEY_ERROR, Nothing)
+ vaProxy.SetText(App.KEY_RESULT, Nothing)
- If Not textValues.ContainsKey(App.KEY_RESULT) Then
- textValues(App.KEY_RESULT) = Nothing
- End If
- If Not smallIntValues.ContainsKey(App.KEY_ERROR) Then
- smallIntValues(App.KEY_ERROR) = 0
- End If
+ If contextHandler Is Nothing Then
+ vaProxy.SetSmallInt(App.KEY_ERROR, ContextHandlerBase.ERR_CONTEXT)
+ vaProxy.SetText(App.KEY_RESULT, String.Format("Unsupported or empty context: '{0}'.", vaProxy.Context))
+ Exit Sub
+ Else
+ contextHandler.Execute()
+ End If
- End Sub
+ If vaProxy.GetText(App.KEY_RESULT) Is Nothing Then
+ vaProxy.SetText(App.KEY_RESULT, String.Empty) 'Nothing
+ End If
+ If vaProxy.GetSmallInt(App.KEY_ERROR) Is Nothing Then
+ vaProxy.SetSmallInt(App.KEY_ERROR, 0)
+ End If
+ End Sub
End Class