Ejemplo n.º 1
0
        void ProjectCreated(object sender, ProjectEventArgs e)
        {
            if (!AddInOptions.AutomaticallyAddFiles)
            {
                return;
            }
            if (!CanBeVersionControlledFile(e.Project.Directory))
            {
                return;
            }

            string projectDir = Path.GetFullPath(e.Project.Directory);

            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(projectDir);
                    if (status.TextStatus != StatusKind.Unversioned)
                    {
                        return;
                    }
                    client.Add(projectDir, Recurse.None);
                    if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "bin"), e.Project.OutputAssemblyFullPath))
                    {
                        client.AddToIgnoreList(projectDir, "bin");
                    }
                    CompilableProject compilableProject = e.Project as CompilableProject;
                    if (compilableProject != null)
                    {
                        if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "obj"), compilableProject.IntermediateOutputFullPath))
                        {
                            client.AddToIgnoreList(projectDir, "obj");
                        }
                    }
                    foreach (ProjectItem item in e.Project.Items)
                    {
                        FileProjectItem fileItem = item as FileProjectItem;
                        if (fileItem != null)
                        {
                            if (FileUtility.IsBaseDirectory(projectDir, fileItem.FileName))
                            {
                                AddFileWithParentDirectoriesToSvn(client, fileItem.FileName);
                            }
                        }
                    }
                    AddFileWithParentDirectoriesToSvn(client, e.Project.FileName);
                }
            } catch (SvnClientException ex) {
                MessageService.ShowError(ex.Message);
            } catch (Exception ex) {
                MessageService.ShowException(ex, "Project add exception");
            }
        }
		void SolutionCreated(object sender, SolutionEventArgs e)
		{
			if (!AddInOptions.AutomaticallyAddFiles) return;
			string solutionFileName = e.Solution.FileName;
			string solutionDirectory = e.Solution.Directory;
			
			if (!CanBeVersionControlledFile(solutionDirectory)) return;
			
			try {
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					SvnMessageView.HandleNotifications(client);
					
					Status status = client.SingleStatus(solutionDirectory);
					if (status.TextStatus == StatusKind.Unversioned) {
						client.Add(solutionDirectory, Recurse.None);
					}
					status = client.SingleStatus(solutionFileName);
					if (status.TextStatus == StatusKind.Unversioned) {
						client.Add(solutionFileName, Recurse.None);
						client.AddToIgnoreList(solutionDirectory, Path.GetFileName(solutionFileName) + ".cache");
					}
				}
				foreach (IProject p in e.Solution.Projects) {
					ProjectCreated(null, new ProjectEventArgs(p));
				}
			} catch (SvnClientException ex) {
				MessageService.ShowError(ex.Message);
			} catch (Exception ex) {
				MessageService.ShowError(ex, "Solution add exception");
			}
		}
Ejemplo n.º 3
0
        void SolutionCreated(object sender, SolutionEventArgs e)
        {
            if (!AddInOptions.AutomaticallyAddFiles)
            {
                return;
            }
            string solutionFileName  = e.Solution.FileName;
            string solutionDirectory = e.Solution.Directory;

            if (!CanBeVersionControlledFile(solutionDirectory))
            {
                return;
            }

            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(solutionDirectory);
                    if (status.TextStatus == StatusKind.Unversioned)
                    {
                        client.Add(solutionDirectory, Recurse.None);
                    }
                    status = client.SingleStatus(solutionFileName);
                    if (status.TextStatus == StatusKind.Unversioned)
                    {
                        client.Add(solutionFileName, Recurse.None);
                        client.AddToIgnoreList(solutionDirectory, Path.GetFileName(solutionFileName) + ".cache");
                    }
                }
                foreach (IProject p in e.Solution.Projects)
                {
                    ProjectCreated(null, new ProjectEventArgs(p));
                }
            } catch (SvnClientException ex) {
                MessageService.ShowError(ex.Message);
            } catch (Exception ex) {
                MessageService.ShowException(ex, "Solution add exception");
            }
        }
		void ProjectCreated(object sender, ProjectEventArgs e)
		{
			if (!AddInOptions.AutomaticallyAddFiles) return;
			if (!CanBeVersionControlledFile(e.Project.Directory)) return;
			
			string projectDir = Path.GetFullPath(e.Project.Directory);
			try {
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					SvnMessageView.HandleNotifications(client);
					
					Status status = client.SingleStatus(projectDir);
					if (status.TextStatus != StatusKind.Unversioned)
						return;
					client.Add(projectDir, Recurse.None);
					if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "bin"), e.Project.OutputAssemblyFullPath)) {
						client.AddToIgnoreList(projectDir, "bin");
					}
					CompilableProject compilableProject = e.Project as CompilableProject;
					if (compilableProject != null) {
						if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "obj"), compilableProject.IntermediateOutputFullPath)) {
							client.AddToIgnoreList(projectDir, "obj");
						}
					}
					foreach (ProjectItem item in e.Project.Items) {
						FileProjectItem fileItem = item as FileProjectItem;
						if (fileItem != null) {
							if (FileUtility.IsBaseDirectory(projectDir, fileItem.FileName)) {
								AddFileWithParentDirectoriesToSvn(client, fileItem.FileName);
							}
						}
					}
					AddFileWithParentDirectoriesToSvn(client, e.Project.FileName);
				}
			} catch (SvnClientException ex) {
				MessageService.ShowError(ex.Message);
			} catch (Exception ex) {
				MessageService.ShowError(ex, "Project add exception");
			}
		}