本文整理匯總了C#中System.Logger.Close方法的典型用法代碼示例。如果您正苦於以下問題:C# Logger.Close方法的具體用法?C# Logger.Close怎麽用?C# Logger.Close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Logger
的用法示例。
在下文中一共展示了Logger.Close方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
static int Main(string[] args)
{
Console.WriteLine("");
if (args.Length != 2){
Console.WriteLine("Error: Number of argument is invalid !");
PrintHelper();
return (int)ExitCode.InvalidArguments;
}
string xmlFIlePath = args[0];
string logFIlePath = args[1];
if(!File.Exists(xmlFIlePath)){
Console.WriteLine("Error: Xml file argument doesn't exist !");
PrintHelper();
return (int)ExitCode.InvalidArguments;
}
if(!Directory.Exists(Path.GetDirectoryName(logFIlePath))){
Console.WriteLine("Error: The directory of the log file argument doesn't exist !");
PrintHelper();
return (int)ExitCode.InvalidArguments;
}
Logger logger=null;
try{
try{
logger = new Logger(args[1]);
}catch(Exception ex){
Console.WriteLine("Failed to create log file: " + ex.Message);
return (int)ExitCode.InvalidArguments;
}
RunnerPlan data;
try{
logger.Log("Parse xml file to get the compare plan (" + xmlFIlePath + ")");
data = RunnerPlan.ParseFromXml(xmlFIlePath);
logger.Log("\tCleanRegEx : " + data.CleanRegEx);
logger.Log("\tCompShape : " + data.CompShape);
logger.Log("\tCompStyle : " + data.CompStyle);
logger.Log("\tCompValue : " + data.CompValue);
}catch(Exception ex){
logger.Log("Failed to parse Xml file: " + ex.Message);
return (int)ExitCode.FailedToParsePlan;
}
Compare compare;
try{
compare = new Compare();
compare.InfoEvent += new InfoUpdateEventHandler(logger.Log);
compare.CompareFiles(data.FilesA, data.FilesB, data.CleanRegEx, data.ReportFolder, data.CompValue, data.CompStyle, data.CompStyle, true);
}catch(Exception ex){
logger.Log("Failed to compare files: " + ex.Message);
return (int)ExitCode.FailedToCompare;
}
logger.Log("End of comparison.");
return (int)ExitCode.Succeed;
}catch(Exception){
return (int)ExitCode.UnknownError;
}finally{
logger.Close();
}
}