当前位置: 首页>>代码示例>>C#>>正文


C# TaskLoggingHelper.LogErrorFromResources方法代码示例

本文整理汇总了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;
        }
开发者ID:tario,项目名称:sdctasks,代码行数:33,代码来源:TaskHelpers.cs

示例2: TestLogErrorFromResourcesNullMessage2

		public void TestLogErrorFromResourcesNullMessage2 ()
		{
			tlh = new TaskLoggingHelper (task);
			tlh.LogErrorFromResources (null, null, null, null, 0, 0, 0, 0, null);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:5,代码来源:TaskLoggingHelperTest.cs

示例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;
        }
开发者ID:tario,项目名称:sdctasks,代码行数:61,代码来源:TaskHelpers.cs


注:本文中的Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorFromResources方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。