I finally got the HTTP object to write a file that has the correct SHA256 checksum. This was so tedious. The HTTP object has a property called 'LocalFile' that is supposed to write the contents of the server response to a file. But it craps out and asks me to send an error report to MS. So this seemingly simple process becomes much more difficult.
I had to set the webserver to convert the binary file to hex code and output the hex text... this doubles the size of the transfer, but at least gives me something to work with. In NSBasic, I create 2 files, one to hold hex text and one to hold the actually binary file. I use the HTTP_Transfer(direction,bytesTranserred,text) event to write the contents of the text to the file that will hold hex text. I have to do this 4096 bytes at a time. I use the HTTP_EndTransfer(direction) event to close the hex text file and reopen it at the beginning. Then, I iterate through the hex file using file_handle.ReadText(8192). It takes 2 hex letters to make a byte, so 8192 characters is equal to 4096 bytes. I use the newObjects.utilctls.StringUtilities.HexToBin function to convert the hex into a binary VT_ARRAY. Then, I can finally use the file_handle.WriteBin method to begin writing to the actually binary file, 4096 bytes at a time. I also use the file_handle.EOS to determine if I am done iterating through the hex file, 8192 characters at a time. When this finally finishes, I can run a SHA256 checksum on the binary file at NSBasic and it matches what the server has. --- In [email protected], "t2thecathp" <t2theca...@...> wrote: > > I ended up using the IPWorks! HTTP object before reading your reply. > > I am trying to use newObjects SFMain and SFStream utilities to write the > data, but it isn't working right. > > The HTTP control wants to give me data as a text string, but it needs to be a > VT_ARRAY in order to use the WriteBin method from SFStream. > > I am using the SHA256 checksum to verify file integrity and it isn't matching > the checksum generated at the server. > > As far as ShellExecute goes... The NSBasic app must be closed before running > the installer, so how do I set something else to run when app closes? > > --- In [email protected], "George Henne" <gh@> wrote: > > > > To my knowledge, no one has done this, but it could be useful. > > > > You would have to use NetStreams to check the version with a server > > program. That's fairly easy. The next step, copying the file, is a bit > > more work: you should be able to do it with nsoftware's ftp lib. > > Finally, your program could use the ShellExecute command to run the > > installer. > > > > >OK, I figured out one of my questions: > > > > > >To auto run something after a warm boot, place it here: \Windows\StartUp > > > > > >--- In [email protected], "t2thecathp" <t2thecathp@> wrote: > > >> > > >> Is there a way auto update a NSBasic app from the handheld device? > > >> > > >> I have NSBasic set to retain the CAB file when an installer file is > > >created (when you press F5). From the handheld device, I close the open > > >NSBasic application and I use Internet Explorer to go to a webserver and > > >download a CAB file. The CAB file executes and handles the install/ > > >reinstall of the NSBasic app. > > >> > > >> What I would like to do is pass AppMinor and AppMajor to a web server, > > >and let the web server determine if I have the latest version. > > >> > > >> But if the version is out of date, what do I do next? > > >> > > >> I am thinking I have to download the CAB file and place it in a > > >special folder and then initiate a reboot of the device (a warm boot). > > >I know you can have CAB file auto run after after a warm boot, but I > > >don't know where you have to put the file. > > >> > > >> So where is the special folder for that? > > >> > > >> And how do you initiate a warm boot from NSBasic? > > >> > > >> Or, if it is possible to close the NSBasic app and have the CAB file > > >be executed upon closing the NSBasic app, that would be an even better > > >solution. How would I do that? > > >> > > >> Any suggestions would be helpful. > > >> > > > > > > > > > > > > > > >------------------------------------ > > > > > >Yahoo! Groups Links > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nsb-ce" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nsb-ce?hl=en -~----------~----~----~----~------~----~------~--~---
