Esempio n. 1
0
    public void Load()
    {
        removeFurniture();
        reports.Clear();
        string filePath   = EditorUtility.OpenFilePanel("Open a Floor Plan", Application.persistentDataPath, "json");
        string jsonString = File.ReadAllText(filePath);

        saveData = JsonMapper.ToObject(jsonString);
        UserInputInformation.saveDataGS = saveData;
        fileName = (string)saveData["fileName"];
        for (int i = 0; i < saveData["reports"].Count; i++)
        {
            int    id       = (int)(saveData["reports"][i]["reportID"]);
            string date     = (string)saveData["reports"][i]["dateStamp"];
            string duration = (string)saveData["reports"][i]["duration"];
            string alg      = (string)saveData["reports"][i]["algorithmType"];
            int    coverage = (int)(saveData["reports"][i]["coverageValue"]);
            floorPlanIDGS = i;
            RunReport prevRun = new RunReport(id, date, duration, alg, coverage);
            reports.Add(prevRun);
        }

        UserInputInformation.prevReports = reports;
        loadRooms(saveData);

        // for(int i = 0; i<reports.Count; i++)
        // {
        //     Debug.Log(reports[i].getID());
        //     Debug.Log(reports[i].getDate());
        //     Debug.Log(reports[i].getDuration());
        //     Debug.Log(reports[i].getAlgorithmType());
        //     Debug.Log(reports[i].getCoverage());
        // }
    }
Esempio n. 2
0
        public StatsUpdateList PullSurvivorStats(StatsUpdateList iList, bool iGatherFromAllPlayers)
        {
            iList.Clear();
            RunReport runReport = RunReport.Generate(Run.instance, GameResultType.Unknown);
            List <RunReport.PlayerInfo> playerInfoList = new List <RunReport.PlayerInfo> {
            };
            DateTime now   = DateTime.Now;
            TimeSpan delta = now - timeStart;

            for (int i = 0; i < runReport.playerInfoCount; i++)
            {
                if ((iGatherFromAllPlayers) ||
                    (runReport.GetPlayerInfo(i).isLocalPlayer))
                {
                    RunReport.PlayerInfo playerInfo = runReport.GetPlayerInfo(i);
                    ulong totalDamageDealt          = playerInfo.statSheet.GetStatValueULong(StatDef.totalDamageDealt) +
                                                      playerInfo.statSheet.GetStatValueULong(StatDef.totalMinionDamageDealt);


                    // The server doesn't have access to playerInfo.networkUser.userName, playerInfo.name, or playerInfo.networkUser.GetNetworkPlayerName().GetResolvedName();

                    string nameIdentifier = playerInfo.bodyName;

                    StatsUpdate update = new StatsUpdate(i + 1,
                                                         nameIdentifier,
                                                         delta,
                                                         totalDamageDealt,
                                                         playerInfo.statSheet.GetStatValueULong(StatDef.totalKills));
                    iList.Add(update);
                }
            }

            return(iList);
        }
        private BuildRunResults buildProjects(RunInfo[] projectList, RunReport runReport)
        {
            var indirectlyBuilt = new List <string>();

            foreach (var file in projectList)
            {
                if (file.ShouldBeBuilt)
                {
                    Debug.WriteDebug("Set to build project {0}", file.Project.Key);
                    var report = build(file, runReport);
                    if (report != null)
                    {
                        return(report);
                    }
                }
                else
                {
                    Debug.WriteDebug("Not set to build project {0}", file.Project.Key);
                    indirectlyBuilt.Add(file.Project.Key);
                }
            }
            foreach (var project in indirectlyBuilt)
            {
                runReport.AddBuild(project, new TimeSpan(0), true);
            }
            return(null);
        }
        public void ClearCheck(Run run, RunReport runReport)
        {
            if (run is null)
            {
                return;
            }
            if (runReport is null)
            {
                return;
            }

            if (!runReport.gameEnding)
            {
                return;
            }

            if (runReport.gameEnding.isWin)
            {
                if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "moon2")
                {
                    if (base.meetsBodyRequirement && base.isUserAlive)
                    {
                        Inventory userInventory = base.localUser.cachedMaster.inventory;
                        if (userInventory.GetTotalItemCountOfTier(ItemTier.Boss) == 0 &&
                            userInventory.GetTotalItemCountOfTier(ItemTier.Lunar) == 0 &&
                            userInventory.GetTotalItemCountOfTier(ItemTier.Tier1) == 0 &&
                            userInventory.GetTotalItemCountOfTier(ItemTier.Tier2) == 0 &&
                            userInventory.GetTotalItemCountOfTier(ItemTier.Tier3) == 0)
                        {
                            base.Grant();
                        }
                    }
                }
            }
        }
        private RunReport execute(ProjectChangeMessage message)
        {
            var runReport = new RunReport();

            try
            {
                Debug.WriteDebug("Starting project change run");
                var changedProjects = getListOfChangedProjects(message);
                var list            = getPrioritizedList(changedProjects);
                if (!_buildRunner.Build(changedProjects, list, runReport, () => { return(_exit); }))
                {
                    return(runReport);
                }
                if (_exit)
                {
                    _abortedBuilds.Clear();
                    _abortedBuilds.AddRange(list);
                    return(runReport);
                }
                else
                {
                    _abortedBuilds.Clear();
                }
                markAllAsBuilt(list);
                testAll(list, runReport);
            }
            catch (Exception ex)
            {
                var result = new TestRunResults("", "", false, TestRunner.Any, new TestResult[] { new TestResult(TestRunner.Any, TestRunStatus.Failed, "AutoTest.Net internal error", ex.ToString()) });
                _bus.Publish(new TestRunMessage(result));
            }
            return(runReport);
        }
        private void testAll(RunInfo[] projectList, RunReport runReport)
        {
            var preProcessed = preProcessTestRun(projectList);

            preProcessed = new PreProcessedTesRuns(preProcessed.ProcessWrapper, new TestRunInfoMerger(preProcessed.RunInfos).MergeWith(_abortedTestRuns).ToArray());
            runPreProcessedTestRun(preProcessed, runReport);
        }
Esempio n. 7
0
        public void ClearCheck(Run run, RunReport runReport)
        {
            if (run is null)
            {
                return;
            }
            if (runReport is null)
            {
                return;
            }

            if (!runReport.gameEnding)
            {
                return;
            }

            if (runReport.gameEnding.isWin)
            {
                DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty());

                if (difficultyDef != null && difficultyDef.countsAsHardMode)
                {
                    if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "limbo")
                    {
                        if (base.meetsBodyRequirement)
                        {
                            Debug.Log("Is this working?");
                            base.Grant();
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        public void ClearCheck(Run run, RunReport runReport)
        {
            if (run is null)
            {
                return;
            }
            if (runReport is null)
            {
                return;
            }

            if (!runReport.gameEnding)
            {
                return;
            }

            if (runReport.gameEnding.isWin)
            {
                DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty());

                if (difficultyDef != null && difficultyDef.countsAsHardMode)
                {
                    if (base.meetsBodyRequirement)
                    {
                        base.Grant();
                    }
                }
            }
        }
 static public void UpdateUserPointsStages(Run run, RunReport runReport)
 {
     if (Data.earningMethod == 0 || Data.earningMethod == 2)
     {
         float pointsMultiplier = 1;
         if (runReport.gameEnding.gameEndingIndex == RoR2Content.GameEndings.mainEnding.gameEndingIndex)
         {
             pointsMultiplier = pointsMultiplier * winMultiplier;
         }
         else if (runReport.gameEnding.gameEndingIndex == RoR2Content.GameEndings.standardLoss.gameEndingIndex)
         {
             pointsMultiplier = pointsMultiplier * lossMutliplier;
         }
         else if (runReport.gameEnding.gameEndingIndex == RoR2Content.GameEndings.obliterationEnding.gameEndingIndex)
         {
             pointsMultiplier = pointsMultiplier * obliterateMultiplier;
         }
         else if (runReport.gameEnding.gameEndingIndex == RoR2Content.GameEndings.limboEnding.gameEndingIndex)
         {
             pointsMultiplier = pointsMultiplier * limboMultiplier;
         }
         pointsMultiplier = pointsMultiplier * GetDifficultyMultiplier(run);
         if (Data.earningMethod == 0)
         {
             pointsMultiplier = pointsMultiplier * run.stageClearCount;
         }
         foreach (string userID in Data.localUsers)
         {
             Data.RefreshInfo(userID);
             userPointsEarnt  += Mathf.FloorToInt(pointsMultiplier);
             userPointsRecent += Mathf.FloorToInt(pointsMultiplier);
             Data.SaveConfigProfile();
         }
     }
 }
 // Token: 0x0600274F RID: 10063 RVA: 0x000AA618 File Offset: 0x000A8818
 private void OnClientGameOverGlobal(Run run, RunReport runReport)
 {
     if (runReport.gameResultType != GameResultType.Lost && DifficultyIndex.Hard <= runReport.ruleBook.FindDifficulty())
     {
         base.Grant();
     }
 }
        public void Consume(AssemblyChangeMessage message)
        {
            _isRunning = true;
            var runReport = new RunReport();

            try
            {
                informParticipants(message);
                var runInfos     = getRunInfos(message);
                var preProcessed = preProcess(runInfos);
                preProcessed = new PreProcessedTesRuns(preProcessed.ProcessWrapper, new TestRunInfoMerger(preProcessed.RunInfos).MergeWith(_abortedTestRuns).ToArray());
                foreach (var runner in _testRunners)
                {
                    runTest(runner, preProcessed, runReport);
                    if (_exit)
                    {
                        _abortedTestRuns.Clear();
                        _abortedTestRuns.AddRange(preProcessed.RunInfos);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                var result = new TestRunResults("", "", false, TestRunner.Any, new TestResult[] { new TestResult(TestRunner.Any, TestRunStatus.Failed, "AutoTest.Net internal error", ex.ToString()) });
                _bus.Publish(new TestRunMessage(result));
            }
            _bus.Publish(new RunFinishedMessage(runReport));
            if (!_exit)
            {
                _abortedTestRuns.Clear();
            }
            _exit      = false;
            _isRunning = false;
        }
Esempio n. 12
0
        public void ClearCheck(Run run, RunReport runReport)
        {
            if (run is null)
            {
                return;
            }
            if (runReport is null)
            {
                return;
            }

            if (!runReport.gameEnding)
            {
                return;
            }

            if (runReport.gameEnding.isWin)
            {
                DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty());

                if (difficultyDef != null && difficultyDef.nameToken == "DIFFICULTY_TYPHOON_NAME")
                {
                    if (base.meetsBodyRequirement)
                    {
                        base.Grant();
                    }
                }
            }
        }
Esempio n. 13
0
        public void Should_serialize_run_finished_message()
        {
            var runreport = new RunReport();

            runreport.AddBuild("project 1", new TimeSpan(23), true);
            runreport.AddBuild("project 2", new TimeSpan(12), false);
            runreport.AddTestRun("project 2", "assembly", new TimeSpan(52), 12, 1, 2);
            runreport.WasAborted();
            var message = new RunFinishedMessage(runreport);
            var output  = serializeDeserialize <RunFinishedMessage>(message);

            output.Report.NumberOfBuildsSucceeded.ShouldEqual(1);
            output.Report.NumberOfBuildsFailed.ShouldEqual(1);
            output.Report.RunActions[0].Project.ShouldEqual("project 1");
            output.Report.RunActions[0].Type.ShouldEqual(InformationType.Build);
            output.Report.RunActions[0].Succeeded.ShouldEqual(true);
            output.Report.RunActions[0].TimeSpent.ShouldEqual(new TimeSpan(23));
            output.Report.RunActions[1].Project.ShouldEqual("project 2");
            output.Report.RunActions[1].Type.ShouldEqual(InformationType.Build);
            output.Report.RunActions[1].Succeeded.ShouldEqual(false);
            output.Report.RunActions[1].TimeSpent.ShouldEqual(new TimeSpan(12));
            output.Report.Aborted.ShouldBeTrue();

            output.Report.NumberOfTestsPassed.ShouldEqual(12);
            output.Report.NumberOfTestsFailed.ShouldEqual(2);
            output.Report.NumberOfTestsIgnored.ShouldEqual(1);
            output.Report.RunActions[2].Project.ShouldEqual("project 2");
            output.Report.RunActions[2].Assembly.ShouldEqual("assembly");
            output.Report.RunActions[2].Type.ShouldEqual(InformationType.TestRun);
            output.Report.RunActions[2].Succeeded.ShouldEqual(false);
            output.Report.RunActions[2].TimeSpent.ShouldEqual(new TimeSpan(52));
        }
        private void runTest(ITestRunner runner, PreProcessedTesRuns preProcessed, RunReport report)
        {
            var testRunInfos = new List <TestRunInfo>();

            foreach (var runInfo in preProcessed.RunInfos)
            {
                if (_testAssemblyValidator.ShouldNotTestAssembly(runInfo.Assembly))
                {
                    return;
                }
                if (runner.CanHandleTestFor(runInfo.Assembly))
                {
                    testRunInfos.Add(runInfo.CloneToTestRunInfo());
                    _bus.Publish(new RunInformationMessage(InformationType.TestRun, "", runInfo.Assembly, runner.GetType()));
                }
            }
            if (testRunInfos.Count == 0)
            {
                return;
            }
            var results = runner.RunTests(testRunInfos.ToArray(), preProcessed.ProcessWrapper, () => { return(_exit); });

            if (_exit)
            {
                return;
            }
            mergeReport(results, report, testRunInfos.ToArray());
            reRunTests(runner, report, testRunInfos, preProcessed.ProcessWrapper);
        }
Esempio n. 15
0
        public string GetCharacterStats()
        {
            if (CachedCharacterBody == null)
            {
                return(string.Empty);
            }
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < CachedStatsToDisplay.Length; i++)
            {
                object stat = typeof(CharacterBody).GetProperty(CachedStatsToDisplay[i],
                                                                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetValue(CachedCharacterBody);
                sb.AppendLine($"{CachedStatsToDisplayNames[i]}: {stat}");
            }

            RunReport runReport = RunReport.Generate(Run.instance, GameResultType.Unknown);

            for (int i = 0; i < runReport.playerInfoCount; i++)
            {
                RunReport.PlayerInfo playerInfo = runReport.GetPlayerInfo(i);

                if (playerInfo.isLocalPlayer)
                {
                    sb.AppendLine($"Kills: {playerInfo.statSheet.GetStatValueULong(StatDef.totalKills)}");
                    sb.AppendLine($"Damage Dealt: {playerInfo.statSheet.GetStatValueULong(StatDef.totalDamageDealt)}");
                    sb.AppendLine($"Gold Collected: {playerInfo.statSheet.GetStatValueULong(StatDef.goldCollected)}");
                    sb.AppendLine($"Stages Completed: {playerInfo.statSheet.GetStatValueULong(StatDef.totalStagesCompleted)}");
                    break;
                }
            }

            return(sb.ToString());
        }
Esempio n. 16
0
 private void RunBtn_Click(object sender, RoutedEventArgs e)
 {
     // Get BaseModel
     var(success, baseModel) = FileUtility.GetBaseModel(fileName);
     if (success)
     {
         //hide window
         this.Hide();
         Thread.Sleep(500);
         // num of iterations
         numIterations = Convert.ToInt32(NumIterationTxt.Text);
         // get fill type
         fillType = GetFillType(RunningTypeCB.SelectedIndex);
         // Extract PreProcess, Run, Process, PostProcessing Models
         var(PreProcess, Run, Process, PostProcessing, processName) = ModelUtility.ConvertBaseModelToActionModels(baseModel);
         RunReport runReport = new RunReport(new GenericRunner(PreProcess, Run, Process, PostProcessing, processName), fillType);
         runReport.Run(ClickEngine.Engine.SeedWork.FileUtility.GetUniqueTxtFileName(nameof(GenericRunner)), numIterations);
         this.Show();
         MessageBox.Show("The process is successfully finished.");
     }
     else
     {
         this.Show();
         MessageBox.Show($"Cannot read the model {fileName}");
     }
     SystemInteractions.ShowHideWindow(SystemInteractions.WindowHideShow.SHOW);
 }
Esempio n. 17
0
        // Token: 0x060021A8 RID: 8616 RVA: 0x0009E640 File Offset: 0x0009C840
        public void SetDisplayData(GameEndReportPanelController.DisplayData newDisplayData)
        {
            if (this.displayData.Equals(newDisplayData))
            {
                return;
            }
            this.displayData = newDisplayData;
            if (this.resultLabel)
            {
                GameResultType gameResultType = GameResultType.Unknown;
                if (this.displayData.runReport != null)
                {
                    gameResultType = this.displayData.runReport.gameResultType;
                }
                string token;
                if (gameResultType != GameResultType.Lost)
                {
                    if (gameResultType != GameResultType.Won)
                    {
                        token = "GAME_RESULT_UNKNOWN";
                    }
                    else
                    {
                        token = "GAME_RESULT_WON";
                    }
                }
                else
                {
                    token = "GAME_RESULT_LOST";
                }
                this.resultLabel.text = Language.GetString(token);
            }
            RunReport runReport = this.displayData.runReport;

            RunReport.PlayerInfo playerInfo = (runReport != null) ? runReport.GetPlayerInfoSafe(this.displayData.playerIndex) : null;
            this.SetPlayerInfo(playerInfo);
            RunReport runReport2 = this.displayData.runReport;
            int       num        = (runReport2 != null) ? runReport2.playerInfoCount : 0;

            this.playerNavigationController.gameObject.SetActive(num > 1);
            this.playerNavigationController.SetDisplayData(new CarouselNavigationController.DisplayData(num, this.displayData.playerIndex));
            ReadOnlyCollection <MPButton> elements = this.playerNavigationController.buttonAllocator.elements;

            for (int i = 0; i < elements.Count; i++)
            {
                MPButton             mpbutton                = elements[i];
                RunReport.PlayerInfo playerInfo2             = this.displayData.runReport.GetPlayerInfo(i);
                CharacterBody        bodyPrefabBodyComponent = BodyCatalog.GetBodyPrefabBodyComponent(playerInfo2.bodyIndex);
                Texture texture = bodyPrefabBodyComponent ? bodyPrefabBodyComponent.portraitIcon : null;
                mpbutton.GetComponentInChildren <RawImage>().texture = texture;
                mpbutton.GetComponent <TooltipProvider>().SetContent(TooltipProvider.GetPlayerNameTooltipContent(playerInfo2.name));
            }
            this.selectedPlayerEffectRoot.transform.SetParent(this.playerNavigationController.buttonAllocator.elements[this.displayData.playerIndex].transform);
            this.selectedPlayerEffectRoot.gameObject.SetActive(false);
            this.selectedPlayerEffectRoot.gameObject.SetActive(true);
            this.selectedPlayerEffectRoot.offsetMin  = Vector2.zero;
            this.selectedPlayerEffectRoot.offsetMax  = Vector2.zero;
            this.selectedPlayerEffectRoot.localScale = Vector3.one;
        }
 private RunInfo[] postProcessBuildRuns(RunInfo[] runInfos, ref RunReport runReport)
 {
     foreach (var preProcessor in _preBuildProcessors)
     {
         runInfos = preProcessor.PostProcess(runInfos, ref runReport);
     }
     return(runInfos);
 }
        private void runPreProcessedTestRun(PreProcessedTesRuns preProcessed, RunReport runReport)
        {
            foreach (var runner in _testRunners)
            {
                Debug.WriteDebug("Preparing runner " + runner.GetType().ToString());
                var runInfos = new List <TestRunInfo>();
                foreach (var file in preProcessed.RunInfos)
                {
                    var project = file.Project;
                    if (hasInvalidAssembly(file))
                    {
                        continue;
                    }
                    var assembly = file.Assembly;
                    if (_testAssemblyValidator.ShouldNotTestAssembly(assembly))
                    {
                        continue;
                    }
                    if (runner.CanHandleTestFor(assembly))
                    {
                        runInfos.Add(file.CloneToTestRunInfo());
                        _bus.Publish(new RunInformationMessage(InformationType.TestRun, project.Key, assembly, runner.GetType()));
                    }
                }
                if (runInfos.Count > 0)
                {
                    Debug.WriteDebug("Running tests for runner " + runner.GetType().ToString());
                    runTests(runner, runInfos.ToArray(), preProcessed.ProcessWrapper, runReport);
                    if (_exit)
                    {
                        _abortedTestRuns.Clear();
                        _abortedTestRuns.AddRange(preProcessed.RunInfos);
                        return;
                    }

                    var rerunInfos = new List <TestRunInfo>();
                    foreach (var info in runInfos)
                    {
                        if (info.RerunAllTestWhenFinishedForAny())
                        {
                            rerunInfos.Add(new TestRunInfo(info.Project, info.Assembly));
                        }
                    }
                    if (rerunInfos.Count > 0)
                    {
                        Debug.WriteDebug("Rerunning all tests for runner " + runner.GetType().ToString());
                        runTests(runner, rerunInfos.ToArray(), preProcessed.ProcessWrapper, runReport);
                        if (_exit)
                        {
                            _abortedTestRuns.Clear();
                            _abortedTestRuns.AddRange(preProcessed.RunInfos);
                            return;
                        }
                    }
                }
            }
            _abortedTestRuns.Clear();
        }
        private void testAll(RunInfo[] projectList, RunReport runReport)
        {
            Debug.WriteDebug("Running test preprosessor");
            var preProcessed = preProcessTestRun(projectList);

            preProcessed = new PreProcessedTesRuns(preProcessed.ProcessWrapper, new TestRunInfoMerger(preProcessed.RunInfos).MergeByAssembly(_abortedTestRuns).ToArray());
            Debug.WriteDebug("Done - Running test preprosessor");
            runPreProcessedTestRun(preProcessed, runReport);
        }
        private bool buildProject(Project project, RunReport report)
        {
            var buildReport = _buildRunner.RunBuild(project, _configuration.BuildExecutable(project.Value), () => { return(_exit); });
            var succeeded   = buildReport.ErrorCount == 0;

            report.AddBuild(buildReport.Project, buildReport.TimeSpent, succeeded);
            _bus.Publish(new BuildRunMessage(buildReport));
            return(succeeded);
        }
        public bool CreateReport(String icn, String description, System.Data.DataSet theData)
        {
            _icn         = icn;
            _description = description;

            bool isSuccessful = false;

            iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER.Rotate());
            try
            {
                //set up RunReport event overrides & create doc
                _pageCount = 1;
                StatusChangeReport events = this;
                PdfWriter          writer = PdfWriter.GetInstance(document, new FileStream(ReportObject.ReportTempFileFullName, FileMode.Create));
                writer.PageEvent = events;

                MultiColumnText columns   = new MultiColumnText(document.PageSize.Top - 100, document.PageSize.Height - (50));
                float           pageLeft  = document.PageSize.Left;
                float           pageright = document.PageSize.Right;
                columns.AddSimpleColumn(-150, document.PageSize.Width + 76);

                //set up tables, etc...
                PdfPTable table = new PdfPTable(6);
                table.WidthPercentage = 85;// document.PageSize.Width;
                PdfPCell cell = new PdfPCell();
                Image    gif  = Image.GetInstance(Resources.logo, BaseColor.WHITE);
                gif.ScalePercent(25);
                runReport = new RunReport();
                document.Open();
                document.SetPageSize(PageSize.LETTER.Rotate());
                document.SetMargins(-100, -100, 10, 45);
                document.AddTitle(ReportObject.ReportTitle + ": " + DateTime.Now.ToString("MM/dd/yyyy"));

                ReportColumns(table);

                //here add detail
                WriteDetail(table, 6, theData);
                columns.AddElement(table);
                document.Add(columns);
                document.Close();
                OpenFile(ReportObject.ReportTempFileFullName);
                //CreateReport(_icn, _description, theData);
                isSuccessful = true;
            }
            catch (DocumentException de)
            {
                ReportObject.ReportError      = de.Message;
                ReportObject.ReportErrorLevel = (int)LogLevel.ERROR;
            }
            catch (IOException ioe)
            {
                ReportObject.ReportError      = ioe.Message;
                ReportObject.ReportErrorLevel = (int)LogLevel.ERROR;
            }
            return(isSuccessful);
        }
        private BuildRunResults build(RunInfo info, RunReport runReport)
        {
            if (File.Exists(_configuration.BuildExecutable(info.Project.Value)))
            {
                notifyAboutBuild(info);
                return(buildProject(info, runReport));
            }

            return(null);
        }
 public RunInfo[] PostProcess(RunInfo[] details, ref RunReport runReport)
 {
     _tmpProjects
         .ForEach(x =>
                      {
                          if (File.Exists(x))
                              File.Delete(x);
                      });
     _tmpProjects.Clear();
     return details;
 }
Esempio n. 25
0
        // Token: 0x0600252D RID: 9517 RVA: 0x000AEB98 File Offset: 0x000ACD98
        public void AddRunReportPanel(RunReport runReport)
        {
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/UI/GameEndReportPanel"), this.container);

            gameObject.GetComponent <GameEndReportPanelController>().SetDisplayData(new GameEndReportPanelController.DisplayData
            {
                runReport   = runReport,
                playerIndex = 0
            });
            gameObject.GetComponent <MPEventSystemProvider>().fallBackToMainEventSystem = true;
            this.managedObjects.Add(gameObject);
        }
Esempio n. 26
0
        private void generateSummary(RunReport report)
        {
            if (report == null)
            {
                _setSummary("");
                return;
            }

            var builder = new SummaryBuilder(report);

            _setSummary(builder.Build());
        }
Esempio n. 27
0
        private void generateSummary(RunReport report)
        {
            if (report == null)
            {
                _toolTipProvider.RemoveAll();
                return;
            }

            var builder = new SummaryBuilder(report);

            _toolTipProvider.SetToolTip(label1, builder.Build());
        }
Esempio n. 28
0
 private string getRunFinishedMessage(RunReport report)
 {
     return(string.Format(
                "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)",
                report.NumberOfProjectsBuilt,
                report.NumberOfBuildsSucceeded,
                report.NumberOfBuildsFailed,
                report.NumberOfTestsRan,
                report.NumberOfTestsPassed,
                report.NumberOfTestsFailed,
                report.NumberOfTestsIgnored));
 }
 private BuildRunResults buildProjects(string[] changedProjects, RunInfo[] projectList, RunReport runReport)
 {
     if (_buildConfig.OptimisticBuildStrategy != null)
     {
         try {
             return optimisticBuild(changedProjects, projectList, runReport);
         } catch (Exception ex) {
             Debug.WriteException(ex);
         }
     }
     return buildProjects(projectList, runReport);
 }
        public void Should_build_tooltip_string()
        {
            var report = new RunReport();
            report.AddBuild(Path.GetFullPath("Project1.csproj"), new TimeSpan(0, 0, 0, 2, 234), true);
            report.AddBuild(Path.GetFullPath("Project2.csproj"), new TimeSpan(0, 0, 0, 3, 154), false);
            report.AddTestRun(Path.GetFullPath("Project3.csproj"), Path.GetFullPath("Assembly.dll"), new TimeSpan(0, 0, 0, 6, 211), 0, 0, 0);

            var builder = new SummaryBuilder(report);
            var output = builder.Build();

            output.ToString().ShouldEqual(getResult());
        }
Esempio n. 31
0
        private void generateSummary(RunReport report)
        {
            if (report == null)
            {
                _dispatch("run-summary", new { message = "" });
                return;
            }

            var builder = new SummaryBuilder(report);

            _dispatch("run-summary", new { message = builder.Build() });
        }
        public void Should_build_tooltip_string()
        {
            var report = new RunReport();

            report.AddBuild(Path.GetFullPath("Project1.csproj"), new TimeSpan(0, 0, 0, 2, 234), true);
            report.AddBuild(Path.GetFullPath("Project2.csproj"), new TimeSpan(0, 0, 0, 3, 154), false);
            report.AddTestRun(Path.GetFullPath("Project3.csproj"), Path.GetFullPath("Assembly.dll"), new TimeSpan(0, 0, 0, 6, 211), 0, 0, 0);

            var builder = new SummaryBuilder(report);
            var output  = builder.Build();

            output.ToString().ShouldEqual(getResult());
        }
Esempio n. 33
0
 public RunInfo[] PostProcess(RunInfo[] details, ref RunReport runReport)
 {
     _tmpProjects
     .ForEach(x =>
     {
         if (File.Exists(x))
         {
             File.Delete(x);
         }
     });
     _tmpProjects.Clear();
     return(details);
 }
        public bool Build(string[] originalProjects, RunInfo[] projectList, RunReport runReport, Func<bool> exit)
        {
            _exit = exit;
            projectList = preProcessBuildRun(projectList);
            if (projectList.Where(x => x.ShouldBeBuilt).Select(x => x).Count() == 0)
                return true;

            Debug.WriteInfo("Running builds");
            BuildRunResults results = null;
            if (_configuration.ShouldBuildSolution)
                results = buildSolution(projectList, runReport);
            else
                results = buildProjects(originalProjects, projectList, runReport);
            postProcessBuildRuns(projectList, ref runReport);
            return results == null;
        }
 private BuildRunResults buildProjects(RunInfo[] projectList, RunReport runReport)
 {
     var indirectlyBuilt = new List<string>();
     foreach (var file in projectList)
     {
         if (file.ShouldBeBuilt)
         {
             Debug.WriteDebug("Set to build project {0}", file.Project.Key);
             var report = build(file, runReport);
             if (report != null)
                 return report;
         }
         else
         {
             Debug.WriteDebug("Not set to build project {0}", file.Project.Key);
             indirectlyBuilt.Add(file.Project.Key);
         }
     }
     foreach (var project in indirectlyBuilt)
         runReport.AddBuild(project, new TimeSpan(0), true);
     return null;
 }
        private BuildRunResults buildSolution(RunInfo[] projectList, RunReport runReport)
        {
            var buildExecutable = _configuration.BuildExecutable(new ProjectDocument(ProjectType.None));
            if (File.Exists(buildExecutable))
            {
                _bus.Publish(new RunInformationMessage(InformationType.Build, _configuration.SolutionToBuild, "", typeof(MSBuildRunner)));

                var buildReport = _buildRunner.RunBuild(_configuration.SolutionToBuild, projectList.Where(p => p.Project.Value.RequiresRebuild).Count() > 0, buildExecutable, () => { return _exit(); });
                buildReport = postProcessBuildReports(buildReport);
                var succeeded = buildReport.ErrorCount == 0;
                runReport.AddBuild(_configuration.WatchToken, buildReport.TimeSpent, succeeded);
                _bus.Publish(new BuildRunMessage(buildReport));
                if (succeeded)
                    return null;
                else
                    return buildReport;
            }
            return null;
        }
        private BuildRunResults build(RunInfo info, RunReport runReport)
        {
            if (File.Exists(_configuration.BuildExecutable(info.Project.Value)))
            {
                notifyAboutBuild(info);
                return buildProject(info, runReport);
            }

            return null;
        }
 public RunInfo[] PostProcess(RunInfo[] details, ref RunReport runReport)
 {
     return details;
 }
 public RunInfo[] PostProcess(RunInfo[] details, ref RunReport runReport)
 {
     _isActive = false;
     _configuration.ResetSolution();
     if (_files == null)
         return details;
     updateReport(ref runReport);
     if (File.Exists(_files.Solution.Tempfile))
         File.Delete(_files.Solution.Tempfile);
     _files.Files.ToList()
         .ForEach(x =>
         {
             if (File.Exists(x.Tempfile))
                 File.Delete(x.Tempfile);
         });
     _files = null;
     return details;
 }
Esempio n. 40
0
 public SummaryBuilder(RunReport report)
 {
     _report = report;
 }
 private RunInfo[] postProcessBuildRuns(RunInfo[] runInfos, ref RunReport runReport)
 {
     foreach (var preProcessor in _preBuildProcessors)
         runInfos = preProcessor.PostProcess(runInfos, ref runReport);
     return runInfos;
 }
 private BuildRunResults optimisticBuild(string[] changedProjects, RunInfo[] projectList, RunReport runReport)
 {
     var projectWithIssues = new List<string>();
     projectWithIssues.AddRange(_runCache
         .Errors
         .GroupBy(x => x.Key)
         .Select(x => x.Key));
     var builtProjects = new List<RunInfo>();
     var indirectlyBuilt = new List<string>();
     foreach (var file in projectList)
     {
         if (changedProjects.Contains(file.Project.Key) || projectWithIssues.Contains(file.Project.Key))
         {
             Debug.WriteDebug("Optimistic build for project {0}", file.Project.Key);
             var original = file.Assembly + ".original" + Path.GetExtension(file.Assembly);
             _fs.CopyFile(file.Assembly, original);
             var report = build(file, runReport);
             var optimisticAdviced = _buildConfig.OptimisticBuildStrategy(file.Assembly, original);
             _fs.DeleteFile(original);
             if (!optimisticAdviced)
                 throw new Exception("Optimistic build is not adviced for this scenario");
             if (report != null)
                 return report;
             builtProjects.Add(file);
         }
         else
         {
             Debug.WriteDebug("Not set to optimisticly build project {0}", file.Project.Key);
             indirectlyBuilt.Add(file.Project.Key);
         }
     }
     builtProjects.ForEach(x => copyAssembly(x.Project.Key, x.Assembly));
     foreach (var project in indirectlyBuilt)
         runReport.AddBuild(project, new TimeSpan(0), true);
     return null;
 }
 public void SetUp()
 {
     _report = new RunReport();
 }
 RunInfo[] IPreProcessBuildruns.PostProcess(RunInfo[] details, ref RunReport runReport)
 {
     return details;
 }
 private void updateReport(ref RunReport runReport)
 {
     foreach (var x in runReport.RunActions)
     {
         if (compare(x.Project, _files.Solution.Tempfile))
             x.UpdateProject(_files.Solution.Original);
         else
         {
             var project = _files.Files.FirstOrDefault(f => compare(f.Tempfile, x.Project));
             if (project != null)
                 x.UpdateProject(project.Original);
         }
     }
 }
 private BuildRunResults buildProject(RunInfo info, RunReport report)
 {
     var project = info.Project;
     var buildReport = _buildRunner.RunBuild(info, _configuration.BuildExecutable(project.Value), () => { return _exit(); });
     buildReport = postProcessBuildReports(buildReport);
     var succeeded = buildReport.ErrorCount == 0;
     report.AddBuild(buildReport.Project, buildReport.TimeSpent, succeeded);
     _bus.Publish(new BuildRunMessage(buildReport));
     if (succeeded)
         return null;
     else
         return buildReport;
 }
        public void Handle(List<ChangedFile> files)
        {
        	IsRunning = true;
            _bus.Publish(new RunStartedMessage(files.ToArray()));
            var runReport = new RunReport();

            var configsString = _config.AllSettings("php.phpunit.configs");
            var configs = configsString.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
            foreach (var config in configs) {
                var configLocation = _config.AllSettings("php.phpunit." + config + ".configlocation");
                var patterns = _config.AllSettings("php.phpunit." + config + ".Convention.Pattern");
                var testPaths = _config.AllSettings("php.phpunit." + config + ".Convention.TestPaths");

                var testLocations = new List<string>();
                if (patterns.Length == 0 && testPaths.Length == 0) {
                    testLocations.Add("");
                } else {
                    var matcher = new PhpFileConventionMatcher(
                                        _config.WatchPath,
                                        patterns.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries),
                                        testPaths.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries));
                    foreach (var file in files) {
                        foreach (var location in matcher.Match(file.FullName)) {
                            if (!Directory.Exists(location))
                                continue;
                            if (!testLocations.Contains(location))
                                testLocations.Add(location);
                        }
                    }
                }

                if (configLocation != "")
                    configLocation = "-c " + configLocation + " ";

                foreach (var location in testLocations) {
                    var results 
                        = new PhpUnitRunner(_cache)
                        .Run(
                            configLocation + location,
                            _config.WatchPath,
                            location,
                            (line) => {
                                sendLiveFeedback(line);
                            });
                    AutoTest.Core.DebugLog.Debug.WriteDebug("Returned " + results.Count.ToString() + " results");
                    var resultList = new List<TestRunResults>();
                    var runInfos = results.Select(x => new TestRunInfo(new Project(x.Project, null), x.Assembly)).ToArray();
                    resultList.AddRange(results);
                    resultList.AddRange(_removedTestLocator.RemoveUnmatchedRunInfoTests(results.ToArray(), runInfos));
                    foreach (var result in resultList) {
                        AutoTest.Core.DebugLog.Debug.WriteDebug("Result contains " + result.All.Length.ToString() + " tests");
                        runReport.AddTestRun(
                            result.Project,
                            result.Assembly,
                            result.TimeSpent,
                            result.Passed.Length,
                            result.Ignored.Length,
                            result.Failed.Length);
                        _bus.Publish(new TestRunMessage(result));
                    }
                }
            }
            // Oh my god.. please fix this
            // Issue with ordering of TestRunMessage and RunFinishedMessage
            System.Threading.Thread.Sleep(100);
            _bus.Publish(new RunFinishedMessage(runReport));
            IsRunning = false;
        }
Esempio n. 48
0
		private void runNotification(string msg, RunReport report) {
			var notifyType = getNotify(report);			
			_notifier.Notify(msg, notifyType);			
		}
Esempio n. 49
0
		private NotificationType getNotify(RunReport report)
		{
			if (report == null)
				return NotificationType.Information;
			if (report.NumberOfBuildsFailed > 0 || report.NumberOfTestsFailed > 0)
				return NotificationType.Red;
			if (report.NumberOfTestsIgnored > 0)
				return NotificationType.Yellow;
			return NotificationType.Green;
		}
Esempio n. 50
0
        private void generateSummary(RunReport report)
        {
            if (report == null)
            {
                _toolTipProvider.RemoveAll();
                return;
            }

            var builder = new SummaryBuilder(report);
            _toolTipProvider.SetToolTip(labelRunState, builder.Build());
        }