/// <summary>
        /// Initialize the O365 binding extension
        /// </summary>
        /// <param name="context">Context containing info relevant to this extension</param>
        public void Initialize(ExtensionConfigContext context)
        {
            _webhookTriggerProvider = new WebhookTriggerBindingProvider();
            _notificationUrl        = context.GetWebhookHandler();

            var graphWebhookConverter = new GraphWebhookSubscriptionConverter(_graphServiceClientManager, _options, _subscriptionStore);

            // Webhooks
            var webhookSubscriptionRule = context.AddBindingRule <GraphWebhookSubscriptionAttribute>();

            webhookSubscriptionRule.BindToInput <Subscription[]>(graphWebhookConverter);
            webhookSubscriptionRule.BindToInput <OpenType[]>(typeof(GenericGraphWebhookSubscriptionConverter <>), _graphServiceClientManager, _options, _subscriptionStore);
            webhookSubscriptionRule.BindToInput <string[]>(graphWebhookConverter);
            webhookSubscriptionRule.BindToInput <JArray>(graphWebhookConverter);
            webhookSubscriptionRule.BindToCollector <string>(CreateCollector);
            context.AddBindingRule <GraphWebhookTriggerAttribute>().BindToTrigger(_webhookTriggerProvider);

            // OneDrive
            var oneDriveService   = new OneDriveService(_graphServiceClientManager);
            var OneDriveRule      = context.AddBindingRule <OneDriveAttribute>();
            var oneDriveConverter = new OneDriveConverter(oneDriveService);

            // OneDrive inputs
            OneDriveRule.BindToInput <byte[]>(oneDriveConverter);
            OneDriveRule.BindToInput <string>(oneDriveConverter);
            OneDriveRule.BindToInput <Stream>(oneDriveConverter);
            OneDriveRule.BindToInput <DriveItem>(oneDriveConverter);
            //OneDriveoutputs
            OneDriveRule.BindToCollector <byte[]>(oneDriveConverter);

            // Excel
            var excelService   = new ExcelService(_graphServiceClientManager);
            var ExcelRule      = context.AddBindingRule <ExcelAttribute>();
            var excelConverter = new ExcelConverter(excelService);

            // Excel Outputs
            ExcelRule.AddConverter <object[][], string>(ExcelService.CreateRows);
            ExcelRule.AddConverter <JObject, string>(excelConverter);
            ExcelRule.AddOpenConverter <OpenType, string>(typeof(ExcelGenericsConverter <>), excelService); // used to append/update arrays of POCOs
            ExcelRule.BindToCollector <string>(excelConverter);
            // Excel Inputs
            ExcelRule.BindToInput <string[][]>(excelConverter);
            ExcelRule.BindToInput <WorkbookTable>(excelConverter);
            ExcelRule.BindToInput <OpenType>(typeof(ExcelGenericsConverter <>), excelService);

            // Outlook
            var outlookService   = new OutlookService(_graphServiceClientManager);
            var OutlookRule      = context.AddBindingRule <OutlookAttribute>();
            var outlookConverter = new OutlookConverter(outlookService);

            // Outlook Outputs
            OutlookRule.AddConverter <JObject, Message>(outlookConverter);
            OutlookRule.AddOpenConverter <OpenType, Message>(typeof(OutlookGenericsConverter <>), outlookService);
            OutlookRule.AddConverter <string, Message>(outlookConverter);
            OutlookRule.BindToCollector <Message>(outlookConverter);
        }
Пример #2
0
        public async Task ShowTaskTest()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>();

            await service.InitAsync(MockData.Token, pageId, mockClient);

            var taskList = await service.GetTasksAsync(MockData.ToDo);

            Assert.IsTrue(taskList != null && taskList.Count > 0);
        }
Пример #3
0
        public async Task ShowTaskTest()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>()
            {
                { "ToDo", "ToDo" }, { "Grocery", "Grocery" }, { "Shopping", "Shopping" }
            };

            await service.InitAsync("test", pageId, mockClient);

            var taskList = await service.GetTasksAsync("ToDo");

            Assert.IsTrue(taskList != null && taskList.Count > 0);
        }
        public async Task AddTaskTests()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>();

            await service.InitAsync(MockData.Token, pageId, mockClient);

            var taskList = await service.GetTasksAsync(MockData.ToDo);

            await service.AddTaskAsync(MockData.ToDo, MockData.TaskContent);

            var addedTaskList = await service.GetTasksAsync(MockData.ToDo);

            Assert.IsTrue(taskList.Count + 1 == addedTaskList.Count);
        }
        public async Task MarkTaskTest()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>();

            await service.InitAsync(MockData.Token, pageId, mockClient);

            var taskList = await service.GetTasksAsync(MockData.ToDo);

            await service.MarkTasksCompletedAsync(MockData.ToDo, taskList.GetRange(0, 1));

            var markedTaskList = await service.GetTasksAsync(MockData.ToDo);

            Assert.IsTrue(markedTaskList != null && markedTaskList.Count == taskList.Count - 1 && markedTaskList[0].Id != taskList[0].Id);
        }
        public async Task DeleteTaskTest()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>();

            await service.InitAsync(MockData.Token, pageId, mockClient);

            var taskList = await service.GetTasksAsync(MockData.ToDo);

            await service.DeleteTasksAsync(MockData.ToDo, taskList.GetRange(0, 1));

            var deletedTaskList = await service.GetTasksAsync(MockData.ToDo);

            Assert.IsTrue(taskList.Count == deletedTaskList.Count + 1);
            Assert.IsFalse(deletedTaskList.Contains(taskList[0]));
        }
Пример #7
0
        public async Task MarkTaskTest()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>()
            {
                { "ToDo", "ToDo" }, { "Grocery", "Grocery" }, { "Shopping", "Shopping" }
            };

            await service.InitAsync("test", pageId, mockClient);

            var taskList = await service.GetTasksAsync("ToDo");

            await service.MarkTasksCompletedAsync("ToDo", taskList.GetRange(0, 1));

            var markedTaskList = await service.GetTasksAsync("ToDo");

            Assert.IsTrue(markedTaskList != null && markedTaskList.Count > 0 && markedTaskList[0].IsCompleted);
        }
        public async Task AddTaskAccessDeniedTests()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>();

            try
            {
                await service.InitAsync(MockData.Token, pageId, mockClient);

                await service.AddTaskAsync(MockData.Shopping, MockData.TaskContent);

                Assert.Fail();
            }
            catch (SkillException ex)
            {
                Assert.AreEqual(ex.ExceptionType, SkillExceptionType.APIAccessDenied);
            }
        }
Пример #9
0
        public async Task DeleteTaskTest()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>()
            {
                { "ToDo", "ToDo" }, { "Grocery", "Grocery" }, { "Shopping", "Shopping" }
            };

            await service.InitAsync("test", pageId, mockClient);

            var taskList = await service.GetTasksAsync("ToDo");

            await service.DeleteTasksAsync("ToDo", taskList.GetRange(0, 1));

            var deletedTaskList = await service.GetTasksAsync("ToDo");

            Assert.IsTrue(taskList.Count == deletedTaskList.Count + 1);
            Assert.IsFalse(deletedTaskList.Contains(taskList[0]));
        }
Пример #10
0
        public async Task AddTaskAccessDeniedTests()
        {
            var service = new OutlookService();
            var pageId  = new Dictionary <string, string>()
            {
                { "ToDo", "ToDo" }, { "Grocery", "Grocery" }, { "Shopping", "Shopping" }
            };

            try
            {
                await service.InitAsync("test", pageId, mockClient);

                await service.AddTaskAsync("Shopping", "Test 9");

                Assert.Fail();
            }
            catch (SkillException ex)
            {
                Assert.AreEqual(ex.ExceptionType, SkillExceptionType.APIAccessDenied);
            }
        }
Пример #11
0
 public OutlookAsyncCollector(OutlookService client)
 {
     _client   = client;
     _messages = new Collection <Message>();
 }
 public OutlookAsyncCollector(OutlookService client, OutlookAttribute attribute)
 {
     _client    = client;
     _attribute = attribute;
     _messages  = new Collection <Message>();
 }
Пример #13
0
 public OutlookController()
 {
     _outlookService = new OutlookService();
 }
Пример #14
0
        public void LogSettings()
        {
            log.Info("CALENDAR SYNC SETTINGS");
            log.Info("Profile: " + _ProfileName);
            log.Info("Last Synced: " + LastSyncDate);

            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Service: " + OutlookService.ToString());
            if (OutlookService == OutlookOgcs.Calendar.Service.SharedCalendar)
            {
                log.Info("  Shared Calendar: " + SharedCalendar);
            }
            else
            {
                log.Info("  Mailbox/FolderStore Name: " + MailboxName);
            }
            log.Info("  Calendar: " + (UseOutlookCalendar.Name == "Calendar" ? "Default " : "") + UseOutlookCalendar.ToString());
            log.Info("  Category Filter: " + CategoriesRestrictBy.ToString());
            log.Info("  Categories: " + String.Join(",", Categories.ToArray()));
            log.Info("  Only Responded Invites: " + OnlyRespondedInvites);
            log.Info("  Filter String: " + OutlookDateFormat);
            log.Info("  GAL Blocked: " + OutlookGalBlocked);

            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Calendar: " + (UseGoogleCalendar == null ? "" : UseGoogleCalendar.ToString(true)));
            log.Info("  Exclude Declined Invites: " + ExcludeDeclinedInvites);
            log.Info("  Exclude Goals: " + ExcludeGoals);
            log.Info("  Cloak Email: " + CloakEmail);

            log.Info("SYNC OPTIONS:-");
            log.Info(" How");
            log.Info("  SyncDirection: " + SyncDirection.Name);
            log.Info("  MergeItems: " + MergeItems);
            log.Info("  DisableDelete: " + DisableDelete);
            log.Info("  ConfirmOnDelete: " + ConfirmOnDelete);
            log.Info("  SetEntriesPrivate: " + SetEntriesPrivate);
            log.Info("  SetEntriesAvailable: " + SetEntriesAvailable + (SetEntriesAvailable ? "; " + AvailabilityStatus : ""));
            log.Info("  SetEntriesColour: " + SetEntriesColour + (SetEntriesColour ? "; " + SetEntriesColourValue + "; \"" + SetEntriesColourName + "\"" : ""));
            if ((SetEntriesPrivate || SetEntriesAvailable || SetEntriesColour) && SyncDirection == Sync.Direction.Bidirectional)
            {
                log.Info("    TargetCalendar: " + TargetCalendar.Name);
                log.Info("    CreatedItemsOnly: " + CreatedItemsOnly);
            }
            if (ColourMaps.Count > 0)
            {
                log.Info("  Custom Colour/Category Mapping:-");
                if (OutlookOgcs.Factory.OutlookVersionName == OutlookOgcs.Factory.OutlookVersionNames.Outlook2003)
                {
                    log.Fail("    Using Outlook2003 - categories not supported, although mapping exists");
                }
                else
                {
                    ColourMaps.ToList().ForEach(c => log.Info("    " + OutlookOgcs.Calendar.Categories.OutlookColour(c.Key) + ":" + c.Key + " <=> " +
                                                              c.Value + ":" + GoogleOgcs.EventColour.Palette.GetColourName(c.Value)));
                }
            }
            log.Info("  SingleCategoryOnly: " + SingleCategoryOnly);
            log.Info("  Obfuscate Words: " + Obfuscation.Enabled);
            if (Obfuscation.Enabled)
            {
                if (Obfuscation.FindReplace.Count == 0)
                {
                    log.Info("    No regex defined.");
                }
                else
                {
                    foreach (FindReplace findReplace in Obfuscation.FindReplace)
                    {
                        log.Info("    '" + findReplace.find + "' -> '" + findReplace.replace + "'");
                    }
                }
            }
            log.Info(" When");
            log.Info("  DaysInThePast: " + DaysInThePast);
            log.Info("  DaysInTheFuture:" + DaysInTheFuture);
            log.Info("  SyncInterval: " + SyncInterval);
            log.Info("  SyncIntervalUnit: " + SyncIntervalUnit);
            log.Info("  Push Changes: " + OutlookPush);
            log.Info(" What");
            log.Info("  AddLocation: " + AddLocation);
            log.Info("  AddDescription: " + AddDescription + "; OnlyToGoogle: " + AddDescription_OnlyToGoogle);
            log.Info("  AddAttendees: " + AddAttendees + " <" + MaxAttendees);
            log.Info("  AddColours: " + AddColours);
            log.Info("  AddReminders: " + AddReminders);
            log.Info("    UseGoogleDefaultReminder: " + UseGoogleDefaultReminder);
            log.Info("    UseOutlookDefaultReminder: " + UseOutlookDefaultReminder);
            log.Info("    ReminderDND: " + ReminderDND + " (" + ReminderDNDstart.ToString("HH:mm") + "-" + ReminderDNDend.ToString("HH:mm") + ")");
        }
Пример #15
0
        public void LogSettings()
        {
            log.Info(Program.MaskFilePath(ConfigFile));
            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Service: " + OutlookService.ToString());
            if (OutlookService == OutlookOgcs.Calendar.Service.SharedCalendar)
            {
                log.Info("  Shared Calendar: " + SharedCalendar);
            }
            else
            {
                log.Info("  Mailbox/FolderStore Name: " + MailboxName);
            }
            log.Info("  Calendar: " + (UseOutlookCalendar.Name == "Calendar"?"Default ":"") + UseOutlookCalendar.ToString());
            log.Info("  Category Filter: " + CategoriesRestrictBy.ToString());
            log.Info("  Categories: " + String.Join(",", Categories.ToArray()));
            log.Info("  Only Responded Invites: " + OnlyRespondedInvites);
            log.Info("  Filter String: " + OutlookDateFormat);
            log.Info("  GAL Blocked: " + OutlookGalBlocked);
            if (TimezoneMaps.Count > 0)
            {
                log.Info("  Custom Timezone Mapping:-");
                TimezoneMaps.ToList().ForEach(tz => log.Info("    " + tz.Key + " => " + tz.Value));
            }

            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Calendar: " + (UseGoogleCalendar == null ? "" : UseGoogleCalendar.ToString(true)));
            log.Info("  Exclude Goals: " + ExcludeGoals);
            log.Info("  Personal API Keys: " + UsingPersonalAPIkeys());
            log.Info("    Client Identifier: " + PersonalClientIdentifier);
            log.Info("    Client Secret: " + (PersonalClientSecret.Length < 5
                ? "".PadLeft(PersonalClientSecret.Length, '*')
                : PersonalClientSecret.Substring(0, PersonalClientSecret.Length - 5).PadRight(5, '*')));
            log.Info("  API attendee limit in effect: " + APIlimit_inEffect);
            log.Info("  API attendee limit last reached: " + APIlimit_lastHit);
            log.Info("  Assigned API key: " + AssignedClientIdentifier);
            log.Info("  Cloak Email: " + CloakEmail);

            log.Info("SYNC OPTIONS:-");
            log.Info(" How");
            log.Info("  SyncDirection: " + SyncDirection.Name);
            log.Info("  MergeItems: " + MergeItems);
            log.Info("  DisableDelete: " + DisableDelete);
            log.Info("  ConfirmOnDelete: " + ConfirmOnDelete);
            log.Info("  SetEntriesPrivate: " + SetEntriesPrivate);
            log.Info("  SetEntriesAvailable: " + SetEntriesAvailable + (SetEntriesAvailable ? "; " + AvailabilityStatus : ""));
            log.Info("  SetEntriesColour: " + SetEntriesColour + (SetEntriesColour ? "; " + SetEntriesColourValue + "; \"" + SetEntriesColourName + "\"" : ""));
            if ((SetEntriesPrivate || SetEntriesAvailable || SetEntriesColour) && SyncDirection == Sync.Direction.Bidirectional)
            {
                log.Info("    TargetCalendar: " + TargetCalendar.Name);
                log.Info("    CreatedItemsOnly: " + CreatedItemsOnly);
            }
            if (ColourMaps.Count > 0)
            {
                log.Info("  Custom Colour/Category Mapping:-");
                if (OutlookOgcs.Factory.OutlookVersionName == OutlookOgcs.Factory.OutlookVersionNames.Outlook2003)
                {
                    log.Fail("    Using Outlook2003 - categories not supported, although mapping exists");
                }
                else
                {
                    ColourMaps.ToList().ForEach(c => log.Info("    " + OutlookOgcs.Calendar.Categories.OutlookColour(c.Key) + ":" + c.Key + " <=> " +
                                                              c.Value + ":" + GoogleOgcs.EventColour.Palette.GetColourName(c.Value)));
                }
            }
            log.Info("  Obfuscate Words: " + Obfuscation.Enabled);
            if (Obfuscation.Enabled)
            {
                if (Settings.Instance.Obfuscation.FindReplace.Count == 0)
                {
                    log.Info("    No regex defined.");
                }
                else
                {
                    foreach (FindReplace findReplace in Settings.Instance.Obfuscation.FindReplace)
                    {
                        log.Info("    '" + findReplace.find + "' -> '" + findReplace.replace + "'");
                    }
                }
            }
            log.Info(" When");
            log.Info("  DaysInThePast: " + DaysInThePast);
            log.Info("  DaysInTheFuture:" + DaysInTheFuture);
            log.Info("  SyncInterval: " + SyncInterval);
            log.Info("  SyncIntervalUnit: " + SyncIntervalUnit);
            log.Info("  Push Changes: " + OutlookPush);
            log.Info(" What");
            log.Info("  AddLocation: " + AddLocation);
            log.Info("  AddDescription: " + AddDescription + "; OnlyToGoogle: " + AddDescription_OnlyToGoogle);
            log.Info("  AddAttendees: " + AddAttendees);
            log.Info("  AddColours: " + AddColours);
            log.Info("  AddReminders: " + AddReminders);
            log.Info("    UseGoogleDefaultReminder: " + UseGoogleDefaultReminder);
            log.Info("    UseOutlookDefaultReminder: " + UseOutlookDefaultReminder);
            log.Info("    ReminderDND: " + ReminderDND + " (" + ReminderDNDstart.ToString("HH:mm") + "-" + ReminderDNDend.ToString("HH:mm") + ")");

            log.Info("PROXY:-");
            log.Info("  Type: " + Proxy.Type);
            if (Proxy.BrowserUserAgent != Proxy.DefaultBrowserAgent)
            {
                log.Info("  Browser Agent: " + Proxy.BrowserUserAgent);
            }
            if (Proxy.Type == "Custom")
            {
                log.Info("  Server Name: " + Proxy.ServerName);
                log.Info("  Port: " + Proxy.Port.ToString());
                log.Info("  Authentication Required: " + Proxy.AuthenticationRequired);
                log.Info("  UserName: "******"  Password: "******"" : "*********"));
            }

            log.Info("APPLICATION BEHAVIOUR:-");
            log.Info("  ShowBubbleTooltipWhenSyncing: " + ShowBubbleTooltipWhenSyncing);
            log.Info("  StartOnStartup: " + StartOnStartup + "; DelayedStartup: " + StartupDelay.ToString());
            log.Info("  HideSplashScreen: " + (UserIsBenefactor() ? HideSplashScreen.ToString() : "N/A"));
            log.Info("  SuppressSocialPopup: " + (UserIsBenefactor() ? SuppressSocialPopup.ToString() : "N/A"));
            log.Info("  StartInTray: " + StartInTray);
            log.Info("  MinimiseToTray: " + MinimiseToTray);
            log.Info("  MinimiseNotClose: " + MinimiseNotClose);
            log.Info("  ShowBubbleWhenMinimising: " + ShowBubbleWhenMinimising);
            log.Info("  Portable: " + Portable);
            log.Info("  CreateCSVFiles: " + CreateCSVFiles);

            log.Info("  VerboseOutput: " + VerboseOutput);
            log.Info("  MuteClickSounds: " + MuteClickSounds);
            //To pick up from settings.xml file:
            //((log4net.Repository.Hierarchy.Hierarchy)log.Logger.Repository).Root.Level.Name);
            log.Info("  Logging Level: " + LoggingLevel);
            log.Info("  Error Reporting: " + CloudLogging ?? "Undefined");

            log.Info("ABOUT:-");
            log.Info("  Alpha Releases: " + alphaReleases);
            log.Info("  Skip Version: " + SkipVersion);
            log.Info("  Subscribed: " + Subscribed.ToString("dd-MMM-yyyy"));
            log.Info("  Timezone Database: " + TimezoneDB.Instance.Version);

            log.Info("ENVIRONMENT:-");
            log.Info("  Current Locale: " + System.Globalization.CultureInfo.CurrentCulture.Name);
            log.Info("  Short Date Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            log.Info("  Short Time Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
            TimeZone curTimeZone = TimeZone.CurrentTimeZone;

            log.Info("  System Time Zone: " + curTimeZone.StandardName + "; DST=" + curTimeZone.IsDaylightSavingTime(DateTime.Now));
            log.Info("  Completed Syncs: " + CompletedSyncs);
        }
Пример #16
0
 public OutlookConverter(OutlookService outlookService)
 {
     _outlookService = outlookService;
 }
Пример #17
0
 public OutlookGenericsConverter(OutlookService service)
 {
     _converter = new OutlookConverter(service);
 }
        public void LogSettings()
        {
            log.Info(Program.SettingsFile);
            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Service: " + OutlookService.ToString());
            if (OutlookService == OutlookOgcs.Calendar.Service.SharedCalendar)
            {
                log.Info("  Shared Calendar: " + SharedCalendar);
            }
            else
            {
                log.Info("  Mailbox/FolderStore Name: " + MailboxName);
            }
            log.Info("  Calendar: " + (UseOutlookCalendar.Name == "Calendar"?"Default ":"") + UseOutlookCalendar.Name);
            log.Info("  Category Filter: " + CategoriesRestrictBy.ToString());
            log.Info("  Categories: " + String.Join(",", Categories.ToArray()));
            log.Info("  Filter String: " + OutlookDateFormat);
            log.Info("  GAL Blocked: " + OutlookGalBlocked);

            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Calendar: " + UseGoogleCalendar.Name);
            log.Info("  Personal API Keys: " + UsingPersonalAPIkeys());
            log.Info("    Client Identifier: " + PersonalClientIdentifier);
            log.Info("    Client Secret: " + (PersonalClientSecret.Length < 5
                ? "".PadLeft(PersonalClientSecret.Length, '*')
                : PersonalClientSecret.Substring(0, PersonalClientSecret.Length - 5).PadRight(5, '*')));
            log.Info("  API attendee limit in effect: " + APIlimit_inEffect);
            log.Info("  API attendee limit last reached: " + APIlimit_lastHit);
            log.Info("  Assigned API key: " + AssignedClientIdentifier);
            log.Info("  Cloak Email: " + CloakEmail);

            log.Info("SYNC OPTIONS:-");
            log.Info(" Main");
            log.Info("  SyncDirection: " + SyncDirection.Name);
            log.Info("  DaysInThePast: " + DaysInThePast);
            log.Info("  DaysInTheFuture:" + DaysInTheFuture);
            log.Info("  SyncInterval: " + SyncInterval);
            log.Info("  SyncIntervalUnit: " + SyncIntervalUnit);
            log.Info("  Push Changes: " + OutlookPush);
            log.Info("  AddDescription: " + AddDescription + "; OnlyToGoogle: " + AddDescription_OnlyToGoogle);
            log.Info("  AddReminders: " + AddReminders);
            log.Info("    UseGoogleDefaultReminder: " + UseGoogleDefaultReminder);
            log.Info("    ReminderDND: " + ReminderDND + " (" + ReminderDNDstart.ToString("HH:mm") + "-" + ReminderDNDend.ToString("HH:mm") + ")");
            log.Info("  AddAttendees: " + AddAttendees);
            log.Info("  MergeItems: " + MergeItems);
            log.Info("  DisableDelete: " + DisableDelete);
            log.Info("  ConfirmOnDelete: " + ConfirmOnDelete);
            log.Info("  SetEntriesPrivate: " + SetEntriesPrivate);
            log.Info("  SetEntriesAvailable: " + SetEntriesAvailable);
            if ((SetEntriesPrivate || SetEntriesAvailable) && SyncDirection == SyncDirection.Bidirectional)
            {
                log.Info("    TargetCalendar: " + TargetCalendar.Name);
                log.Info("    CreatedItemsOnly: " + CreatedItemsOnly);
            }
            log.Info("  Obfuscate Words: " + Obfuscation.Enabled);
            if (Obfuscation.Enabled)
            {
                if (Settings.Instance.Obfuscation.FindReplace.Count == 0)
                {
                    log.Info("    No regex defined.");
                }
                else
                {
                    foreach (FindReplace findReplace in Settings.Instance.Obfuscation.FindReplace)
                    {
                        log.Info("    '" + findReplace.find + "' -> '" + findReplace.replace + "'");
                    }
                }
            }

            log.Info("PROXY:-");
            log.Info("  Type: " + Proxy.Type);
            if (Proxy.Type == "Custom")
            {
                log.Info("  Server Name: " + Proxy.ServerName);
                log.Info("  Port: " + Proxy.Port.ToString());
                log.Info("  Authentication Required: " + Proxy.AuthenticationRequired);
                log.Info("  UserName: "******"  Password: "******"" : "*********"));
            }

            log.Info("APPLICATION BEHAVIOUR:-");
            log.Info("  ShowBubbleTooltipWhenSyncing: " + ShowBubbleTooltipWhenSyncing);
            log.Info("  StartOnStartup: " + StartOnStartup + "; DelayedStartup: " + StartupDelay.ToString());
            log.Info("  HideSplashScreen: " + ((Subscribed != DateTime.Parse("01-Jan-2000") || Donor) ? HideSplashScreen.ToString() : "N/A"));
            log.Info("  StartInTray: " + StartInTray);
            log.Info("  MinimiseToTray: " + MinimiseToTray);
            log.Info("  MinimiseNotClose: " + MinimiseNotClose);
            log.Info("  ShowBubbleWhenMinimising: " + ShowBubbleWhenMinimising);
            log.Info("  Portable: " + Portable);
            log.Info("  CreateCSVFiles: " + CreateCSVFiles);

            log.Info("  VerboseOutput: " + VerboseOutput);
            log.Info("  MuteClickSounds: " + MuteClickSounds);
            //To pick up from settings.xml file:
            //((log4net.Repository.Hierarchy.Hierarchy)log.Logger.Repository).Root.Level.Name);
            log.Info("  Logging Level: " + LoggingLevel);

            log.Info("ABOUT:-");
            log.Info("  Alpha Releases: " + alphaReleases);
            log.Info("  Subscribed: " + Subscribed.ToString("dd-MMM-yyyy"));
            log.Info("  Timezone Database: " + TimezoneDB.Instance.Version);

            log.Info("ENVIRONMENT:-");
            log.Info("  Current Locale: " + System.Globalization.CultureInfo.CurrentCulture.Name);
            log.Info("  Short Date Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            log.Info("  Short Time Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
            log.Info("  Completed Syncs: " + CompletedSyncs);
        }
Пример #19
0
        public void LogSettings()
        {
            log.Info(Program.SettingsFile);
            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Service: " + OutlookService.ToString());
            log.Info("  Calendar: " + (UseOutlookCalendar.Name == "Calendar"?"Default ":"") + UseOutlookCalendar.Name);
            log.Info("  Filter String: " + OutlookDateFormat);

            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Calendar: " + UseGoogleCalendar.Name);
            log.Info("  API attendee limit in effect: " + APIlimit_inEffect);
            log.Info("  API attendee limit last reached: " + APIlimit_lastHit);

            log.Info("SYNC OPTIONS:-");
            log.Info(" Main");
            log.Info("  SyncDirection: " + SyncDirection.Name);
            log.Info("  DaysInThePast: " + DaysInThePast);
            log.Info("  DaysInTheFuture:" + DaysInTheFuture);
            log.Info("  SyncInterval: " + SyncInterval);
            log.Info("  SyncIntervalUnit: " + SyncIntervalUnit);
            log.Info("  Push Changes: " + OutlookPush);
            log.Info("  AddDescription: " + AddDescription + "; OnlyToGoogle: " + AddDescription_OnlyToGoogle);
            log.Info("  AddReminders: " + AddReminders);
            log.Info("  AddAttendees: " + AddAttendees);
            log.Info("  MergeItems: " + MergeItems);
            log.Info("  DisableDelete: " + DisableDelete);
            log.Info("  ConfirmOnDelete: " + ConfirmOnDelete);
            log.Info("  Obfuscate Words: " + Obfuscation.Enabled);
            if (Obfuscation.Enabled)
            {
                if (Settings.Instance.Obfuscation.FindReplace.Count == 0)
                {
                    log.Info("    No regex defined.");
                }
                else
                {
                    foreach (FindReplace findReplace in Settings.Instance.Obfuscation.FindReplace)
                    {
                        log.Info("    '" + findReplace.find + "' -> '" + findReplace.replace + "'");
                    }
                }
            }

            log.Info("PROXY:-");
            log.Info("  Type: " + Proxy.Type);
            if (Proxy.Type == "Custom")
            {
                log.Info("  Server Name: " + Proxy.ServerName);
                log.Info("  Port: " + Proxy.Port.ToString());
                log.Info("  UserName: "******"  Password: "******"" : "*********"));
            }

            log.Info("APPLICATION BEHAVIOUR:-");
            log.Info("  ShowBubbleTooltipWhenSyncing: " + ShowBubbleTooltipWhenSyncing);
            log.Info("  StartOnStartup: " + StartOnStartup);
            log.Info("  StartInTray: " + StartInTray);
            log.Info("  MinimiseToTray: " + MinimiseToTray);
            log.Info("  MinimiseNotClose: " + MinimiseNotClose);
            log.Info("  ShowBubbleWhenMinimising: " + ShowBubbleWhenMinimising);
            log.Info("  Portable: " + Portable);
            log.Info("  CreateCSVFiles: " + CreateCSVFiles);

            log.Info("  VerboseOutput: " + VerboseOutput);
            //To pick up from settings.xml file:
            //((log4net.Repository.Hierarchy.Hierarchy)log.Logger.Repository).Root.Level.Name);
            log.Info("  Logging Level: " + LoggingLevel);

            log.Info("ENVIRONMENT:-");
            log.Info("  Current Locale: " + System.Globalization.CultureInfo.CurrentCulture.Name);
            log.Info("  Short Date Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            log.Info("  Short Time Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
            log.Info("  Completed Syncs: " + CompletedSyncs);
        }