Exemple #1
0
        internal static void Parse(Context ctx, string ini, IParserCallbacks callbacks)
        {
            if (ini == null)
            {
                throw new ArgumentNullException("ini");
            }
            if (callbacks == null)
            {
                throw new ArgumentNullException("callbacks");
            }

            PhpIniParser parser = new PhpIniParser(ini, callbacks);

            parser.TopLevel(ctx);
        }
Exemple #2
0
        /// <summary>
        /// Parses an INI-style configuration file.
        /// </summary>
        /// <param name="ctx">Runtime context.</param>
        /// <param name="stream">A stream referring to the file to parse. Should be open in binary mode.</param>
        /// <param name="callbacks">Implementation of the parser callbacks invoked during parsing.</param>
        /// <exception cref="ParseException">Parse error.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="stream"/> or <paramref name="callbacks"/> is a <B>null</B> reference.</exception>
        /// <exception cref="ArgumentException">Stream is was not opened as binary.</exception>
        internal static void Parse(Context ctx, PhpStream stream, IParserCallbacks callbacks)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (!stream.IsBinary)
            {
                throw new ArgumentException("Stream must be binary");
            }
            if (callbacks == null)
            {
                throw new ArgumentNullException("callbacks");
            }

            PhpIniParser parser = new PhpIniParser(stream, callbacks);

            parser.TopLevel(ctx);
        }