//------------------------------------------------------------ // ErrorUtil.FormatErrorMessage (1) // /// <summary> /// <para>Get the format string by id, create an error message with args</para> /// </summary> /// <param name="formatted"></param> /// <param name="excp"></param> /// <param name="strID"></param> /// <param name="args"></param> /// <returns>Return false if failed to make an error message.</returns> //------------------------------------------------------------ static internal bool FormatErrorMessage( out string formatted, out Exception excp, ResNo resNo, params Object[] args) { formatted = null; int argCount = 0; string format = null; excp = null; if (CResources.GetString(resNo, out format, out argCount, out excp)) { return(FormatStringUtil.FormatString( out formatted, out excp, format, argCount, args)); } return(false); }
//------------------------------------------------------------ // CController.ShowMessage (3) // /// <summary></summary> /// <param name="msg"></param> //------------------------------------------------------------ internal void ShowMessage(ResNo resNo, params Object[] args) { string fmt = null; int count = 0; Exception excp = null; if (CResources.GetString(resNo, out fmt, out count, out excp)) { FormatStringUtil.FillupArguments(ref args, count); WriteLine(fmt, args); } else { if (excp != null) { WriteLine(excp.Message); } else { WriteLine("Unknow error in ShowMessage"); } } }
//------------------------------------------------------------ // ConsoleOutput.PrintString (1) // /// <summary> /// Load a string from a resource and print it, followed by an optional newline. /// </summary> /// <param name="sid"></param> /// <param name="newline"></param> /// <param name="prettyprint"></param> /// <remarks> /// ALink's PrintHelp() function will just iterate through a range of ids, /// and only print the ones which exist. /// Thus, the string may not exist for ALink, but it should for CSC. /// </remarks> //------------------------------------------------------------ internal void PrintString( ResNo resNo, bool newLine, // = true, bool prettyPrint) // = false { string buffer; Exception excp = null; if (!CResources.GetString(resNo, out buffer, out excp)) { return; } if (prettyPrint) { //DebugUtil.Assert(newline); PrettyPrint(buffer, 0); } else { PrintInternal(buffer, newLine); } }