Get build info¶
BuildInfo.GetBuildInfo is a standalone static utility that reads an optional version*.dat-pattern file from a caller-supplied directory and returns build/version metadata as key/value pairs, tolerating the file's absence. No caller of this method was found within this project or within SAIF.Web.API.Clients's scanned source; it may be invoked by a hosting application (e.g., a diagnostics/health endpoint) outside this repository's scanned scope*.
| Field | Value |
|---|---|
| Operation ID | OP-CORE-001 |
| Trigger | Called by a consumer (no in-repo caller found)* |
| Inputs | appDirectory (directory path to search), optional buildInfoFilePattern (glob, defaults to version*.dat) |
| Outputs | IEnumerable<KeyValuePair<string,string>> — a list of key/value metadata pairs |
| Primary components | SAIF.Web.API.Core.BuildInfo.GetBuildInfo(string, string) |
| Entry point | src/SAIF.Web.API.Core/BuildInfo.cs |
Steps¶
- Capture the calling assembly via
System.Reflection.Assembly.GetCallingAssembly(). No business rule enforced; no SQL/table interaction; no delegation. - Search
appDirectoryfor the first file matchingbuildInfoFilePatternusingSystem.IO.Directory.GetFiles(...).FirstOrDefault(). No business rule enforced (file absence is tolerated, not an error — see step 4). - Seed the result list with two fixed entries:
"Assembly"→ the calling assembly'sFullName, and"Directory"→ theappDirectoryargument as passed. - If no matching file was found (
file == null): skip file parsing entirely and return only the two seeded entries from step 3. This is a silent/no-error fallback, not an exception path. - If a file was found: read all lines via
System.IO.File.ReadAllLines(file), then for each line apply the regex(?<key>\w+): (?<value>.*). - Lines that match contribute a new key/value pair to the result.
- Lines that do not match are silently skipped — no error, no logging.
- This is free-form parsing of an externally-supplied version/build metadata file with no validation of key uniqueness or value format.
- Return the accumulated
List<KeyValuePair<string,string>>(typed asIEnumerable<KeyValuePair<string,string>>).
No step in this operation delegates to another documented library operation; only BCL I/O, reflection, and regex APIs are used.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([GetBuildInfo called]) --> Capture[Capture calling assembly]
Capture --> Search["Search appDirectory for<br>buildInfoFilePattern"]
Search --> Seed["Seed result with<br>Assembly and Directory<br>entries"]
Seed --> Found{File found?}
Found -->|No| ReturnSeeded(["Return seeded entries<br>only"])
Found -->|Yes| ReadLines[Read all lines from file]
ReadLines --> MatchLoop["Match each line against<br>key: value regex"]
MatchLoop --> ReturnAll(["Return seeded + matched<br>key/value pairs"])
Failure and edge-case behavior¶
- Missing build-info file: tolerated, not an error — only the seeded
Assembly/Directoryentries are returned. - Non-matching lines in a found file: silently skipped, no error or logging.
- No validation of key uniqueness or value format is performed on parsed entries.
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
src/SAIF.Web.API.Core/BuildInfo.cs