chore: organize solution into module folders (Core/Server/Drivers/Client/Tooling)
Group all 69 projects into category subfolders under src/ and tests/ so the Rider Solution Explorer mirrors the module structure. Folders: Core, Server, Drivers (with a nested Driver CLIs subfolder), Client, Tooling. - Move every project folder on disk with git mv (history preserved as renames). - Recompute relative paths in 57 .csproj files: cross-category ProjectReferences, the lib/ HintPath+None refs in Driver.Historian.Wonderware, and the external mxaccessgw refs in Driver.Galaxy and its test project. - Rebuild ZB.MOM.WW.OtOpcUa.slnx with nested solution folders. - Re-prefix project paths in functional scripts (e2e, compliance, smoke SQL, integration, install). Build green (0 errors); unit tests pass. Docs left for a separate pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Parses and normalizes failover URL sets for redundant OPC UA connections.
|
||||
/// </summary>
|
||||
public static class FailoverUrlParser
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses a comma-separated failover URL string, prepending the primary URL.
|
||||
/// Trims whitespace and deduplicates.
|
||||
/// </summary>
|
||||
/// <param name="primaryUrl">The primary endpoint URL.</param>
|
||||
/// <param name="failoverCsv">Optional comma-separated failover URLs.</param>
|
||||
/// <returns>An array with the primary URL first, followed by unique failover URLs.</returns>
|
||||
public static string[] Parse(string primaryUrl, string? failoverCsv)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(failoverCsv))
|
||||
return [primaryUrl];
|
||||
|
||||
var urls = new List<string> { primaryUrl };
|
||||
foreach (var url in failoverCsv.Split(',', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
var trimmed = url.Trim();
|
||||
if (!string.IsNullOrEmpty(trimmed) && !urls.Contains(trimmed, StringComparer.OrdinalIgnoreCase))
|
||||
urls.Add(trimmed);
|
||||
}
|
||||
|
||||
return urls.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a failover URL set from the primary URL and an optional array of failover URLs.
|
||||
/// </summary>
|
||||
/// <param name="primaryUrl">The primary endpoint URL.</param>
|
||||
/// <param name="failoverUrls">Optional failover URLs.</param>
|
||||
/// <returns>An array with the primary URL first, followed by unique failover URLs.</returns>
|
||||
public static string[] Parse(string primaryUrl, string[]? failoverUrls)
|
||||
{
|
||||
if (failoverUrls == null || failoverUrls.Length == 0)
|
||||
return [primaryUrl];
|
||||
|
||||
var urls = new List<string> { primaryUrl };
|
||||
foreach (var url in failoverUrls)
|
||||
{
|
||||
var trimmed = url?.Trim();
|
||||
if (!string.IsNullOrEmpty(trimmed) && !urls.Contains(trimmed, StringComparer.OrdinalIgnoreCase))
|
||||
urls.Add(trimmed);
|
||||
}
|
||||
|
||||
return urls.ToArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user