Click here to Skip to main content
15,922,407 members
Home / Discussions / C#
   

C#

 
AnswerRe: Windows service Windows XP and Windows 7 Pin
Mc_Topaz15-Jan-12 22:22
Mc_Topaz15-Jan-12 22:22 
GeneralRe: Windows service Windows XP and Windows 7 Pin
BobJanova16-Jan-12 3:48
BobJanova16-Jan-12 3:48 
GeneralRe: Windows service Windows XP and Windows 7 Pin
Dave Kreskowiak16-Jan-12 4:27
mveDave Kreskowiak16-Jan-12 4:27 
AnswerRe: Windows service Windows XP and Windows 7 Pin
Mc_Topaz16-Jan-12 5:29
Mc_Topaz16-Jan-12 5:29 
GeneralRe: Windows service Windows XP and Windows 7 Pin
Dave Kreskowiak16-Jan-12 6:40
mveDave Kreskowiak16-Jan-12 6:40 
QuestionMSIL obfuscator with .pdb symbol and source line number fixup Pin
Ravi Bhavnani15-Jan-12 16:26
professionalRavi Bhavnani15-Jan-12 16:26 
QuestionMagic Button Text Padding Pin
John R. Shaw15-Jan-12 8:30
John R. Shaw15-Jan-12 8:30 
AnswerRe: Magic Button Text Padding Pin
BillWoodruff15-Jan-12 16:07
professionalBillWoodruff15-Jan-12 16:07 
QuestionSuggestion to do a multilanguage project Pin
Arunkumar.Koloth15-Jan-12 1:21
Arunkumar.Koloth15-Jan-12 1:21 
AnswerRe: Suggestion to do a multilanguage project Pin
venomation15-Jan-12 1:42
venomation15-Jan-12 1:42 
AnswerRe: Suggestion to do a multilanguage project Pin
Not Active15-Jan-12 7:22
mentorNot Active15-Jan-12 7:22 
AnswerRe: Suggestion to do a multilanguage project Pin
Bernhard Hiller15-Jan-12 21:31
Bernhard Hiller15-Jan-12 21:31 
GeneralRe: Suggestion to do a multilanguage project Pin
joost.versteegen16-Jan-12 4:26
joost.versteegen16-Jan-12 4:26 
AnswerRe: Suggestion to do a multilanguage project Pin
jschell16-Jan-12 8:52
jschell16-Jan-12 8:52 
QuestionProblem with Ninject Pin
venomation15-Jan-12 0:28
venomation15-Jan-12 0:28 
AnswerRe: Problem with Ninject Pin
Dave Kreskowiak15-Jan-12 3:23
mveDave Kreskowiak15-Jan-12 3:23 
QuestionRemote PC diagnostics Code Pin
Mohammed NAeem14-Jan-12 21:49
Mohammed NAeem14-Jan-12 21:49 
AnswerRe: Remote PC diagnostics Code Pin
Eddy Vluggen15-Jan-12 6:02
professionalEddy Vluggen15-Jan-12 6:02 
QuestionLooking for help deciphering this code class Pin
turbosupramk313-Jan-12 19:09
turbosupramk313-Jan-12 19:09 
AnswerRe: Looking for help deciphering this code class Pin
Richard MacCutchan13-Jan-12 22:23
mveRichard MacCutchan13-Jan-12 22:23 
GeneralRe: Looking for help deciphering this code class Pin
turbosupramk314-Jan-12 3:28
turbosupramk314-Jan-12 3:28 
GeneralRe: Looking for help deciphering this code class Pin
Richard MacCutchan14-Jan-12 3:41
mveRichard MacCutchan14-Jan-12 3:41 
GeneralRe: Looking for help deciphering this code class Pin
harold aptroot14-Jan-12 4:34
harold aptroot14-Jan-12 4:34 
AnswerRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 0:23
mveOriginalGriff14-Jan-12 0:23 
If these bits are confusing you, then you need to go back and start with the C# basics - there is nothing there I would not expect anyone halfway trained in C# to have problems with.

C#
private const uint COMMAND_LOAD_RAM_AND_RUN = 1;
private const uint COMMAND_LOAD_EEPROM_AND_RUN = 3;
Just declares two constant values so that you can use names in your code instead of relying on magic numbers.
C#
lfsrData[0] = 0xF9;  // 0xF9 is 249 in hex
            for (int i = 1; i < 251; ++i)
                lfsrData[i] = (byte)(0xFE | (IterateLFSR() ? 1 : 0));   // 0xFE is 254 in hex
Presets a buffer of 251 bytes with a specific sequence: the first byte will be 0xF9, all teh others will be 0xFE or 0xFF, depending on how the IterateLFSR method works. Which is dependant on the value of _LFSR, which depends on when you last called ResetLFSR - and I'm not going to try to follow your code to work that out!
C#
byte[] buffer = new byte[258];
for (int i = 0; i < 258; ++i)
    buffer[i] = 0xF9;   // 0xF9 is 249 in hex
Just declares a byte array and fills it with a simple hex value.

C#
for (int i = 0; i < 250; ++i)
           {
               if (ReceiveBit(false, 100) != IterateLFSR())
                   throw new ApplicationException("Receiving LFSR data failed!");
           }
 
           //Receive pr version
           byte version = 0;
           for (int i = 0; i < 8; ++i)
           {
               version >>= 1;
               version += (byte)(ReceiveBit(false, 100) ? 128 : 0);
           }
Just seems to be a way of clocking in eight bit data on a serial line, with a varying prefix bit that I can't be bothered to work out. Followed by chucking the data you just received away.

To be honest, it's a bit rubbish. Someone has tried to use mnemonics for special values, and then ignored that and hardwired magic numbers such as 0xF9 in anyway, without trying to explain why.

Go back where you got it, and see if there is any design documentation which might explain why they are doing this!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

GeneralRe: Looking for help deciphering this code class Pin
turbosupramk314-Jan-12 3:27
turbosupramk314-Jan-12 3:27 

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.