Example #1
0
            internal void AddFileIfMissing(string path)
            {
                path = Path.GetFullPath(path);

                if (!UpdateProjectFile || !ProjectFound)
                {
                    return;
                }

                Log("Checking if project \"{0}\" contains file \"{1}\"", ProjectPath, path);
                var line = string.Format(LineFormat, path.Substring(ProjectDir.Length + 1, path.Length - ProjectDir.Length - 1));

                lock (_dictionaryLock)
                {
                    if (ProjectFiles.ContainsKey(line))
                    {
                        Log("Project \"{0}\" contains file \"{1}\"", ProjectPath, path);
                        return;
                    }

                    Log("Project \"{0}\" does not contains file \"{1}\"", ProjectPath, path);
                    ProjectFiles.Add(line, line);
                }
                if (UseTfsToCheckoutFiles)
                {
                    Tfs.Add(path);
                }

                Console.WriteLine(path + " added to project.");
                ProjectUpdated = true;
            }
            internal void AddFileIfMissing(string path)
            {
                path = Path.GetFullPath(path);
                if (!UpdateProjectFile || File.Exists(path) || !ProjectFound)
                {
                    return;
                }

                var line = string.Format(LineFormat, path.Substring(ProjectDir.Length + 1, path.Length - ProjectDir.Length - 1));

                lock (_dictionaryLock)
                {
                    if (ProjectFiles.ContainsKey(line))
                    {
                        return;
                    }

                    ProjectFiles.Add(line, line);
                }
                if (TfsWorkspace != null)
                {
                    // Create File so it can be added:
                    using (File.Create(path))
                    {
                        TfsWorkspace.PendAdd(path, false);
                    }
                }

                ProjectUpdated = true;
            }
            internal void AddFileIfMissing(string path)
            {
                path = Path.GetFullPath(path);

                if (!UpdateProjectFile || !ProjectFound)
                {
                    return;
                }

                Log("Checking if project \"{0}\" contains file \"{1}\"", ProjectPath, path);
                var line = string.Format(LineFormat, path.Substring(ProjectDir.Length + 1, path.Length - ProjectDir.Length - 1));

                lock (_dictionaryLock)
                {
                    if (ProjectFiles.ContainsKey(line))
                    {
                        Log("Project \"{0}\" contains file \"{1}\"", ProjectPath, path);
                        return;
                    }

                    Log("Project \"{0}\" does not contains file \"{1}\"", ProjectPath, path);
                    ProjectFiles.Add(line, line);
                }
                if (TfsWorkspace != null)
                {
                    // Create File so it can be added:
                    using (File.Create(path))
                    {
                        Console.WriteLine("Created New File: " + path);
                    }
                    var pendingCompleted = TfsWorkspace.PendAdd(path, false);
                    if (pendingCompleted == 0)
                    {
                        pendingCompleted = TfsWorkspace.PendEdit(path);
                    }
                    if (pendingCompleted == 0)
                    {
                        Log("Unable to Add \"{0}\" to TFS.", path);
                    }
                    else
                    {
                        Log("Unable to Add \"{0}\" to TFS.", path);
                    }
                }

                ProjectUpdated = true;
            }
Example #4
0
 private bool ProjectAlreadyLoaded(string projectName)
 {
     return(ProjectFiles.ContainsKey(projectName));
 }