Joshi.Utils.Imap.Imap.ParseQuotedString C# (CSharp) Method

ParseQuotedString() private method

Parse the quoted string in body structure
private ParseQuotedString ( string &sBodyStruct, string &sString ) : bool
sBodyStruct string Body Structure
sString string "Quoted string
return bool
        bool ParseQuotedString(ref string sBodyStruct, ref string sString)
        {
            sString = "";

            // remove any spaces at the beginning and the end
            sBodyStruct = sBodyStruct.Trim();

            // check if this is NIL
            if (IsNilString(ref sBodyStruct))
                return true;;

            if (sBodyStruct[0] == '"')
            {
                // extract the part within quotes
                char ch;
                int nEnd;
                for (nEnd = 1; (ch = sBodyStruct[nEnd]) != '"'; nEnd++)
                {
                    if (ch == '\\')
                        nEnd++;
                }
                sString = sBodyStruct.Substring( 1, nEnd-1 );
                sBodyStruct = sBodyStruct.Substring( nEnd+1 );
                return true;
            }
            string sLog = "InValid Body Structure " + sBodyStruct + ".";
            Log( LogTypeEnum.ERROR, sLog);
            return false;
        }