public TfsServerConfiguration Get()
        {
            var configProvider = new ConfigurationProvider();

            var config = new TfsServerConfiguration
                {
                    VersionOneUrl = configProvider.VersionOneUrl.ToString(),
                    VersionOnePassword = configProvider.VersionOnePassword,
                    VersionOneUserName = configProvider.VersionOneUserName,
                    TfsUrl = configProvider.TfsUrl.ToString(),
                    TfsUserName = configProvider.TfsUserName,
                    TfsPassword = configProvider.TfsPassword,
                    TfsWorkItemRegex = configProvider.TfsWorkItemRegex,
                    IsWindowsIntegratedSecurity = configProvider.IsWindowsIntegratedSecurity,
                    DebugMode = configProvider.DebugMode,
                    BaseListenerUrl = configProvider.BaseListenerUrl.ToString()
                };

            if (configProvider.ProxySettings.ProxyIsEnabled)
            {
                config.ProxyDomain = configProvider.ProxySettings.Domain;
                config.ProxyIsEnabled = configProvider.ProxySettings.ProxyIsEnabled;
                config.ProxyUrl = configProvider.ProxySettings.Url.ToString();
                config.ProxyUsername = configProvider.ProxySettings.Username;
                config.ProxyPassword = configProvider.ProxySettings.Password;
            }

            return config;
        }
Example #2
0
        /// <summary>
        /// Yuck.  Why?
        /// </summary>
        /// <returns></returns>
        public static VersionOne.TFS2010.DataLayer.VersionOneSettings GetV1Settings()
        {
            var config = new ConfigurationProvider();

            return new VersionOne.TFS2010.DataLayer.VersionOneSettings
                {
                    Path = config.VersionOneUrl.ToString(),
                    Username = config.VersionOneUserName,
                    Password = config.VersionOnePassword,
                    Integrated = config.IsWindowsIntegratedSecurity,
                    ProxySettings = config.ProxySettings
                };
        }
Example #3
0
        public static TfsTeamProjectCollection ConnectToTfs()
        {
            var config = new ConfigurationProvider();

            var url = config.TfsUrl;
            var user = config.TfsUserName;
            var password = config.TfsPassword;

            var domain = string.Empty;
            var pos = user.IndexOf('\\');

            if (pos >= 0)
            {
                domain = user.Substring(0, pos);
                user = user.Substring(pos + 1);
            }

            var creds = new NetworkCredential(user, password, domain);
            var tfsServer = new TfsTeamProjectCollection(url, creds);
            tfsServer.Authenticate();
            return tfsServer;
        }