Rev 770 | Rev 1527 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 770 | Rev 782 | ||
|---|---|---|---|
| Line 232... | Line 232... | ||
| 232 | } |
232 | } |
| 233 | 233 | ||
| 234 | static private bool parseNodeId(string node) { |
234 | static private bool parseNodeId(string node) { |
| 235 | // the goal here is to find a byte from 0-255 in a string, format in decimal (0-255) or in hex (0x0-0xff) |
235 | // the goal here is to find a byte from 0-255 in a string, format in decimal (0-255) or in hex (0x0-0xff) |
| 236 | // this is probably not done very neat |
236 | // this is probably not done very neat |
| - | 237 | if (node.Length > 2) { |
|
| - | 238 | if (node.Substring(node.Length-2, 2).Equals("UL")) { |
|
| - | 239 | node = node.Substring(0, node.Length-2); |
|
| - | 240 | } |
|
| - | 241 | } |
|
| - | 242 | ||
| 237 | sNodeid = false; |
243 | sNodeid = false; |
| 238 | if (node.Length > 0) { |
244 | if (node.Length > 0) { |
| 239 | try { |
245 | try { |
| 240 | nodeid = byte.Parse(node); |
246 | nodeid = byte.Parse(node); |
| 241 | sNodeid = true; |
247 | sNodeid = true; |
| 242 | } catch {} |
248 | } catch {} |
| 243 | } |
249 | } |
| 244 | if (node.Length > 2) { |
250 | if (node.Length > 2) { |
| 245 | if (node.Substring(0, 2).Equals("0x")) { |
251 | if (node.Substring(0, 2).Equals("0x")) { |
| 246 | try { |
252 | try { |
| 247 | nodeid = byte.Parse(node.Substring(2, node.Length-2), System.Globalization.NumberStyles.HexNumber); |
253 | nodeid = byte.Parse(node.Substring(2, node.Length-2), System.Globalization.NumberStyles.HexNumber); |
| 248 | sNodeid = true; |
254 | sNodeid = true; |
| 249 | } catch { |
255 | } catch { |
| 250 | if (DEBUG_LEVEL>0) { Console.WriteLine("nodeadress parse error 1"); } |
256 | if (DEBUG_LEVEL>0) { Console.WriteLine("nodeadress parse error 1"); } |
| 251 | return false; |
257 | return false; |
| 252 | } |
258 | } |
| 253 | } |
259 | } |
| 254 | } |
260 | } |
| 255 | 261 | ||
| 256 | return true; |
262 | return true; |
| 257 | } |
263 | } |
| 258 | 264 | ||
| 259 | static private bool parseHWId(string node) { |
265 | static private bool parseHWId(string node) { |
| 260 | // the goal here is to find a uint in a string, format in decimal (0-4294967296) or in hex (0x0-0xffffffff) |
266 | // the goal here is to find a uint in a string, format in decimal (0-4294967296) or in hex (0x0-0xffffffff) |
| 261 | // this is probably not done very neat |
267 | // this is probably not done very neat |
| - | 268 | ||
| - | 269 | if (node.Length > 2) { |
|
| - | 270 | if (node.Substring(node.Length-2, 2).Equals("UL")) { |
|
| - | 271 | node = node.Substring(0, node.Length-2); |
|
| - | 272 | } |
|
| - | 273 | } |
|
| - | 274 | ||
| 262 | sHWid = false; |
275 | sHWid = false; |
| 263 | if (node.Length > 0) { |
276 | if (node.Length > 0) { |
| 264 | try { |
277 | try { |
| 265 | HWid = uint.Parse(node); |
278 | HWid = uint.Parse(node); |
| 266 | sHWid = true; |
279 | sHWid = true; |