Esempio n. 1
0
        /// <summary>
        /// Parses the text of an HTML template and returns the size specified (if any).
        /// </summary>
        /// <remarks>
        /// If a size comment was found, but the specified size could not be parsed, then warnings will be written to
        /// the Pauthor global log.
        /// </remarks>
        /// <param name="template">the HTML template to parse</param>
        /// <param name="width">updated with the specified width, if one was provided</param>
        /// <param name="height">updated with the specified height, if one was provided</param>
        public void ReadSizeFromTemplate(String template, ref int width, ref int height)
        {
            Match match = TemplateSizeRegex.Match(template);

            if (match.Success == false)
            {
                return;
            }

            if (Int32.TryParse(match.Groups[1].Value, out width) == false)
            {
                Globals.TraceMessage(TraceEventType.Warning, "HTML Template had an unexpected width: " + match.Groups[1].Value, "Invalid dimension in template");
            }

            if (Int32.TryParse(match.Groups[2].Value, out height) == false)
            {
                Globals.TraceMessage(TraceEventType.Warning, "HTML Template had an unexpected height: " + match.Groups[2].Value, "Invalid dimension in template");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Parses the text of an HTML template and returns the size specified (if any).
        /// </summary>
        /// <remarks>
        /// If a size comment was found, but the specified size could not be parsed, then warnings will be written to
        /// the Pauthor global log.
        /// </remarks>
        /// <param name="template">the HTML template to parse</param>
        /// <param name="width">updated with the specified width, if one was provided</param>
        /// <param name="height">updated with the specified height, if one was provided</param>
        public void ReadSizeFromTemplate(String template, ref int width, ref int height)
        {
            Match match = TemplateSizeRegex.Match(template);

            if (match.Success == false)
            {
                return;
            }

            if (Int32.TryParse(match.Groups[1].Value, out width) == false)
            {
                Log.Warning("HTML Template had an unexpected width: " + match.Groups[1].Value);
            }


            if (Int32.TryParse(match.Groups[2].Value, out height) == false)
            {
                Log.Warning("HTML Template had an unexpected height: " + match.Groups[2].Value);
            }
        }