public static String ApplyRegex(String source, SyncDirection direction) { String retStr = source; if (Settings.Instance.Obfuscation.Enabled && direction == Settings.Instance.Obfuscation.Direction) { foreach (DataGridViewRow row in MainForm.Instance.dgObfuscateRegex.Rows) { DataGridViewCellCollection cells = row.Cells; if (cells[Obfuscate.FindCol].Value != null) { System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex( cells[Obfuscate.FindCol].Value.ToString(), System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.MatchCollection matches = rgx.Matches(retStr); if (matches.Count > 0) { log.Debug("Regex has matched and altered string: " + cells[Obfuscate.FindCol].Value.ToString()); if (cells[Obfuscate.ReplaceCol].Value == null) { cells[Obfuscate.ReplaceCol].Value = ""; } retStr = rgx.Replace(retStr, cells[Obfuscate.ReplaceCol].Value.ToString()); } } } } return(retStr); }
private void setDefaults() { //Default values assignedClientIdentifier = ""; PersonalClientIdentifier = ""; PersonalClientSecret = ""; OutlookService = OutlookCalendar.Service.DefaultMailbox; MailboxName = ""; SharedCalendar = ""; UseOutlookCalendar = new MyOutlookCalendarListEntry(); CategoriesRestrictBy = RestrictBy.Exclude; Categories = new System.Collections.Generic.List <String>(); OutlookDateFormat = "g"; UseGoogleCalendar = new MyGoogleCalendarListEntry(); RefreshToken = ""; apiLimit_inEffect = false; apiLimit_lastHit = DateTime.Parse("01-Jan-2000"); GaccountEmail = ""; SyncDirection = new SyncDirection(); DaysInThePast = 1; DaysInTheFuture = 60; SyncInterval = 0; SyncIntervalUnit = "Hours"; OutlookPush = false; AddDescription = true; AddDescription_OnlyToGoogle = true; AddReminders = false; UseGoogleDefaultReminder = false; ReminderDND = false; ReminderDNDstart = DateTime.Now.Date.AddHours(22); ReminderDNDend = DateTime.Now.Date.AddDays(1).AddHours(6); AddAttendees = false; MergeItems = true; DisableDelete = true; ConfirmOnDelete = true; Obfuscation = new Obfuscate(); ShowBubbleTooltipWhenSyncing = true; StartOnStartup = false; StartInTray = false; MinimiseToTray = false; MinimiseNotClose = false; ShowBubbleWhenMinimising = true; CreateCSVFiles = false; LoggingLevel = "DEBUG"; portable = false; Proxy = new SettingsProxy(); alphaReleases = false; Subscribed = DateTime.Parse("01-Jan-2000"); donor = false; hideSplashScreen = false; lastSyncDate = new DateTime(0); completedSyncs = 0; VerboseOutput = false; }
public void CompareOutlookPattern(Event ev, AppointmentItem ai, SyncDirection syncDirection, System.Text.StringBuilder sb, ref int itemModified) { if (ev.Recurrence == null) { return; } log.Fine("Building a temporary recurrent Appointment generated from Event"); AppointmentItem evAI = OutlookCalendar.Instance.IOutlook.UseOutlookCalendar().Items.Add() as AppointmentItem; evAI.Start = DateTime.Parse(ev.Start.Date ?? ev.Start.DateTime); RecurrencePattern evOpattern; RecurrencePattern aiOpattern = ai.GetRecurrencePattern(); BuildOutlookPattern(ev, evAI, out evOpattern); log.Fine("Comparing Google recurrence to Outlook equivalent"); if (MainForm.CompareAttribute("Recurrence Type", syncDirection, evOpattern.RecurrenceType.ToString(), aiOpattern.RecurrenceType.ToString(), sb, ref itemModified)) { aiOpattern.RecurrenceType = evOpattern.RecurrenceType; } if (MainForm.CompareAttribute("Recurrence Occurences", syncDirection, evOpattern.Occurrences.ToString(), aiOpattern.Occurrences.ToString(), sb, ref itemModified)) { aiOpattern.Occurrences = evOpattern.Occurrences; } if (MainForm.CompareAttribute("Recurrence Interval", syncDirection, evOpattern.Interval.ToString(), aiOpattern.Interval.ToString(), sb, ref itemModified)) { aiOpattern.Interval = evOpattern.Interval; } if (MainForm.CompareAttribute("Recurrence Instance", syncDirection, evOpattern.Instance.ToString(), aiOpattern.Instance.ToString(), sb, ref itemModified)) { aiOpattern.Instance = evOpattern.Instance; } if (MainForm.CompareAttribute("Recurrence DoW", syncDirection, evOpattern.DayOfWeekMask.ToString(), aiOpattern.DayOfWeekMask.ToString(), sb, ref itemModified)) { aiOpattern.DayOfWeekMask = evOpattern.DayOfWeekMask; } if (MainForm.CompareAttribute("Recurrence MoY", syncDirection, evOpattern.MonthOfYear.ToString(), aiOpattern.MonthOfYear.ToString(), sb, ref itemModified)) { aiOpattern.MonthOfYear = evOpattern.MonthOfYear; } aiOpattern = (RecurrencePattern)OutlookCalendar.ReleaseObject(aiOpattern); evOpattern = (RecurrencePattern)OutlookCalendar.ReleaseObject(evOpattern); evAI = (AppointmentItem)OutlookCalendar.ReleaseObject(evAI); }
private void setDefaults() { //Default values OutlookService = OutlookCalendar.Service.DefaultMailbox; MailboxName = ""; EWSuser = ""; EWSpassword = ""; EWSserver = ""; UseOutlookCalendar = new MyOutlookCalendarListEntry(); OutlookDateFormat = "g"; UseGoogleCalendar = new MyGoogleCalendarListEntry(); RefreshToken = ""; apiLimit_inEffect = false; apiLimit_lastHit = DateTime.Parse("01-Jan-2000"); SyncDirection = new SyncDirection(); DaysInThePast = 1; DaysInTheFuture = 60; SyncInterval = 0; SyncIntervalUnit = "Hours"; OutlookPush = false; AddDescription = true; AddDescription_OnlyToGoogle = true; AddReminders = false; AddAttendees = true; MergeItems = true; DisableDelete = true; ConfirmOnDelete = true; Obfuscation = new Obfuscate(); ShowBubbleTooltipWhenSyncing = true; StartOnStartup = false; StartInTray = false; MinimiseToTray = false; MinimiseNotClose = false; ShowBubbleWhenMinimising = true; CreateCSVFiles = false; LoggingLevel = "DEBUG"; portable = false; Proxy = new SettingsProxy(); alphaReleases = false; lastSyncDate = new DateTime(0); completedSyncs = 0; VerboseOutput = false; }
public static String ApplyRegex(String source, SyncDirection direction) { String retStr = source; if (Settings.Instance.Obfuscation.Enabled && direction == Settings.Instance.Obfuscation.Direction) { foreach (DataGridViewRow row in MainForm.Instance.dgObfuscateRegex.Rows) { DataGridViewCellCollection cells = row.Cells; if (cells[Obfuscate.FindCol].Value != null) { System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex( cells[Obfuscate.FindCol].Value.ToString(), System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.MatchCollection matches = rgx.Matches(retStr); if (matches.Count > 0) { log.Debug("Regex has matched and altered string: " + cells[Obfuscate.FindCol].Value.ToString()); if (cells[Obfuscate.ReplaceCol].Value == null) cells[Obfuscate.ReplaceCol].Value = ""; retStr = rgx.Replace(retStr, cells[Obfuscate.ReplaceCol].Value.ToString()); } } } } return retStr; }
public static Boolean CompareAttribute(String attrDesc, SyncDirection fromTo, Boolean googleAttr, Boolean outlookAttr, System.Text.StringBuilder sb, ref int itemModified) { log.Fine("Comparing " + attrDesc); if (googleAttr != outlookAttr) { if (fromTo == SyncDirection.GoogleToOutlook) { sb.AppendLine(attrDesc + ": " + outlookAttr + " => " + googleAttr); } else { sb.AppendLine(attrDesc + ": " + googleAttr + " => " + outlookAttr); } itemModified++; return true; } else { return false; } }
public static Boolean CompareAttribute(String attrDesc, SyncDirection fromTo, String googleAttr, String outlookAttr, System.Text.StringBuilder sb, ref int itemModified) { if (googleAttr == null) googleAttr = ""; if (outlookAttr == null) outlookAttr = ""; //Truncate long strings String googleAttr_stub = (googleAttr.Length > 50) ? googleAttr.Substring(0, 47) + "..." : googleAttr; String outlookAttr_stub = (outlookAttr.Length > 50) ? outlookAttr.Substring(0, 47) + "..." : outlookAttr; log.Fine("Comparing " + attrDesc); if (googleAttr != outlookAttr) { if (fromTo == SyncDirection.GoogleToOutlook) { sb.AppendLine(attrDesc + ": " + outlookAttr_stub + " => " + googleAttr_stub); } else { sb.AppendLine(attrDesc + ": " + googleAttr_stub + " => " + outlookAttr_stub); } itemModified++; return true; } return false; }
public void CompareOutlookPattern(Event ev, ref RecurrencePattern aiOpattern, SyncDirection syncDirection, System.Text.StringBuilder sb, ref int itemModified) { if (ev.Recurrence == null) { return; } log.Fine("Building a temporary recurrent Appointment generated from Event"); AppointmentItem evAI = OutlookOgcs.Calendar.Instance.IOutlook.UseOutlookCalendar().Items.Add() as AppointmentItem; evAI.Start = DateTime.Parse(ev.Start.Date ?? ev.Start.DateTime); RecurrencePattern evOpattern = null; try { buildOutlookPattern(ev, evAI, out evOpattern); log.Fine("Comparing Google recurrence to Outlook equivalent"); //Some versions of Outlook are erroring when 2-way syncing weekday recurring series. //Even though Outlook has Interval of zero, which is illegal, when this is updated, it won't save. Issue #398 Boolean skipIntervalCheck = false; if (aiOpattern.RecurrenceType == OlRecurrenceType.olRecursWeekly && aiOpattern.DayOfWeekMask == getDOWmask("BYDAY=MO,TU,WE,TH,FR") && aiOpattern.Interval == 0 && evOpattern.RecurrenceType == aiOpattern.RecurrenceType && evOpattern.DayOfWeekMask == aiOpattern.DayOfWeekMask && evOpattern.Interval == 1) { skipIntervalCheck = true; } if (MainForm.CompareAttribute("Recurrence Type", syncDirection, evOpattern.RecurrenceType.ToString(), aiOpattern.RecurrenceType.ToString(), sb, ref itemModified)) { aiOpattern.RecurrenceType = evOpattern.RecurrenceType; } if (!skipIntervalCheck && MainForm.CompareAttribute("Recurrence Interval", syncDirection, evOpattern.Interval.ToString(), aiOpattern.Interval.ToString(), sb, ref itemModified)) { aiOpattern.Interval = evOpattern.Interval; } if (MainForm.CompareAttribute("Recurrence Instance", syncDirection, evOpattern.Instance.ToString(), aiOpattern.Instance.ToString(), sb, ref itemModified)) { aiOpattern.Instance = evOpattern.Instance; } if (MainForm.CompareAttribute("Recurrence DoW", syncDirection, evOpattern.DayOfWeekMask.ToString(), aiOpattern.DayOfWeekMask.ToString(), sb, ref itemModified)) { aiOpattern.DayOfWeekMask = evOpattern.DayOfWeekMask; } if (MainForm.CompareAttribute("Recurrence MoY", syncDirection, evOpattern.MonthOfYear.ToString(), aiOpattern.MonthOfYear.ToString(), sb, ref itemModified)) { aiOpattern.MonthOfYear = evOpattern.MonthOfYear; } if (MainForm.CompareAttribute("Recurrence NoEndDate", syncDirection, evOpattern.NoEndDate, aiOpattern.NoEndDate, sb, ref itemModified)) { aiOpattern.NoEndDate = evOpattern.NoEndDate; } if (MainForm.CompareAttribute("Recurrence Occurences", syncDirection, evOpattern.Occurrences.ToString(), aiOpattern.Occurrences.ToString(), sb, ref itemModified)) { aiOpattern.Occurrences = evOpattern.Occurrences; } } finally { evOpattern = (RecurrencePattern)OutlookOgcs.Calendar.ReleaseObject(evOpattern); evAI.Delete(); evAI = (AppointmentItem)OutlookOgcs.Calendar.ReleaseObject(evAI); } }
public void CompareOutlookPattern(Event ev, AppointmentItem ai, SyncDirection syncDirection, System.Text.StringBuilder sb, ref int itemModified) { if (ev.Recurrence == null) return; log.Fine("Building a temporary recurrent Appointment generated from Event"); AppointmentItem evAI = OutlookCalendar.Instance.IOutlook.UseOutlookCalendar().Items.Add() as AppointmentItem; evAI.Start = DateTime.Parse(ev.Start.Date ?? ev.Start.DateTime); RecurrencePattern evOpattern; RecurrencePattern aiOpattern = ai.GetRecurrencePattern(); BuildOutlookPattern(ev, evAI, out evOpattern); log.Fine("Comparing Google recurrence to Outlook equivalent"); if (MainForm.CompareAttribute("Recurrence Type", syncDirection, evOpattern.RecurrenceType.ToString(), aiOpattern.RecurrenceType.ToString(), sb, ref itemModified)) { aiOpattern.RecurrenceType = evOpattern.RecurrenceType; } if (MainForm.CompareAttribute("Recurrence Occurences", syncDirection, evOpattern.Occurrences.ToString(), aiOpattern.Occurrences.ToString(), sb, ref itemModified)) { aiOpattern.Occurrences = evOpattern.Occurrences; } if (MainForm.CompareAttribute("Recurrence Interval", syncDirection, evOpattern.Interval.ToString(), aiOpattern.Interval.ToString(), sb, ref itemModified)) { aiOpattern.Interval = evOpattern.Interval; } if (MainForm.CompareAttribute("Recurrence Instance", syncDirection, evOpattern.Instance.ToString(), aiOpattern.Instance.ToString(), sb, ref itemModified)) { aiOpattern.Instance= evOpattern.Instance; } if (MainForm.CompareAttribute("Recurrence DoW", syncDirection, evOpattern.DayOfWeekMask.ToString(), aiOpattern.DayOfWeekMask.ToString(), sb, ref itemModified)) { aiOpattern.DayOfWeekMask = evOpattern.DayOfWeekMask; } if (MainForm.CompareAttribute("Recurrence MoY", syncDirection, evOpattern.MonthOfYear.ToString(), aiOpattern.MonthOfYear.ToString(), sb, ref itemModified)) { aiOpattern.MonthOfYear = evOpattern.MonthOfYear; } aiOpattern = (RecurrencePattern)OutlookCalendar.ReleaseObject(aiOpattern); evOpattern = (RecurrencePattern)OutlookCalendar.ReleaseObject(evOpattern); evAI = (AppointmentItem)OutlookCalendar.ReleaseObject(evAI); }