本文整理汇总了C#中Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorFromResources方法的典型用法代码示例。如果您正苦于以下问题:C# TaskLoggingHelper.LogErrorFromResources方法的具体用法?C# TaskLoggingHelper.LogErrorFromResources怎么用?C# TaskLoggingHelper.LogErrorFromResources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Utilities.TaskLoggingHelper
的用法示例。
在下文中一共展示了TaskLoggingHelper.LogErrorFromResources方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckFilePath
/// <summary>
/// Checks that the file path is sanitized and follows
/// all the conventions estabilished by the operating system.
/// </summary>
/// <param name="fileName">The input file name to validate.</param>
/// <param name="log">The current log instance.</param>
/// <returns>A value indicating whether the action was executed succesfuly.</returns>
internal static bool CheckFilePath(string fileName, TaskLoggingHelper log)
{
bool flag = true;
string directoryName = string.Empty;
try
{
directoryName = Path.GetDirectoryName(fileName);
}
catch (ArgumentException exception)
{
directoryName = exception.Message;
flag = false;
}
catch (PathTooLongException exception2)
{
directoryName = exception2.Message;
flag = false;
}
if (!flag)
{
log.LogErrorFromResources("InvalidPathChars", new object[] { directoryName });
}
return flag;
}
示例2: TestLogErrorFromResourcesNullMessage2
public void TestLogErrorFromResourcesNullMessage2 ()
{
tlh = new TaskLoggingHelper (task);
tlh.LogErrorFromResources (null, null, null, null, 0, 0, 0, 0, null);
}
示例3: SafeCreateDirectory
/// <summary>
/// Executes a directory creation procedure and safely handles the exceptions
/// that might pop up.
/// </summary>
/// <param name="path">The path of the directory to create.</param>
/// <param name="log">The current instance of the log.</param>
/// <returns>A value indicating whether the action was executed succesfuly.</returns>
internal static bool SafeCreateDirectory(string path, TaskLoggingHelper log)
{
bool flag = true;
string message = string.Empty;
if (!Directory.Exists(path))
{
try
{
Directory.CreateDirectory(path);
}
catch (UnauthorizedAccessException exception)
{
message = exception.Message;
flag = false;
}
catch (ArgumentNullException exception2)
{
message = exception2.Message;
flag = false;
}
catch (ArgumentException exception3)
{
message = exception3.Message;
flag = false;
}
catch (PathTooLongException exception4)
{
message = exception4.Message;
flag = false;
}
catch (DirectoryNotFoundException exception5)
{
message = exception5.Message;
flag = false;
}
catch (IOException exception6)
{
message = exception6.Message;
flag = false;
}
catch (NotSupportedException exception7)
{
message = exception7.Message;
flag = false;
}
}
if (!flag)
{
log.LogErrorFromResources("DirectoryCreationError", new object[] { message });
}
return flag;
}