Skip to content

SAIF.Resources operations and processes

This page is the operation catalog and cross-operation hub for SAIF.Resources. Each operation's detailed, step-by-step logic lives in its own page under operations/. SAIF.Resources is a passive shared resource library — it implements no application business rules and performs no database access; its "operations" are technical utility behaviors for template loading, token replacement, language metadata, and reflection-based property mapping.

Operation catalog

Operation Intent Trigger Inputs Outputs Rules Tables SQL
Load and tokenize a localized text template Resolve a culture-specific template from disk or an assembly manifest, falling back through broader cultures, and parse its tokens. Caller calls LoadResource on a clsFileResourceManager or clsAssemblyResourceManager Resource name, template extension, culture code, resource directory or assembly context Initialized Text, ReplacedText, and Tokens state — — —
Replace a token in loaded text Render tokenized content by replacing all occurrences of a named token. Caller calls ReplaceToken after a template has been loaded Token name and replacement text Updated ReplacedText string — — —
Enumerate supported languages Return localized language choices for English and Spanish consumers. Caller reads mdlLanguages.SupportedLanguages SupportedCultures values IEnumerable(Of clsLanguage) — — —
Map resource or view-model properties Project matching public properties from one type onto a new destination instance, or emit scaffolding source for matching properties. Caller calls ResourceViewModelMapper.Map or GetViewModelProperties Generic source type, destination type, and property type New mapped destination instance or generated VB property declarations — — —

Process flow diagram

The following diagram visualizes the primary template-loading and replacement flow across the load and replace-token operations.

flowchart TD
    Start([Start]) --> Choose[Select file-based or assembly-based loader]
    Choose --> Resolve[Resolve exact culture resource]
    Resolve --> Found{Resource found?}
    Found -->|No| Fallback[Retry with two-letter culture<br>then unsuffixed default resource]
    Fallback --> FallbackFound{Resource found?}
    FallbackFound -->|No| EndNoLoad([Return without loading text])
    Found -->|Yes| Read[Read template text]
    FallbackFound -->|Yes| Read
    Read --> Init[Initialize text and replaced text]
    Init --> Tokens[LoadTokens parses placeholders]
    Tokens --> Replace[Caller invokes ReplaceToken as needed]
    Replace --> End([Return rendered text])

Failure and edge-case behavior

  • If neither an exact-culture, two-letter-culture, nor unsuffixed default resource exists, the load call returns without loading content and prior loader state is left unchanged (see Load and tokenize a localized text template).
  • ReplaceToken leaves ReplacedText unchanged when the requested token name is not present (see Replace a token in loaded text).
  • ResourceViewModelMapper.Map ignores destination properties that do not match a source property on both name and property type (see Map resource or view-model properties).
  • SupportedLanguages returns only the culture codes currently listed in SupportedCultures, and labels any non-Spanish culture with the English description (see Enumerate supported languages).

Sources

  • Resources\SAIF.Resources\clsResourceManager.vb
  • Resources\SAIF.Resources\clsFileResourceManager.vb
  • Resources\SAIF.Resources\clsAssemblyResourceManager.vb
  • Resources\SAIF.Resources\clsLanguage.vb
  • Resources\SAIF.Resources\mdlLanguages.vb
  • Resources\SAIF.Resources\Mappings\ResourceViewModelMapper.vb
  • Resources\SAIF.Resources\Common\Common_UI.Designer.vb