Exemplo n.º 1
0
        public static IniElement ParseLine(string line)
        {
            if (line == null)
            {
                return(null);
            }
            if (line.Contains("\n"))
            {
                throw new ArgumentException("String passed to the ParseLine method cannot contain more than one line.");
            }
            var        trim = line.Trim();
            IniElement elem = null;

            if (IniBlankLine.IsLineValid(trim))
            {
                elem = new IniBlankLine(1);
            }
            else if (IniCommentary.IsLineValid(line))
            {
                elem = new IniCommentary(line);
            }
            else if (IniSectionStart.IsLineValid(trim))
            {
                elem = new IniSectionStart(line);
            }
            else if (IniValue.IsLineValid(trim))
            {
                elem = new IniValue(line);
            }
            return(elem ?? new IniElement(line));
        }
Exemplo n.º 2
0
		public static IniElement ParseLine(string line)
		{
			if (line == null)
				return null;
			if (line.Contains("\n"))
				throw new ArgumentException("String passed to the ParseLine method cannot contain more than one line.");
			var trim = line.Trim();
			IniElement elem = null;
			if (IniBlankLine.IsLineValid(trim))
				elem = new IniBlankLine(1);
			else if (IniCommentary.IsLineValid(line))
				elem = new IniCommentary(line);
			else if (IniSectionStart.IsLineValid(trim))
				elem = new IniSectionStart(line);
			else if (IniValue.IsLineValid(trim))
				elem = new IniValue(line);
			return elem ?? new IniElement(line);
		}