All pastes #331959 Raw Edit

Something

public text v1 · immutable
#331959 ·published 2007-01-29 17:11 UTC
rendered paste body
        public void ParseMode(string message)
        {
            string[] line = message.Split(' ');
            if (string.Compare(Nick, line[2]).Equals(0))
            {
                message = String.Empty;
                line[0] = GetUserHostByNick(line[0]);
                line[3] = line[3].Replace(":", string.Empty);
                for (int i = 0; i < line.Length; ++i)
                    message += line[i] + " ";
            }
            ParseModes(message);
        }

        public void ParseModes(string message)
        {
            string[] line = message.Split(partsep, StringSplitOptions.RemoveEmptyEntries);
            ModeChangeType type = ModeChangeType.Assignment;
            int argscount = 0, linecount = 0, argnumber;
            for (int i = 0; i < line[3].Length; ++i)
                if ((!line[3][i].Equals('+')) && (!line[3][i].Equals('-')))
                    ++argscount;
            for (int i = 0; i < line[3].Length; ++i)
                if (line[3][i].Equals('+'))
                    type = ModeChangeType.Assignment;
                else if (line[3][i].Equals('-'))
                    type = ModeChangeType.Revocation;
                else
                {
                    argnumber = (line.Length - 4) + ++linecount;
                    OnModeChanged(message, new IRCUser(line[0]), line[2], line[3][i], type, (argnumber > argscount) ? line[(line.Length - 4) + (argnumber - argscount)] : string.Empty);
                }
        }