コード例 #1
0
        private void cmdRunAnalysis_Click(object sender, EventArgs e)
        {
            if (txtCoinID.Text.Equals(string.Empty))
            {
                MessageBox.Show("Please enter Coin ID!"); return;
            }
            if (txtSymbol.Text.Equals(string.Empty))
            {
                MessageBox.Show("Please enter Symbol!"); return;
            }
            if (txtGtRoot.Text.Equals(string.Empty))
            {
                MessageBox.Show("Please enter Github Root!"); return;
            }
            if (txtLeadPrj.Text.Equals(string.Empty))
            {
                MessageBox.Show("Please enter Lead Project or '-'!"); return;
            }

            //** Secret Key
            string strGAuth = ConfigurationManager.AppSettings["gthauth"];

            //** get Token GitHub Info
            ProjectInfoBuilder infoBuild = new ProjectInfoBuilder(strGAuth);
            TokenGitHubInfo    inf       = infoBuild.GetProjectInfo(txtCoinID.Text, txtSymbol.Text, txtGtRoot.Text, txtLeadPrj.Text);

            if (inf.ErrNum > 0)
            {
                //** If there is an error - return, no point to search for repos and commits
                MessageBox.Show("Token Info Error - " + inf.ErrNum.ToString() + "::" + inf.ErrMes);
                return;
            }

            //** Get Repo List
            RepoListCompiler repListComp = new RepoListCompiler(strGAuth);

            repListComp.GetRepoList(inf);

            ContribInfoCompiler ctrbListComp = new ContribInfoCompiler(strGAuth);

            Repo        rpRep    = null;
            List <Repo> lstRepos = inf.RepoList;

            for (int i = 0; i < lstRepos.Count; i++)
            {
                rpRep = lstRepos[i];
                ctrbListComp.GetContribCommits(rpRep, inf.GitHubRoot);
                Thread.Sleep(1000);
            }

            ProjectsLoader ldPrj = new ProjectsLoader();

            if (ldPrj.LoadGitHubInfo(inf, chkIsSingle.Checked) > 0)
            {
                MessageBox.Show(ldPrj.ErrMes);
                return;
            }

            MessageBox.Show("Success!");
        }
コード例 #2
0
        private void cmdRunAll_Click(object sender, EventArgs e)
        {
            int    smallset = 0;
            DbOper dbo      = new DbOper();

            if (chkClean.Checked)
            {
                dbo.TruncateTables();
            }
            if (chkSmall.Checked)
            {
                smallset = 1;
            }

            DataTable dtCoins = dbo.GetCoinsForGitHub(smallset);

            //** Secret Key
            string strGAuth = ConfigurationManager.AppSettings["gthauth"];

            TokenGitHubInfo     inf          = null;
            ProjectInfoBuilder  infoBuild    = new ProjectInfoBuilder(strGAuth);
            RepoListCompiler    repListComp  = new RepoListCompiler(strGAuth);
            ContribInfoCompiler ctrbListComp = new ContribInfoCompiler(strGAuth);
            ProjectsLoader      ldPrj        = new ProjectsLoader();
            Repo        rpRep    = null;
            List <Repo> lstRepos = null;;
            string      lprj     = "";

            foreach (DataRow dr in dtCoins.Rows)
            {
                lprj = dr[3].ToString().Replace("/", "");
                if (lprj.Length > 20)
                {
                    lprj = "-";
                }
                if (lprj.Equals(""))
                {
                    lprj = "-";
                }
                inf = infoBuild.GetProjectInfo(dr[0].ToString(), dr[1].ToString(), dr[2].ToString(), lprj);

                //** Get Repo List
                repListComp.GetRepoList(inf);

                lstRepos = inf.RepoList;

                for (int i = 0; i < lstRepos.Count; i++)
                {
                    rpRep = lstRepos[i];
                    ctrbListComp.GetContribCommits(rpRep, inf.GitHubRoot);
                    Thread.Sleep(3000);
                }

                ldPrj.LoadGitHubInfo(inf, false);

                //if (ldPrj.LoadGitHubInfo(inf, false) > 0)
                //{
                //    //MessageBox.Show(ldPrj.ErrMes);
                //    //continue;
                //}

                Thread.Sleep(2000);
            }

            MessageBox.Show("Success!");
        }