private int LoadInfoDB(TokenGitHubInfo inf, bool truncate) { DbOper dbo = new DbOper(); if (truncate) { dbo.TruncateTables(); } dbo.LoadRoot(inf.CoinID, inf.Symbol, inf.GitHubRoot, inf.GitHubLeadPrj, inf.ReposNumber, inf.Followers, inf.CreatedAt, inf.UpdatedAt, inf.ErrNum.ToString(), inf.ErrMes, inf.Url); if (dbo.ErrNum > 0) { intErr = dbo.ErrNum; strErr = dbo.ErrMes; dbo.CloseConn(); return(intErr); } if (inf.ErrNum > 0) { return(intErr); } dbo.LoadHithubInfoTable("RepoInfo", "repoinfo.txt"); if (dbo.ErrNum > 0) { intErr = dbo.ErrNum; strErr = dbo.ErrMes; dbo.CloseConn(); return(intErr); } dbo.LoadHithubInfoTable("ContribInfo", "contribinfo.txt"); if (dbo.ErrNum > 0) { intErr = dbo.ErrNum; strErr = dbo.ErrMes; dbo.CloseConn(); return(intErr); } //dbo.CloseConn(); return(intErr); }
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!"); }