protected override void Run(string fileName)
 {
     using (var client = new SvnClientWrapper())
     {
         var propertyValue = client.GetPropertyValue(Path.GetDirectoryName(fileName), "svn:ignore");
         if (propertyValue != null)
         {
             var watcher = WatchProjects();
             var shortFileName = Path.GetFileName(fileName);
             var b = new StringBuilder();
             using (var r = new StringReader(propertyValue))
             {
                 string line;
                 while ((line = r.ReadLine()) != null)
                 {
                     if (!string.Equals(line, shortFileName, StringComparison.OrdinalIgnoreCase))
                     {
                         b.AppendLine(line);
                     }
                 }
             }
             client.SetPropertyValue(Path.GetDirectoryName(fileName), "svn:ignore", b.ToString());
             MessageService.ShowMessageFormatted("${res:AddIns.Subversion.ItemRemovedFromIgnoreList}", shortFileName);
             watcher.Callback();
         }
     }
 }
		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");
			}
		}
 private void GetLogMessages()
 {
     try
     {
         LoggingService.Info("SVN: Get log of " + _fileName);
         if (File.Exists(_fileName))
         {
             using (var client = new SvnClientWrapper())
             {
                 client.AllowInteractiveAuthorization();
                 client.Log(new[] { _fileName },
                            Revision.Head,          // Revision start
                            Revision.FromNumber(1), // Revision end
                            int.MaxValue,           // Limit
                            false,                  // bool discoverChangePath
                            false,                  // bool strictNodeHistory
                            ReceiveLogMessage);
             }
         }
     }
     catch (Exception ex)
     {
         // if exceptions aren't caught here, they force SD to exit
         if (ex is SvnClientException || ex is System.Runtime.InteropServices.SEHException)
         {
             LoggingService.Warn(ex);
             WorkbenchSingleton.SafeThreadAsyncCall(_infoPanel.ShowError, ex);
         }
         else
         {
             MessageService.ShowException(ex);
         }
     }
 }
 protected override void Run(string filename)
 {
     using (SvnClientWrapper client = new SvnClientWrapper()) {
         string propertyValue = client.GetPropertyValue(Path.GetDirectoryName(filename), "svn:ignore");
         if (propertyValue != null)
         {
             ProjectWatcher watcher       = WatchProjects();
             string         shortFileName = Path.GetFileName(filename);
             StringBuilder  b             = new StringBuilder();
             using (StringReader r = new StringReader(propertyValue)) {
                 string line;
                 while ((line = r.ReadLine()) != null)
                 {
                     if (!string.Equals(line, shortFileName, StringComparison.OrdinalIgnoreCase))
                     {
                         b.AppendLine(line);
                     }
                 }
             }
             client.SetPropertyValue(Path.GetDirectoryName(filename), "svn:ignore", b.ToString());
             MessageService.ShowMessageFormatted("${res:AddIns.Subversion.ItemRemovedFromIgnoreList}", shortFileName);
             watcher.Callback();
         }
     }
 }
 void AddFileWithParentDirectoriesToSvn(SvnClientWrapper client, string fileName)
 {
     if (!CanBeVersionControlledFile(fileName)) {
         AddFileWithParentDirectoriesToSvn(client, FileUtility.GetAbsolutePath(fileName, ".."));
     }
     Status status = client.SingleStatus(fileName);
     if (status.TextStatus != StatusKind.Unversioned)
         return;
     client.Add(fileName, Recurse.None);
 }
        void FileRenaming(object sender, FileRenamingEventArgs e)
        {
            if (e.Cancel)
            {
                return;
            }
            if (!AddInOptions.AutomaticallyRenameFiles)
            {
                return;
            }
            string fullSource = Path.GetFullPath(e.SourceFile);

            if (!CanBeVersionControlledFile(fullSource))
            {
                return;
            }
            if (!FileHelpers.CheckRenameOrReplacePossible(e))
            {
                e.Cancel = true;
                return;
            }
            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(fullSource);
                    switch (status.TextStatus)
                    {
                    case StatusKind.Unversioned:
                    case StatusKind.None:
                    case StatusKind.Ignored:
                        return;                                 // nothing to do

                    case StatusKind.Normal:
                    case StatusKind.Modified:
                    case StatusKind.Replaced:
                    case StatusKind.Added:
                        // rename without problem
                        break;

                    default:
                        MessageService.ShowErrorFormatted("${res:AddIns.Subversion.CannotMoveError}", status.TextStatus.ToString());
                        e.Cancel = true;
                        return;
                    }
                    e.OperationAlreadyDone = true;
                    client.Move(fullSource,
                                Path.GetFullPath(e.TargetFile),
                                true
                                );
                }
            } catch (Exception ex) {
                MessageService.ShowError("File renamed exception: " + ex);
            }
        }
        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 AddFileWithParentDirectoriesToSvn(SvnClientWrapper client, string fileName)
        {
            if (!CanBeVersionControlledFile(fileName))
            {
                AddFileWithParentDirectoriesToSvn(client, FileUtility.GetAbsolutePath(fileName, ".."));
            }
            Status status = client.SingleStatus(fileName);

            if (status.TextStatus != StatusKind.Unversioned)
            {
                return;
            }
            client.Add(fileName, Recurse.None);
        }
        private static void FileCopying(object sender, FileRenamingEventArgs e)
        {
            if (e.Cancel)
                return;
            if (!AddInOptions.AutomaticallyRenameFiles)
                return;
            var fullSource = Path.GetFullPath(e.SourceFile);
            if (!LocalHelper.CanBeVersionControlledFile(fullSource))
                return;
            var fullTarget = Path.GetFullPath(e.TargetFile);
            if (!LocalHelper.CanBeVersionControlledFile(fullTarget))
                return;
            try
            {
                using (var client = new SvnClientWrapper())
                {
                    SvnMessageView.HandleNotifications(client);

                    var status = client.SingleStatus(fullSource);
                    switch (status.TextStatus)
                    {
                        case StatusKind.Unversioned:
                        case StatusKind.None:
                            return; // nothing to do
                        case StatusKind.Normal:
                        case StatusKind.Modified:
                        case StatusKind.Replaced:
                        case StatusKind.Added:

                            // copy without problem
                            break;

                        default:
                            MessageService.ShowErrorFormatted("${res:AddIns.Subversion.CannotCopyError}", status.TextStatus.ToString());
                            e.Cancel = true;
                            return;
                    }
                    e.OperationAlreadyDone = true;
                    client.Copy(fullSource, fullTarget);
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError("File renamed exception: " + ex);
            }
        }
        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");
            }
        }
        /// <summary>
        /// Adds the newly created file to the repository.
        /// </summary>
        /// <param name="sender">Not used.</param>
        /// <param name="e">The name of the file and whether it is a directory or not.</param>
        void FileCreated(object sender, FileEventArgs e)
        {
            if (!AddInOptions.AutomaticallyAddFiles)
            {
                return;
            }
            if (!Path.IsPathRooted(e.FileName))
            {
                return;
            }

            string fullName = Path.GetFullPath(e.FileName);

            if (!CanBeVersionControlledFile(fullName))
            {
                return;
            }
            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(fullName);
                    switch (status.TextStatus)
                    {
                    case StatusKind.Unversioned:
                    case StatusKind.Deleted:
                        using (SharpDevelop.Gui.AsynchronousWaitDialog.ShowWaitDialog("svn add")) {
                            client.Add(fullName, Recurse.None);
                        }
                        break;
                    }
                }
            } catch (SvnClientException ex) {
                MessageService.ShowError(ex.Message);
            }
        }
		void FileRemoving(object sender, FileCancelEventArgs e)
		{
			if (e.Cancel) return;
			string fullName = Path.GetFullPath(e.FileName);
			if (!CanBeVersionControlledFile(fullName)) return;
			
			if (e.IsDirectory) {
				
				// show "cannot delete directories" message even if
				// AutomaticallyDeleteFiles (see below) is off!
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					SvnMessageView.HandleNotifications(client);
					
					Status status = client.SingleStatus(fullName);
					switch (status.TextStatus) {
						case StatusKind.None:
						case StatusKind.Unversioned:
						case StatusKind.Ignored:
							break;
						default:
							// must be done using the subversion client, even if
							// AutomaticallyDeleteFiles is off, because we don't want to corrupt the
							// working copy
							e.OperationAlreadyDone = true;
							try {
								client.Delete(new string[] { fullName }, false);
							} catch (SvnClientException ex) {
								LoggingService.Warn("SVN Error" + ex);
								LoggingService.Warn(ex);
								
								if (ex.IsKnownError(KnownError.CannotDeleteFileWithLocalModifications)
								    || ex.IsKnownError(KnownError.CannotDeleteFileNotUnderVersionControl))
								{
									if (MessageService.ShowCustomDialog("${res:AddIns.Subversion.DeleteDirectory}",
									                                    StringParser.Parse("${res:AddIns.Subversion.ErrorDelete}:\n", new string[,] { { "File", fullName } }) +
									                                    ex.Message, 0, 1,
									                                    "${res:AddIns.Subversion.ForceDelete}", "${res:Global.CancelButtonText}")
									    == 0)
									{
										try {
											client.Delete(new string[] { fullName }, true);
										} catch (SvnClientException ex2) {
											e.Cancel = true;
											MessageService.ShowError(ex2.Message);
										}
									} else {
										e.Cancel = true;
									}
								} else {
									e.Cancel = true;
									MessageService.ShowError(ex.Message);
								}
							}
							break;
					}
				}
				return;
			}
			// not a directory, but a file:
			
			if (!AddInOptions.AutomaticallyDeleteFiles) return;
			try {
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					SvnMessageView.HandleNotifications(client);
					
					Status status = client.SingleStatus(fullName);
					switch (status.TextStatus) {
						case StatusKind.None:
						case StatusKind.Unversioned:
						case StatusKind.Ignored:
						case StatusKind.Deleted:
							return; // nothing to do
						case StatusKind.Normal:
							// remove without problem
							break;
						case StatusKind.Modified:
						case StatusKind.Replaced:
							if (MessageService.AskQuestion("${res:AddIns.Subversion.RevertLocalModifications}")) {
								// modified files cannot be deleted, so we need to revert the changes first
								client.Revert(new string[] { fullName }, e.IsDirectory ? Recurse.Full : Recurse.None);
							} else {
								e.Cancel = true;
								return;
							}
							break;
						case StatusKind.Added:
							if (status.Copied) {
								if (!MessageService.AskQuestion("${res:AddIns.Subversion.RemoveMovedFile}")) {
									e.Cancel = true;
									return;
								}
							}
							client.Revert(new string[] { fullName }, e.IsDirectory ? Recurse.Full : Recurse.None);
							return;
						default:
							MessageService.ShowErrorFormatted("${res:AddIns.Subversion.CannotRemoveError}", status.TextStatus.ToString());
							e.Cancel = true;
							return;
					}
					e.OperationAlreadyDone = true;
					client.Delete(new string [] { fullName }, true);
				}
			} catch (Exception ex) {
				MessageService.ShowError("File removed exception: " + ex);
			}
		}
        void FileRemoving(object sender, FileCancelEventArgs e)
        {
            if (e.Cancel)
            {
                return;
            }
            string fullName = Path.GetFullPath(e.FileName);

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

            if (e.IsDirectory)
            {
                // show "cannot delete directories" message even if
                // AutomaticallyDeleteFiles (see below) is off!
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    try {
                        Status status = client.SingleStatus(fullName);
                        switch (status.TextStatus)
                        {
                        case StatusKind.None:
                        case StatusKind.Unversioned:
                        case StatusKind.Ignored:
                            break;

                        default:
                            // must be done using the subversion client, even if
                            // AutomaticallyDeleteFiles is off, because we don't want to corrupt the
                            // working copy
                            e.OperationAlreadyDone = true;
                            try {
                                client.Delete(new string[] { fullName }, false);
                            } catch (SvnClientException ex) {
                                LoggingService.Warn("SVN Error" + ex);
                                LoggingService.Warn(ex);

                                if (ex.IsKnownError(KnownError.CannotDeleteFileWithLocalModifications) ||
                                    ex.IsKnownError(KnownError.CannotDeleteFileNotUnderVersionControl))
                                {
                                    if (MessageService.ShowCustomDialog("${res:AddIns.Subversion.DeleteDirectory}",
                                                                        StringParser.Parse("${res:AddIns.Subversion.ErrorDelete}:\n",
                                                                                           new StringTagPair("File", fullName)) +
                                                                        ex.Message, 0, 1,
                                                                        "${res:AddIns.Subversion.ForceDelete}", "${res:Global.CancelButtonText}")
                                        == 0)
                                    {
                                        try {
                                            client.Delete(new string[] { fullName }, true);
                                        } catch (SvnClientException ex2) {
                                            e.Cancel = true;
                                            MessageService.ShowError(ex2.Message);
                                        }
                                    }
                                    else
                                    {
                                        e.Cancel = true;
                                    }
                                }
                                else
                                {
                                    e.Cancel = true;
                                    MessageService.ShowError(ex.Message);
                                }
                            }
                            break;
                        }
                    } catch (SvnClientException ex3) {
                        e.Cancel = true;
                        MessageService.ShowError(ex3.Message);
                    }
                }
                return;
            }
            // not a directory, but a file:

            if (!AddInOptions.AutomaticallyDeleteFiles)
            {
                return;
            }
            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(fullName);
                    switch (status.TextStatus)
                    {
                    case StatusKind.None:
                    case StatusKind.Unversioned:
                    case StatusKind.Ignored:
                    case StatusKind.Deleted:
                        return;                                 // nothing to do

                    case StatusKind.Normal:
                        // remove without problem
                        break;

                    case StatusKind.Modified:
                    case StatusKind.Replaced:
                        if (MessageService.AskQuestion("${res:AddIns.Subversion.RevertLocalModifications}"))
                        {
                            // modified files cannot be deleted, so we need to revert the changes first
                            client.Revert(new string[] { fullName }, e.IsDirectory ? Recurse.Full : Recurse.None);
                        }
                        else
                        {
                            e.Cancel = true;
                            return;
                        }
                        break;

                    case StatusKind.Added:
                        if (status.Copied)
                        {
                            if (!MessageService.AskQuestion("${res:AddIns.Subversion.RemoveMovedFile}"))
                            {
                                e.Cancel = true;
                                return;
                            }
                        }
                        client.Revert(new string[] { fullName }, e.IsDirectory ? Recurse.Full : Recurse.None);
                        return;

                    default:
                        MessageService.ShowErrorFormatted("${res:AddIns.Subversion.CannotRemoveError}", status.TextStatus.ToString());
                        e.Cancel = true;
                        return;
                    }
                    e.OperationAlreadyDone = true;
                    client.Delete(new string [] { fullName }, true);
                }
            } catch (Exception ex) {
                MessageService.ShowError("File removed exception: " + ex);
            }
        }
        public static StatusKind GetStatus(FileSystemInfo fileSystemInfo)
        {
            if (fileSystemInfo == null)
            {
                throw new ArgumentNullException(nameof(fileSystemInfo));
            }

            lock (ClientLock)
            {
                if (_subversionDisabled)
                    return StatusKind.None;

                //Console.WriteLine(fileName);

                if (_client == null)
                {
                    try
                    {
                        _client = new SvnClientWrapper();
                    }
                    catch (Exception ex)
                    {
                        _subversionDisabled = true;

                        WorkbenchSingleton.SafeThreadAsyncCall(
                            MessageService.ShowWarning,
                            $@"Error initializing Subversion library:{Environment.NewLine}{ex}");

                        return StatusKind.None;
                    }
                }

                try
                {
                    return _client.SingleStatus(fileSystemInfo.FullName).TextStatus;
                }
                catch (SvnClientException ex)
                {
                    LoggingService.Warn($@"Error getting SVN status of ""{fileSystemInfo.FullName}"".", ex);
                    return StatusKind.None;
                }
            }
        }
        void FileRenaming(object sender, FileRenamingEventArgs e)
        {
            if (e.Cancel) return;
            if (!AddInOptions.AutomaticallyRenameFiles) return;
            string fullSource = Path.GetFullPath(e.SourceFile);
            if (!CanBeVersionControlledFile(fullSource)) return;
            if (!FileHelpers.CheckRenameOrReplacePossible(e)) {
                e.Cancel = true;
                return;
            }
            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(fullSource);
                    switch (status.TextStatus) {
                        case StatusKind.Unversioned:
                        case StatusKind.None:
                        case StatusKind.Ignored:
                            return; // nothing to do
                        case StatusKind.Normal:
                        case StatusKind.Modified:
                        case StatusKind.Replaced:
                        case StatusKind.Added:
                            // rename without problem
                            break;
                        default:
                            MessageService.ShowErrorFormatted("${res:AddIns.Subversion.CannotMoveError}", status.TextStatus.ToString());
                            e.Cancel = true;
                            return;
                    }
                    e.OperationAlreadyDone = true;
                    client.Move(fullSource,
                                Path.GetFullPath(e.TargetFile),
                                true
                               );
                }
            } catch (Exception ex) {
                MessageService.ShowError("File renamed exception: " + ex);
            }
        }
 private void LoadChangedPaths(object state)
 {
     try
     {
         var logMessage = (LogMessage)_loadChangedPathsItem.Tag;
         using (var client = new SvnClientWrapper())
         {
             client.AllowInteractiveAuthorization();
             try
             {
                 client.Log(new[] { _fileName },
                            Revision.FromNumber(logMessage.Revision), // Revision start
                            Revision.FromNumber(logMessage.Revision), // Revision end
                            int.MaxValue,           // limit
                            true,                   // bool discoverChangePath
                            false,                  // bool strictNodeHistory
                            ReceiveChangedPaths);
             }
             catch (SvnClientException ex)
             {
                 if (ex.IsKnownError(KnownError.FileNotFound))
                 {
                     // This can happen when the file was renamed/moved so it cannot be found
                     // directly in the old revision. In that case, we do a full download of
                     // all revisions (so the file can be found in the new revision and svn can
                     // follow back its history).
                     client.Log(new[] { _fileName },
                                Revision.FromNumber(1),            // Revision start
                                Revision.FromNumber(_lastRevision), // Revision end
                                int.MaxValue,           // limit
                                true,                   // bool discoverChangePath
                                false,                  // bool strictNodeHistory
                                ReceiveAllChangedPaths);
                 }
                 else
                 {
                     throw;
                 }
             }
         }
         _loadChangedPathsItem = null;
         _isLoadingChangedPaths = false;
         WorkbenchSingleton.SafeThreadAsyncCall<object, EventArgs>(RevisionListViewSelectionChanged, null, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         MessageService.ShowException(ex);
     }
 }
		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");
			}
		}
		/// <summary>
		/// Adds the newly created file to the repository.
		/// </summary>
		/// <param name="sender">Not used.</param>
		/// <param name="e">The name of the file and whether it is a directory or not.</param>
		void FileCreated(object sender, FileEventArgs e)
		{
			if (!AddInOptions.AutomaticallyAddFiles) return;
			if (!Path.IsPathRooted(e.FileName)) return;
			
			string fullName = Path.GetFullPath(e.FileName);
			if (!CanBeVersionControlledFile(fullName)) return;
			try {
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					SvnMessageView.HandleNotifications(client);
					
					Status status = client.SingleStatus(fullName);
					switch (status.TextStatus) {
						case StatusKind.Unversioned:
						case StatusKind.Deleted:
							using (SharpDevelop.Gui.AsynchronousWaitDialog.ShowWaitDialog("svn add")) {
								client.Add(fullName, Recurse.None);
							}
							break;
					}
				}
			} catch (Exception ex) {
				MessageService.ShowError("File add exception: " + ex);
			}
		}