Click here to Skip to main content
15,895,709 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 3:37
mveOriginalGriff14-Jan-12 3:37 
GeneralRe: Looking for help deciphering this code class Pin
turbosupramk314-Jan-12 3:41
turbosupramk314-Jan-12 3:41 
GeneralRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 3:53
mveOriginalGriff14-Jan-12 3:53 
GeneralRe: Looking for help deciphering this code class Pin
harold aptroot14-Jan-12 4:47
harold aptroot14-Jan-12 4:47 
GeneralRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 5:03
mveOriginalGriff14-Jan-12 5:03 
GeneralRe: Looking for help deciphering this code class Pin
harold aptroot14-Jan-12 5:22
harold aptroot14-Jan-12 5:22 
GeneralRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 5:31
mveOriginalGriff14-Jan-12 5:31 
GeneralRe: Looking for help deciphering this code class Pin
turbosupramk314-Jan-12 8:18
turbosupramk314-Jan-12 8:18 
GeneralRe: Looking for help deciphering this code class Pin
harold aptroot14-Jan-12 9:34
harold aptroot14-Jan-12 9:34 
GeneralRe: Looking for help deciphering this code class Pin
turbosupramk315-Jan-12 5:23
turbosupramk315-Jan-12 5:23 
AnswerRe: Looking for help deciphering this code class Pin
BobJanova15-Jan-12 23:11
BobJanova15-Jan-12 23:11 
QuestionOnline users Pin
RichardKly13-Jan-12 6:37
RichardKly13-Jan-12 6:37 
AnswerRe: Online users Pin
PIEBALDconsult13-Jan-12 6:47
mvePIEBALDconsult13-Jan-12 6:47 
AnswerRe: Online users Pin
Qendro13-Jan-12 6:54
Qendro13-Jan-12 6:54 
Questionhwo to sort observabale collection? Pin
SRKSHOME13-Jan-12 3:08
SRKSHOME13-Jan-12 3:08 
AnswerRe: hwo to sort observabale collection? PinPopular
Abhinav S13-Jan-12 3:19
Abhinav S13-Jan-12 3:19 

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.