Esempio n. 1
0
        protected override void OnDeactivate(bool close)
        {
            var ignoreTask = TfsClient.UpdateWorkItems();

            _disposables.Dispose();
            base.OnDeactivate(close);
        }
Esempio n. 2
0
        /// <summary>
        /// Called when [plan work item].
        /// </summary>
        /// <param name="workItemIds">The work item ids.</param>
        public void OnPlanWorkItem(int[] workItemIds, bool areWorkItemsSelected = true)
        {
            var dteService = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;

            if (dteService == null)
            {
                Debug.WriteLine("[PlanWorkItemController] DTE Service is null.");
                return;
            }

            var teamExplorer = (ITeamExplorer)(Package.GetGlobalService(typeof(ITeamExplorer)));

            teamFoundationServerExt = (dteService.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") as TeamFoundationServerExt);

            TfsClient tfsClient = new TfsClient(teamFoundationServerExt);

            teamExplorer.NavigateToPage(new Guid(PlanWorkItemPage.PageId), new PlanWorkItemPageModel()
            {
                WorkItemIds                = workItemIds,
                UsersAvailableForAssign    = tfsClient.GetUsers(),
                ConfigurationFilePath      = TFSScrumExtensionsPackage.ConfigurationFilePath,
                AvailableWorkItemTypes     = tfsClient.GetWorkItemsTypes(),
                AvailableWorkItemLinkTypes = tfsClient.GetWorkItemLinkTypes(),
                TfsClient            = tfsClient,
                AreWorkItemsSelected = areWorkItemsSelected
            });
        }
Esempio n. 3
0
        /// <summary>
        /// Exécute la génération.
        /// </summary>
        public void Generate()
        {
            // Vérification.
            CheckModelFiles();
            CheckOutputDirectory();

            // Chargements des domaines.
            _domainList = LoadDomain();

            // On initialise dans un singleton le client TFS.
            string workspaceDir = Path.GetFullPath(".");

            using (TfsManager.Client = TfsClient.Connect(GeneratorParameters.TfsCollectionUrl, workspaceDir)) {
                // Chargement des modèles objet en mémoire.
                LoadObjectModel();

                // Génération.
                GenerateSqlSchema();
                GenerateJavascript();
            }

            // Pause.
            if (GeneratorParameters.Pause)
            {
                Console.Out.WriteLine();
                Console.Out.Write("Traitement terminé, veuillez appuyer sur une touche pour fermer cette fenêtre...");
                Console.ReadKey();
            }
        }
 public TfsPullRequestProvider(ProgramArgs programArgs)
 {
     _programArgs = programArgs;
     DiscoverTfsCredentials();
     _tfsClient = new TfsClient(new TfsClientConfiguration
     {
         Url         = new Uri($"{_programArgs.TfsApiUrl}/{_programArgs.TfsCollection}", UriKind.Absolute),
         Credentials = new NetworkCredential(_programArgs.TfsUsername, _programArgs.TfsToken),
     });
 }
Esempio n. 5
0
        private void comboTfsClientProvider_SelectedIndexChanged(object sender, EventArgs e)
        {
            //set the choosen tfsclient provider
            string selectedProvideName = ((NameDescriptionPair)comboTfsClientProvider.SelectedItem).Name;

            TfsClient.SetProvider(selectedProvideName);

            Settings.Default.TFSClientProvider = selectedProvideName;
            Settings.Default.Save();
        }
Esempio n. 6
0
 public TfsConfigViewModel(
     ITfsConfiguration tfsConfiguration,
     ITfsLanguage tfsLanguage,
     IGreenshotLanguage greenshotLanguage,
     TfsClient tfsClient,
     FileConfigPartViewModel fileConfigPartViewModel)
 {
     TfsConfiguration        = tfsConfiguration;
     TfsLanguage             = tfsLanguage;
     GreenshotLanguage       = greenshotLanguage;
     TfsClient               = tfsClient;
     FileConfigPartViewModel = fileConfigPartViewModel;
 }
Esempio n. 7
0
        /// <summary>
        /// Determines whether this instance is connected.
        /// </summary>
        /// <returns></returns>
        public bool IsConnected()
        {
            var dteService = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;

            if (dteService == null)
            {
                Debug.WriteLine("[PlanWorkItemController] DTE Service is null.");
                return(false);
            }

            var teamExplorer = (ITeamExplorer)(Package.GetGlobalService(typeof(ITeamExplorer)));

            teamFoundationServerExt = (dteService.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") as TeamFoundationServerExt);
            TfsClient tfsClient = new TfsClient(teamFoundationServerExt);

            return(tfsClient.IsTeamProjectConnnected());
        }
        public CheckContext(TfsClient tfs)
        {
            m_tfs = tfs;

            LocalFiles               = new CheckContextService <List <string> >(GetLocalFiles);
            ProjectDocument          = new CheckContextService <ProjectDocument>(GetProjectDocument);
            ProjectCommonProperties  = new CheckContextService <Dictionary <string, string> >(GetProjectCommonProperties);
            ProjectDebugProperties   = new CheckContextService <Dictionary <string, string> >(GetProjectDebugProperties);
            ProjectReleaseProperties = new CheckContextService <Dictionary <string, string> >(GetProjectReleaseProperties);
            ProjectIsWeb             = new CheckContextService <bool>(GetProjectIsWeb);
            ProjectFiles             = new CheckContextService <List <ProjectFile> >(GetProjectFiles);

            TfsSolutionItems = new CheckContextService <List <string> >(GetTfsSolutionItems);
            TfsNugetItems    = new CheckContextService <List <string> >(GetTfsNugetItems);
            TfsPackagesItems = new CheckContextService <List <string> >(GetTfsPackagesItems);
            TfsSolutionFile  = new CheckContextService <string>(GetTfsSolutionFile);
            TfsNugetConfig   = new CheckContextService <string>(GetTfsNugetConfig);
        }
Esempio n. 9
0
        public override void CheckPage(TfsClient client)
        {
            base.CheckPage(client);

            var path = TfsPath;

            if (!CheckTfsPathArea(path, AreaName))
            {
                throw new InvalidOperationException($"TFS path '{path}' seems not conforming with area name '{AreaName}'.");
            }

            if (!CheckTfsPathProject(path, ProjectName))
            {
                throw new InvalidOperationException($"TFS path '{path}' seems not conforming with project name '{ProjectName}'.");
            }

            var project = new ProjectDocument(() => client.ReadFile(ProjectFile));

            ProjectUid = project.GetProjectGuid();
        }
Esempio n. 10
0
        public PageBuilder(CachedConfluenceClient confluence, TfsClient tfs, BuildOwners owners)
        {
            if (confluence == null)
            {
                throw new ArgumentNullException(nameof(confluence));
            }

            if (tfs == null)
            {
                throw new ArgumentNullException(nameof(tfs));
            }

            if (owners == null)
            {
                throw new ArgumentNullException(nameof(owners));
            }

            m_confluence = confluence;
            m_tfs        = tfs;
            m_owners     = owners;
        }
Esempio n. 11
0
        private static void SaveSource()
        {
            Console.Write("Saving TFS location... ");

            Args.TempPath.CreateDirectoryIfNotExists();

            var client    = new TfsClient(Config.TfsUrl);
            var changeset = client.GetLatestChangeset(Args.TfsPath);

            var sb = new StringBuilder();

            sb.AppendLine("Source:");
            sb.AppendLine(Args.TfsPath);
            sb.AppendFormat("Changeset #{0}", changeset.Id).AppendLine();
            sb.AppendFormat("User: {0}", changeset.UserDisplay).AppendLine();
            sb.AppendFormat("Date: {0}", changeset.Date.ToDetailedString()).AppendLine();

            var file = Path.Combine(Args.TempPath, "source.txt");

            File.WriteAllText(file, sb.ToString());

            Console.WriteLine("OK");
        }
Esempio n. 12
0
        private static void CheckProject()
        {
            var tfs     = new TfsClient(Config.TfsUrl);
            var context = new CheckContext(tfs);

            foreach (var issue in Args.CheckIssues.Split('|'))
            {
                var checker = GetChecker(issue);

                try
                {
                    checker.Check(context);
                }
                catch (FailedCheckException e)
                {
                    throw new InvalidOperationException(
                              String.Format(
                                  @"
                               
                               
*** FAILED CHECK {0} // {1} ***
                               
{2}
                               
If you beleive everything is correct please talk to Oleg Shuruev to improve this check.
                               
                               
",
                                  issue,
                                  checker.GetType().Name,
                                  e.Message),
                              e);
                }

                Console.WriteLine("{0}... OK", issue);
            }
        }
Esempio n. 13
0
        private void SaveSource()
        {
            Console.Write("Saving TFS summary... ");

            var client    = new TfsClient(m_config.TfsUrl);
            var changeset = client.GetLatestChangeset(m_args.TfsPath);

            var sb = new StringBuilder();

            sb.AppendLine("Source:");
            sb.AppendLine(m_args.TfsPath);
            sb.Append($"Changeset #{changeset.Id}").AppendLine();
            sb.Append($"User: {changeset.UserDisplay}").AppendLine();
            sb.Append($"Date: {changeset.Date.ToDetailedString()}").AppendLine();

            File.WriteAllText(m_args.SourceFile(), sb.ToString());

            Console.WriteLine("OK");

            if (m_args.DebugMode)
            {
                Console.WriteLine(sb.ToString());
            }
        }
Esempio n. 14
0
        private Dictionary <string, IItemInformation> GetItemInformation(IEnumerable <ITaskItem> files)
        {
            var client = new TfsClient();

            CopyBuildEngine(client);

            var success = false;
            var attempt = 0; const int retryCount = 3;

            while (!success && attempt < retryCount)
            {
                Log.LogMessage("Retrieving local file information to determine tfs source indexing attempt {0}", attempt + 1);
                client.Command = "info";
                if (!string.IsNullOrEmpty(this.ChangesetVersion))
                {
                    client.ChangesetVersion = this.ChangesetVersion;
                }

                if (!string.IsNullOrEmpty(this.TeamProjectCollectionUri))
                {
                    client.Collection = this.TeamProjectCollectionUri;
                }

                client.Files            = GetItemSpecs(files);
                client.WorkingDirectory = this.WorkspaceDirectory;
                success = client.Execute();
                attempt = attempt + 1;
            }

            Log.LogMessage("Success {0}, exit code {1} after {2} attempts.", success.ToString().ToLower(), client.ExitCode, attempt);


            var infoCommandResponse = new InfoCommandResponse(client.Output.ToString());

            return(this.ServerMode  ? infoCommandResponse.ServerInformation : infoCommandResponse.LocalInformation);
        }
Esempio n. 15
0
 public virtual void CheckPage(TfsClient client)
 {
 }
Esempio n. 16
0
 /// <summary>
 /// Créé une nouvelle instance de ProjectUpdater.
 /// </summary>
 /// <param name="client">Client TFS.</param>
 private ProjectUpdater(TfsClient client)
 {
     _client = client;
 }
Esempio n. 17
0
 /// <summary>
 /// Créé un ProjectUpdater.
 /// </summary>
 /// <param name="client">Client TFS.</param>
 /// <returns>ProjectUpdater.</returns>
 public static ProjectUpdater Create(TfsClient client)
 {
     return(new ProjectUpdater(client));
 }
Esempio n. 18
0
        public static int Main(string[] args)
        {
            bool commandLine = false;
            TfsClientConfiguration configuration = new TfsClientConfiguration();
            string section = null, command = null;

            string[] commandArgs = null;

            try
            {
                commandLine = ParseCommandLine(args, ref configuration, ref section, ref command, ref commandArgs);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("{0}: {1}", ProgramName, e.Message);
            }

            if (!commandLine)
            {
                Console.Error.WriteLine("usage: {0} <url> <command> [--username=<username> [--password=<password>]] [<argument>...]", ProgramName);
                return(1);
            }
            if (command == null)
            {
                Console.Error.WriteLine("{0}: '{1}' is not a {0} command", ProgramName, section);
                Console.Error.WriteLine("usage: {0} <command> [<argument>...]", ProgramName);
                return(1);
            }

            TfsClient client = new TfsClient(configuration);

            try
            {
                Type sectionType = Type.GetType(String.Format("Infinity.Client.{0}Command", section));

                if (sectionType != null)
                {
                    object     commandObj    = Activator.CreateInstance(sectionType, client);
                    MethodInfo commandMethod = sectionType.GetMethod(command);

                    if (commandMethod != null)
                    {
                        return((int)commandMethod.Invoke(commandObj, new object[] { commandArgs }));
                    }
                }

                Console.Error.WriteLine("{0}: '{1}.{2}' is not a {0} command", ProgramName, section, command);
                Console.Error.WriteLine("usage: {0} <command> [<argument>...]", ProgramName);
            }
            catch (Exception e)
            {
                while (e is TargetInvocationException || e is AggregateException)
                {
                    e = e.InnerException;
                }

                Console.Error.WriteLine(e.Message);
            }

            return(1);
        }
Esempio n. 19
0
 public TfsSourceControl(string tfsUrl)
 {
     m_tfs = new TfsClient(tfsUrl);
 }
Esempio n. 20
0
        public ProjectCommand(TfsClient client)
        {
            Assert.NotNull(client, "client");

            Client = client;
        }