Click here to Skip to main content
15,900,724 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era887-Jan-07 8:16
new_era887-Jan-07 8:16 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Captain See Sharp7-Jan-07 8:25
Captain See Sharp7-Jan-07 8:25 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era887-Jan-07 8:51
new_era887-Jan-07 8:51 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
WillemM7-Jan-07 7:34
WillemM7-Jan-07 7:34 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Luc Pattyn7-Jan-07 8:00
sitebuilderLuc Pattyn7-Jan-07 8:00 
QuestionHelp needed converting string hash values into binary... Pin
rvp717y6-Jan-07 12:45
rvp717y6-Jan-07 12:45 
AnswerRe: Help needed converting string hash values into binary... Pin
Guffa6-Jan-07 13:45
Guffa6-Jan-07 13:45 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y6-Jan-07 14:59
rvp717y6-Jan-07 14:59 
Yup, you're right - it's a 32 character long string, however it does only occupy 32 bytes - it's not unicode. No encoding required - it's pure ASCII and is stored as such.

Anyway after much head scratching, I've got the following code to work:


// sHash[32] is a byte array length 32
// eg: the hex value 'A6' is split into sHash[0] & sHash[1]
// the following code will amalgamate this character data into a
// byte array length 16

int l = 0, iFirst, iSecond;

for (int k = 0; k < 32; k += 2)
{
if (sHash[k] > '9')
iFirst = (sHash[k] - 'A') + 10;
else
iFirst = (sHash[k] - '0');

if (sHash[k+1] > '9')
iSecond = (sHash[k+1] - 'A') + 10;
else
iSecond = (sHash[k+1] - '0');

EnHash[l++] = Convert.ToByte(((iFirst * 16) + iSecond));
}


Thanks for your comments above - it's an interesting idea to use int32.parse - I'll give that a go just to see how that works - ultimately it's not too diferent from what I worked out.

Kind regards,
John.
GeneralRe: Help needed converting string hash values into binary... Pin
Luc Pattyn6-Jan-07 18:39
sitebuilderLuc Pattyn6-Jan-07 18:39 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y7-Jan-07 5:02
rvp717y7-Jan-07 5:02 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y7-Jan-07 5:44
rvp717y7-Jan-07 5:44 
Question[Message Deleted] Pin
code_wiz6-Jan-07 11:51
code_wiz6-Jan-07 11:51 
AnswerRe: ListView/TreeView controls vs. Databinding in .NET 2.0 Pin
Nader Elshehabi7-Jan-07 2:46
Nader Elshehabi7-Jan-07 2:46 
QuestionC# Monitors [modified] Pin
manustone6-Jan-07 10:27
manustone6-Jan-07 10:27 
AnswerRe: C# Monitors Pin
gnadeem6-Jan-07 11:42
gnadeem6-Jan-07 11:42 
GeneralRe: C# Monitors Pin
manustone8-Jan-07 4:06
manustone8-Jan-07 4:06 
QuestionHow do I send cmds to a dvd drive in C#? Pin
try{}catch{}6-Jan-07 10:06
try{}catch{}6-Jan-07 10:06 
AnswerRe: How do I send cmds to a dvd drive in C#? Pin
Ed.Poore6-Jan-07 11:13
Ed.Poore6-Jan-07 11:13 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
tophor26-Jan-07 15:44
tophor26-Jan-07 15:44 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
Ed.Poore6-Jan-07 18:45
Ed.Poore6-Jan-07 18:45 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
try{}catch{}7-Jan-07 15:18
try{}catch{}7-Jan-07 15:18 
QuestionWhich coding convention do you use? Pin
cebyrjoe26-Jan-07 10:03
cebyrjoe26-Jan-07 10:03 
AnswerRe: Which coding convention do you use? Pin
Christian Graus6-Jan-07 11:12
protectorChristian Graus6-Jan-07 11:12 
AnswerRe: Which coding convention do you use? Pin
gnadeem6-Jan-07 11:19
gnadeem6-Jan-07 11:19 
GeneralRe: Which coding convention do you use? Pin
gnadeem6-Jan-07 11:22
gnadeem6-Jan-07 11:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.