View Single Post
Old 08-03-2016, 12:41 PM   #28263
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Quote:
Originally Posted by Katsunami View Post
It comes directly from the manufacturer of the device I'm trying to communicate with. There isn't anything else. I'm trying to lift the protocol from the code, but it's scattered throughout a single, 1079 lines long Windows form. Some of the required settings are actually acquired directly from the controls. Think like so:

buffer[5] = (byte)(button4.Text.Split(" ")[1])

(Split the text on button 4 into two parts, take the second part, and then convert it to a byte. It's not really obvious at first glance what value goes into buffer[5], to say the least, especially because button4.Text can change depending on the state of the program )

Ouch, that is bad programming... Using generic variable names and not giving controls logical names is not good nor smart. It was excusable when I started programming in the 80s, because there was hardly any memory to play with and every byte counted. Not anymore though, not even for a 'fast track'.
Toxaris is offline   Reply With Quote