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

C# ErrorLogger类代码示例

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

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



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

示例1: Configure

        public static void Configure()
        {
            ILog logger = new ConsoleLogger();
            ILog errorLogger = new ErrorLogger();

            LogManager.GetLog = type => type == typeof(ActionMessage) ? logger : errorLogger;
        }
开发者ID:christianlang,项目名称:Todo,代码行数:7,代码来源:Logging.cs


示例2: WebProjectManager

        public WebProjectManager(IPackageRepository source, string siteRoot, IWebMatrixHost host)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (String.IsNullOrEmpty(siteRoot))
            {
                throw new ArgumentException("siteRoot");
            }

            _siteRoot = siteRoot;
            string webRepositoryDirectory = GetWebRepositoryDirectory(siteRoot);

            Logger = new ErrorLogger(host);

            var project = new WebProjectSystem(siteRoot);

            project.Logger = Logger;

            _projectManager = new ProjectManager(sourceRepository: source,
                                                   pathResolver: new DefaultPackagePathResolver(webRepositoryDirectory),
                                                   localRepository: PackageRepositoryFactory.Default.CreateRepository(webRepositoryDirectory),
                                                   project: project);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:26,代码来源:WebProjectManager.cs


示例3: checkBSP

    //checks for boxes with only 1 possible input
    public ErrorLogger checkBSP(ref bool madeChange)
    {
        ErrorLogger RV = new ErrorLogger();

        bool noChange = false;
        List<short> curList = new List<short>();
        while (!noChange)
        {
            noChange = true;
            for (int i = 0; i < 81; i++)
            {
                if (numBoxes[i].getValue() == 0)
                {
                    curList.Clear();
                    curList.AddRange(numBoxes[i].getPV());
                    if (curList.Count == 1)
                    {
                        RV = RV + insertNum(numBoxes[i], curList[0]);
                        Console.WriteLine("Single Box Insert: " + i.ToString() + " inserting value: " + curList[0].ToString());
                        noChange = false;
                        madeChange = true;
                    }
                    else if (curList.Count == 0)
                    {
                        RV = RV + new ErrorLogger(-1, "Box " + i + " has no possible values");
                    }
                }
                if (RV.hasError()) break;
            }
            if (RV.hasError()) break;
        }
        return RV;
    }
开发者ID:SamuelLBau,项目名称:SukokuSolver,代码行数:34,代码来源:SDBoard.cs


示例4: FwDataFixer

		/// <summary>
		/// Constructor.  Reads the file and stores any data needed for corrections later on.
		/// </summary>
		public FwDataFixer(string filename, IProgress progress, ErrorLogger logger, ErrorCounter counter)
		{
			m_filename = filename;
			m_progress = progress;
			errorLogger = logger;
			errorCounter = counter;

			m_progress.Minimum = 0;
			m_progress.Maximum = 1000;
			m_progress.Position = 0;
			m_progress.Message = String.Format(Strings.ksReadingTheInputFile, m_filename);
			m_crt = 0;
			// The following fixers will be run on each rt element during FixErrorsAndSave()
			// Note: every change to the file MUST log an error. This is used in FixFwData to set a return code indicating whether anything changed.
			// This in turn is used in Send/Receive to determine whether we need to re-split the file before committing.
			// N.B.: Order is important here!!!!!!!
			m_rtLevelFixers.Add(new DuplicateStyleFixer());
			m_rtLevelFixers.Add(new OriginalFixer());
			m_rtLevelFixers.Add(new CustomPropertyFixer());
			m_rtLevelFixers.Add(new BasicCustomPropertyFixer());
			var senseFixer = new GrammaticalSenseFixer();
			m_rtLevelFixers.Add(senseFixer);
			m_rtLevelFixers.Add(new MorphBundleFixer(senseFixer)); // after we've possibly removed MSAs in GrammaticalSenseFixer
			m_rtLevelFixers.Add(new SequenceFixer());
			m_rtLevelFixers.Add(new HomographFixer());
			m_rtLevelFixers.Add(new DuplicateWordformFixer());
			m_rtLevelFixers.Add(new CustomListNameFixer());
			InitializeFixers(m_filename);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:32,代码来源:FwDataFixer.cs


示例5: deleteItem

 public static string deleteItem(string itemId)
 {
     ErrorLogger log = new ErrorLogger();
     log.ErrorLog(HttpContext.Current.Server.MapPath("Logs/Delete"), "Item with ID " + itemId + " deleted from database.");
     bool success = CatalogAccess.DeleteItem(itemId);
     return success ? "Item deleted successfully." : "There was an error processing your request.";
 }
开发者ID:jaysan1292,项目名称:COMP2098-Website-Project,代码行数:7,代码来源:ItemManager.aspx.cs


示例6: RunInteractiveCore

        /// <summary>
        /// csi.exe and vbi.exe entry point.
        /// </summary>
        private int RunInteractiveCore(ErrorLogger errorLogger)
        {
            Debug.Assert(_compiler.Arguments.IsScriptRunner);

            var sourceFiles = _compiler.Arguments.SourceFiles;

            if (sourceFiles.IsEmpty && _compiler.Arguments.DisplayLogo)
            {
                _compiler.PrintLogo(_console.Out);

                if (!_compiler.Arguments.DisplayHelp)
                {
                    _console.Out.WriteLine(ScriptingResources.HelpPrompt);
                }
            }

            if (_compiler.Arguments.DisplayHelp)
            {
                _compiler.PrintHelp(_console.Out);
                return 0;
            }

            SourceText code = null;

            var diagnosticsInfos = new List<DiagnosticInfo>();

            if (!sourceFiles.IsEmpty)
            {
                if (sourceFiles.Length > 1 || !sourceFiles[0].IsScript)
                {
                    diagnosticsInfos.Add(new DiagnosticInfo(_compiler.MessageProvider, _compiler.MessageProvider.ERR_ExpectedSingleScript));
                }
                else
                {
                    code = _compiler.ReadFileContent(sourceFiles[0], diagnosticsInfos);
                }
            }

            var scriptPathOpt = sourceFiles.IsEmpty ? null : sourceFiles[0].Path;
            var scriptOptions = GetScriptOptions(_compiler.Arguments, scriptPathOpt, _compiler.MessageProvider, diagnosticsInfos);

            var errors = _compiler.Arguments.Errors.Concat(diagnosticsInfos.Select(Diagnostic.Create));
            if (_compiler.ReportErrors(errors, _console.Out, errorLogger))
            {
                return CommonCompiler.Failed;
            }

            var cancellationToken = new CancellationToken();

            if (_compiler.Arguments.InteractiveMode)
            {
                RunInteractiveLoop(scriptOptions, code?.ToString(), cancellationToken);
                return CommonCompiler.Succeeded;
            }
            else
            {
                return RunScript(scriptOptions, code.ToString(), errorLogger, cancellationToken);
            }
        }
开发者ID:hcn0843,项目名称:roslyn,代码行数:62,代码来源:CommandLineRunner.cs


示例7: RunInteractiveCore

        /// <summary>
        /// csi.exe and vbi.exe entry point.
        /// </summary>
        private static int RunInteractiveCore(CommonCompiler compiler, TextWriter consoleOutput, ErrorLogger errorLogger)
        {
            Debug.Assert(compiler.Arguments.IsInteractive);

            var hasScriptFiles = compiler.Arguments.SourceFiles.Any(file => file.IsScript);

            if (compiler.Arguments.DisplayLogo && !hasScriptFiles)
            {
                compiler.PrintLogo(consoleOutput);
            }

            if (compiler.Arguments.DisplayHelp)
            {
                compiler.PrintHelp(consoleOutput);
                return 0;
            }

            // TODO (tomat):
            // When we have command line REPL enabled we'll launch it if there are no input files. 
            IEnumerable<Diagnostic> errors = compiler.Arguments.Errors;
            if (!hasScriptFiles)
            {
                errors = errors.Concat(new[] { Diagnostic.Create(compiler.MessageProvider, compiler.MessageProvider.ERR_NoScriptsSpecified) });
            }

            if (compiler.ReportErrors(errors, consoleOutput, errorLogger))
            {
                return CommonCompiler.Failed;
            }

            // arguments are always available when executing script code:
            Debug.Assert(compiler.Arguments.ScriptArguments != null);

            var compilation = compiler.CreateCompilation(consoleOutput, touchedFilesLogger: null, errorLogger: errorLogger);
            if (compilation == null)
            {
                return CommonCompiler.Failed;
            }

            byte[] compiledAssembly;
            using (MemoryStream output = new MemoryStream())
            {
                EmitResult emitResult = compilation.Emit(output);
                if (compiler.ReportErrors(emitResult.Diagnostics, consoleOutput, errorLogger))
                {
                    return CommonCompiler.Failed;
                }

                compiledAssembly = output.ToArray();
            }

            var assembly = Assembly.Load(compiledAssembly);

            return Execute(assembly, compiler.Arguments.ScriptArguments.ToArray());
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:58,代码来源:ScriptCompilerUtil.cs


示例8: RunInteractiveCore

        /// <summary>
        /// csi.exe and vbi.exe entry point.
        /// </summary>
        private int RunInteractiveCore(ErrorLogger errorLogger)
        {
            Debug.Assert(_compiler.Arguments.IsInteractive);

            var sourceFiles = _compiler.Arguments.SourceFiles;

            if (sourceFiles.IsEmpty && _compiler.Arguments.DisplayLogo)
            {
                _compiler.PrintLogo(_console.Out);
            }

            if (_compiler.Arguments.DisplayHelp)
            {
                _compiler.PrintHelp(_console.Out);
                return 0;
            }

            SourceText code = null;
            IEnumerable<Diagnostic> errors = _compiler.Arguments.Errors;
            if (!sourceFiles.IsEmpty)
            {
                if (sourceFiles.Length > 1 || !sourceFiles[0].IsScript)
                {
                    errors = errors.Concat(new[] { Diagnostic.Create(_compiler.MessageProvider, _compiler.MessageProvider.ERR_ExpectedSingleScript) });
                }
                else
                {
                    var diagnostics = new List<DiagnosticInfo>();
                    code = _compiler.ReadFileContent(sourceFiles[0], diagnostics);
                    errors = errors.Concat(diagnostics.Select(Diagnostic.Create));
                }
            }

            if (_compiler.ReportErrors(errors, _console.Out, errorLogger))
            {
                return CommonCompiler.Failed;
            }

            var cancellationToken = new CancellationToken();
            var hostObject = new CommandLineHostObject(_console.Out, _objectFormatter, cancellationToken);
            hostObject.Args = _compiler.Arguments.ScriptArguments.ToArray();

            var scriptOptions = GetScriptOptions(_compiler.Arguments);

            if (sourceFiles.IsEmpty)
            {
                RunInteractiveLoop(scriptOptions, hostObject);
            }
            else
            {
                RunScript(scriptOptions, code.ToString(), sourceFiles[0].Path, hostObject, errorLogger);
            }

            return hostObject.ExitCode;
        }
开发者ID:nemec,项目名称:roslyn,代码行数:58,代码来源:CommandLineRunner.cs


示例9: Compile

        public CompileResult Compile(string source, CompileContext context)
        {
            var sourceFile = context.RootDirectory.GetFile(context.SourceFilePath);
            importedFilePaths = new HashedSet<string>();
            var parser = new Parser
            {
                Importer = new Importer(new CassetteLessFileReader(sourceFile.Directory, importedFilePaths))
            };
            var errorLogger = new ErrorLogger();
            var engine = new LessEngine(
                                    parser,
                                    errorLogger,
                                    configuration.MinifyOutput,
                                    configuration.Debug,
                                    configuration.DisableVariableRedefines,
                                    configuration.DisableColorCompression,
                                    configuration.KeepFirstSpecialComment,
                                    configuration.Plugins);

            string css;
            try
            {
                css = engine.TransformToCss(source, sourceFile.FullPath);
            }
            catch (Exception ex)
            {
                throw new LessCompileException(
                    string.Format("Error compiling {0}{1}{2}", context.SourceFilePath, Environment.NewLine, ex.Message),
                    ex
                );
            }

            if (errorLogger.HasErrors)
            {
                var exceptionMessage = string.Format(
                    "Error compiling {0}{1}{2}",
                    context.SourceFilePath,
                    Environment.NewLine,
                    errorLogger.ErrorMessage
                );
                throw new LessCompileException(exceptionMessage);
            }
            else
            {
                return new CompileResult(css, importedFilePaths);
            }
        }
开发者ID:joplaal,项目名称:cassette,代码行数:47,代码来源:LessCompiler.cs


示例10: GetPostedSector

        protected static Sector GetPostedSector(HttpRequest request, ErrorLogger errors)
        {
            Sector sector = null;

            if (request.Files["file"] != null && request.Files["file"].ContentLength > 0)
            {
                HttpPostedFile hpf = request.Files["file"];
                sector = new Sector(hpf.InputStream, hpf.ContentType, errors);
            }
            else if (!String.IsNullOrEmpty(request.Form["data"]))
            {
                string data = request.Form["data"];
                sector = new Sector(data.ToStream(), MediaTypeNames.Text.Plain, errors);
            }
            else if (new ContentType(request.ContentType).MediaType == MediaTypeNames.Text.Plain)
            {
                sector = new Sector(request.InputStream, MediaTypeNames.Text.Plain, errors);
            }
            else
            {
                return null;
            }

            if (request.Files["metadata"] != null && request.Files["metadata"].ContentLength > 0)
            {
                HttpPostedFile hpf = request.Files["metadata"];

                string type = SectorMetadataFileParser.SniffType(hpf.InputStream);
                Sector meta = SectorMetadataFileParser.ForType(type).Parse(hpf.InputStream);
                sector.Merge(meta);
            }
            else if (!String.IsNullOrEmpty(request.Form["metadata"]))
            {
                string metadata = request.Form["metadata"];
                string type = SectorMetadataFileParser.SniffType(metadata.ToStream());
                var parser = SectorMetadataFileParser.ForType(type);
                using (var reader = new StringReader(metadata))
                {
                    Sector meta = parser.Parse(reader);
                    sector.Merge(meta);
                }
            }

            return sector;
        }
开发者ID:Matt--,项目名称:travellermap,代码行数:45,代码来源:ImageHandlerBase.cs


示例11: Compile

        public string Compile(string source, IFile sourceFile)
        {
            var parser = new Parser
            {
                Importer = new Importer(new CassetteLessFileReader(sourceFile.Directory))
            };
            var errorLogger = new ErrorLogger();
            var engine = new LessEngine(parser, errorLogger, false);

            var css = engine.TransformToCss(source, sourceFile.FullPath);

            if (errorLogger.HasErrors)
            {
                throw new LessCompileException(errorLogger.ErrorMessage);
            }
            else
            {
                return css;
            }
        }
开发者ID:ChrisMH,项目名称:cassette,代码行数:20,代码来源:LessCompiler.cs


示例12: ExecuteNonQuery

    // Execute an update, delete, or insert command
    // and return the number of affect rows
    public static int ExecuteNonQuery(DbCommand command)
    {
        // the number of affected rows
        int affectedRows = -1;

        // Execute the command making sure the connection gets closed in the end
        try {
            command.Connection.Open();
            // Execute the command and get the number of affected rows
            affectedRows = command.ExecuteNonQuery();
        } catch (Exception ex) {
            // Log eventual errors and rethrow them
            ErrorLogger error = new ErrorLogger();
            error.ErrorLog(HttpContext.Current.Server.MapPath("Logs/ExecuteNonQueryErrorLog"), ex.Message);
            throw;
        } finally {
            // Close the connection
            command.Connection.Close();
        }
        return affectedRows;
    }
开发者ID:jaysan1292,项目名称:COMP2098-Website-Project,代码行数:23,代码来源:GenericDataAccess.cs


示例13: Parse

        public override void Parse(TextReader reader, WorldCollection worlds, ErrorLogger errors)
        {
            int lineNumber = 0;
            for (string line = reader.ReadLine(); line != null; line = reader.ReadLine())
            {
                ++lineNumber;

                if (line.Length == 0)
                    continue;

                switch (line[0])
                {
                    case '#': break; // comment
                    case '$': break; // route
                    case '@': break; // subsector
                    default:
                        ParseWorld(worlds, line, lineNumber, errors ?? worlds.ErrorList);
                        break;
                }
            }
        }
开发者ID:Matt--,项目名称:travellermap,代码行数:21,代码来源:SectorParser.cs


示例14: CreateCompilation

 public override Compilation CreateCompilation(TextWriter consoleOutput, TouchedFileLogger touchedFilesLogger, ErrorLogger errorLogger)
 {
     Compilation = base.CreateCompilation(consoleOutput, touchedFilesLogger, errorLogger);
     return Compilation;
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:5,代码来源:MockCSharpCompiler.cs


示例15: ReloadScripts

        /// <summary>
        /// 
        /// </summary>
        public static bool ReloadScripts()
        {
            if (SceneManager.GameProject == null) return false;

            lock (locker)
            {

                try
                {
                    if (File.Exists(SceneManager.GameProject.ProjectPath + @"\_Scripts.csproj"))
                        File.Delete(SceneManager.GameProject.ProjectPath + @"\_Scripts.csproj");
                    //search for .sln and .csproj files
                    foreach (string filename in Directory.GetFiles(SceneManager.GameProject.ProjectPath))
                    {
                        if (System.IO.Path.GetExtension(filename).ToLower().Equals(".csproj"))
                        {
                            UserPreferences.Instance.ProjectCsProjFilePath = filename;
                        }
                        else if (System.IO.Path.GetExtension(filename).ToLower().Equals(".sln"))
                        {
                            UserPreferences.Instance.ProjectSlnFilePath = filename;
                        }
                    }

                    // Check if scripts were removed:
                    bool removed = false;

                    string projectFileName = UserPreferences.Instance.ProjectCsProjFilePath;
                    XmlDocument doc = new XmlDocument();
                    doc.Load(projectFileName);

                    while (doc.GetElementsByTagName("ItemGroup").Count < 2)
                        doc.GetElementsByTagName("Project").Item(0).AppendChild(doc.CreateElement("ItemGroup"));

                    foreach (XmlNode _node in doc.GetElementsByTagName("ItemGroup").Item(1).ChildNodes)
                    {
                        if (_node.Name.ToLower().Equals("compile"))
                        {
                            if (!File.Exists(SceneManager.GameProject.ProjectPath + "\\" + _node.Attributes.GetNamedItem("Include").Value))
                            {
                                doc.GetElementsByTagName("ItemGroup").Item(1).RemoveChild(_node);
                                removed = true;
                            }
                        }
                    }

                    if (removed)
                        doc.Save(projectFileName);

                    string tmpProjectFileName = SceneManager.GameProject.ProjectPath + @"\_Scripts.csproj";
                    string hash = string.Empty;

                    hash = GibboHelper.EncryptMD5(DateTime.Now.ToString());

                    //try
                    //{
                        /* Change the assembly Name */
                        doc = new XmlDocument();
                        doc.Load(projectFileName);
                        doc.GetElementsByTagName("Project").Item(0).ChildNodes[0]["AssemblyName"].InnerText = hash;
                        doc.Save(tmpProjectFileName);
                    //}
                    //catch (Exception ex)
                    //{
                    //    Console.WriteLine(ex.Message);
                    //}

                    /* Compile project */
                    ProjectCollection projectCollection = new ProjectCollection();
                    Dictionary<string, string> GlobalProperty = new Dictionary<string, string>();
                    GlobalProperty.Add("Configuration", SceneManager.GameProject.Debug ? "Debug" : "Release");
                    GlobalProperty.Add("Platform", "x86");

                    //FileLogger logger = new FileLogger() { Parameters = @"logfile=C:\gibbo_log.txt" };
                    logger = new ErrorLogger();

                    BuildRequestData buildRequest = new BuildRequestData(tmpProjectFileName, GlobalProperty, null, new string[] { "Build" }, null);
                    BuildResult buildResult = BuildManager.DefaultBuildManager.Build(
                            new BuildParameters(projectCollection)
                            {
                                BuildThreadPriority = System.Threading.ThreadPriority.AboveNormal,
                                Loggers = new List<ILogger>() { logger }
                            },
                            buildRequest);

                    //foreach (var tr in logger.Errors)
                    //{
                    //    Console.WriteLine(tr.ToString());
                    //}

                    //Console.WriteLine(buildResult.OverallResult);

                    string cPath = SceneManager.GameProject.ProjectPath + @"\bin\" + (SceneManager.GameProject.Debug ? "Debug" : "Release") + "\\" + hash + ".dll";

                    if (File.Exists(cPath))
                    {
                        /* read assembly to memory without locking the file */
//.........这里部分代码省略.........
开发者ID:Alexz18z35z,项目名称:Gibbo2D,代码行数:101,代码来源:ScriptsBuilder.cs


示例16: PerformLoggedAction

 private IEnumerable<string> PerformLoggedAction(Action action)
 {
     var logger = new ErrorLogger();
     _projectManager.Logger = logger;
     try
     {
         action();
     }
     finally
     {
         _projectManager.Logger = null;
     }
     return logger.Errors;
 }
开发者ID:Wagnerp,项目名称:AutoUpdate,代码行数:14,代码来源:WebProjectManager.cs


示例17: CreateCompilation

        public override Compilation CreateCompilation(TextWriter consoleOutput, TouchedFileLogger touchedFilesLogger, ErrorLogger errorLogger)
        {
            var parseOptions = Arguments.ParseOptions;
            var scriptParseOptions = parseOptions.WithKind(SourceCodeKind.Script);

            bool hadErrors = false;

            var sourceFiles = Arguments.SourceFiles;
            var trees = new SyntaxTree[sourceFiles.Length];
            var normalizedFilePaths = new String[sourceFiles.Length];

            if (Arguments.CompilationOptions.ConcurrentBuild)
            {
                Parallel.For(0, sourceFiles.Length, UICultureUtilities.WithCurrentUICulture<int>(i =>
                {
                    //NOTE: order of trees is important!!
                    trees[i] = ParseFile(consoleOutput, parseOptions, scriptParseOptions, ref hadErrors, sourceFiles[i], errorLogger, out normalizedFilePaths[i]);
                }));
            }
            else
            {
                for (int i = 0; i < sourceFiles.Length; i++)
                {
                    //NOTE: order of trees is important!!
                    trees[i] = ParseFile(consoleOutput, parseOptions, scriptParseOptions, ref hadErrors, sourceFiles[i], errorLogger, out normalizedFilePaths[i]);
                }
            }

            // If errors had been reported in ParseFile, while trying to read files, then we should simply exit.
            if (hadErrors)
            {
                return null;
            }

            var diagnostics = new List<DiagnosticInfo>();

            var uniqueFilePaths = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
            for (int i = 0; i < sourceFiles.Length; i++)
            {
                var normalizedFilePath = normalizedFilePaths[i];
                Debug.Assert(normalizedFilePath != null);
                Debug.Assert(PathUtilities.IsAbsolute(normalizedFilePath));

                if (!uniqueFilePaths.Add(normalizedFilePath))
                {
                    // warning CS2002: Source file '{0}' specified multiple times
                    diagnostics.Add(new DiagnosticInfo(MessageProvider, (int)ErrorCode.WRN_FileAlreadyIncluded,
                        Arguments.PrintFullPaths ? normalizedFilePath : _diagnosticFormatter.RelativizeNormalizedPath(normalizedFilePath)));

                    trees[i] = null;
                }
            }

            if (Arguments.TouchedFilesPath != null)
            {
                foreach (var path in uniqueFilePaths)
                {
                    touchedFilesLogger.AddRead(path);
                }
            }

            var assemblyIdentityComparer = DesktopAssemblyIdentityComparer.Default;
            var appConfigPath = this.Arguments.AppConfigPath;
            if (appConfigPath != null)
            {
                try
                {
                    using (var appConfigStream = PortableShim.FileStream.Create(appConfigPath, PortableShim.FileMode.Open, PortableShim.FileAccess.Read))
                    {
                        assemblyIdentityComparer = DesktopAssemblyIdentityComparer.LoadFromXml(appConfigStream);
                    }

                    if (touchedFilesLogger != null)
                    {
                        touchedFilesLogger.AddRead(appConfigPath);
                    }
                }
                catch (Exception ex)
                {
                    diagnostics.Add(new DiagnosticInfo(MessageProvider, (int)ErrorCode.ERR_CantReadConfigFile, appConfigPath, ex.Message));
                }
            }

            var xmlFileResolver = new LoggingXmlFileResolver(Arguments.BaseDirectory, touchedFilesLogger);
            var sourceFileResolver = new LoggingSourceFileResolver(ImmutableArray<string>.Empty, Arguments.BaseDirectory, touchedFilesLogger);

            MetadataReferenceResolver referenceDirectiveResolver;
            var resolvedReferences = ResolveMetadataReferences(diagnostics, touchedFilesLogger, out referenceDirectiveResolver);
            if (ReportErrors(diagnostics, consoleOutput, errorLogger))
            {
                return null;
            }

            var strongNameProvider = new LoggingStrongNameProvider(Arguments.KeyFileSearchPaths, touchedFilesLogger);

            var compilation = CSharpCompilation.Create(
                Arguments.CompilationName,
                trees.WhereNotNull(),
                resolvedReferences,
                Arguments.CompilationOptions.
//.........这里部分代码省略.........
开发者ID:nemec,项目名称:roslyn,代码行数:101,代码来源:CSharpCompiler.cs


示例18: ParseFile

        private SyntaxTree ParseFile(
            TextWriter consoleOutput,
            CSharpParseOptions parseOptions,
            CSharpParseOptions scriptParseOptions,
            ref bool hadErrors,
            CommandLineSourceFile file,
            ErrorLogger errorLogger,
            out string normalizedFilePath)
        {
            var fileReadDiagnostics = new List<DiagnosticInfo>();
            var content = ReadFileContent(file, fileReadDiagnostics, out normalizedFilePath);

            if (content == null)
            {
                ReportErrors(fileReadDiagnostics, consoleOutput, errorLogger);
                fileReadDiagnostics.Clear();
                hadErrors = true;
                return null;
            }
            else
            {
                return ParseFile(parseOptions, scriptParseOptions, content, file);
            }
        }
开发者ID:nemec,项目名称:roslyn,代码行数:24,代码来源:CSharpCompiler.cs


示例19: QuartzScheduler

        /// <summary>
        /// Create a <see cref="QuartzScheduler" /> with the given configuration
        /// properties.
        /// </summary>
        /// <seealso cref="QuartzSchedulerResources" />
        public QuartzScheduler(QuartzSchedulerResources resources, SchedulingContext ctxt, TimeSpan idleWaitTime, TimeSpan dbRetryInterval)
        {
            Log = LogManager.GetLogger(GetType());
            this.resources = resources;
            try
            {
                Bind();
            }
            catch (Exception re)
            {
                throw new SchedulerException("Unable to bind scheduler to remoting context.", re);
            }

            schedThread = new QuartzSchedulerThread(this, resources, ctxt);
            if (idleWaitTime > TimeSpan.Zero)
            {
                schedThread.IdleWaitTime = idleWaitTime;
            }
            if (dbRetryInterval > TimeSpan.Zero)
            {
                schedThread.DbFailureRetryInterval = dbRetryInterval;
            }

            jobMgr = new ExecutingJobsManager();
            AddGlobalJobListener(jobMgr);
            errLogger = new ErrorLogger();
            AddSchedulerListener(errLogger);

            signaler = new SchedulerSignalerImpl(this, this.schedThread);

            Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz Scheduler v.{0} created.", Version));
        }
开发者ID:djvit-iteelabs,项目名称:Infosystem.Scraper,代码行数:37,代码来源:QuartzScheduler.cs


示例20: RunScript

        private int RunScript(ScriptOptions options, string code, ErrorLogger errorLogger, CancellationToken cancellationToken)
        {
            var globals = new CommandLineScriptGlobals(_console.Out, _objectFormatter);
            globals.Args.AddRange(_compiler.Arguments.ScriptArguments);

            var script = Script.CreateInitialScript<object>(_scriptCompiler, code, options, globals.GetType(), assemblyLoaderOpt: null);
            try
            {
                script.RunAsync(globals, cancellationToken).Wait();

                // TODO: use the return value of the script https://github.com/dotnet/roslyn/issues/5773
                return CommonCompiler.Succeeded;
            }
            catch (CompilationErrorException e)
            {
                _compiler.ReportErrors(e.Diagnostics, _console.Out, errorLogger);
                return CommonCompiler.Failed;
            }
        }
开发者ID:hcn0843,项目名称:roslyn,代码行数:19,代码来源:CommandLineRunner.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ErrorNodeList类代码示例发布时间:2022-05-24
下一篇:
C# ErrorLog类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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