示例#1
0
        private void UploadButton_Click(object sender, EventArgs e)
        {
            try
            {
                string spaceName = SpaceComboBox.Text;
                if (m_spaces.ContainsKey(spaceName))
                {
                    spaceName = m_spaces[spaceName].key;
                }
                else
                {
                    m_confluenceService.CreateSpace(spaceName);
                }

                string rootPageName = RootPageComboBox.Text;
                if (!m_pages.ContainsKey(rootPageName))
                {
                    m_confluenceService.CreatePage(rootPageName, spaceName);
                }

                string platformPageName = PlatformComboBox.Text;
                if (!m_pages.ContainsKey(platformPageName))
                {
                    m_confluenceService.CreatePage(platformPageName, rootPageName, spaceName);
                }

                string buildPageName = BuildComboBox.Text;
                if (!m_pages.ContainsKey(buildPageName))
                {
                    m_confluenceService.CreatePage(buildPageName, platformPageName, spaceName);
                }

                string timeDateString = DateTime.Now.ToString("dd/MM/yy hh:mm:ss \\(\\U\\T\\Cz\\)");

                ConfluenceService.PageContentMetaData pageContentMD = new ConfluenceService.PageContentMetaData(
                    timeDateString, m_logData.Name,
                    m_logData.BuildInfo.PlatformString, m_logData.BuildInfo.BuildNumberString, "",
                    m_confluenceService.m_username, BuildInfoTextBox.Text, AppendRadioButton.Checked);

                ConfluenceService.PageMetaData pageMetaData = new ConfluenceService.PageMetaData(spaceName, buildPageName, platformPageName, pageContentMD);

                if (IncludeOverallCheckBox.Checked)
                {
                    m_confluenceService.UploadFPSDataPage(pageMetaData, m_logData, m_logFilePath);
                }

                foreach (FrameRecordRange frr in m_logData.LevelRanges)
                {
                    if (LevelsCheckedListBox.CheckedItems.Contains(frr.Name))
                    {
                        LogData levelLogData = new LogData(m_logData, frr);
                        levelLogData.CalculateBucketSets();

                        pageContentMD.m_levelName = levelLogData.Name;
                        ConfluenceService.PageMetaData levelPageMD = new ConfluenceService.PageMetaData(spaceName, levelLogData.Name + " - " + buildPageName, buildPageName, pageContentMD);

                        m_confluenceService.UploadFPSDataPage(levelPageMD, levelLogData, m_logFilePath);
                    }
                }

                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong! :(\n\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        static void UploadStatsPages(ConfluenceService confluence, LogData logData, string[] groups, string spaceName, string rootPageName, string platformPageName, string buildPageName, XmlNodeList metrics, bool uploadSummary, string logfile)
        {
            try
            {
                List <ConfluenceSOAP.RemoteSpaceSummary> spaces = confluence.GetSpaces();

                bool spaceExists        = false;
                bool rootPageExists     = false;
                bool platformPageExists = false;
                bool buildPageExists    = false;

                foreach (ConfluenceSOAP.RemoteSpaceSummary space in spaces)
                {
                    if (space.key == spaceName)
                    {
                        spaceExists = true;
                        break;
                    }
                }

                if (!spaceExists)
                {
                    confluence.CreateSpace(spaceName);
                }

                List <ConfluenceSOAP.RemotePageSummary> pages = confluence.GetPages(spaceName);

                foreach (ConfluenceSOAP.RemotePageSummary page in pages)
                {
                    if (page.title == rootPageName)
                    {
                        rootPageExists = true;
                    }

                    if (page.title == platformPageName)
                    {
                        platformPageExists = true;
                    }

                    if (page.title == buildPageName)
                    {
                        buildPageExists = true;
                    }
                }

                if (!rootPageExists)
                {
                    confluence.CreatePage(rootPageName, spaceName);
                }

                if (!platformPageExists)
                {
                    confluence.CreatePage(platformPageName, rootPageName, spaceName);
                }

                if (!buildPageExists)
                {
                    confluence.CreatePage(buildPageName, platformPageName, spaceName);
                }

                string timeDateString = DateTime.Now.ToString("dd/MM/yy hh:mm:ss \\(\\U\\T\\Cz\\)");

                ConfluenceService.PageContentMetaData pageContentMD = new ConfluenceService.PageContentMetaData(timeDateString, logData.Name, logData.BuildInfo.PlatformString, logData.BuildInfo.BuildNumberString, "", confluence.m_username, "automated build system", false);
                ConfluenceService.PageMetaData        pageMetaData  = new ConfluenceService.PageMetaData(spaceName, buildPageName, platformPageName, pageContentMD);
                confluence.UploadStatsDataPage(pageMetaData, logData, groups, metrics, uploadSummary);

                foreach (FrameRecordRange frr in logData.LevelRanges)
                {
                    LogData levelLogData = new LogData(logData, frr);
                    pageContentMD.m_levelName = levelLogData.Name;
                    ConfluenceService.PageMetaData levelPageMD = new ConfluenceService.PageMetaData(spaceName, levelLogData.Name + " - " + buildPageName, buildPageName, pageContentMD);
                    confluence.UploadStatsDataPage(levelPageMD, levelLogData, groups, metrics, true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Something went wrong! :(\n\n" + ex.ToString() + Environment.NewLine + "Stack trace: " + ex.StackTrace);
                System.Environment.Exit(3);
            }
        }