Click here to Skip to main content
15,902,939 members
Home / Discussions / C#
   

C#

 
AnswerRe: String Format With $ Pin
Pete O'Hanlon24-Aug-17 6:46
mvePete O'Hanlon24-Aug-17 6:46 
GeneralRe: String Format With $ Pin
Kevin Marois24-Aug-17 6:47
professionalKevin Marois24-Aug-17 6:47 
AnswerRe: String Format With $ Pin
Bernhard Hiller24-Aug-17 21:50
Bernhard Hiller24-Aug-17 21:50 
PraiseRe: String Format With $ Pin
Richard Deeming25-Aug-17 2:04
mveRichard Deeming25-Aug-17 2:04 
GeneralRe: String Format With $ Pin
Bernhard Hiller25-Aug-17 2:30
Bernhard Hiller25-Aug-17 2:30 
GeneralRe: String Format With $ Pin
BillWoodruff26-Aug-17 5:20
professionalBillWoodruff26-Aug-17 5:20 
GeneralRe: String Format With $ Pin
Bernhard Hiller28-Aug-17 3:25
Bernhard Hiller28-Aug-17 3:25 
QuestionEverything works fine in the Crystal-report, only the image does not display Pin
goldsoft23-Aug-17 23:37
goldsoft23-Aug-17 23:37 
QuestionANPR Pin
Member 1311476923-Aug-17 18:38
Member 1311476923-Aug-17 18:38 
AnswerRe: ANPR Pin
Pete O'Hanlon23-Aug-17 21:06
mvePete O'Hanlon23-Aug-17 21:06 
AnswerRe: ANPR Pin
Gerry Schmitz26-Aug-17 8:39
mveGerry Schmitz26-Aug-17 8:39 
QuestionHow would I go about implementing this in my code/program? Pin
Delaney Perkins22-Aug-17 22:18
Delaney Perkins22-Aug-17 22:18 
AnswerRe: How would I go about implementing this in my code/program? PinPopular
Chris Quinn22-Aug-17 23:09
Chris Quinn22-Aug-17 23:09 
AnswerRe: How would I go about implementing this in my code/program? Pin
OriginalGriff22-Aug-17 23:23
mveOriginalGriff22-Aug-17 23:23 
AnswerRe: How would I go about implementing this in my code/program? Pin
Pete O'Hanlon23-Aug-17 0:00
mvePete O'Hanlon23-Aug-17 0:00 
AnswerRe: How would I go about implementing this in my code/program? Pin
Gerry Schmitz23-Aug-17 6:38
mveGerry Schmitz23-Aug-17 6:38 
GeneralRe: How would I go about implementing this in my code/program? Pin
Eddy Vluggen23-Aug-17 7:01
professionalEddy Vluggen23-Aug-17 7:01 
GeneralRe: How would I go about implementing this in my code/program? Pin
Gerry Schmitz24-Aug-17 5:26
mveGerry Schmitz24-Aug-17 5:26 
GeneralRe: How would I go about implementing this in my code/program? Pin
Richard MacCutchan24-Aug-17 5:50
mveRichard MacCutchan24-Aug-17 5:50 
GeneralRe: How would I go about implementing this in my code/program? Pin
Gerry Schmitz26-Aug-17 8:08
mveGerry Schmitz26-Aug-17 8:08 
GeneralRe: How would I go about implementing this in my code/program? Pin
Eddy Vluggen24-Aug-17 6:38
professionalEddy Vluggen24-Aug-17 6:38 
AnswerRe: How would I go about implementing this in my code/program? Pin
Bernhard Hiller23-Aug-17 21:16
Bernhard Hiller23-Aug-17 21:16 
Questionintel Hex file creator from Txt File Pin
Psudonym21-Aug-17 21:31
Psudonym21-Aug-17 21:31 
Guys,

I am working on creating intel.hex file from the inputted .txt file. The format of Intel Hex file is

Steps that I follow....

1. Input a .txt file using combo-box and browse button (working fine)
2. Read .txt file using StreamReader (Working fine)
3. Read a single line of the txt file as string (working fine)
4. Get the length of the string ( Now here is a twist)
If I just do str.length, I get the length of the string but it is not of use for me...
Lets take an example of a txt file having data 123456GCTJ
the string str = "123456GCTJ" and str.length = 10
However, since I am converting this text to intel hex format, the string is actually this way...
12, 34, 56, G, C, T, J -> Length = 7
Now, I have to do this dynamically.
Question 1. How to get the string length? Do I have to write my own function? or Do I have to define a public class and associate it with the string like... str.getlengthForIntel()

5. Once, I have length, append the data to the format i.e. Start of Frame + Address + Data + checksum
(Working Fine)

6. Checksum (how to get the checksum? I have written below piece of code which I doubt will work once we have solution to above question)

private string GetChecksum(string strData)
       {
           byte checksum = 0;
           char[] DataArray = strData.ToCharArray();
           byte ArrayLen = 0;
           string strAscii;

           //Add all bytes of the string
           while (ArrayLen < strData.Length)
           {
               if ((DataArray[ArrayLen]) != ':')
               {
                   checksum += (byte)(GetNumberFromString(DataArray[ArrayLen], DataArray[ArrayLen + 1]));
                   ArrayLen++;
               }
               ArrayLen++;
           }

           //1's complement of the addition
           checksum = (byte)(~(int)checksum);

           //2's complement of the addition
           checksum += 1;

           strAscii = ((checksum & 0xF0) >> 4).ToString("X") + (checksum & 0x0F).ToString("X");
           return strAscii;
       }


       private byte GetNumberFromString(char cHighByte, char cLowByte)
       {
           uint uHighByte, uLowByte;
           uint uFinalNum;

           uHighByte = GetHexValueFromAscii(cHighByte);
           uLowByte = GetHexValueFromAscii(cLowByte);

           uFinalNum = (uHighByte << 4) + uLowByte;

           return (byte)uFinalNum;
       }


       private byte GetHexValueFromAscii(char Ascii)
       {
           byte HexNum;
           if ((Ascii >= 0x30) && (Ascii <= 0x39))
           {
               HexNum = (byte)(Ascii & 0x0F);
           }
           else
           {
               HexNum = (byte)Ascii;
           }
           return HexNum;
       }

QuestionRe: intel Hex file creator from Txt File Pin
Richard MacCutchan21-Aug-17 21:37
mveRichard MacCutchan21-Aug-17 21:37 
AnswerRe: intel Hex file creator from Txt File Pin
OriginalGriff21-Aug-17 21:41
mveOriginalGriff21-Aug-17 21:41 

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.