private void LoadJsonSources(IBSharpContext context) { var jsonparser = new Json.JsonParser(); foreach (var file in Directory.GetFiles(Project.GetRootDirectory(), "*.bxls.json", SearchOption.AllDirectories)) { try { var xml = jsonparser.ParseXml(File.ReadAllText(file)); ConvertToBSharpSourceXml(file, xml); Project.Sources.Add(xml); Project.Log.Debug("add src from " + file); } catch (Exception ex) { context.RegisterError(BSharpErrors.Generic(ex)); Project.Log.Fatal("cannot load src from " + file + " : " + ex.Message); } } }
private void LoadBxlSources(IBSharpContext context) { var bxlparser = new BxlParser(); if (null != Project.Definition) { Project.Log.Debug(Project.SrcClass.Compiled.ToString()); } var filter = DirectoryFileFilter.Create(Project); PrintDebugFilter(filter); foreach (var file in filter.Collect().ToArray()) { try { var xml = bxlparser.Parse(null, file); Project.Sources.Add(xml); Project.Log.Debug("add src from " + file); } catch (Exception ex) { context.RegisterError(BSharpErrors.Generic(ex)); Project.Log.Fatal("cannot load src from " + file + " : " + ex.Message); } } }
/// <summary> /// Регистратор ошибок /// </summary> /// <param name="result"></param> /// <param name="e"></param> protected virtual void RegisterError(IBSharpContext result, Exception e) { result.RegisterError(BSharpErrors.Generic(e)); }