How zshameel/relink works
1. What this repo is
Re:Link is a Windows desktop app built in C#/.NET WinForms. Its job is to act as the user’s default browser and route clicked links to different installed browsers based on rules. The architecture is centered around one core flow: intercept a URL click, evaluate rules, choose a browser, and launch it with that URL.
2. Application entry and UI shell
ReLinkMain.cs is the app entry point, with MainForm as the main configuration/UI surface. The UI is not the product itself; it is the management console for rules, browser selection, and app behavior. ToastForm provides lightweight user feedback, likely for actions such as successful launches or warnings.
3. Rule engine: URL-to-browser mapping
The Rules/ folder contains the core matching logic:
- Rule.cs represents a single routing rule.
- MatchType.cs defines how matching works.
- Wildcard.cs suggests support for pattern-based host/path matching.
This subsystem is the decision layer of the app: it takes an incoming link and determines which browser should handle it.
4. Browser abstraction and launch pipeline
The Browser/ folder encapsulates everything related to browser discovery, registration, and launch:
- BrowserInfo.cs and BrowserType.cs model available browsers.
- BrowserManager.cs likely resolves the target browser and starts it.
- BrowserRegistrar.cs and BrowserRegistrarWin10.cs indicate OS-specific default-browser registration logic.
- NativeHelper.cs and OSVersion.cs point to Win32/OS integration needed for shell registration and compatibility handling.
This is a major boundary: the app separates rule evaluation from browser execution/registration.
5. Default-browser / link-handler integration
The README makes clear that Re:Link is meant to be set as the default browser, so the external entry point is the Windows shell’s URL handling. That means the app sits between desktop apps (email clients, chat apps, etc.) and the actual target browsers. The BrowserRegistrar classes likely manage this shell integration so the OS sends links to Re:Link first.
6. Configuration and browser selector metadata
Config/BrowserSelector.xml likely stores known browser definitions or selector metadata used to populate the browser list. This is a configuration boundary separate from user-specific settings and rules. It probably helps the app understand which browsers are installed and how to refer to them consistently.
7. User settings and persisted state
Settings/BrowserSettings.cs appears to hold user-configurable browser-related preferences. The project also includes App.config and Properties/Settings.settings, which suggests a mix of application settings and persisted user settings. This subsystem stores the user’s chosen rule mappings, defaults, and any app preferences needed across launches.
8. Property-change infrastructure
PropertyService/ provides a small internal observable model:
- PropertyService.cs
- Properties.cs
- PropertyChangedEventArgs.cs
This looks like a lightweight state/notification layer used by the WinForms UI to keep controls in sync with backing data, without introducing a full MVVM framework.
9. Custom browser-selection UI
The ImageComboBox/ folder is a reusable custom control for selecting items with icons. This is probably used in the UI wherever the user chooses a browser for a rule. It includes:
- custom combo box rendering and dropdown behavior,
- image handling,
- item collections and type converters,
- embedded bitmaps used for the control.
Architecturally, this is a presentation component, not business logic.
10. Forms and user interaction flow
MainForm is the primary configuration surface where rules are edited and browsers selected. ToastForm provides transient notifications. Together they form the user-facing layer, while the actual routing logic remains in Rules/ and Browser/.
11. Assets and branding
Images/, embedded bitmap resources in ImageComboBox/, and Properties/Resources.* support the UI with icons and localized/static assets. These do not affect routing logic, but they matter for the UI’s browser list and selection experience.
12. Project boundaries and dependencies
ReLink.csproj and ReLink.sln show this is a single desktop application project, with ImageComboBox included as an internal project/component. The main architectural boundaries are:
- Shell integration with Windows,
- Rule evaluation,
- Browser launch/registration,
- WinForms configuration UI,
- Persistent settings/state.
13. How the runtime data flow likely works
The typical path is:
1. Windows sends a clicked URL to Re:Link because it is the default handler.
2. The app parses the link and consults the rule engine.
3. The matched rule selects a browser.
4. BrowserManager launches that browser with the URL.
5. The UI reflects or allows editing of these rules and browser associations.
14. Technology summary
The repo is primarily WinForms + Windows shell integration, with some native/OS-specific code for browser registration. Its architecture is intentionally small and monolithic, but internally separated into clear modules for routing, browser management, settings, and UI.
Main entry points: MainForm.cs Main form · BrowserManager.cs Browser manager · ImageComboBox.cs Image combo · BrowserRegistrar.cs Registrar
Components 22
Runtime flow
Default-browser link interception and browser dispatch
- Browser info · Describes an installed browser instance
Browser/BrowserInfo.cs - Browser type · Identifies supported browser kinds
Browser/BrowserType.cs - Browser manager · Resolves the target browser and launches URLs
Browser/BrowserManager.cs - Registrar · Registers Re:Link as a browser and default handler
Browser/BrowserRegistrar.cs - Win10 registrar · Windows 10 specific registration behavior
Browser/BrowserRegistrarWin10.cs - Native helper · Native calls used by browser registration and OS integration
Browser/NativeHelper.cs - OS version · Encodes Windows version checks and branching
Browser/OSVersion.cs
Routing rules
URL matching and browser selection logic
- Rule · Represents one URL-to-browser mapping rule
Rules/Rule.cs - Match type · Defines how a rule compares against a URL
Rules/MatchType.cs - Wildcard · Pattern helper for host and path matching
Rules/Wildcard.cs
WinForms UI
Configuration and feedback surfaces
State and settings
Persisted app settings and property notification
- Browser settings · Stores user browser preferences and related options
Settings/BrowserSettings.cs - Property service · Lightweight observable state container for the UI
PropertyService/PropertyService.cs - Properties · Backing property definitions used by the property service
PropertyService/Properties.cs - Changed args · Custom property-changed event arguments
PropertyService/PropertyChangedEventArgs.cs
UI controls
Reusable selection control for browser picking
- Image combo · Browser picker control with image-aware dropdown behavior
ImageComboBox/ImageComboBox.cs - Combo item · Selectable item used by the image combo box
ImageComboBox/ImageComboBoxItem.cs - Item collection · Collection for image combo box items
ImageComboBox/ImageComboBoxItemCollection.cs
Assets
Icons, resources, and selector metadata
- Browser selector · XML metadata describing browser selection options
Config/BrowserSelector.xml - Resources · Shared icons and UI resource strings
Properties/Resources.resx
Bootstrap
Application entry and project boundaries
- App entry · Program entry point that starts the WinForms application
ReLinkMain.cs
Connections 23
- App entry → Main form: starts · Bootstraps the main WinForms shell
- Main form → Property service: binds · Uses observable state to keep the UI in sync
- Main form → Image combo: uses · Browser selection is driven through the custom combo box
- Main form → Browser settings: edits · Configures persisted browser-related preferences
- Main form → Toast: shows · Displays transient status messages
- Rule → Match type: depends on · Rules use match modes to compare URLs
- Rule → Wildcard: uses · Pattern matching supports rule evaluation
- Browser manager → Browser info: selects · Chooses a browser definition to launch
- Browser manager → Browser type: classifies · Uses browser type to branch behavior
- Browser manager → Rule: consults · Evaluates rules before launching a browser
- Browser manager → Browser settings: reads · Applies stored browser preferences
- Registrar → Win10 registrar: delegates · Uses version-specific registration flow when needed
- Registrar → Native helper: calls · Invokes native Windows integration helpers
- Registrar → OS version: branches on · Selects registration behavior by Windows version
- Image combo → Combo item: renders · Displays selectable browser items
- Image combo → Item collection: contains · Manages the item list for the dropdown
- Image combo → Resources: uses · Pulls in icons and embedded UI assets
- Property service → Properties: manages · Stores and updates observable properties
- Property service → Changed args: raises · Emits property change notifications
- Browser selector → Browser info: describes · Provides metadata for available browsers
- Main form → Browser manager: invokes · Triggers browser resolution and launch from the UI
- Toast → Resources: uses · Shares application icons and resource strings
- App entry → Registrar: initializes · Application startup prepares shell integration paths