The Visual Studio Debugger Helped Me Bring an old MS-DOS Command Back From The Dead.
Video Title: The Visual Studio Debugger Helped Me Bring an old MS-DOS Command Back From The Dead.
In my last lesson I showed how to run DOS commands from a Windows forms application but I hit a problem the tree command uses asy box drawing characters to show the branches connecting directories and subdirectories but when I try to show this in a text box I get
All kinds of weird characters in this video I’ll explain what the problem is and how to fix it okay so here’s what it looks like when it’s been fixed what’s the secret well let me first explain the problem the problem is that the command window is like a trip back
Into the 1980s it works pretty much the way that the old dos operating system used to work in fact the command I’m running tree is an old dos command and the output is displayed using a limited set of characters with the integer values given by asy codes the Box
Drawing characters for example have asy code codes in the range shown here where 196 is a horizontal line 179 is a vertical line and so on but in modern windows-based applications we generally work with Unicode characters Unicode defines a much bigger range of characters including characters in all kinds of non-european languages the
Graphics characters in ASI are still there in Unicode but they have different values this lesson is going to be about debugging I have a problem I want to fix it but which debugging tool is going to help me to do that first let me explain how I didn’t fix the problem in my
Innocence I initially assumed that converting between asy and unicode characters would simply be a matter of setting the character encoding property in the start info object that initializes a process I tried it and it didn’t work well my eventual solution therefore was to replace the problematic characters in The String returned by the
Tree command before displaying it in a text box the replacing itself was straightforward I just used this replace command to replace every occurrence of each asy box drawing character with a corresponding Unicode character now before going any further I should say that the actual characters and codes you
See may be different than these according to your operating system the fonts installed and so on and you may need to go through the same process that I’m about to to show you in order to deal with any problems now you may wonder how did I find which characters I
Needed to replace and what do all these character codes here mean anyway let me introduce you to the immediate window this is one of a number of invaluable tools integrated into the visual studio debugger when solving problems like this the immediate window is the place to start
So at first I just put a breakpoint in my code and then I run the project in the debugger and I have to make sure that the immediate window is open if not select it from the debug Windows immediate menu uh item now once I’ve stopped at a
Breakpoint I can evaluate code in the immediate window at it simplest I can just enter a variable name such as s and that will show the string value of that variable at this point in the debugging but if I want to find the value of a single character I can
Evaluate a character at an index like this or like this it turns out that the character here is one of the characters that I want to replace I can see that its asy value is 92 so I make a note of that for future reference okay so there is a faster way
To find out the other codes I need so here I’ve copied these characters the ones that should be box characters but when I display them in my program they aren’t I’ve copied them one by one out of the text box in the running application and pasted them into this
String in the code of my project this code is attached to a buttonclick event handler I’ve added a break point here and now I debug my program and in the immediate window I can look at the characters one by one s0 the character at index zero of the
String s index one and so on so how do I go from that to these character codes Unicode character codes can be entered into Strings following SLU as I’ve done here but the codes need to be in hexadecimal to find the asy and uni code characters I can simply find some charts
Online here are some charts that I’ve been using but if you use Google you can find many other sites which contain these sorts of character references the Unicode characters are shown in hexadecimal but the asy codes are shown in decimal converting them is easy though just enter the number into the windows
Calculator and it shows the heximal equivalent here so that’s the value I entered into my code and that’s really all there is to it now I can run my code and this time the tree displays pretty much the same way it does in the command window so all
The Box drawing characters show the branches where they need to be shown and I’ve also set the colors of the text box uh and the font I’ve reset to mimic as much as I can the display of the command window to some extent now after all that work it has to
Be said that the Dos tree command isn’t really all that useful not these days it’s a it’s a curiosity that’s been left over from ancient times when all operating system commands were run from a prompt well nowadays you’d be better using the Windows Explorer to view directories or you could write your own
Dis browser and I showed exactly how to do that in an earlier project my dis browser shows subdirectories in a collapsible Tree View on a Windows Form and that’s obviously a lot better than just having a static display of subdirect trees as I can with the Dos
Tree command still the point of this lesson is not really how to resurrect ancient DOS commands it’s more to do with how to debug and fix problems using visual studio and if you’ve never used the intermediate window before well I hope this gives you at least a few ideas
About how useful it can be thanks for watching to be notified whenever I upload new videos be sure to subscribe and click the bell and I’ll see you again soon
Video Keywords: Ruby Programming
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
appreciate all of your posts!
"Promosm" 😑
Actualy it is a Windows command.
Awesome tutorial Huw!