private void AutomaticallyUpdateProjects(VSSolution sourceSolution, VSSolution destinationSolution) { ReferenceCopierViewModel viewmodel = new ReferenceCopierViewModel(); string sourceDirectory = FileManager.GetDirectory(sourceSolution.FullFileName); string destinationDirectory = FileManager.GetDirectory(destinationSolution.FullFileName); string strippedDestinationSolutionName = FileManager.RemovePath(destinationSolution.FullFileName); foreach (var sourceProject in sourceSolution.ReferencedProjects) { var strippedSource = FileManager.RemovePath(sourceProject); var found = destinationSolution.ReferencedProjects.FirstOrDefault(item => FileManager.RemovePath(item) == strippedSource); if (found != null) { ViewModel.FromFile = FileManager.RemoveDotDotSlash(sourceDirectory + sourceProject); ViewModel.ToFile = FileManager.RemoveDotDotSlash(destinationDirectory + found); ViewModel.PerformCopy(showPopup: false); PluginManager.ReceiveOutput($"Copied references for project {strippedSource} in {strippedDestinationSolutionName}."); } else { PluginManager.ReceiveOutput($"Skipping project {strippedSource} because a matching project was not found in {strippedDestinationSolutionName}"); } } }
private void HandleCopyProjectLinks(object sender, EventArgs e) { if (control == null) { control = new ReferenceCopierControl(); this.AddToTab(PluginManager.LeftTab, control, "Reference Sharing"); var viewModel = new ReferenceCopierViewModel(); control.DataContext = viewModel; } else { AddTab(); } }
private void AutomaticallyUpdateProjects(VSSolution sourceSolution, VSSolution destinationSolution) { ReferenceCopierViewModel viewmodel = new ReferenceCopierViewModel(); string sourceDirectory = FileManager.GetDirectory(sourceSolution.FullFileName); string destinationDirectory = FileManager.GetDirectory(destinationSolution.FullFileName); string strippedDestinationSolutionName = FileManager.RemovePath(destinationSolution.FullFileName); foreach (var sourceProject in sourceSolution.ReferencedProjects) { var strippedSource = FileManager.RemovePath(sourceProject); var found = destinationSolution.ReferencedProjects.FirstOrDefault(item => FileManager.RemovePath(item) == strippedSource); if(found != null) { ViewModel.FromFile = FileManager.RemoveDotDotSlash(sourceDirectory + sourceProject); ViewModel.ToFile = FileManager.RemoveDotDotSlash( destinationDirectory + found); ViewModel.PerformCopy(showPopup:false); PluginManager.ReceiveOutput($"Copied references for project {strippedSource} in {strippedDestinationSolutionName}."); } else { PluginManager.ReceiveOutput($"Skipping project {strippedSource} because a matching project was not found in {strippedDestinationSolutionName}"); } } }