• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Compiler.CompilerError类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.CodeDom.Compiler.CompilerError的典型用法代码示例。如果您正苦于以下问题:C# CompilerError类的具体用法?C# CompilerError怎么用?C# CompilerError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CompilerError类属于System.CodeDom.Compiler命名空间,在下文中一共展示了CompilerError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LogError

 void LogError(CompilerError error)
 {
     if (error.IsWarning)
         Log.LogWarning(null, error.ErrorNumber, null, error.FileName, error.Line, error.Column, 0, 0, error.ErrorText);
     else
         Log.LogError(null, error.ErrorNumber, null, error.FileName, error.Line, error.Column, 0, 0, error.ErrorText);
 }
开发者ID:kokudori,项目名称:Y3,代码行数:7,代码来源:CompileY3.cs


示例2: ParseLine

		public CompilerError ParseLine(string line)
		{
			// try to match standard mono errors
			Match match = normalError.Match(line); 
			if (match.Success) {
				CompilerError error = new CompilerError();
				error.Column      = Int32.Parse(match.Result("${column}"));
				error.Line        = Int32.Parse(match.Result("${line}"));
				error.FileName    = Path.GetFullPath(match.Result("${file}"));
				error.IsWarning   = match.Result("${error}") == "warning";
				error.ErrorNumber = match.Result("${number}");
				error.ErrorText   = match.Result("${message}");
				return error;
			} else {
				match = generalError.Match(line);
				if (match.Success) {
					CompilerError error = new CompilerError();
					error.IsWarning   = match.Result("${error}") == "warning";
					error.ErrorNumber = match.Result("${number}");
					error.ErrorText   = match.Result("${message}");
					return error;
				}
			}
			return null;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:25,代码来源:MonoCSharpCompilerResultsParser.cs


示例3: AppendError

        private static void AppendError(StringBuilder message, CompilerError error, string[] lines)
        {
            message.AppendLine( error.ToString() );

            if (error.Line <= 0)
            {
                return;
            }

            var line = error.Line - 1;

            if( line - 1 > 0 )
            {
                message.AppendLine( string.Format("{0}: {1}", (line - 1).ToString( "0000", CultureInfo.CurrentUICulture ), lines[line - 1]) );
            }

            message.AppendLine( string.Format("{0}: {1}", (line - 1).ToString( "0000", CultureInfo.CurrentUICulture ), lines[line]) );

            if( line + 1 < lines.Length )
            {
                message.AppendLine( string.Format("{0}: {1}", (line + 1).ToString( "0000", CultureInfo.CurrentUICulture ), lines[line + 1]) );
            }

            message.AppendLine();
        }
开发者ID:richiejp,项目名称:NHaml,代码行数:25,代码来源:TemplateCompilationException.cs


示例4: TaskType_CompilerErrorIsNotWarning_ReturnsError

		public void TaskType_CompilerErrorIsNotWarning_ReturnsError()
		{
			var error = new CompilerError();
			var task = new CompilerErrorTask(error);
			
			Assert.AreEqual(TaskType.Error, task.TaskType);
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:7,代码来源:CompilerErrorTaskTests.cs


示例5: LogError

 private void LogError(string fileName, string format, params object[] args)
 {
     var engineHost = (ITextTemplatingEngineHost)this.TextTemplating;
     string errorText = string.Format(CultureInfo.CurrentCulture, format, args);
     var error = new CompilerError { FileName = fileName, ErrorText = errorText };
     engineHost.LogErrors(new CompilerErrorCollection(new[] { error }));
 }
开发者ID:icool123,项目名称:T4Toolbox,代码行数:7,代码来源:TemplatedFileGenerator.cs


示例6: Warning

		public void Warning (string message)
		{
			var err = new CompilerError (null, -1, -1, null, message) {
				IsWarning = true,
			};
			Errors.Add (err);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:TextTransformation.cs


示例7: CompilerConversionTestCase

 public CompilerConversionTestCase(Type sourceType, Type targetType, CastFlag castFlag, string codeline = null, CompilerError compilerError = null)
 {
     this.SourceType = sourceType;
     this.TargetType = targetType;
     this.Codeline = codeline;
     this.CompilerError = compilerError;
     this.CastFlag = castFlag;
 }
开发者ID:thomasgalliker,项目名称:TypeConverter,代码行数:8,代码来源:CompilerConversionTestCase.cs


示例8: CompilerErrorTask

        public CompilerErrorTask(CompilerError error)
            : base(GetFileName(error.FileName),
				error.ErrorText,
				error.Column,
				error.Line,
				GetTaskType(error.IsWarning))
        {
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:8,代码来源:CompilerErrorTask.cs


示例9: AddError

		CompilerError AddError (string message)
		{
			CompilerError err = new CompilerError ();
			err.Column = err.Line = -1;
			err.ErrorText = message;
			errors.Add (err);
			return err;
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:8,代码来源:TextTransformation.cs


示例10: TaskType_CompilerErrorIsWarning_ReturnsWarning

		public void TaskType_CompilerErrorIsWarning_ReturnsWarning()
		{
			var error = new CompilerError();
			error.IsWarning = true;
			var task = new CompilerErrorTask(error);
			
			Assert.AreEqual(TaskType.Warning, task.TaskType);
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:8,代码来源:CompilerErrorTaskTests.cs


示例11: AddRange

 /// <devdoc>
 /// <para>Copies the elements of an array to the end of the <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/>.</para>
 /// </devdoc>
 public void AddRange(CompilerError[] value) {
     if (value == null) {
         throw new ArgumentNullException("value");
     }
     for (int i = 0; ((i) < (value.Length)); i = ((i) + (1))) {
         this.Add(value[i]);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:CompilerErrorCollection.cs


示例12: Line_CompilerErrorLineIsThree_ReturnsThree

		public void Line_CompilerErrorLineIsThree_ReturnsThree()
		{
			var error = new CompilerError();
			error.FileName = "test.txt";
			error.Line = 3;
			var task = new CompilerErrorTask(error);
			
			Assert.AreEqual(3, task.Line);
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:9,代码来源:CompilerErrorTaskTests.cs


示例13: FileName_CompilerErrorFileNameIsTestTxt_ReturnsTestTxt

		public void FileName_CompilerErrorFileNameIsTestTxt_ReturnsTestTxt()
		{
			var error = new CompilerError();
			error.FileName = "test.txt";
			var task = new CompilerErrorTask(error);
			
			FileName expectedFileName = new FileName("test.txt");
			Assert.AreEqual(expectedFileName, task.FileName);
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:9,代码来源:CompilerErrorTaskTests.cs


示例14: FormatCompilerError

 private static string FormatCompilerError(CompilerError compilerError)
 {
     return string.Format(
         "{0}, Line {1}: {2}",
         compilerError.FileName,
         compilerError.Line,
         compilerError.ErrorText
         );
 }
开发者ID:RazorPad,项目名称:RazorPad.Core,代码行数:9,代码来源:RazorViewComponentAssemblyCompilationException.cs


示例15: BuildError

		public BuildError (CompilerError error)
		{
			FileName = error.FileName;
			Line = error.Line;
			Column = error.Column;
			ErrorNumber = error.ErrorNumber;
			ErrorText = error.ErrorText;
			IsWarning = error.IsWarning;
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:9,代码来源:BuildError.cs


示例16: ScriptCompilerError

 public ScriptCompilerError(CompilerError compilerError)
 {
     Column = compilerError.Column;
     ErrorNumber = compilerError.ErrorNumber;
     ErrorText = compilerError.ErrorText;
     FileName = compilerError.FileName;
     IsWarning = compilerError.IsWarning;
     Line = compilerError.Line;
 }
开发者ID:Jchuchla,项目名称:vixen,代码行数:9,代码来源:ScriptCompilerError.cs


示例17: Convert

        public static ConvertionResult Convert(string code, AlgoType algotype, Model.File[] includeFiles)
        {
            string calgoCode = null;
            IEnumerable<ParsingError> parsingErrors = new ParsingError[0];
            var compilerErrors = new CompilerError[0];

            var codeBase = CodeBase.Mq4;
            if (CSharpCodeDetector.IsCSharpCode(code))
            {
                codeBase = CodeBase.CSharp;
            }
            else if (MqCodeBaseDetector.IsMq5Code(code))
            {
                codeBase = CodeBase.Mq5;
            }
            else if (!MqCodeBaseDetector.IsValidMq4Code(code))
            {
                codeBase = CodeBase.Invalid;
            }
            else
            {
                var parser = new Mq4Parser();

                var indicatorParsingResult = parser.Parse(code, algotype, includeFiles);
                var algo = indicatorParsingResult.Algo;
                parsingErrors = indicatorParsingResult.ParsingErrors;
                if (parsingErrors.All(e => e.ErrorType < ErrorType.Error))
                {
                    var presenter = CreatePresenter(algotype);
                    calgoCode = presenter.GenerateCodeFrom(algo);

                    var compiler = new CSharpCompiler();
                    var fileName = Path.GetTempFileName();
                    try
                    {
                        var codeToCompile = calgoCode;
                        var indexToInsert = codeToCompile.IndexOf("//Custom Indicators Place Holder");
                        foreach (var customIndicatorName in algo.CustomIndicators)
                        {
                            codeToCompile = codeToCompile.Insert(indexToInsert,
                                                                 CustomIndicatorTemplate.Replace("CustomIndicatorName",
                                                                                                 customIndicatorName));
                        }
                        compilerErrors = compiler.Compile(codeToCompile, fileName);

                        codeBase = MqCodeBaseDetector.GetCodeBaseFromErrors(compilerErrors);
                    }
                    finally
                    {
                        File.Delete(fileName);
                    }
                }
            }

            return new ConvertionResult(calgoCode, parsingErrors, compilerErrors, codeBase);
        }
开发者ID:matiasev,项目名称:2calgo.Library,代码行数:56,代码来源:cAlgoConverter.cs


示例18: Column_CompilerErrorColumnIsTwo_ReturnsTwo

		public void Column_CompilerErrorColumnIsTwo_ReturnsTwo()
		{
			var error = new CompilerError();
			error.FileName = "test.txt";
			error.Line = 1;
			error.Column = 2;
			var task = new CompilerErrorTask(error);
			
			Assert.AreEqual(2, task.Column);
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:10,代码来源:CompilerErrorTaskTests.cs


示例19: CompilerExceptionListViewItem

 public CompilerExceptionListViewItem(CompilerError ce, int imgListCount)
     : base(ce.ErrorText)
 {
     this.compilerError = ce;
     //this.ImageIndex = (imgListCount / 2) - 1;
     this.ImageIndex = (imgListCount / 2);
     this.SubItems.Add(ce.Line.ToString() );
     this.SubItems.Add(ce.Column.ToString() );
     this.SubItems.Add(ce.IsWarning.ToString() );
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:10,代码来源:CompilerExceptionListViewItem.cs


示例20: Ctor_sets_properties

        public void Ctor_sets_properties()
        {
            var message = "Some message";
            var errors = new CompilerError[0];

            var ex = new CompilerErrorException(message, errors);

            Assert.Equal(message, ex.Message);
            Assert.Same(errors, ex.Errors);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:10,代码来源:CompilerErrorExceptionTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Compiler.CompilerErrorCollection类代码示例发布时间:2022-05-26
下一篇:
C# Compiler.CodeGeneratorOptions类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap