private void cbEncConfig_SelectedIndexChanged(object sender, EventArgs e) { tbSDKDir.Text = ""; tbVCDir.Text = ""; int nsel = cbEncConfig.SelectedIndex; if (nsel == -1) { return; } ThkVCDirSet vccfg = envCfgs.GetVCConfig(); if (vccfg == null) { return; } ThkVCDirItem[] vcitems = vccfg.EnvConfigItems; ThkVCDirItem curItem = new ThkVCDirItem(); if (nsel >= vcitems.Length) { curItem = vccfg.VcDefault; } else { curItem = vcitems[nsel]; } tbVCDir.Text = curItem.StrVCDir; tbSDKDir.Text = curItem.StrSDKDir; }
public void AddVcConfig(string strVer, string strDir, string strSDKdir) { ThkVCDirItem vci = new ThkVCDirItem(); vci.StrVCVer = strVer; vci.StrVCDir = strDir; vci.StrSDKDir = strSDKdir; arrVCItem.Add(vci); }
/// <summary> /// Called when the whole build completes. /// /// Calculate and display the total build time. Also sort the project durations and display them. /// </summary> public void OnBuildDone(EnvDTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action) { // Check if we are actually timing this build if (amTiming) { amTiming = false; dtEnd = DateTime.Now; m_OutputWindowPane.OutputString(String.Format("\n 现在结束编译,开始时间为: {0},结束时间:{1}\n", dtStart, dtEnd)); TimeSpan tsElapsed = dtEnd - dtStart; m_OutputWindowPane.OutputString(String.Format("\n全部编译时间为: {0}\n", tsElapsed)); } if (m_IsBuildOrRebuild) { m_IsBuildOrRebuild = false; if (m_envcfgs == null) { m_envcfgs = new ThkEnvCfgs(); m_envcfgs.LoadConfig(); } ThkVCDirSet vcset = m_envcfgs.GetVCConfig(); if (vcset == null) { m_OutputWindowPane.OutputString("\n跨过:未找到森科编译环境配置信息\n"); return; } ThkVCDirItem curVc = vcset.GetCurVCItem(); if (curVc != null && curVc.StrVCDir != null && curVc.StrVCDir.Length > 0) { Environment.SetEnvironmentVariable("VCInstallDir", curVc.StrVCDir, EnvironmentVariableTarget.Process); } if (curVc.StrVCVer == null) { curVc.StrVCVer = "未知版本"; } m_OutputWindowPane.OutputString("\n森科开发项目编译结束,自动转换成缺省配置.." + curVc.StrVCVer + "....成功!\n"); } }
/// <summary> /// Called when each project build begins. /// /// Record the start time of the project. /// </summary> void OnBuildProjConfigBegin(string Project, string ProjectConfig, string Platform, string SolutionConfig) { m_OutputWindowPane.OutputString("\n正准备生成项目 " + Project + ":" + ProjectConfig + ":" + Platform + ":" + SolutionConfig); m_OutputWindowPane.OutputString("\n森科开发环境将自动进行编译环境处理......\n"); if (m_envcfgs == null) { m_envcfgs = new ThkEnvCfgs(); m_envcfgs.LoadConfig(); } ThkVCDirSet vcset = m_envcfgs.GetVCConfig(); if (vcset == null) { m_OutputWindowPane.OutputString("\n错误:未找到森科编译环境配置信息\n"); return; } ThkVCDirItem curVc = new ThkVCDirItem(); if (ProjectConfig.IndexOf("WF") != -1 || ProjectConfig.IndexOf("VC9") != -1 || ProjectConfig.IndexOf("ThkRelease") != -1) { curVc = vcset.GetVcItem("VC2008"); } else if (ProjectConfig.IndexOf("CR") != -1) { curVc = vcset.GetVcItem("VC2010"); } else { curVc = vcset.GetCurVCItem(); } //if (curVc != null && curVc.StrVCDir != null && curVc.StrVCDir.Length > 0) //{ // Environment.SetEnvironmentVariable("VCInstallDir", curVc.StrVCDir, EnvironmentVariableTarget.Process); //} //if (curVc.StrVCVer == null) // curVc.StrVCVer = "未知版本"; //m_OutputWindowPane.OutputString("\n森科开发环境开始进行."+Platform+".平台配置.....\n"); ThkEnvConfig enc = m_envcfgs.GetCurEnvConfig(); if (enc != null) { ThkEnvCfgItem[] encitems = enc.EnvConfigItems; foreach (ThkEnvCfgItem ci in encitems) { if (String.Compare(ci.EnvCfgFlatform, Platform, true) == 0) { Environment.SetEnvironmentVariable(ci.EnvCfgItem, ci.EnvCfgValue, EnvironmentVariableTarget.Process); } } } m_OutputWindowPane.OutputString("\n森科开发环境切换.." + curVc.StrVCVer + "....成功!\n"); string strthkapi = Environment.GetEnvironmentVariable("ThkApi"); if (strthkapi == null || strthkapi.Length == 0) { strthkapi = "未配置"; } m_OutputWindowPane.OutputString("\n当前...ThkApi 内容为." + strthkapi + "....\n"); strthkapi = Environment.GetEnvironmentVariable("ThkProApi"); if (strthkapi == null || strthkapi.Length == 0) { strthkapi = "未配置"; } m_OutputWindowPane.OutputString("\n当前...ThkProApi 内容为." + strthkapi + "....\n"); }