Пример #1
0
        public override void GenericCommand_AfterCommandExecute(string Guid, int ID, object CustomIn, object CustomOut)
        {
            base.GenericCommand_AfterCommandExecute(Guid, ID, CustomIn, CustomOut);
            Command cmd         = GetCommand(Guid, ID);
            string  commandName = "";

            if (cmd != null)
            {
                commandName = cmd.Name;

                //Speed up the process by always ignoring boring commands
                if (boringCommands.Contains(commandName) == false)
                {
                    IOsbideEvent oEvent = EventFactory.FromCommand(commandName, dte);

                    //protect against the off-chance that we'll get a null return value
                    if (oEvent != null)
                    {
                        //let others know that we have created a new event
                        NotifyEventCreated(this, new EventCreatedArgs(oEvent));
                    }
                }
            }
        }
Пример #2
0
        public override void OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            base.OnBuildDone(Scope, Action);

            //this might take a while, so throw it in its own thread
            //System.Threading.Tasks.Task.Factory.StartNew(
            //    () =>
            //    {
            BuildEvent    build           = new BuildEvent();
            List <string> filesWithErrors = new List <string>();

            build.SolutionName = dte.Solution.FullName;
            build.EventDate    = DateTime.UtcNow;

            //start at 1 when iterating through Error List
            for (int i = 1; i <= dte.ToolWindows.ErrorList.ErrorItems.Count; i++)
            {
                ErrorItem item = dte.ToolWindows.ErrorList.ErrorItems.Item(i);
                BuildEventErrorListItem beli = new BuildEventErrorListItem();
                beli.BuildEvent    = build;
                beli.ErrorListItem = ErrorListItem.FromErrorItem(item);

                //only worry about critical errors
                if (beli.ErrorListItem.CriticalErrorName.Length > 0)
                {
                    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 (int i = 1; i <= dte.Debugger.Breakpoints.Count; i++)
            {
                BreakPoint           bp   = new BreakPoint(dte.Debugger.Breakpoints.Item(i));
                BuildEventBreakPoint bebp = new BuildEventBreakPoint();
                bebp.BreakPoint = bp;
                bebp.BuildEvent = build;
                build.Breakpoints.Add(bebp);
            }

            //get all files in the solution
            List <CodeDocument> files = build.GetSolutionFiles(dte.Solution);

            //add in associated documents
            foreach (CodeDocument file in files)
            {
                BuildDocument bd = new BuildDocument();
                bd.Build    = build;
                bd.Document = file;
                build.Documents.Add(bd);
            }

            byte[] data = EventFactory.ToZippedBinary(build);

            //let others know that we have created a new event
            NotifyEventCreated(this, new EventCreatedArgs(build));
            //}
            //);
        }