Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
GeneralRe: Discussion : Can we say Overloading as polymorphism Pin
dojohansen9-Apr-09 3:04
dojohansen9-Apr-09 3:04 
QuestionString manipulation with large strings [modified] Pin
Harvey Saayman8-Apr-09 22:17
Harvey Saayman8-Apr-09 22:17 
AnswerRe: String manipulation with large strings Pin
Rob Philpott8-Apr-09 22:52
Rob Philpott8-Apr-09 22:52 
GeneralRe: String manipulation with large strings Pin
Harvey Saayman8-Apr-09 23:13
Harvey Saayman8-Apr-09 23:13 
GeneralRe: String manipulation with large strings Pin
Rob Philpott8-Apr-09 23:24
Rob Philpott8-Apr-09 23:24 
GeneralRe: String manipulation with large strings Pin
Harvey Saayman8-Apr-09 23:38
Harvey Saayman8-Apr-09 23:38 
GeneralRe: String manipulation with large strings Pin
dojohansen8-Apr-09 23:58
dojohansen8-Apr-09 23:58 
GeneralRe: String manipulation with large strings Pin
Harvey Saayman9-Apr-09 0:30
Harvey Saayman9-Apr-09 0:30 
Hey there

Yeah i realize the string builder is allot more efficient, i usually just get the concept working using stings and then if necessary replace it with string builders.

To try and fix this problem replaced the string with a string builder, here is the current code

private void ProcessMessage(string CommandPool)
{
    RawResponseReceived(CommandPool);
    StringBuilder sbCommandPool = new StringBuilder(CommandPool);

    while (sbCommandPool.ToString() != string.Empty)
    {
        //
        // If the command starts with a ln=
        if (sbCommandPool.ToString().StartsWith("ln="))
        {
            //
            // Remove the ln=
            sbCommandPool = sbCommandPool.Remove(0, 3);

            //
            // Get the length of the command

            int RequestSize = -1;
            string FinalLength = string.Empty;

            while (Int32.TryParse(sbCommandPool[0].ToString(), out RequestSize))
            {
                FinalLength += RequestSize.ToString();
                sbCommandPool = sbCommandPool.Remove(0, 1);
            }

            //
            // Parse the request size
            RequestSize = Int32.Parse(FinalLength);

            //
            // remove the terminator at the start
            sbCommandPool = sbCommandPool.Remove(0, 1);

            //
            // get the individual command
            string command = sbCommandPool.ToString().Substring(0, RequestSize); //It breaks here

            //
            // remove command from the command pool
            sbCommandPool = sbCommandPool.Remove(0, RequestSize);

            //
            // send command away for proccessing
            ProcessCommand(command);
        }
        else
        {
            Console.Write("Char removed - " + sbCommandPool[0]);
            sbCommandPool = sbCommandPool.Remove(0, 1);
        }
    }
}


the problem persists, when the debugger hits string command = sbCommandPool.ToString().Substring(0, RequestSize); the UI thread becomes active again and the next lines aren't getting executed Confused | :confused:

Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL

you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

GeneralRe: String manipulation with large strings Pin
dojohansen9-Apr-09 1:14
dojohansen9-Apr-09 1:14 
GeneralRe: String manipulation with large strings Pin
dojohansen9-Apr-09 1:25
dojohansen9-Apr-09 1:25 
JokeRe: String manipulation with large strings Pin
dojohansen9-Apr-09 1:37
dojohansen9-Apr-09 1:37 
Questionhow to select the text from the dropdownlist Pin
mdazeemuddin8-Apr-09 22:03
mdazeemuddin8-Apr-09 22:03 
QuestionPenel in Status Bar [modified] Pin
Sajjad Leo8-Apr-09 21:16
Sajjad Leo8-Apr-09 21:16 
AnswerRe: Penel in Status Bar Pin
DaveyM698-Apr-09 22:09
professionalDaveyM698-Apr-09 22:09 
GeneralRe: Penel in Status Bar Pin
Sajjad Leo8-Apr-09 23:19
Sajjad Leo8-Apr-09 23:19 
GeneralRe: Penel in Status Bar Pin
DaveyM699-Apr-09 0:11
professionalDaveyM699-Apr-09 0:11 
GeneralRe: Penel in Status Bar Pin
Sajjad Leo12-Apr-09 20:28
Sajjad Leo12-Apr-09 20:28 
QuestionMedia player control Pin
yesu prakash8-Apr-09 20:44
yesu prakash8-Apr-09 20:44 
AnswerRe: Media player control Pin
12Code8-Apr-09 20:52
12Code8-Apr-09 20:52 
QuestionHelp to me to find simple method for days of month Pin
M Riaz Bashir8-Apr-09 20:30
M Riaz Bashir8-Apr-09 20:30 
AnswerRe: Help to me to find simple method for days of month Pin
DaveyM698-Apr-09 20:37
professionalDaveyM698-Apr-09 20:37 
GeneralRe: Help to me to find simple method for days of month Pin
M Riaz Bashir8-Apr-09 20:39
M Riaz Bashir8-Apr-09 20:39 
QuestionOracle.DataAccess.Client - DbProviderFactories.GetFactory [modified] Pin
devvvy8-Apr-09 20:25
devvvy8-Apr-09 20:25 
AnswerRe: Oracle.DataAccess.Client - DbProviderFactories.GetFactory Pin
devvvy9-Apr-09 16:00
devvvy9-Apr-09 16:00 
Questionproblem with SetSystemTime() fucntion of Kernel32.dll Pin
cppwxwidgetsss8-Apr-09 19:34
cppwxwidgetsss8-Apr-09 19:34 

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.