Mono.CSharp.ReportPrinter.Print C# (CSharp) Method

Print() protected method

protected Print ( AbstractMessage msg, TextWriter output ) : void
msg AbstractMessage
output System.IO.TextWriter
return void
		protected void Print (AbstractMessage msg, TextWriter output)
		{
			StringBuilder txt = new StringBuilder ();
			if (!msg.Location.IsNull) {
				if (RootContext.ShowFullPaths)
					txt.Append (msg.Location.ToStringFullName ());
				else
					txt.Append (msg.Location.ToString ());

				txt.Append (" ");
			}

			txt.AppendFormat ("{0} CS{1:0000}: {2}", msg.MessageType, msg.Code, msg.Text);

			if (!msg.IsWarning)
				output.WriteLine (FormatText (txt.ToString ()));
			else
				output.WriteLine (txt.ToString ());

			if (msg.RelatedSymbols != null) {
				foreach (string s in msg.RelatedSymbols)
					output.WriteLine (s + msg.MessageType + ")");
			}
		}

Same methods

ReportPrinter::Print ( AbstractMessage msg ) : void

Usage Example

示例#1
0
        public void Warning(int code, int level, Location loc, string message)
        {
            if (reporting_disabled > 0)
            {
                return;
            }

            if (!IsWarningEnabled(code, level, loc))
            {
                return;
            }

            AbstractMessage msg;

            if (IsWarningAsError(code))
            {
                message = "Warning as Error: " + message;
                msg     = new ErrorMessage(code, loc, message, extra_information);
            }
            else
            {
                msg = new WarningMessage(code, loc, message, extra_information);
            }

            extra_information.Clear();
            printer.Print(msg);
        }
All Usage Examples Of Mono.CSharp.ReportPrinter::Print