Esempio n. 1
0
        /// <summary>
        /// Main method.
        /// </summary>
        /// <param name="args">
        /// Command line arguments.
        /// </param>
        public static void Main(string[] args)
        {
            // TODO Read the settings ini file
            var app = new SupaApp();

            app.ReadConfiguration("settings.json");
            dynamic appConfig = app.Configuration;

            // Setup logging
            Log.Logger =
                new LoggerConfiguration().MinimumLevel.Verbose().WriteTo.ColoredConsole().CreateLogger();

            IDictionary <string, object> workItemTemplate = appConfig.TfsSink.WorkItemTemplate;
            var tfsSink = new TfsSink(
                new Uri(appConfig.TfsSink.ServiceUri),
                new NetworkCredential(appConfig.TfsSink.Username, appConfig.TfsSink.Password),
                appConfig.TfsSink.ParentWorkItem,
                appConfig.TfsSink.WorkItemType,
                workItemTemplate);

            tfsSink.Configure();

            while (true)
            {
                try
                {
                    var credential = new NetworkCredential(
                        appConfig.ExchangeSource.Username,
                        appConfig.ExchangeSource.Password,
                        appConfig.ExchangeSource.Domain);
                    var source = new ExchangeSource(
                        new Uri(appConfig.ExchangeSource.ServiceUri),
                        credential,
                        appConfig.ExchangeSource.FolderName);

                    foreach (var issue in source.Issues)
                    {
                        tfsSink.UpdateWorkItem(issue);
                    }

                    Log.Logger.Information("Exit.");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception: {ex}");
                }

                Thread.Sleep(15 * 60 * 1000);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Main method.
        /// </summary>
        /// <param name="args">
        /// Command line arguments.
        /// </param>
        public static void Main(string[] args)
        {
            // TODO Read the settings ini file
            var app = new SupaApp();
            app.ReadConfiguration("settings.json");
            dynamic appConfig = app.Configuration;

            // Setup logging
            Log.Logger =
                new LoggerConfiguration().MinimumLevel.Verbose().WriteTo.ColoredConsole().CreateLogger();

            IDictionary<string, object> workItemTemplate = appConfig.TfsSink.WorkItemTemplate;
            var tfsSink = new TfsSink(
                new Uri(appConfig.TfsSink.ServiceUri),
                new NetworkCredential(appConfig.TfsSink.Username, appConfig.TfsSink.Password),
                appConfig.TfsSink.ParentWorkItem,
                appConfig.TfsSink.WorkItemType,
                workItemTemplate);
            tfsSink.Configure();

            while (true)
            {
                try
                {
                    var credential = new NetworkCredential(
                        appConfig.ExchangeSource.Username,
                        appConfig.ExchangeSource.Password,
                        appConfig.ExchangeSource.Domain);
                    var source = new ExchangeSource(
                        new Uri(appConfig.ExchangeSource.ServiceUri),
                        credential,
                        appConfig.ExchangeSource.FolderName);

                    foreach (var issue in source.Issues)
                    {
                        tfsSink.UpdateWorkItem(issue);
                    }

                    Log.Logger.Information("Exit.");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception: {ex}");
                }

                Thread.Sleep(15 * 60 * 1000);
            }
        }