mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
fix: adds condition to handle legacy and current portal URL structures and adds null check for getting list types in basic config helper methods
This commit is contained in:
@@ -55,7 +55,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, SourceListItem> GetSourceListForKey(string key)
|
public Dictionary<string, SourceListItem> GetSourceListForKey(string key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(key) || !SourceLists.ContainsKey(key))
|
if (SourceLists == null || string.IsNullOrEmpty(key) || !SourceLists.ContainsKey(key))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return SourceLists[key];
|
return SourceLists[key];
|
||||||
@@ -68,7 +68,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// <returns>DestinationList if the key exists, null otherwise</returns>
|
/// <returns>DestinationList if the key exists, null otherwise</returns>
|
||||||
public Dictionary<string, DestinationListItem> GetDestinationListForKey(string key)
|
public Dictionary<string, DestinationListItem> GetDestinationListForKey(string key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(key) || !DestinationLists.ContainsKey(key))
|
if (DestinationLists == null || string.IsNullOrEmpty(key) || !DestinationLists.ContainsKey(key))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// <returns>AudioControlPointList if the key exists, null otherwise</returns>
|
/// <returns>AudioControlPointList if the key exists, null otherwise</returns>
|
||||||
public AudioControlPointListItem GetAudioControlPointListForKey(string key)
|
public AudioControlPointListItem GetAudioControlPointListForKey(string key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(key) || !AudioControlPointLists.ContainsKey(key))
|
if (AudioControlPointLists == null || string.IsNullOrEmpty(key) || !AudioControlPointLists.ContainsKey(key))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return AudioControlPointLists[key];
|
return AudioControlPointLists[key];
|
||||||
@@ -94,7 +94,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, CameraListItem> GetCameraListForKey(string key)
|
public Dictionary<string, CameraListItem> GetCameraListForKey(string key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(key) || !CameraLists.ContainsKey(key))
|
if (CameraLists == null || string.IsNullOrEmpty(key) || !CameraLists.ContainsKey(key))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return CameraLists[key];
|
return CameraLists[key];
|
||||||
|
|||||||
@@ -31,9 +31,17 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
if (string.IsNullOrEmpty(SystemUrl))
|
if (string.IsNullOrEmpty(SystemUrl))
|
||||||
return "missing url";
|
return "missing url";
|
||||||
|
|
||||||
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
|
if (SystemUrl.Contains("#"))
|
||||||
string uuid = result.Groups[1].Value;
|
{
|
||||||
return uuid;
|
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
|
||||||
|
string uuid = result.Groups[1].Value;
|
||||||
|
return uuid;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/.*");
|
||||||
|
string uuid = result.Groups[1].Value;
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,10 +52,18 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(TemplateUrl))
|
if (string.IsNullOrEmpty(TemplateUrl))
|
||||||
return "missing template url";
|
return "missing template url";
|
||||||
|
|
||||||
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
|
if (TemplateUrl.Contains("#"))
|
||||||
string uuid = result.Groups[1].Value;
|
{
|
||||||
return uuid;
|
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
|
||||||
|
string uuid = result.Groups[1].Value;
|
||||||
|
return uuid;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/(.*)\/system-template-versions\/(.*)\/.*");
|
||||||
|
string uuid = result.Groups[2].Value;
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user