Branch:
feature/message-change-tracker• Commit:b39cbdd3b7ec• Solution:Gsync.sln
Gsync is a Visual Studio Tools for Office (VSTO) Outlook add‑in that lays the foundation for message change tracking. It provides a clean abstraction layer over Outlook COM objects, safe “detached” snapshots for diffing, robust comparers, and testable utilities (threading, serialization, logging) so the change‑tracker feature can be built in small, verifiable increments.
- Tech: VSTO add‑in, .NET Framework 4.8.1, C#
- Targets: Microsoft Outlook (Desktop)
- Key pillars:
- Outlook interop wrappers (
IItem,IMailItem,OutlookItemWrapper,MailItemWrapper,Detached*) - Detached snapshots for safe comparison & persistence (
DetachedOutlookItem,DetachedMailItem) - Comparers for equality and similarity (
MailItemEqualityComparer,MailItemSimilarityComparer,IItemEqualityComparer,IItemSimilarityComparer) - Store discovery (
StoresWrapper,StoreWrapper,GmailStoreLocator) - Threading & UI helpers (
UiWrapper,UiTask, timers) to keep the UI responsive - SmartSerializable framework for config/persistence with DI‑friendly file system & dialogs
- Ribbon plumbing with Development actions to exercise the stack
- SVGControl WinForms library for crisp, scalable UI assets
- Outlook interop wrappers (
- Logging: log4net; logs emitted under
%APPDATA%\Gsync\Logs(e.g.,debug yyyy-MM-dd-HH-mm.log,trace yyyy-MM-dd-HH-mm.log).
Gsync.sln
├─ Gsync # Outlook add‑in (VSTO) – core code, wrappers, ribbon, logging
├─ Gsync.Test # MSTest-based unit tests (uses Moq)
└─ SVGControl # WinForms SVG rendering & controls
- OutlookInterop
Interfaces/Items:IItem,IMailItemItem/_OutlookItem:OutlookItemWrapper,OutlookItemWrapperLoose,DetachedOutlookItemItem/MailItem:MailItemWrapper,DetachedMailItem,MailItemEqualityComparer,MailItemSimilarityComparerStore:StoresWrapper,StoreWrapperFolder:FolderMinimalWrapperExtensions: WinForms interop & UI helpers
- GmailLink:
GmailStoreLocator(simple heuristics to find Gmail stores) - Utilities
- Threading:
UiWrapper,UiTask,ThreadSafeSingleShotGuard, timers (TimerWrapper,Timed*) - SmartSerializable: generic serialization/persistence helpers (+ Config Viewer)
- Collections:
ConcurrentObservableDictionary<TKey,TValue> - Newtonsoft JSON converters & path helpers
- Threading:
- Ribbon: Ribbon XML and callbacks (
_Ribbon/RibbonGsync.xml,RibbonGsync,DevelopmentMethods) - AppGlobals: App‑wide DI and bootstrapping (
OutlookApplication,FS,UI,StoresWrapper)
- Windows with Microsoft Outlook (Desktop) installed
- Visual Studio 2022 (17.x) with Office/SharePoint development workload (VSTO)
- .NET Framework 4.8.1 developer pack
- NuGet package restore enabled
- (Optional, for tests) MSTest.TestFramework / MSTest.TestAdapter, Moq (restored via NuGet)
The add‑in uses COM interop assemblies (e.g.,
Microsoft.Office.Interop.Outlook) and log4net. NuGet packages are restored on build where applicable (e.g.,SVGControl/packages.config).
- Clone the repository and open
Gsync.slnin Visual Studio 2022. - Ensure NuGet restore is enabled (
Tools → NuGet Package Manager → Package Manager Settings → Restore). - Set Gsync as the startup project.
- Build the solution (Debug).
- Run (F5). Visual Studio will start Outlook with the add‑in loaded for debugging.
- In Outlook, open the Gsync ribbon tab → Development group to run helper actions (e.g., LoopInbox).
If Outlook doesn’t load the add‑in: check File → Options → Add‑ins → COM Add‑ins; verify the Gsync add‑in isn’t disabled. You may need VSTO runtime and to trust the solution on first run.
- Logs are written under:
%APPDATA%\Gsync\Logs - Files include a timestamped debug log and trace log (method calls), configured via
log4net.config. - On startup,
ThisAddInensures the log directory exists and points appender file paths to the current timestamp.
- Framework: MSTest (attributes like
[TestClass],[TestMethod]), with Moq for mocking Outlook wrappers. - Scope: wrappers (property forwarding, event wiring), comparers, detached snapshots, store discovery, threading utilities, SmartSerializable, JSON converters, collections.
- Run: open Test Explorer in Visual Studio and run all tests in the Gsync.Test project.
- Detached Pattern:
Detached*items decouple comparisons from live COM objects—safe to serialize, diff, and persist. - Comparers: Use equality for strict identity; similarity comparers enable fuzzy matching for near‑duplicates.
- Stores:
StoresWrapperhydrates all session stores;StoreWrapperprovides account, inbox, and folder accessors. - Threading: Use
UiTask/UiWrapperto marshal work to the UI thread. Avoid long‑running operations on the Outlook UI thread. - Persistence:
SmartSerializable<T>centralizes JSON I/O with DI‑friendly file system and dialog interfaces (testable).
- Snapshot & Diff Engine for message change tracking (built on
Detached*+ comparers) - Change Surface UI (per‑item history, accept/revert flows)
- Background Scanning & Throttling (timer‑backed with backoff)
- Retention & Persistence Policy for snapshots/configs
- Diagnostics (optional telemetry hooks; trace improvements)
- CI integration for test coverage
- Generated/IDE files are excluded via
.gitignore. - Binary resources (e.g., SVGs) live under
SVGControland add‑in resource folders. - Keep new code layered: Outlook COM types must not leak above wrapper abstractions.
MIT License. See LICENSE for the full text.
-
Third-party license texts: see
THIRD-PARTY-NOTICES.mdand thelicenses/folder. -
Suggested source-file header (C#):
// Copyright (c) 2025 Dan Moisan // Licensed under the MIT License. See LICENSE in the repo root for license information.
- Built with Microsoft Office Interop, MSTest, Moq, Newtonsoft.Json, and custom SVG WinForms controls.