private void ActionBuildEvent(BuildEvent buildEvent) { using (packetSender.Suppress <ConstructionAmountChanged>()) using (packetSender.Suppress <ConstructionCompleted>()) using (packetSender.Suppress <PlaceBasePiece>()) using (packetSender.Suppress <DeconstructionBegin>()) using (packetSender.Suppress <DeconstructionCompleted>()) using (packetSender.Suppress <BasePieceMetadataChanged>()) { if (buildEvent is BasePiecePlacedEvent) { PlaceBasePiece((BasePiecePlacedEvent)buildEvent); } else if (buildEvent is ConstructionCompletedEvent) { ConstructionCompleted((ConstructionCompletedEvent)buildEvent); } else if (buildEvent is ConstructionAmountChangedEvent) { ConstructionAmountChanged((ConstructionAmountChangedEvent)buildEvent); } else if (buildEvent is DeconstructionBeginEvent) { DeconstructionBegin((DeconstructionBeginEvent)buildEvent); } else if (buildEvent is DeconstructionCompletedEvent) { DeconstructionCompleted((DeconstructionCompletedEvent)buildEvent); } } }
/// <summary> /// Invoked when a user starts a build (clean, rebuild, ...) of a solution, project, or batch build. /// </summary> private void _buildEvents_OnBuildBegin(vsBuildScope scope, vsBuildAction action) { Asserts.Null(_currentEvent, "another build is running."); _currentEvent = Create <BuildEvent>(); _currentEvent.Scope = scope.ToString(); _currentEvent.Action = action.ToString(); }
public int GetPreviousDiffId(int id) { BuildEvent original = Db.BuildEvents.Where(b => b.EventLogId == id).FirstOrDefault(); if (original == null) { return(-1); } //find the next build in the sequence that: // a: belongs to the same user // b: is from the same solution BuildEvent previous = (from be in Db.BuildEvents where be.EventLogId < id && be.EventLog.SenderId == original.EventLog.SenderId && be.SolutionName.CompareTo(original.SolutionName) == 0 orderby be.EventLogId descending select be).FirstOrDefault(); if (previous != null) { return(previous.EventLogId); } else { return(-1); } }
public static void SendBuildEvent(GUID guid, BuildTarget buildTarget, BuildTargetGroup buildTargetGroup, IEnumerable <XRLoader> loaders) { #if UNITY_ANALYTICS && ENABLE_CLOUD_SERVICES_ANALYTICS if (!s_Initialized && !Initialize()) { return; } List <string> loaderTypeNames = new List <string>(); foreach (var loader in loaders) { loaderTypeNames.Add(loader.GetType().Name); } var data = new BuildEvent { buildGuid = guid.ToString(), buildTarget = buildTarget.ToString(), buildTargetGroup = buildTargetGroup.ToString(), assigned_loaders = loaderTypeNames.ToArray(), }; EditorAnalytics.SendEventWithLimit(kEventBuild, data); #endif //UNITY_ANALYTICS && ENABLE_CLOUD_SERVICES_ANALYTICS }
public static void SendBuildEvent(Project project, Build.BuildResult buildResult) { if (project?.Settings == null) { return; } var configEntity = project.WorldManager.GetConfigEntity(); var displayInfo = project.EntityManager.GetComponentData <DisplayInfo>(configEntity); var e = new BuildEvent() { package = PackageInfo.Create(), context = ContextInfo.Default, project = ProjectInfo.Create(project), duration = buildResult.Duration.Ticks, heap_size = project.Settings.WebSettings.MemorySizeInMB, opt_auto_resize = displayInfo.autoSizeToFrame, opt_webp_decompressor = false, // TODO: re-populate from settings opt_ecma5 = false, // deprecated opt_single_file_output = project.Settings.WebSettings.SingleFileOutput, opt_embed_assets = project.Settings.WebSettings.SingleFileOutput, default_texture_format = project.Settings.DefaultTextureSettings.FormatType.ToString() }; Send(EventName.tinyEditorBuild, e); }
private void ProcessBuildEventsUntilFrameBlocked() { bool processedFrameBlockingEvent = false; bool isNextEventFrameBlocked = false; while (buildEvents.Count > 0 && !isNextEventFrameBlocked) { BuildEvent nextEvent = buildEvents.Dequeue(); try { ActionBuildEvent(nextEvent); } catch (Exception ex) { Log.Error("Error processing buildEvent in ThrottledBuilder" + ex); } if (nextEvent.RequiresFreshFrame()) { processedFrameBlockingEvent = true; } isNextEventFrameBlocked = (processedFrameBlockingEvent && buildEvents.NextEventRequiresFreshFrame()); } }
public void ShouldSerializeToString() { var e = new BuildEvent { Action = "SomeAction", Scope = "SomeScope", Targets = new[] { new BuildTarget { Duration = new TimeSpan(0, 0, 1), Platform = "SomePlatform", Project = "SomeProject", ProjectConfiguration = "SomeConfiguration", SolutionConfiguration = "SomeOtherConfiguration", StartedAt = new DateTimeOffset(2014, 01, 01, 13, 45, 54, TimeSpan.FromHours(-5)), Successful = true } } }; const string expected = "{\"$type\":\"KaVE.Commons.Model.Events.VisualStudio.BuildEvent, KaVE.Commons\",\"Scope\":\"SomeScope\",\"Action\":\"SomeAction\",\"Targets\":[{\"$type\":\"KaVE.Commons.Model.Events.VisualStudio.BuildTarget, KaVE.Commons\",\"Project\":\"SomeProject\",\"ProjectConfiguration\":\"SomeConfiguration\",\"Platform\":\"SomePlatform\",\"SolutionConfiguration\":\"SomeOtherConfiguration\",\"StartedAt\":\"2014-01-01T13:45:54-05:00\",\"Duration\":\"00:00:01\",\"Successful\":true}],\"TriggeredBy\":0}"; JsonAssert.SerializesTo(e, expected); JsonAssert.DeserializesTo(expected, e); }
internal void PopEvent <T> (T finished_args) where T : BuildStatusEventArgs { if (events.Count == 0) { throw new InvalidOperationException("INTERNAL ERROR: Trying to pop from an empty events stack"); } BuildEvent be = events [events.Count - 1]; if (parent.config.PerformanceSummary || verbosity == LoggerVerbosity.Diagnostic) { var args = be.EventArgs; TargetStartedEventArgs tgt_args = args as TargetStartedEventArgs; if (tgt_args != null) { AddPerfInfo(tgt_args.TargetName, args.Timestamp, targetPerfTable); } else { TaskStartedEventArgs tsk_args = args as TaskStartedEventArgs; if (tsk_args != null) { AddPerfInfo(tsk_args.TaskName, args.Timestamp, tasksPerfTable); } } } be.ExecuteFinishedHandler(finished_args); events.RemoveAt(events.Count - 1); current_events_string = null; }
/// <summary> /// Shows all documents associated with a given build document /// </summary> /// <param name="eventLogId"></param> /// <returns></returns> public ActionResult Documents(int eventLogId) { BuildEvent build = OsbideDb.BuildEvents .Include(be => be.Documents.Select(d => d.Document)) .Include(be => be.EventLog) .Where(be => be.EventLogId == eventLogId) .FirstOrDefault(); //find NPSM state for this build TimelineState buildState = (from npsm in Db.TimelineStates where npsm.StartTime >= build.EventLog.DateReceived && npsm.IsSocialEvent == false && npsm.UserId == build.EventLog.SenderId && npsm.State != "--" orderby npsm.Id ascending select npsm).Take(1).FirstOrDefault(); //find next "interested" build, defined as follows: //document contains +/- 10% more lines //new document added to build List <BuildEvent> futureBuilds = (from be in OsbideDb.BuildEvents join el in OsbideDb.EventLogs on be.EventLogId equals el.Id where el.Id > build.EventLogId && el.EventTypeId == 2 && //2 = build event log type el.SenderId == build.EventLog.SenderId select be) .Include(be => be.EventLog) .Include(be => be.Documents.Select(d => d.Document)) .Take(100) .ToList(); BuildEvent futureInterstingBuild = FindInterestingBuild(build, futureBuilds); //do the same thing, finding the most recent previously interesting build List <BuildEvent> pastBuilds = (from be in OsbideDb.BuildEvents join el in OsbideDb.EventLogs on be.EventLogId equals el.Id where el.Id < build.EventLogId && el.EventTypeId == 2 && //2 = build event log type el.SenderId == build.EventLog.SenderId orderby be.EventLogId descending select be ) .Include(be => be.EventLog) .Include(be => be.Documents.Select(d => d.Document)) .Take(100) .ToList(); BuildEvent pastInterestingBuild = FindInterestingBuild(build, pastBuilds); BuildDocumentsViewModel viewModel = new BuildDocumentsViewModel() { CurrentBuild = build, NextInterestingBuild = futureInterstingBuild, FutureBuilds = futureBuilds, PreviousInterestingBuild = pastInterestingBuild, PastBuilds = pastBuilds, BuildState = buildState }; return(View(viewModel)); }
private void RunTemplates(vsBuildScope scope, BuildEvent buildEvent) { _dte.GetProjectsWithinBuildScope(vsBuildScope.vsBuildScopeSolution) .FindT4ProjectItems() .ThatShouldRunOn(buildEvent, successfullProjects) .ToList() .ForEach(item => item.RunTemplate()); }
/// <summary> /// Returns the build that follows the supplied log Id for the given user /// </summary> /// <param name="buildLogId"></param> /// <param name="userId"></param> /// <returns>-1 if nothing was found, the LogId of the associated build otherwise</returns> public int GetNextDiffId(int id) { BuildEvent next = GetNextEvent(id); if (next == null) { return(-1); } return(next.EventLogId); }
public static bool ShouldRunOn(this ProjectItem projectItem, BuildEvent whenToRun, HashSet <string> successfullProjects) { var item = new AutoT4ProjectItemSettings(projectItem); return(item.RunOnBuild == whenToRun && (string.IsNullOrWhiteSpace(item.DependsOnProject) || (successfullProjects != null && (successfullProjects.Contains(item.DependsOnProject) || successfullProjects.Any(x => x.Contains(item.DependsOnProject)))))); }
public static void Publish(BuildEvent buildEvent) { if (_threadQueue != null) { _threadQueue.QueueObject(buildEvent); } else { BuildEventStream.OnNext(buildEvent); } }
internal void PushEvent <T> (object sender, T args) where T : BuildStatusEventArgs { BuildEvent be = new BuildEvent { Sender = sender, EventArgs = args, StartHandlerHasExecuted = false, ConsoleLogger = this.parent }; events.Add(be); current_events_string = null; }
/// <summary> /// Finds the first interesting build in the sequence using the following rules: /// 1. A file that exists or does not exist in baseDocument exists /// 2. A file that exists in baseDocument differes by more than 10% /// </summary> /// <param name="documents"></param> /// <returns></returns> private BuildEvent FindInterestingBuild(BuildEvent baseEvent, List <BuildEvent> events) { Dictionary <string, CodeDocument> baseDocuments = new Dictionary <string, CodeDocument>(); foreach (CodeDocument document in baseEvent.Documents.Select(d => d.Document)) { baseDocuments.Add(document.FileName, document); } //null hypothesis: no interesting events found BuildEvent interestingEvent = baseEvent; bool interestingEventFound = false; foreach (BuildEvent nextBuild in events) { foreach (CodeDocument document in nextBuild.Documents.Select(d => d.Document)) { //rule #1: additional file(s) if (baseEvent.Documents.Count != nextBuild.Documents.Count || baseDocuments.ContainsKey(document.FileName) == false) { interestingEventFound = true; interestingEvent = nextBuild; } else { //rule #2: file length differ by more than 10% int originalLength = baseDocuments[document.FileName].Lines.Count; int futureLength = document.Lines.Count; double bound = originalLength * 0.10; //ABS accounts for future length being smaller than original if (Math.Abs(futureLength - originalLength) > bound) { //rule #1 satisfied interestingEventFound = true; interestingEvent = nextBuild; } } } //short-circut loop if we found something interesting if (interestingEventFound == true) { break; } } return(interestingEvent); }
private void OnBuild(BuildEvent eventData) { _buildStarted = false; if (_nearestCellEntity == null) { return; } _nearestCellEntity.AddComponent(new FloorComponent()); _nearestCellEntity.RemoveComponents <SceneObjectComponent>(); _nearestCellEntity.AddComponent(new SceneObjectComponent(_configs.FloorBuildedPrefab, _nearestCell.Position)); ClearNearestCell(); }
/// <summary> /// Converts the old <see cref="bool"/> <see cref="RunOnBuild"/> property to <see cref="BuildEvent"/> /// </summary> private BuildEvent CoerceOldRunOnBuildValue(string value) { var newRunOnBuildValue = DefaultRunOnBuildSetting; bool previousRunOnBuild; if (bool.TryParse(value, out previousRunOnBuild)) { newRunOnBuildValue = previousRunOnBuild ? BuildEvent.AfterBuild : BuildEvent.DoNotRun; } //coercion was needed, therefore the new value needs to be assigned so that it gets migrated in the settings RunOnBuild = newRunOnBuildValue; return(newRunOnBuildValue); }
/// <summary> /// Returns the build event that is related to this exception. Note that the underlying EF DB connection /// will be closed at the end of this function call, thereby preventing access to some BuildEvent member objects. /// </summary> /// <param name="exEvent"></param> /// <returns></returns> public static BuildEvent GetBuildEvent(this ExceptionEvent exEvent) { BuildEvent evt = new BuildEvent(); using (OsbideContext db = OsbideContext.DefaultWebConnection) { var query = from log in db.EventLogs join be in db.BuildEvents on log.Id equals be.EventLogId where log.Id < exEvent.EventLogId && log.LogType == BuildEvent.Name orderby log.Id descending select be; var result = query.Take(1); evt = result.FirstOrDefault(); } return(evt); }
private void ProcessBuildEventsUntilFrameBlocked() { bool processedFrameBlockingEvent = false; bool isNextEventFrameBlocked = false; while (buildEvents.Count > 0 && !isNextEventFrameBlocked) { BuildEvent nextEvent = buildEvents.Dequeue(); ActionBuildEvent(nextEvent); if (nextEvent.RequiresFreshFrame()) { processedFrameBlockingEvent = true; } isNextEventFrameBlocked = (processedFrameBlockingEvent && buildEvents.NextEventRequiresFreshFrame()); } }
public static void SendBuildEvent(UTinyProject project, UTinyBuildResults buildResults, TimeSpan duration) { if (project?.Settings == null || buildResults == null) { return; } var buildReportRoot = buildResults.BuildReport.Root; var buildReportRuntime = buildReportRoot.GetChild(UTinyBuildReport.RuntimeNode); var buildReportAssets = buildReportRoot.GetChild(UTinyBuildReport.AssetsNode); var buildReportCode = buildReportRoot.GetChild(UTinyBuildReport.CodeNode); var e = new BuildEvent() { package = TinyPackageUtility.Package, context = ContextInfo.Default, project = ProjectInfo.Create(project), duration = duration.Ticks, total_bytes = buildReportRoot?.Item.CompressedSize ?? 0, runtime_bytes = buildReportRuntime?.Item.CompressedSize ?? 0, assets_bytes = buildReportAssets?.Item.CompressedSize ?? 0, code_bytes = buildReportCode?.Item.CompressedSize ?? 0, total_raw_bytes = buildReportRoot?.Item.Size ?? 0, runtime_raw_bytes = buildReportRuntime?.Item.Size ?? 0, assets_raw_bytes = buildReportAssets?.Item.Size ?? 0, code_raw_bytes = buildReportCode?.Item.Size ?? 0, heap_size = project.Settings.MemorySize, opt_auto_resize = project.Settings.CanvasAutoResize, opt_ws_client = project.Settings.IncludeWSClient, opt_webp_decompressor = project.Settings.IncludeWebPDecompressor, opt_ecma5 = project.Settings.RunBabel, opt_single_file_output = project.Settings.SingleFileHtml, opt_embed_assets = project.Settings.EmbedAssets, default_texture_format = project.Settings.DefaultTextureSettings.FormatType.ToString() }; Send(EventName.tinyEditorBuild, e); }
private BuildEvent GetNextEvent(int id) { BuildEvent original = Db.BuildEvents.Where(b => b.EventLogId == id).FirstOrDefault(); if (original == null) { return(null); } //find the next build in the sequence that: // a: belongs to the same user // b: is from the same solution BuildEvent next = Db.BuildEvents .Where(b => b.EventLogId > id) .Where(b => b.EventLog.SenderId == original.EventLog.SenderId) .Where(b => b.SolutionName.CompareTo(original.SolutionName) == 0) .FirstOrDefault(); return(next); }
private void Build_ToolStripButton_Click(object sender, EventArgs e) { for (int i = 0; i < tabControlCode.TabCount; i++) { if (tabControlCode.TabPages[i].Focus()) { foreach (FastColoredTextBox item in tabControlCode.TabPages[i].Controls) { if (item is FastColoredTextBox) { this.proj.csfile[i].Text = item.Text; } } } } BuildEvent?.Invoke(this, new ProjectEventArgs() { project = this.proj }); }
private void ActionBuildEvent(BuildEvent buildEvent) { if (buildEvent is BasePiecePlacedEvent) { BuildBasePiece((BasePiecePlacedEvent)buildEvent); } else if (buildEvent is ConstructionCompletedEvent) { ConstructionCompleted((ConstructionCompletedEvent)buildEvent); } else if (buildEvent is ConstructionAmountChangedEvent) { ConstructionAmountChanged((ConstructionAmountChangedEvent)buildEvent); } else if (buildEvent is DeconstructionBeginEvent) { DeconstructionBegin((DeconstructionBeginEvent)buildEvent); } else if (buildEvent is DeconstructionCompletedEvent) { DeconstructionCompleted((DeconstructionCompletedEvent)buildEvent); } }
private void ActionBuildEvent(BuildEvent buildEvent) { using (packetSender.Suppress <ConstructionAmountChanged>()) using (packetSender.Suppress <ConstructionCompleted>()) using (packetSender.Suppress <PlaceBasePiece>()) using (packetSender.Suppress <DeconstructionBegin>()) using (packetSender.Suppress <DeconstructionCompleted>()) using (packetSender.Suppress <BasePieceMetadataChanged>()) { switch (buildEvent) { case BasePiecePlacedEvent @event: PlaceBasePiece(@event); break; case ConstructionCompletedEvent completedEvent: ConstructionCompleted(completedEvent); break; case LaterConstructionCompletedEvent laterConstructionCompleted: LaterConstructionCompleted(laterConstructionCompleted); break; case ConstructionAmountChangedEvent changedEvent: ConstructionAmountChanged(changedEvent); break; case DeconstructionBeginEvent beginEvent: DeconstructionBegin(beginEvent); break; case DeconstructionCompletedEvent deconstructionCompletedEvent: DeconstructionCompleted(deconstructionCompletedEvent); break; } } }
/// <summary> /// Will return the build event associated with the given exception event. /// </summary> /// <param name="exEvent"></param> /// <returns></returns> public static List <CodeDocument> GetCodeDocuments(this ExceptionEvent exEvent) { List <CodeDocument> docs = new List <CodeDocument>(); using (OsbideContext db = OsbideContext.DefaultWebConnection) { var query = from log in db.EventLogs join be in db.BuildEvents on log.Id equals be.EventLogId where log.Id < exEvent.EventLogId && log.LogType == BuildEvent.Name orderby log.Id descending select be; var result = query.Take(1); BuildEvent build = result.FirstOrDefault(); if (build != null) { foreach (BuildDocument doc in build.Documents) { docs.Add(doc.Document); } } } return(docs); }
public bool ScheduleEvent(BuildEvent ev) { bool bOK = _activeEvent == null; if (bOK) { _activeEvent = ev; _activeEvent.Start(this); } return bOK; }
public void OnBuildMethod(GameObject Tile) { BuildEvent?.Invoke(CopyobjectToBuild, Tile); CopyobjectToBuild.GetComponent <TowerLogic>().BeginLogic(); CopyobjectToBuild = null; }
void AddOutputWindowFilterItem(BuildEvent buildEvent) { _outputComboBoxFilters.Add(new OutputFilterItem(buildEvent)); RefreshOutputTextBox(); }
public void MapsBuildEventsToWaiting() { var @event = new BuildEvent(); AssertMapsToActivity(@event, Activity.Waiting); }
public EventLog SubmitLog(EventLog log, OsbideUser user) { LocalErrorLog errorLogger = new LocalErrorLog(); errorLogger.SenderId = user.Id; errorLogger.Content = "About to save log " + log.LogType + " to DB. "; errorLogger.LogDate = DateTime.Now; log.Sender = null; log.SenderId = user.Id; log.DateReceived = DateTime.UtcNow; log.EventTypeId = Convert.ToInt32(Enum.Parse(typeof(EventTypes), log.LogType)); //insert into the DB Db.EventLogs.Add(log); try { Db.SaveChanges(); errorLogger.Content += "Item saved. "; } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { errorLogger.Content += "Error saving: "; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Diagnostics.Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); errorLogger.Content += string.Format("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } Db.LocalErrorLogs.Add(errorLogger); Db.SaveChanges(); return(null); } catch (Exception ex) { errorLogger.Content += "Error saving: " + ex.Message; System.Diagnostics.Trace.TraceInformation(ex.Message); Db.LocalErrorLogs.Add(errorLogger); Db.SaveChanges(); return(null); } //Tease apart log information and insert into the appropriate DB table IOsbideEvent evt = null; try { errorLogger.Content += "About to unzip event."; evt = EventFactory.FromZippedBinary(log.Data.BinaryData, new OsbideDeserializationBinder()); evt.EventLogId = log.Id; } catch (Exception) { errorLogger.Content += "Error unzipping event."; Db.LocalErrorLogs.Add(errorLogger); Db.SaveChanges(); return(null); } var hashtags = string.Empty; var usertags = string.Empty; if (log.LogType == AskForHelpEvent.Name) { Db.AskForHelpEvents.Add((AskForHelpEvent)evt); AskForHelpEvent ask = evt as AskForHelpEvent; //send email to interested parties //find all of this user's subscribers and send them an email List <OsbideUser> observers = new List <OsbideUser>(); observers = (from subscription in Db.UserSubscriptions join dbUser in Db.Users on new { InstitutionId = subscription.ObserverInstitutionId, SchoolId = subscription.ObserverSchoolId } equals new { InstitutionId = user.InstitutionId, SchoolId = user.SchoolId } where subscription.SubjectSchoolId == user.SchoolId && subscription.SubjectInstitutionId == user.InstitutionId && dbUser.ReceiveEmailOnNewFeedPost == true select dbUser).ToList(); if (observers.Count > 0) { string url = StringConstants.GetActivityFeedDetailsUrl(log.Id); string body = "Greetings,<br />{0} asked for help regarding the following item:<br />\"{1}\"<br />To view this " + "conversation online, please visit {2} or visit your OSBIDE user profile.<br /><br />Thanks,<br />OSBIDE<br /><br />" + "These automated messages can be turned off by editing your user profile."; body = string.Format(body, user.FirstAndLastName, ask.UserComment, url); List <MailAddress> to = new List <MailAddress>(); foreach (OsbideUser observer in observers) { to.Add(new MailAddress(observer.Email)); } Email.Send("[OSBIDE] Someone has asked for help!", body, to); } } else if (log.LogType == BuildEvent.Name) { BuildEvent build = (BuildEvent)evt; Db.BuildEvents.Add(build); string pattern = "error ([^:]+)"; //strip out non-critical errors List <BuildEventErrorListItem> errorItems = build.ErrorItems.Where(e => e.ErrorListItem.CriticalErrorName.Length > 0).ToList(); build.ErrorItems.Clear(); build.ErrorItems = errorItems; //log all errors in their own DB for faster search List <string> errors = new List <string>(); Dictionary <string, ErrorType> errorTypes = new Dictionary <string, ErrorType>(); foreach (BuildEventErrorListItem item in build.ErrorItems) { Match match = Regex.Match(item.ErrorListItem.Description, pattern); //ignore bad matches if (match.Groups.Count == 2) { string errorCode = match.Groups[1].Value.ToLower().Trim(); ErrorType type = Db.ErrorTypes.Where(t => t.Name == errorCode).FirstOrDefault(); if (type == null) { if (errorTypes.ContainsKey(errorCode) == false) { type = new ErrorType() { Name = errorCode }; Db.ErrorTypes.Add(type); } else { type = errorTypes[errorCode]; } } if (errorCode.Length > 0 && errors.Contains(errorCode) == false) { errors.Add(errorCode); } errorTypes[errorCode] = type; } } Db.SaveChanges(); foreach (string errorType in errors) { Db.BuildErrors.Add(new BuildError() { BuildErrorTypeId = errorTypes[errorType].Id, LogId = log.Id }); } } else if (log.LogType == CutCopyPasteEvent.Name) { Db.CutCopyPasteEvents.Add((CutCopyPasteEvent)evt); } else if (log.LogType == DebugEvent.Name) { Db.DebugEvents.Add((DebugEvent)evt); } else if (log.LogType == EditorActivityEvent.Name) { Db.EditorActivityEvents.Add((EditorActivityEvent)evt); } else if (log.LogType == ExceptionEvent.Name) { Db.ExceptionEvents.Add((ExceptionEvent)evt); } else if (log.LogType == FeedPostEvent.Name) { hashtags = string.Join(",", ParseHashtags(((FeedPostEvent)evt).Comment)); usertags = string.Join(",", ParseUserTags(((FeedPostEvent)evt).Comment)); Db.FeedPostEvents.Add((FeedPostEvent)evt); } else if (log.LogType == HelpfulMarkGivenEvent.Name) { Db.HelpfulMarkGivenEvents.Add((HelpfulMarkGivenEvent)evt); } else if (log.LogType == LogCommentEvent.Name) { Db.LogCommentEvents.Add((LogCommentEvent)evt); } else if (log.LogType == SaveEvent.Name) { Db.SaveEvents.Add((SaveEvent)evt); } else if (log.LogType == SubmitEvent.Name) { errorLogger.Content += "Submit event detected. "; Db.SubmitEvents.Add((SubmitEvent)evt); } try { errorLogger.Content += "Attempting to save to DB. "; Db.SaveChanges(); /* * if(hashtags.Length >= 0 || usertags.Length >= 0 ) * * using (var context = new OsbideProcs()) * { * context.InsertPostTags(log.Id, usertags, hashtags); * } * */ } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { errorLogger.Content += "Error saving to DB: "; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Diagnostics.Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); errorLogger.Content += string.Format("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); Db.LocalErrorLogs.Add(errorLogger); Db.SaveChanges(); } } return(null); } catch (Exception ex) { errorLogger.Content += "Error saving to DB: " + ex.Message; Db.LocalErrorLogs.Add(errorLogger); Db.SaveChanges(); System.Diagnostics.Trace.TraceInformation(ex.Message); return(null); } //Db.LocalErrorLogs.Add(errorLogger); //Db.SaveChanges(); return(log); }
public override void OnBuildDone(vsBuildScope scope, vsBuildAction action) { base.OnBuildDone(scope, action); var build = new BuildEvent { SolutionName = Dte.Solution.FullName, }; var filesWithErrors = new List <string>(); //start at 1 when iterating through Error List for (var i = 1; i <= Dte.ToolWindows.ErrorList.ErrorItems.Count; i++) { var item = Dte.ToolWindows.ErrorList.ErrorItems.Item(i); var beli = new BuildEventErrorListItem { BuildEvent = build, ErrorListItem = TypeConverters.ErrorItemToErrorListItem(item) }; //only worry about critical errors if (!string.IsNullOrWhiteSpace(beli.ErrorListItem.CriticalErrorName)) { build.ErrorItems.Add(beli); //add the file with the error to our list of items that have errors if (filesWithErrors.Contains(beli.ErrorListItem.File.ToLower()) == false) { filesWithErrors.Add(beli.ErrorListItem.File.ToLower()); } } } //add in breakpoint information for (var i = 1; i <= Dte.Debugger.Breakpoints.Count; i++) { var bebp = new BuildEventBreakPoint { BreakPoint = TypeConverters.IdeBreakPointToBreakPoint(Dte.Debugger.Breakpoints.Item(i)), BuildEvent = build }; build.Breakpoints.Add(bebp); } //get all files in the solution var files = SolutionHelpers.GetSolutionFiles(Dte.Solution); //add in associated documents foreach (var bd in files.Select(file => new BuildDocument { Build = build, Document = file })) { build.Documents.Add(bd); } EventFactory.ToZippedBinary(build); //let others know that we have created a new event NotifyEventCreated(this, new EventCreatedArgs(build)); CheckInterventionStatus(); }
public void AddVisibleElement(Rect rect, string toolTipText, BuildEvent buildEvent = null) { _visibleElements.Add(new VisibleElement(rect, toolTipText, buildEvent)); }
void ChangeOutputWindowComboBoxSelection(BuildEvent buildEvent) { int index = 0; foreach (OutputFilterItem filter in _outputComboBoxFilters) { if (filter._buildEvent == buildEvent) { OutputWindowComboBox.SelectedIndex = index; break; } index++; } }
internal void UseEvent(BuildEvent evt) { _currEvent = evt; }
public VisibleElement(Rect rect, string toolTipText, BuildEvent buildEvent) { _rect = rect; _toolTipText = toolTipText; _buildEvent = buildEvent; }
/// <summary> /// 默认构造方法。 /// </summary> protected AbstractCodeCreator() { this._eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>(); this._buildEvent = this._eventAggregator?.GetEvent<BuildEvent>(); }
void LogEvent(BuildEvent buildEvent, string parameters) { Console.WriteLine("QB_LOGEVENT:" + buildEvent.ToString() + ":" + parameters); }
public bool UnScheduleEvent(Int64 timeCompleted, string eventName, BuildEventState jobResult, string outputMessages, bool bForce = false) { bool bOK = (_activeEvent != null && (_activeEvent._name == eventName || bForce)); if (bOK) { if (!bForce && outputMessages.Length > 0) { _activeEvent.SetOutputMessages(outputMessages); } _activeEvent.Stop(timeCompleted, jobResult); _completedEvents.Add(_activeEvent); _activeEvent = null; } return bOK; }
public HitTestResult(BuildHost host, CPUCore core, BuildEvent ev) { _host = host; _core = core; _event = ev; }
public void OnStartEvent(BuildEvent newEvent) { bool bAssigned = false; for (int i = 0; i < _cores.Count; ++i) { if (_cores[i].ScheduleEvent(newEvent)) { //Console.WriteLine("START {0} (Core {1}) [{2}]", _name, i, newEvent._name); bAssigned = true; break; } } // we discovered a new core if (!bAssigned) { CPUCore core = new CPUCore(this, _cores.Count); core.ScheduleEvent(newEvent); //Console.WriteLine("START {0} (Core {1}) [{2}]", _name, _cores.Count, newEvent._name); _cores.Add(core); } }
private void ResetState() { _fileStreamPosition = 0; _fileStream.Seek(0, SeekOrigin.Begin); _fileBuffer.Clear(); _buildRunningState = eBuildRunningState.Ready; _buildStatus = eBuildStatus.AllClear; _buildStartTimeMS = 0; _latestTimeStampMS = 0; _hosts.Clear(); _localHost = null; _lastProcessedPosition = 0; _bPreparingBuildsteps = false; _StaticWindow.EventsCanvas.Children.Clear(); _StaticWindow.CoresCanvas.Children.Clear(); // Start by adding a local host _localHost = new BuildHost(_cLocalHostName); _hosts.Add(_cLocalHostName, _localHost); // Always add the prepare build steps event first BuildEvent buildEvent = new BuildEvent(_cPrepareBuildStepsText, 0); _localHost.OnStartEvent(buildEvent); _bPreparingBuildsteps = true; // Reset the Output window text OutputTextBox.Text = ""; // Change back the tabcontrol to the TimeLine automatically _StaticWindow.MyTabControl.SelectedIndex = (int)eTABs.TAB_TimeLine; ResetOutputWindowCombox(); // progress status UpdateBuildProgress(0.0f); StatusBarProgressBar.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF06B025")); // reset to autoscrolling ON _autoScrolling = true; // reset our zoom levels _zoomFactor = 1.0f; _zoomFactorOld = 0.1f; // target pid _targetPID = 0; _lastTargetPIDCheckTimeMS = 0; // live build session state _isLiveSession = false; // graphs SystemGraphsCanvas.Children.Clear(); _systemPerformanceGraphs = new SystemPerformanceGraphsCanvas(SystemGraphsCanvas); // allow a free render update on the first frame after the reset SetConditionalRenderUpdateFlag(true); // reset the cached SteppedBuildTime value _sPreviousSteppedBuildTimeMS = 0; }
private void ExecuteCommandStartJob(string[] tokens, Int64 eventLocalTimeMS) { Int64 timeStamp = (eventLocalTimeMS - _buildStartTimeMS); string hostName = tokens[CommandArgumentIndex.START_JOB_HOST_NAME]; string eventName = tokens[CommandArgumentIndex.START_JOB_EVENT_NAME]; if (_bPreparingBuildsteps) { _localHost.OnCompleteEvent(timeStamp, _cPrepareBuildStepsText, BuildEventState.SUCCEEDED_COMPLETED, ""); } BuildEvent newEvent = new BuildEvent(eventName, timeStamp); BuildHost host = null; if (_hosts.ContainsKey(hostName)) { host = _hosts[hostName] as BuildHost; } else { // discovered a new host! host = new BuildHost(hostName); _hosts.Add(hostName, host); } host.OnStartEvent(newEvent); }
public OutputFilterItem(BuildEvent buildEvent) { _buildEvent = buildEvent; }