---
title: clsResourceManager
summary: API reference for clsResourceManager.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-24
library: SAIF.Resources
reference_type: package
---


# clsResourceManager

Base template manager that stores loaded text, discovers token placeholders, and applies token replacements.

## Purpose

- Provide common state and token-processing behavior for file-based and assembly-based template loaders.

## Context

- Namespace: `SAIF.Resources`
- Assembly/package: `SAIF.ResourceFiles`

## Public members

| Member | Signature | Purpose |
| --- | --- | --- |
| `TokenStartDelimiter` | `Public Shared Property TokenStartDelimiter As String` | Gets or sets the opening delimiter used when parsing tokens. |
| `TokenEndDelimiter` | `Public Shared Property TokenEndDelimiter As String` | Gets or sets the closing delimiter used when parsing tokens. |
| `Text` | `Public ReadOnly Property Text As String` | Returns the original loaded template text. |
| `ReplacedText` | `Public ReadOnly Property ReplacedText As String` | Returns the current template text after token replacement operations. |
| `Tokens` | `Public ReadOnly Property Tokens As List(Of Token)` | Returns the discovered tokens for the currently loaded text. |
| `New` | `Public Sub New(text As String)` | Initializes the manager with template text and immediately tokenizes it. |
| `LoadResource` | `Public Sub LoadResource(inResourceName As String, Optional inTemplateExtension As String = "html")` | Loads a resource using the current thread UI culture and the specified extension. |
| `LoadResource` | `Public Overridable Sub LoadResource(inResourceName As String, inTemplateExtension As String, inCultureCode As String)` | Culture-aware load hook for concrete implementations. |
| `GetToken` | `Public Function GetToken(inTokenName As String) As Token` | Returns the token whose name matches the supplied token identifier. |
| `ReplaceToken` | `Public Function ReplaceToken(inTokenName As String, inReplacement As String) As String` | Replaces every occurrence of the named token in the current text and returns the updated result. |
| `ReplaceToken` | `Public Shared Function ReplaceToken(text As String, inTokenName As String, inReplacement As String) As String` | Performs one-off token replacement against the supplied text without requiring a preexisting manager instance. |

## Behavioral notes

- `LoadTokens` discovers both `{token}` and `{token:content}` patterns and stores them as `Token` instances.
- `ReplaceToken` performs case-insensitive replacement against the current `ReplacedText` value.
- `LoadResource(inResourceName, Optional inTemplateExtension As String = "html")` delegates to the culture-aware overload using `CurrentUICulture.Name`.

## Constraints and usage notes

- Token matching is limited to alphanumeric and underscore token names.
- The base `LoadResource(inResourceName As String, inTemplateExtension As String, inCultureCode As String)` implementation is intentionally empty and must be overridden by a concrete loader to populate `Text`.

## Sources

- `Resources\SAIF.Resources\clsResourceManager.vb`
- `Resources\SAIF.Resources\SAIF.BOF.ResourceFiles.vbproj`
