Skip to content

Commit

Permalink
Log as FAIL when can't find item to post-process after copy and paste.
Browse files Browse the repository at this point in the history
Minor tweaks when upgrading.
  • Loading branch information
phw198 committed Apr 3, 2022
1 parent dc7135d commit 08936ac
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
20 changes: 16 additions & 4 deletions src/OutlookGoogleCalendarSync/OutlookOgcs/ExplorerWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,14 @@ private void repopulateIDs(String entryID, Dictionary<String, object> propertyVa
copiedAi.Save();

} catch (System.Exception ex) {
log.Warn("Failed to repopulate OGCS properties back to copied item.");
OGCSexception.Analyse(ex);
if (ex is System.Runtime.InteropServices.COMException && (
OGCSexception.GetErrorCode(ex) == "0x8004010F" || //The message you specified cannot be found
OGCSexception.GetErrorCode(ex) == "0x8004010A")) //The operation cannot be performed because the object has been deleted
{
log.Warn("Could not find Outlook item with entryID " + entryID + " for post-processing.");
OGCSexception.LogAsFail(ref ex);
}
OGCSexception.Analyse("Failed to repopulate OGCS properties back to copied item.", ex);
} finally {
copiedAi = (AppointmentItem)OutlookOgcs.Calendar.ReleaseObject(copiedAi);
}
Expand Down Expand Up @@ -241,8 +247,14 @@ private void untagAsCopied(String entryID) {
}

} catch (System.Exception ex) {
log.Warn("Failed to remove OGCS 'copied' property on copied item.");
OGCSexception.Analyse(ex);
if (ex is System.Runtime.InteropServices.COMException && (
OGCSexception.GetErrorCode(ex) == "0x8004010F" || //The message you specified cannot be found
OGCSexception.GetErrorCode(ex) == "0x8004010A")) //The operation cannot be performed because the object has been deleted
{
log.Warn("Could not find Outlook item with entryID " + entryID + " for post-processing.");
OGCSexception.LogAsFail(ref ex);
}
OGCSexception.Analyse("Failed to remove OGCS 'copied' property on copied item.", ex);
} finally {
copiedAi = (AppointmentItem)OutlookOgcs.Calendar.ReleaseObject(copiedAi);
}
Expand Down
3 changes: 2 additions & 1 deletion src/OutlookGoogleCalendarSync/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ private static void moveFiles(string srcDir, string dstDir) {
private static void isNewVersion(Boolean isSquirrelInstall) {
string settingsVersion = string.IsNullOrEmpty(Settings.Instance.Version) ? "Unknown" : Settings.Instance.Version;
if (settingsVersion != Application.ProductVersion) {
log.Info("New version detected - upgraded from " + settingsVersion + " to " + Application.ProductVersion);
if (settingsVersion == "Unknown") log.Info("New install and/or brand new settings file detected.");
else log.Info("New upgraded version detected: from " + settingsVersion + " to " + Application.ProductVersion);
try {
Program.ManageStartupRegKey();
} catch (System.Exception ex) {
Expand Down
2 changes: 1 addition & 1 deletion src/OutlookGoogleCalendarSync/SettingsStore/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ public String GaccountEmail_masked() {
[DataMember] public bool? HideSplashScreen {
get { return hideSplashScreen; }
set {
hideSplashScreen = value;
if (!Loading() && hideSplashScreen != value) {
XMLManager.ExportElement(this, "HideSplashScreen", value, ConfigFile);
if (Forms.Main.Instance != null) Forms.Main.Instance.cbHideSplash.Checked = value ?? false;
}
hideSplashScreen = value;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/OutlookGoogleCalendarSync/SettingsStore/Upgrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void Check() {

private static Boolean upgradePerformed() {
try {
if (settingsVersionNum < multipleCalendars) {
if (settingsVersionNum > 0 && settingsVersionNum < multipleCalendars) {
upgradeToMultiCalendar();
settingsVersionNum = multipleCalendars;
return true;
Expand Down

0 comments on commit 08936ac

Please sign in to comment.