|
|
@ -334,7 +334,7 @@ public class StartDeviceRuntimeCommandHandler : IRequestHandler<StartDeviceRunti |
|
|
|
.Select(networkConfig => new CoreNetworkImsConfiguration |
|
|
|
{ |
|
|
|
Index = networkConfig.Index ?? 0, |
|
|
|
Plmn = "000000", |
|
|
|
Plmn = ExtractPlmnFromConfig(networkConfig.CoreNetworkConfigContent), |
|
|
|
CoreNetworkConfiguration = networkConfig.CoreNetworkConfigContent!, |
|
|
|
ImsServiceConfiguration = networkConfig.IMSConfigContent! |
|
|
|
}) |
|
|
@ -445,4 +445,41 @@ public class StartDeviceRuntimeCommandHandler : IRequestHandler<StartDeviceRunti |
|
|
|
|
|
|
|
return (successfulDevices, failedDevices); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 从网络配置中提取PLMN值
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="configContent">网络配置内容</param>
|
|
|
|
/// <returns>提取的PLMN值,如果未找到则返回默认值"000000"</returns>
|
|
|
|
private string ExtractPlmnFromConfig(string configContent) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(configContent)) |
|
|
|
{ |
|
|
|
return "000000"; |
|
|
|
} |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
// 使用正则表达式匹配PLMN值(支持双引号和单引号)
|
|
|
|
var match = System.Text.RegularExpressions.Regex.Match( |
|
|
|
configContent, |
|
|
|
@"""plmn""\s*:\s*[""']([^""']+)[""']", |
|
|
|
System.Text.RegularExpressions.RegexOptions.IgnoreCase); |
|
|
|
|
|
|
|
if (match.Success && match.Groups.Count > 1) |
|
|
|
{ |
|
|
|
var plmnValue = match.Groups[1].Value.Trim(); |
|
|
|
_logger.LogDebug("从配置中提取到PLMN值: {PlmnValue}", plmnValue); |
|
|
|
return string.IsNullOrEmpty(plmnValue) ? "000000" : plmnValue; |
|
|
|
} |
|
|
|
|
|
|
|
_logger.LogDebug("未从配置中找到PLMN值,使用默认值: 000000"); |
|
|
|
return "000000"; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
_logger.LogWarning(ex, "提取PLMN值时发生异常,使用默认值: 000000"); |
|
|
|
return "000000"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |