private void addReferenceToProject(ref NPanday.Artifact.Artifact artifact, string text) { if (project.Object is VSProject) { IReferenceManager refMgr = new ReferenceManager(); refMgr.Initialize((VSLangProj80.VSProject2)project.Object); artifact = refMgr.Add(new ReferenceInfo(artifact)); if (!addVSProjectReference(artifact, text)) { return; } } else if (Connect.IsWebSite(project)) { if (!addVSWebProjectReference(artifact, text)) { return; } } else { MessageBox.Show(this, "Cannot add artifact to none VS projects.", this.Text); return; } }
private void resyncAllArtifacts() { if (applicationObject.Solution != null) { Solution2 solution = (Solution2)applicationObject.Solution; IList <IReferenceManager> refManagers = new List <IReferenceManager>(); foreach (Project project in solution.Projects) { if (!isWebProject(project) && !isFolder(project) && project.Object != null) { IReferenceManager mgr = new ReferenceManager(); try { mgr.Initialize((VSLangProj80.VSProject2)project.Object); refManagers.Add(mgr); } catch { // suppressing... } } } // if POM file exists in any of the projects, commence resync if (refManagers.Count > 0) { refManagerHasError = false; logger.Log(Level.INFO, "Re-syncing artifacts... "); try { foreach (IReferenceManager mgr in refManagers) { mgr.OnError += new EventHandler <ReferenceErrorEventArgs>(refmanager_OnError); mgr.ResyncArtifacts(logger); } if (!refManagerHasError) { logger.Log(Level.INFO, string.Format("done [{0}]", DateTime.Now.ToString("hh:mm tt"))); } } catch (Exception ex) { if (refManagerHasError) { logger.Log(Level.WARNING, string.Format("{0}\n\n{1}\n\n", ex.Message, ex.StackTrace)); } else { logger.Log(Level.SEVERE, (string.Format("failed: {0}\n\n{1}\n\n", ex.Message, ex.StackTrace))); } } } } }
private void resyncAllArtifacts() { if (applicationObject.Solution != null) { Solution2 solution = (Solution2)applicationObject.Solution; IList <IReferenceManager> refManagers = new List <IReferenceManager>(); foreach (Project project in Connect.GetAllProjects(solution.Projects)) { if (!isWebProject(project) && !isFolder(project) && project.Object != null) { IReferenceManager mgr = new ReferenceManager(); try { mgr.Initialize((VSLangProj80.VSProject2)project.Object); refManagers.Add(mgr); } catch { // suppressing... } } } // if POM file exists in any of the projects, commence resync if (refManagers.Count > 0) { refManagerHasError = false; log.Info("Re-syncing artifacts... "); try { foreach (IReferenceManager mgr in refManagers) { mgr.OnError += new EventHandler <ReferenceErrorEventArgs>(refmanager_OnError); mgr.ResyncArtifacts(); } if (!refManagerHasError) { log.InfoFormat("done [{0}]", DateTime.Now.ToString("hh:mm tt")); } } catch (Exception ex) { if (refManagerHasError) { log.Warn(ex.Message, ex); } else { log.Fatal(ex.Message, ex); } } } } }
private void resyncAllArtifacts() { if (applicationObject.Solution != null) { Solution2 solution = (Solution2)applicationObject.Solution; IList<IReferenceManager> refManagers = new List<IReferenceManager>(); foreach (Project project in Connect.GetAllProjects(solution.Projects)) { if (!isWebProject(project) && !isFolder(project) && project.Object != null) { IReferenceManager mgr = new ReferenceManager(); try { mgr.Initialize((VSLangProj80.VSProject2)project.Object); refManagers.Add(mgr); } catch { // suppressing... } } } // if POM file exists in any of the projects, commence resync if (refManagers.Count > 0) { refManagerHasError = false; log.Info("Re-syncing artifacts... "); try { foreach (IReferenceManager mgr in refManagers) { mgr.OnError += new EventHandler<ReferenceErrorEventArgs>(refmanager_OnError); mgr.ResyncArtifacts(); } if (!refManagerHasError) { log.InfoFormat("done [{0}]", DateTime.Now.ToString("hh:mm tt")); } } catch (Exception ex) { if (refManagerHasError) { log.Warn(ex.Message, ex); } else { log.Fatal(ex.Message, ex); } } } } }