Imports System
Imports System.Runtime.InteropServices
'''
''' Class for interfacing to the Swordfish PIC Basic IDE using the API plugin.
'''
''' Author: S Wright
Public Class SwordfishIDEPlugin
#Region "Structures"
Private Structure PageInfo
Public DisplayName As String
Public Filename As String
Public FilenameMCI As String
Public FilenameASM As String
Public FilenameHEX As String
Public Modified As Boolean
Public Device As String
Public DeviceCore As UInteger
Public OSC As UInteger
Public VersionEnabled As Boolean
Public VersionMajor As Byte
Public VersionMinor As Byte
Public VersionRelease As Byte
Public VersionBuild As Byte
Public PageSize As UInteger
Public PageSizeRTF As UInteger
End Structure
Private Structure ProgrammerInfo
Public Path As String
Public Filename As String
Public Params As String
Public ParamsBound As String
Public HookFilename As String
End Structure
#End Region
#Region "Constants"
' Asynchronous
Const NOTIFY_RELOAD_PLUGIN = &H1
Const NOTIFY_TAB_CHANGED = &H2
Const NOTIFY_EXPLORER_UPDATE = &H3
Const NOTIFY_COMPILE_SUCCESS = &H4
Const NOTIFY_COMPILE_FAIL = &H5
Const NOTIFY_SELECTION_CHANGED = &H8
Const NOTIFY_PROGRAMMER_CHANGED = &H9
Const NOTIFY_PROGRAMMER_INSTALLED = &HA
Const NOTIFY_PROGRAMMER_DELETED = &HB
Const NOTIFY_VERSION = &HC
' Synchronous
Const NOTIFY_PRE_COMPILE = &H100
Const NOTIFY_PRE_PROGRAM = &H101
#End Region
#Region "API calls"
Private Declare Function sfConnect Lib "SFPluginMgr.dll" Alias "Connect" (ByVal pHostWin As Long) As Boolean
Private Declare Function sfDisconnect Lib "SFPluginMgr.dll" Alias "Disconnect" () As Boolean
Private Declare Function sfIsConnected Lib "SFPluginMgr.dll" Alias "IsConnected" () As Boolean
Private Declare Sub sfGetPathCompiler Lib "SFPluginMgr.dll" Alias "GetPathCompiler" (ByVal pPath As String, ByVal pLen As UInteger)
Private Declare Sub sfGetPathIDE Lib "SFPluginMgr.dll" Alias "GetPathIDE" (ByVal pPath As String, ByVal pLen As UInteger)
Private Declare Sub sfGetPathPlugin Lib "SFPluginMgr.dll" Alias "GetPathPlugin" (ByVal pPath As String, ByVal pLen As UInteger)
Private Declare Function sfGetPageCount Lib "SFPluginMgr.dll" Alias "GetPageCount" () As UInteger
Private Declare Function sfGetPageInfo Lib "SFPluginMgr.dll" Alias "GetPageInfo" (ByVal pFilename As String, ByRef pPageInfo As PageInfo) As Boolean
Private Declare Function sfSetPage Lib "SFPluginMgr.dll" Alias "SetPage" (ByVal pFilename As String) As Boolean
Private Declare Sub sfGetPage Lib "SFPluginMgr.dll" Alias "GetPage" (ByVal pFilename As String, ByVal pLen As UInteger)
Private Declare Function sfGetPageByIndex Lib "SFPluginMgr.dll" Alias "GetPageByIndex" (ByVal pIndex As UInteger, ByVal pFilename As String, ByVal pLen As UInteger) As Boolean
Private Declare Function sfGetPageIncludeCount Lib "SFPluginMgr.dll" Alias "GetPageIncludeCount" (ByVal pFilename As String) As UInteger
Private Declare Function sfGetPageIncludeByIndex Lib "SFPluginMgr.dll" Alias "GetPageIncludeByIndex" (ByVal pFilename As String, ByVal pIndex As UInteger, ByVal pInclude As String, ByVal pLen As UInteger) As Boolean
Private Declare Sub sfSetPageNew Lib "SFPluginMgr.dll" Alias "SetPageNew" (ByVal pFilename As String)
Private Declare Sub sfSetPageClear Lib "SFPluginMgr.dll" Alias "SetPageClear" ()
Private Declare Sub sfSetPageInsertHeader Lib "SFPluginMgr.dll" Alias "SetPageInsertHeader" ()
Private Declare Sub sfGetPageText Lib "SFPluginMgr.dll" Alias "GetPageText" (ByVal pText As String, ByVal pLen As UInteger)
Private Declare Sub sfGetPageTextRTF Lib "SFPluginMgr.dll" Alias "GetPageTextRTF" (ByVal pText As String, ByVal pLen As UInteger)
Private Declare Sub sfGetPageSelectedText Lib "SFPluginMgr.dll" Alias "GetPageSelectedText" (ByVal pText As String, ByVal pLen As UInteger)
Private Declare Sub sfSetPageUpdateText Lib "SFPluginMgr.dll" Alias "SetPageUpdateText" (ByVal pText As String, ByVal pSaveUpdate As Boolean)
Private Declare Sub sfSetPageText Lib "SFPluginMgr.dll" Alias "SetPageText" (ByVal pText As String)
Private Declare Sub sfSetPageTextAt Lib "SFPluginMgr.dll" Alias "SetPageTextAt" (ByVal pX As UInteger, ByVal pY As UInteger, ByVal pText As String)
Private Declare Sub sfSetPageSelectTextAt Lib "SFPluginMgr.dll" Alias "SetPageSelectTextAt" (ByVal pSelStart As UInteger, ByVal pSelLength As UInteger)
Private Declare Sub sfSetPageCursorPos Lib "SFPluginMgr.dll" Alias "SetPageCursorPos" (ByVal pX As UInteger, ByVal pY As UInteger)
Private Declare Sub sfGetPageCursorPos Lib "SFPluginMgr.dll" Alias "GetPageCursorPos" (ByRef pX As UInteger, ByRef pY As UInteger)
Private Declare Sub sfSetPageTopLine Lib "SFPluginMgr.dll" Alias "SetPageTopLine" (ByVal pLineNumber As UInteger)
Private Declare Sub sfGetPageDisplayLines Lib "SFPluginMgr.dll" Alias "GetPageDisplayLines" (ByRef pTopLine As UInteger, ByRef pLinesInWindow As UInteger)
Private Declare Function sfSetPageSave Lib "SFPluginMgr.dll" Alias "SetPageSave" (ByVal pFilename As String) As Boolean
Private Declare Sub sfSetPageLoad Lib "SFPluginMgr.dll" Alias "SetPageLoad" (ByVal pFilename As String)
Private Declare Sub sfSetPageVersion Lib "SFPluginMgr.dll" Alias "SetPageVersion" (ByVal pFilename As String, ByVal pMajor As Byte, ByVal pMinor As Byte, ByVal pRelease As Byte, ByVal pBuild As Byte)
Private Declare Function sfSetPageClose Lib "SFPluginMgr.dll" Alias "SetPageClose" (ByVal pFilename As String) As Boolean
Private Declare Function sfSetPageCloseAll Lib "SFPluginMgr.dll" Alias "SetPageCloseAll" (ByVal pNewPageName As String) As Boolean
Private Declare Sub sfSetPageVersionEnabled Lib "SFPluginMgr.dll" Alias "SetPageVersionEnabled" (ByVal pFilename As String, ByVal pValue As Boolean)
Private Declare Sub sfSetPageLineColor Lib "SFPluginMgr.dll" Alias "SetPageLineColor" (ByVal pLineNumber As UInteger, ByVal pBG As UInteger, ByVal pFG As UInteger)
Private Declare Sub sfSetPageLineColorDelete Lib "SFPluginMgr.dll" Alias "SetPageLineColorDelete" (ByVal pLineNumber As UInteger)
Private Declare Sub sfSetPageLineColorClear Lib "SFPluginMgr.dll" Alias "SetPageLineColorClear" ()
Private Declare Function sfIsProgrammerAvailable Lib "SFPluginMgr.dll" Alias "IsProgrammerAvailable" () As Boolean
Private Declare Sub sfGetProgrammer Lib "SFPluginMgr.dll" Alias "GetProgrammer" (ByVal pName As String, ByVal pLen As UInteger)
Private Declare Function sfGetProgrammerInfo Lib "SFPluginMgr.dll" Alias "GetProgrammerInfo" (ByVal pName As String, ByRef pProgrammerInfo As ProgrammerInfo) As Boolean
Private Declare Function sfSetProgrammer Lib "SFPluginMgr.dll" Alias "SetProgrammer" (ByVal pName As String) As Boolean
Private Declare Function sfGetProgrammerCount Lib "SFPluginMgr.dll" Alias "GetProgrammerCount" () As UInteger
Private Declare Function sfGetProgrammerByIndex Lib "SFPluginMgr.dll" Alias "GetProgrammerByIndex" (ByVal pIndex As UInteger, ByVal pName As String, ByVal pLen As UInteger) As Boolean
Private Declare Function sfExecuteCompile Lib "SFPluginMgr.dll" Alias "ExecuteCompile" () As Boolean
Private Declare Sub sfExecuteCompileAsync Lib "SFPluginMgr.dll" Alias "ExecuteCompileAsync" ()
Private Declare Sub sfExecuteProgram Lib "SFPluginMgr.dll" Alias "ExecuteProgram" ()
Private Declare Sub sfIDELock Lib "SFPluginMgr.dll" Alias "IDELock" ()
Private Declare Sub sfIDEUnlock Lib "SFPluginMgr.dll" Alias "IDEUnlock" ()
#End Region
#Region "Events Support Code"
' Windows API calls
Private Delegate Function SubClassProcDelegate(ByVal hwnd As Integer, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Integer, ByVal hwnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As SubClassProcDelegate) As Integer
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
' Windows API constants
Private Const WM_USER = 1024
Private Const GWL_WNDPROC = -4
' IDE constants
Private Const WM_NOTIFY_PLUGIN = WM_USER + 100
' Window handles
Private lpPrevWndProc As Integer ' Handle to previous window
Private gHW As Integer ' Handle to my window
' Event arguments
Private MyEventArgs As New EventArgs()
' WindowProcDelegate
Private WindowProcDelegate As SubClassProcDelegate
Private Hooked As Boolean = False
Private Function MyWindowProc(ByVal hw As Integer, ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
If uMsg = WM_NOTIFY_PLUGIN Then
Select Case wParam
Case Is = NOTIFY_RELOAD_PLUGIN
OnReloadPlugin(MyEventArgs)
Case Is = NOTIFY_TAB_CHANGED
OnTabChanged(MyEventArgs)
Case Is = NOTIFY_EXPLORER_UPDATE
OnExplorerUpdate(MyEventArgs)
Case Is = NOTIFY_PRE_COMPILE
OnPreCompile(MyEventArgs)
Case Is = NOTIFY_PRE_PROGRAM
OnPreProgram(MyEventArgs)
Case Is = NOTIFY_COMPILE_SUCCESS
OnCompileSuccess(MyEventArgs)
Case Is = NOTIFY_COMPILE_FAIL
OnCompileFail(MyEventArgs)
Case Is = NOTIFY_SELECTION_CHANGED
OnSelectionChanged(MyEventArgs)
Case Is = NOTIFY_PROGRAMMER_CHANGED
OnProgrammerChanged(MyEventArgs)
Case Is = NOTIFY_PROGRAMMER_INSTALLED
OnProgrammerInstalled(MyEventArgs)
Case Is = NOTIFY_PROGRAMMER_DELETED
OnProgrammerDeleted(MyEventArgs)
Case Is = NOTIFY_VERSION
OnVersionUpdated(MyEventArgs)
End Select
End If
MyWindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam) ' Pass messages back into Windows
End Function
#End Region
#Region "Events"
'''
''' Event raised when an attempt is made to reload the plugin. Instance must be set to 'Single with Reload Message' in Plugin Editor for this event to be raised.
'''
'''
Public Event ReloadPlugin As EventHandler
'''
''' Event raised when the tab is changed in the IDE.
'''
'''
Public Event TabChanged As EventHandler
'''
''' Event raised when the explorer panel is updated in the IDE.
'''
'''
Public Event ExplorerUpdate As EventHandler
'''
''' Event raised before the compile process is started.
'''
'''
Public Event PreCompile As EventHandler
'''
''' Event raised before the HEX file is passed to the programmer.
'''
'''
Public Event PreProgram As EventHandler
'''
''' Event raised after a successful compile.
'''
'''
Public Event CompileSuccess As EventHandler
'''
''' Event raised after a failed compile.
'''
'''
Public Event CompileFail As EventHandler
'''
''' Event raised when the area selected in the IDE is changed.
'''
'''
Public Event SelectionChanged As EventHandler
'''
''' Event raised when the selected programmer is changed.
'''
'''
Public Event ProgrammerChanged As EventHandler
'''
''' Event raised when a new programmer is installed.
'''
'''
Public Event ProgrammerInstalled As EventHandler
'''
''' Event raised when a programmer is deleted.
'''
'''
Public Event ProgrammerDeleted As EventHandler
'''
''' Event raised when the version of a file is updated in the IDE.
'''
'''
Public Event VersionUpdated As EventHandler
Protected Overridable Sub OnReloadPlugin(ByVal e As EventArgs)
RaiseEvent ReloadPlugin(Me, e)
End Sub
Protected Overridable Sub OnTabChanged(ByVal e As EventArgs)
RaiseEvent TabChanged(Me, e)
End Sub
Protected Overridable Sub OnExplorerUpdate(ByVal e As EventArgs)
RaiseEvent ExplorerUpdate(Me, e)
End Sub
Protected Overridable Sub OnPreCompile(ByVal e As EventArgs)
RaiseEvent PreCompile(Me, e)
End Sub
Protected Overridable Sub OnPreProgram(ByVal e As EventArgs)
RaiseEvent PreProgram(Me, e)
End Sub
Protected Overridable Sub OnCompileSuccess(ByVal e As EventArgs)
RaiseEvent CompileSuccess(Me, e)
End Sub
Protected Overridable Sub OnCompileFail(ByVal e As EventArgs)
RaiseEvent CompileFail(Me, e)
End Sub
Protected Overridable Sub OnSelectionChanged(ByVal e As EventArgs)
RaiseEvent SelectionChanged(Me, e)
End Sub
Protected Overridable Sub OnProgrammerChanged(ByVal e As EventArgs)
RaiseEvent ProgrammerChanged(Me, e)
End Sub
Protected Overridable Sub OnProgrammerInstalled(ByVal e As EventArgs)
RaiseEvent ProgrammerInstalled(Me, e)
End Sub
Protected Overridable Sub OnProgrammerDeleted(ByVal e As EventArgs)
RaiseEvent ProgrammerDeleted(Me, e)
End Sub
Protected Overridable Sub OnVersionUpdated(ByVal e As EventArgs)
RaiseEvent VersionUpdated(Me, e)
End Sub
#End Region
#Region "Sub Methods"
Private Function ExtractString(ByRef pString) As String
Dim StringPosition As Integer
StringPosition = InStr(pString, Chr(0))
If StringPosition > 0 Then
ExtractString = Strings.Left(pString, StringPosition - 1)
Else
ExtractString = ""
End If
End Function
Private Sub Hook(ByVal pHostWin As Integer) ' Hooks into Windows messages and obtains the address of the procedure previously in the message chain
If Not Hooked Then
WindowProcDelegate = AddressOf MyWindowProc
Hooked = True
End If
gHW = pHostWin
lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, WindowProcDelegate)
End Sub
Private Sub Unhook() ' Unhooks from Windows messages and returns message chain to its previous state
SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)
Hooked = False
End Sub
'''
''' Connects to Swordfish IDE (n.b. call once only, e.g. in form Load event). Also enables events to be received from IDE.
'''
''' The handle to the main form, obtained using Me.Handle.
''' True if connection successful, else False.
'''
Public Function Connect(ByVal pHostWin As Integer) As Boolean
If Not sfIsConnected Then
Connect = sfConnect(pHostWin)
If Connect Then
Hook(pHostWin)
End If
Else
Connect = True
End If
End Function
'''
''' Disconnects from Swordfish IDE (n.b. call before closing form, e.g. in form FormClosing event, and do not disconnect, then attempt to reconnect).
'''
''' True if disconnection successful, else False.
'''
Public Function Disconnect() As Boolean
If sfIsConnected Then
sfDisconnect()
Disconnect = Not sfIsConnected
If Disconnect Then
Unhook()
End If
Else
Disconnect = True
End If
End Function
'''
''' Establishes if the application is connected to the SwordfishIDE.
'''
'''
''' True if connected, else False.
'''
Public ReadOnly Property IsConnected() As Boolean
Get
Return sfIsConnected
End Get
End Property
'''
''' Gets the full path of the folder in which the IDE is located.
'''
'''
'''
'''
Public ReadOnly Property PathIDE() As String
Get
Dim TempString As String
Const TempStringLength As Integer = 256
TempString = New String(CChar(" "), TempStringLength)
sfGetPathIDE(TempString, TempStringLength)
Return TempString
End Get
End Property
'''
''' Gets the full path of the folder in which the compiler is located.
'''
'''
'''
'''
Public ReadOnly Property PathCompiler() As String
Get
Dim TempString As String
Const TempStringLength As Integer = 256
TempString = New String(CChar(" "), TempStringLength)
sfGetPathCompiler(TempString, TempStringLength)
Return TempString
End Get
End Property
'''
''' Gets the full path of the folder in which plugins are located.
'''
'''
'''
'''
Public ReadOnly Property PathPlugin() As String
Get
Dim TempString As String
Const TempStringLength As Integer = 256
TempString = New String(CChar(" "), TempStringLength)
sfGetPathPlugin(TempString, TempStringLength)
Return TempString
End Get
End Property
'''
''' Gets the number of pages open in the IDE.
'''
'''
'''
'''
Public ReadOnly Property PageCount() As UInteger
Get
PageCount = sfGetPageCount()
End Get
End Property
'''
''' Gets the name displayed in the tab of the IDE (i.e. without path and file extension) for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property DisplayName(ByVal pFilename As String) As String
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
DisplayName = TempPageInfo.DisplayName
Else
DisplayName = ""
End If
End Get
End Property
'''
''' Gets the name displayed in the tab of the IDE (i.e. without path and file extension) for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property DisplayName() As String
Get
DisplayName = DisplayName(Page)
End Get
End Property
'''
''' Gets the full path and filename for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property Filename(ByVal pFilename As String) As String
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
Filename = TempPageInfo.Filename
Else
Filename = ""
End If
End Get
End Property
'''
''' Gets the full path and filename for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property Filename() As String
Get
Filename = Filename(Page)
End Get
End Property
'''
''' Gets the full path and filename of the MCI file, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property FilenameMCI(ByVal pFilename As String) As String
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
FilenameMCI = TempPageInfo.FilenameMCI
Else
FilenameMCI = ""
End If
End Get
End Property
'''
''' Gets the full path and filename of the MCI file, for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property FilenameMCI() As String
Get
FilenameMCI = FilenameMCI(Page)
End Get
End Property
'''
''' Gets the full path and filename of the ASM file, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property FilenameASM(ByVal pFilename As String) As String
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
FilenameASM = TempPageInfo.FilenameASM
Else
FilenameASM = ""
End If
End Get
End Property
'''
''' Gets the full path and filename of the ASM file, for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property FilenameASM() As String
Get
FilenameASM = FilenameASM(Page)
End Get
End Property
'''
''' Gets the full path and filename of the HEX file, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property FilenameHEX(ByVal pFilename As String) As String
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
FilenameHEX = TempPageInfo.FilenameHEX
Else
FilenameHEX = ""
End If
End Get
End Property
'''
''' Gets the full path and filename of the HEX file, for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property FilenameHEX() As String
Get
FilenameHEX = FilenameHEX(Page)
End Get
End Property
'''
''' Gets the device declared in a file (e.g. 18F452), for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property Device(ByVal pFilename As String) As String
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
Device = TempPageInfo.Device
Else
Device = ""
End If
End Get
End Property
'''
''' Gets the device declared in a file (e.g. 18F452), for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property Device() As String
Get
Device = Device(Page)
End Get
End Property
'''
''' Gets the boolean flag to determine if the file has been modified in the IDE since the last save, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property IsModified(ByVal pFilename As String) As Boolean
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
IsModified = TempPageInfo.Modified
Else
IsModified = False
End If
End Get
End Property
'''
''' Gets the boolean flag to determine if the file has been modified in the IDE since the last save, for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property IsModified() As Boolean
Get
IsModified = IsModified(Page)
End Get
End Property
'''
''' Gets the core of the device declared in a file, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property DeviceCore(ByVal pFilename As String) As UInteger
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
DeviceCore = TempPageInfo.DeviceCore
Else
DeviceCore = 0
End If
End Get
End Property
'''
''' Gets the core of the device declared in a file, for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property DeviceCore() As UInteger
Get
DeviceCore = DeviceCore(Page)
End Get
End Property
'''
''' Gets the Osc value declared (in Hz), for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property Osc(ByVal pFilename As String) As UInteger
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
Osc = TempPageInfo.OSC
Else
Osc = 0
End If
End Get
End Property
'''
''' Gets the Osc value declared (in Hz), for the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property Osc() As UInteger
Get
Osc = Osc(Page)
End Get
End Property
'''
''' Gets or sets a boolean flag to enable or disable version incrementing on compile, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public Property VersionEnabled(ByVal pFilename As String) As Boolean
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
VersionEnabled = TempPageInfo.VersionEnabled
Else
VersionEnabled = False
End If
End Get
Set(ByVal value As Boolean)
sfSetPageVersionEnabled(pFilename, value)
End Set
End Property
'''
''' Gets or sets a boolean flag to enable or disable version incrementing on compile, for the currently selected page in the IDE.
'''
'''
'''
'''
Public Property VersionEnabled() As Boolean
Get
VersionEnabled = VersionEnabled(Page)
End Get
Set(ByVal value As Boolean)
sfSetPageVersionEnabled(Page, value)
End Set
End Property
'''
''' Gets or sets the major version, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public Property VersionMajor(ByVal pFilename As String) As Byte
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
VersionMajor = TempPageInfo.VersionMajor
Else
VersionMajor = 0
End If
End Get
Set(ByVal value As Byte)
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
sfGetPageInfo(pFilename, TempPageInfo)
sfSetPageVersion(pFilename, value, TempPageInfo.VersionMinor, TempPageInfo.VersionRelease, TempPageInfo.VersionBuild)
End Set
End Property
'''
''' Gets or sets the major version, for the currently selected page in the IDE.
'''
'''
'''
'''
Public Property VersionMajor() As Byte
Get
Return VersionMajor(Page)
End Get
Set(ByVal value As Byte)
VersionMajor(Page) = value
End Set
End Property
'''
''' Gets or sets the minor version, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public Property VersionMinor(ByVal pFilename As String) As Byte
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
VersionMinor = TempPageInfo.VersionMinor
Else
VersionMinor = 0
End If
End Get
Set(ByVal value As Byte)
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
sfGetPageInfo(pFilename, TempPageInfo)
sfSetPageVersion(pFilename, TempPageInfo.VersionMajor, value, TempPageInfo.VersionRelease, TempPageInfo.VersionBuild)
End Set
End Property
'''
''' Gets or sets the minor version, for the currently selected page in the IDE.
'''
'''
'''
'''
Public Property VersionMinor() As Byte
Get
Return VersionMinor(Page)
End Get
Set(ByVal value As Byte)
VersionMinor(Page) = value
End Set
End Property
'''
''' Gets or sets the release version, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public Property VersionRelease(ByVal pFilename As String) As Byte
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
VersionRelease = TempPageInfo.VersionRelease
Else
VersionRelease = 0
End If
End Get
Set(ByVal value As Byte)
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
sfGetPageInfo(pFilename, TempPageInfo)
sfSetPageVersion(pFilename, TempPageInfo.VersionMajor, TempPageInfo.VersionMinor, value, TempPageInfo.VersionBuild)
End Set
End Property
'''
''' Gets or sets the release version, for the currently selected page in the IDE.
'''
'''
'''
'''
Public Property VersionRelease() As Byte
Get
Return VersionRelease(Page)
End Get
Set(ByVal value As Byte)
VersionRelease(Page) = value
End Set
End Property
'''
''' Gets or sets the build version, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public Property VersionBuild(ByVal pFilename As String) As Byte
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
VersionBuild = TempPageInfo.VersionBuild
Else
VersionBuild = 0
End If
End Get
Set(ByVal value As Byte)
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
sfGetPageInfo(pFilename, TempPageInfo)
sfSetPageVersion(pFilename, TempPageInfo.VersionMajor, TempPageInfo.VersionMinor, TempPageInfo.VersionRelease, value)
End Set
End Property
'''
''' Gets or sets the build version, for the currently selected page in the IDE.
'''
'''
'''
'''
Public Property VersionBuild() As Byte
Get
Return VersionBuild(Page)
End Get
Set(ByVal value As Byte)
VersionBuild(Page) = value
End Set
End Property
'''
''' Gets the page size (in bytes), for a specified file. The page size includes a two byte line termination sequence for every line and a NULL terminator.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property PageSize(ByVal pFilename As String) As UInteger
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
PageSize = TempPageInfo.PageSize
Else
PageSize = 0
End If
End Get
End Property
'''
''' Gets the page size (in bytes), for the currently selected page in the IDE. The page size includes a two byte line termination sequence for every line and a NULL terminator.
'''
'''
'''
'''
Public ReadOnly Property PageSize() As UInteger
Get
PageSize = PageSize(Page)
End Get
End Property
'''
''' Gets the page size (in bytes) for RTF format, for a specified file. The page size includes a two byte line termination sequence for every line and a NULL terminator.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property PageSizeRTF(ByVal pFilename As String) As UInteger
Get
Dim TempPageInfo As PageInfo
TempPageInfo.DisplayName = New String(CChar(" "), 63)
TempPageInfo.Filename = New String(CChar(" "), 255)
TempPageInfo.FilenameMCI = New String(CChar(" "), 255)
TempPageInfo.FilenameASM = New String(CChar(" "), 255)
TempPageInfo.FilenameHEX = New String(CChar(" "), 255)
TempPageInfo.Device = New String(CChar(" "), 15)
If sfGetPageInfo(pFilename, TempPageInfo) Then
PageSizeRTF = TempPageInfo.PageSizeRTF
Else
PageSizeRTF = 0
End If
End Get
End Property
'''
''' Gets the page size (in bytes) for RTF format, for the currently selected page in the IDE. The page size includes a two byte line termination sequence for every line and a NULL terminator.
'''
'''
'''
'''
Public ReadOnly Property PageSizeRTF() As UInteger
Get
PageSizeRTF = PageSizeRTF(Page)
End Get
End Property
'''
''' Switches to a specified page in the IDE.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
Public Function SetPage(ByVal pFilename As String) As Boolean
SetPage = sfSetPage(pFilename)
End Function
'''
''' Gets the path and filename string of the currently selected page in the IDE.
'''
'''
'''
'''
Public ReadOnly Property Page() As String
Get
Dim TempString As String
Const TempStringLength As Integer = 256
TempString = New String(CChar(" "), TempStringLength)
sfGetPage(TempString, TempStringLength)
Page = ExtractString(TempString)
End Get
End Property
'''
''' Gets the path and filename string of a page in the IDE.
'''
''' The index of the required page (n.b. first page is pIndex = 0).
'''
'''
'''
Public ReadOnly Property Page(ByVal pIndex As UInteger) As String
Get
Dim TempString As String
Const TempStringLength As Integer = 256
TempString = New String(CChar(" "), TempStringLength)
If sfGetPageByIndex(pIndex, TempString, TempStringLength) Then
Page = ExtractString(TempString)
Else
Page = ""
End If
End Get
End Property
'''
''' Gets the number of include files, for a specified file (n.b. will always return one or more as device is added as an include).
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
'''
Public ReadOnly Property IncludeCount(ByVal pFilename As String) As UInteger
Get
IncludeCount = sfGetPageIncludeCount(pFilename)
End Get
End Property
'''
''' Gets the number of include files, for the currently selected page in the IDE (n.b. will always return one or more as device is added as an include).
'''
'''
'''
'''
Public ReadOnly Property IncludeCount() As UInteger
Get
IncludeCount = IncludeCount(Page)
End Get
End Property
'''
''' Gets the path and filename of an include by index, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
''' The index of the required include file (n.b. first include is for pIndex = 0).
'''
'''
'''
Public ReadOnly Property Include(ByVal pFilename As String, ByVal pIndex As UInteger) As String
Get
Dim TempString As String
Const TempStringLength As Integer = 256
TempString = New String(CChar(" "), TempStringLength)
If sfGetPageIncludeByIndex(pFilename, pIndex, TempString, TempStringLength) Then
Include = TempString
Else
Include = ""
End If
End Get
End Property
'''
''' Gets the path and filename of an include by index, for the currently selected page in the IDE.
'''
''' The index of the required include file (n.b. first include is for pIndex = 0).
'''
'''
'''
Public ReadOnly Property Include(ByVal pIndex As UInteger) As String
Get
Include = Include(Page, pIndex)
End Get
End Property
'''
''' Creates a new page in the IDE.
'''
''' Name of new page (e.g. "MyProgram.bas", without path).
'''
Public Sub NewPage(ByVal pPageName As String)
sfSetPageNew(pPageName)
End Sub
'''
''' Clears the current page.
'''
'''
Public Sub ClearPage()
sfSetPageClear()
End Sub
'''
''' Inserts a page header at the top of the current page.
'''
'''
Public Sub InsertHeader()
sfSetPageInsertHeader()
End Sub
'''
''' Gets or sets page text, for currently selected page in IDE.
'''
'''
'''
'''
Public Property PageText() As String
Get
Dim TempString As String
Dim TempStringLength As Integer
TempStringLength = PageSize()
TempString = New String(CChar(" "), TempStringLength)
sfGetPageText(TempString, TempStringLength)
Return TempString
End Get
Set(ByVal value As String)
sfSetPageUpdateText(value, False)
End Set
End Property
'''
''' Gets page text, for currently selected page in IDE, as Rich Text Format.
'''
'''
'''
'''
Public ReadOnly Property PageTextRTF() As String
Get
Dim TempString As String
Dim TempStringLength As Integer
TempStringLength = PageSizeRTF()
TempString = New String(CChar(" "), TempStringLength)
sfGetPageTextRTF(TempString, TempStringLength)
Return TempString
End Get
End Property
'''
''' Gets selected text, for currently selected page in IDE.
'''
'''
'''
'''
Public ReadOnly Property SelectedText() As String
Get
Dim TempString As String
Dim TempStringLength As Integer
TempStringLength = PageSize()
TempString = New String(CChar(" "), TempStringLength)
sfGetPageSelectedText(TempString, TempStringLength)
Return TempString
End Get
End Property
'''
''' Inserts text at the cursor position, for currently selected page in IDE.
'''
''' Text to insert as String.
'''
Public Sub InsertText(ByVal pText As String)
sfSetPageText(pText)
End Sub
'''
''' Inserts text at position given by pPos, for currently selected page in IDE.
'''
''' Position to insert text as Point.
'''
'''
Public Sub InsertTextAt(ByVal pPos As Point, ByVal pText As String)
sfSetPageTextAt(CUInt(pPos.X), CUInt(pPos.Y), pText)
End Sub
'''
''' Selects text in the currently selected page in IDE.
'''
''' The start character position of the text to select.
''' The number of characters to select.
'''
Public Sub SelectTextAt(ByVal pSelStart As UInteger, ByVal pSelLength As UInteger)
sfSetPageSelectTextAt(pSelStart, pSelLength)
End Sub
'''
''' Gets or sets the cursor position in the currently selected page in IDE.
'''
'''
'''
'''
Public Property CursorPos() As Point
Get
Dim TempPoint As Point
sfGetPageCursorPos(TempPoint.X, TempPoint.Y)
Return TempPoint
End Get
Set(ByVal value As Point)
sfSetPageCursorPos(CUInt(value.X), CUInt(value.Y))
End Set
End Property
'''
''' Gets or sets the top line in the currently selected page in IDE.
'''
'''
'''
'''
Public Property TopLine() As UInteger
Get
Dim TempUInteger As UInteger
sfGetPageDisplayLines(TopLine, TempUInteger)
End Get
Set(ByVal value As UInteger)
sfSetPageTopLine(value)
End Set
End Property
'''
''' Gets the number of visible lines in the currently selected page in IDE.
'''
'''
'''
'''
Public ReadOnly Property DisplayLines() As UInteger
Get
Dim TempUInteger As UInteger
sfGetPageDisplayLines(TempUInteger, DisplayLines)
End Get
End Property
'''
''' Saves the page, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
Public Function SavePage(ByVal pFilename As String) As Boolean
SavePage = sfSetPageSave(pFilename)
End Function
'''
''' Saves the page, for the currently selected page in the IDE.
'''
'''
'''
Public Function SavePage() As Boolean
SavePage = sfSetPageSave(Page)
End Function
'''
''' Loads a page into the IDE.
'''
''' The path and filename of the file to be loaded.
'''
Public Sub LoadPage(ByVal pFilename As String)
sfSetPageLoad(pFilename)
End Sub
'''
''' Closes the page, for a specified file.
'''
''' The path and filename of the file (n.b. file must be open in the IDE first).
'''
'''
Public Function ClosePage(ByVal pFilename As String) As Boolean
ClosePage = sfSetPageClose(pFilename)
End Function
'''
''' Closes the page, for the currently selected page in the IDE.
'''
'''
'''
Public Function ClosePage() As Boolean
ClosePage = sfSetPageClose(Page)
End Function
'''
''' Closes all pages in the IDE (n.b. a blank document will then open in the IDE).
'''
''' Name of new page (e.g. "NewPage.bas", without path).
'''
'''
Public Function CloseAll(Optional ByVal pNewPageName As String = "") As Boolean
CloseAll = sfSetPageCloseAll(pNewPageName)
End Function
'''
''' Sets the background and foreground colour of a line in the currently selected page.
'''
''' The line number to set the colour of.
''' Background colour as Color.
''' Foreground colour as Color.
'''
Public Sub LineColor(ByVal pLineNumber As UInteger, ByVal pBG As Color, ByVal pFG As Color)
sfSetPageLineColor(pLineNumber, (pBG.ToArgb And &HFF0000) / 2 ^ 16 + (pBG.ToArgb And &HFF) * 2 ^ 16 + (pBG.ToArgb And &HFF00), (pFG.ToArgb And &HFF0000) / 2 ^ 16 + (pFG.ToArgb And &HFF) * 2 ^ 16 + (pFG.ToArgb And &HFF00))
End Sub
'''
''' Deletes the background and foreground colour settings of a line in the currently selected page.
'''
''' The line number to delete the colour settings of.
'''
Public Sub LineColorDelete(ByVal pLineNumber As UInteger)
sfSetPageLineColorDelete(pLineNumber)
End Sub
'''
''' Clears all line colour settings for the currently selected page.
'''
'''
Public Sub LineColorClear()
sfSetPageLineColorClear()
End Sub
'''
''' Checks if a programmer is available. Returns True if the default programming device is not a plugin. Returns False if the default programming device is a plugin (e.g. a simulator).
'''
'''
'''
'''
Public ReadOnly Property IsProgrammerAvailable()
Get
Return sfIsProgrammerAvailable
End Get
End Property
'''
''' Sets a programmer by name.
'''
''' The name of the programmer as String.
'''
'''
Public Function SetProgrammer(ByVal pProgrammerName As String) As Boolean
SetProgrammer = sfSetProgrammer(pProgrammerName)
End Function
'''
''' Gets the name of the currently selected programmer.
'''
'''
'''
'''
Public ReadOnly Property Programmer() As String
Get
Dim TempString As String
Const TempStringLength As Integer = 256
TempString = New String(CChar(" "), TempStringLength)
sfGetProgrammer(TempString, TempStringLength)
Programmer = ExtractString(TempString)
End Get
End Property
'''
''' Gets the name of a programmer by index.
'''
''' The index of the required programmer (n.b. pIndex = 0 for first programmer).
'''
'''
'''
Public ReadOnly Property Programmer(ByVal pIndex As UInteger) As String
Get
Dim TempString As String
Const TempStringLength As Integer = 256
TempString = New String(CChar(" "), TempStringLength)
Programmer = TempString
If sfGetProgrammerByIndex(pIndex, TempString, TempStringLength) Then
Programmer = ExtractString(TempString)
Else
Programmer = ""
End If
End Get
End Property
'''
''' Gets the executable filename of a programmer, by programmer name.
'''
''' The name of the programmer, as String.
'''
'''
'''
Public ReadOnly Property ProgrammerFilename(ByVal pProgrammerName As String) As String
Get
Dim TempProgrammerInfo As ProgrammerInfo
TempProgrammerInfo.Path = New String(CChar(" "), 255)
TempProgrammerInfo.Filename = New String(CChar(" "), 255)
TempProgrammerInfo.Params = New String(CChar(" "), 255)
TempProgrammerInfo.ParamsBound = New String(CChar(" "), 255)
TempProgrammerInfo.HookFilename = New String(CChar(" "), 255)
If sfGetProgrammerInfo(pProgrammerName, TempProgrammerInfo) Then
ProgrammerFilename = TempProgrammerInfo.Filename
Else
ProgrammerFilename = ""
End If
End Get
End Property
'''
''' Gets the executable filename of a programmer, for the the currently selected programmer.
'''
'''
'''
'''
Public ReadOnly Property ProgrammerFilename() As String
Get
ProgrammerFilename = ProgrammerFilename(Programmer)
End Get
End Property
'''
''' Gets the filename of an optional pre-processing executable that is called before the main programmer process is executed, by programmer name.
'''
''' The name of the programmer, as String.
'''
'''
'''
Public ReadOnly Property ProgrammerHookFilename(ByVal pProgrammerName As String) As String
Get
Dim TempProgrammerInfo As ProgrammerInfo
TempProgrammerInfo.Path = New String(CChar(" "), 255)
TempProgrammerInfo.Filename = New String(CChar(" "), 255)
TempProgrammerInfo.Params = New String(CChar(" "), 255)
TempProgrammerInfo.ParamsBound = New String(CChar(" "), 255)
TempProgrammerInfo.HookFilename = New String(CChar(" "), 255)
If sfGetProgrammerInfo(pProgrammerName, TempProgrammerInfo) Then
ProgrammerHookFilename = TempProgrammerInfo.HookFilename
Else
ProgrammerHookFilename = ""
End If
End Get
End Property
'''
''' Gets the filename of an optional pre-processing executable that is called before the main programmer process is executed, for the the currently selected programmer.
'''
'''
'''
'''
Public ReadOnly Property ProgrammerHookFilename() As String
Get
ProgrammerHookFilename = ProgrammerHookFilename(Programmer)
End Get
End Property
'''
''' Gets the unbound command line parameters for a programmer, by programmer name (e.g. -pPIC$target-device$ $hex-filename$).
'''
''' The name of the programmer, as String.
'''
'''
'''
Public ReadOnly Property ProgrammerParameters(ByVal pProgrammerName As String) As String
Get
Dim TempProgrammerInfo As ProgrammerInfo
TempProgrammerInfo.Path = New String(CChar(" "), 255)
TempProgrammerInfo.Filename = New String(CChar(" "), 255)
TempProgrammerInfo.Params = New String(CChar(" "), 255)
TempProgrammerInfo.ParamsBound = New String(CChar(" "), 255)
TempProgrammerInfo.HookFilename = New String(CChar(" "), 255)
If sfGetProgrammerInfo(pProgrammerName, TempProgrammerInfo) Then
ProgrammerParameters = TempProgrammerInfo.Params
Else
ProgrammerParameters = ""
End If
End Get
End Property
'''
''' Gets the unbound command line parameters for a programmer, for the the currently selected programmer (e.g. -pPIC$target-device$ $hex-filename$).
'''
'''
'''
'''
Public ReadOnly Property ProgrammerParameters() As String
Get
ProgrammerParameters = ProgrammerParameters(Programmer)
End Get
End Property
'''
''' Gets the bound command line parameters for a programmer, by programmer name (e.g. -pPIC16F628 myprogram.hex).
'''
''' The name of the programmer, as String.
'''
'''
'''
Public ReadOnly Property ProgrammerParametersBound(ByVal pProgrammerName As String) As String
Get
Dim TempProgrammerInfo As ProgrammerInfo
TempProgrammerInfo.Path = New String(CChar(" "), 255)
TempProgrammerInfo.Filename = New String(CChar(" "), 255)
TempProgrammerInfo.Params = New String(CChar(" "), 255)
TempProgrammerInfo.ParamsBound = New String(CChar(" "), 255)
TempProgrammerInfo.HookFilename = New String(CChar(" "), 255)
If sfGetProgrammerInfo(pProgrammerName, TempProgrammerInfo) Then
ProgrammerParametersBound = TempProgrammerInfo.ParamsBound
Else
ProgrammerParametersBound = ""
End If
End Get
End Property
'''
''' Gets the bound command line parameters for a programmer, for the the currently selected programmer (e.g. -pPIC16F628 myprogram.hex).
'''
'''
'''
'''
Public ReadOnly Property ProgrammerParametersBound() As String
Get
ProgrammerParametersBound = ProgrammerParametersBound(Programmer)
End Get
End Property
'''
''' Gets the path to the programmer executable, by programmer name.
'''
''' The name of the programmer, as String.
'''
'''
'''
Public ReadOnly Property ProgrammerPath(ByVal pProgrammerName As String) As String
Get
Dim TempProgrammerInfo As ProgrammerInfo
TempProgrammerInfo.Path = New String(CChar(" "), 255)
TempProgrammerInfo.Filename = New String(CChar(" "), 255)
TempProgrammerInfo.Params = New String(CChar(" "), 255)
TempProgrammerInfo.ParamsBound = New String(CChar(" "), 255)
TempProgrammerInfo.HookFilename = New String(CChar(" "), 255)
If sfGetProgrammerInfo(pProgrammerName, TempProgrammerInfo) Then
ProgrammerPath = TempProgrammerInfo.Path
Else
ProgrammerPath = ""
End If
End Get
End Property
'''
''' Gets the path to the programmer executable, for the the currently selected programmer.
'''
'''
'''
'''
Public ReadOnly Property ProgrammerPath() As String
Get
ProgrammerPath = ProgrammerPath(Programmer)
End Get
End Property
'''
''' Gets the number of installed programming devices.
'''
'''
'''
'''
Public ReadOnly Property ProgrammerCount() As UInteger
Get
ProgrammerCount = sfGetProgrammerCount
End Get
End Property
'''
''' Executes the compiler process. The function is a synchronous call, i.e. it does not return until the compile process has terminated. If the process succeeds the return value is True, else False is returned.
'''
'''
'''
Public Function Compile() As Boolean
Compile = sfExecuteCompile()
End Function
'''
''' Executes the compiler process. The function is an asynchronous call and returns immediately.
'''
'''
Public Sub CompileAsync()
sfExecuteCompileAsync()
End Sub
'''
''' Executes the default programmer process. The function is an asynchronous call and returns immediately.
'''
'''
Public Sub Program()
sfExecuteProgram()
End Sub
'''
''' A call to this function will lock the IDE interface. This feature can mimic a 'modal' dialog window, where the user is unable to interact with the application beneath the plugin window. In this mode of operation, it is strongly recommended that the plugin is created as a top most window. LockIDE is also useful for plugin operations that may fail if the user were to modify pages or interact with the IDE. A plugin that locks the IDE is responsible for unlocking the interface using a call to UnlockIDE. If two or more plugins lock the IDE, then the IDE will not be unlocked until each plugin has made a call to UnlockIDE.
'''
'''
Public Sub LockIDE()
sfIDELock()
End Sub
'''
''' Unlocks a locked IDE. A call to this function will have no effect unless the plugin has made a previous call to LockIDE.
'''
'''
Public Sub UnlockIDE()
sfIDEUnlock()
End Sub
#End Region
End Class