本文整理汇总了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();
}
}