@Paul Lefebvre
I took your RestTester project and am using it as an example. I have in my app an auto updater, and Wass using HttpSocket. Then it started acting up and was told by @Tim Parnell That I should move to the new frame work as newer servers may not work at all with the classic. I took you Tester and put the url of the file that updates my app and it downloaded it perfectly.
So I started changing things and the line DLHttp.Send(“Get”, mDownloadURL.ToText, downloadFile) is giving me the compile error: “There is more than one item with this name and it’s not clear to which it refers” (I hate that error!)
DLHttp is a Xojo.Net.HTTPSocket, draged on form.
mDownload is a string
download file is a FolderItem
It may be getting confused with the String.ToText right as a parameter. See if breaking it out helps:
dim txDownloadURL as Text
mDownloadURL = DefineEncoding(mDownloadURL, Encodings.UTF8)
txDownloadURL = mDownloadURL.ToText
DLHttp.Send("Get", txDownloadURL, downloadFile)
Yes, classicFile is a classic FolderItem. That line of code uses the Xojo.IO.FolderItem Constructor to create a new Xojo.IO.FolderItem that points to the same file.
1:-----
Moving along however I got the Dreaded “There is more than one item with this name and it’s not clear to which this refers”
Dim downloadFileName As String
If Not mUseActualFilename Then
#If TargetMacOS Then
downloadFileName = "MemberTree.pkg.dmg"
#Else
downloadFileName = "Setup.exe"
#Endif
Else
// Use the actual filename from the XML
Dim file() As String
file = mDownloadURL.Split("/")
downloadFileName = file(file.Ubound)
End If
Dim downloadFile As FolderItem
downloadFile = mDownloadLocation.Child(downloadFileName)
Dim newFile As New Xojo.IO.FolderItem(downloadFile.NativePath.ToText)
'MsgBox ("URL:" + mDownloadURL + " Downloadfile: " + downloadFile.AbsolutePath)
'DownloadSocket.Yield = False
DownloadSocket.Send("GET", mDownloadURL, newFile) <<<<<<<<<<<<<<<<<<<<<<Error here
Me.ActionButtonEnabled = False
DownloadSocket is a Xojo.Net.HTTPSocket
2-------
Is there a way to convert an xojo.IO.Folderitem Back to a classic folderitem?
From the RecievedFIle event I call this:
LaunchFile(installer As FolderItem)
#If TargetWin32
Soft Declare Function ShellExecuteA Lib "Shell32" (hwnd As Integer, operation As CString, _
file As CString, params As CString, directory As CString, show As Integer) As Integer
Soft Declare Function ShellExecuteW Lib "Shell32" (hwnd As Integer, operation As WString, _
file As WString, params As WString, directory As WString, show As Integer) As Integer
Dim params As String
params = ""
Dim intReturnCode as Integer = 0
If System.IsFunctionAvailable("ShellExecuteW", "Shell32") Then
intReturnCode = ShellExecuteW(0, "runas", installer.AbsolutePath, params, "", 1)
Else
intReturnCode = ShellExecuteA(0, "runas", installer.AbsolutePath, params, "", 1)
End If
If intReturnCode = 5 Then
Return False
Else
Return True
End If
#Else
Dim lfile as FolderItem
installer.Launch 'Launch dmg, which mounts the disk image
App.DoEvents(4000)
lfile = GetFolderItem("MemberTree:MemberTree.mpkg:", 0)
lfile.Launch 'launch the actual pkg file
Return True
#EndIf
For number 1 is mDownloadURLText or String? It needs to be Text for the new socket.
For number 2 you would do the same process in reverse. Xojo.IO.FolderItem.Path as Text, convert Text to String, use the path string as a NativePath to construct a classic framework FolderItem.