public List <MetadataScript> GetAttributeScripts(AttributesJson attributesJson) { List <MetadataScript> scripts = new List <MetadataScript>(); foreach (string suffix in MetadataScript.Suffixes) { string scriptKey = MetadataScript.GetMetadataKeyTitle(this.scriptType, suffix); string script = GetPropertyValue(attributesJson, scriptKey); if (!string.IsNullOrEmpty(script)) { Logger.Info("Found {0} in metadata.", MetadataScript.GetMetadataKeyHyphen(this.scriptType, suffix)); scripts.Add(FetchScript(suffix, script)); } } return(scripts); }
public List <MetadataScript> GetScripts(MetadataJson metadata) { AttributesJson instanceAttributesJson; AttributesJson projectAttributesJson; try { instanceAttributesJson = metadata.Instance.Attributes; } catch (NullReferenceException) { instanceAttributesJson = null; } try { projectAttributesJson = metadata.Project.Attributes; } catch (NullReferenceException) { projectAttributesJson = null; } List <MetadataScript> scripts = new List <MetadataScript>(); foreach (string suffix in MetadataScript.Suffixes) { string scriptKey = MetadataScript.GetMetadataKeyTitle(this.scriptType, suffix); string script = GetPropertyValue(instanceAttributesJson, scriptKey) ?? GetPropertyValue(projectAttributesJson, scriptKey); if (!string.IsNullOrEmpty(script)) { Logger.Info("Found {0} in metadata.", MetadataScript.GetMetadataKeyHyphen(this.scriptType, suffix)); scripts.Add(FetchScript(suffix, script)); } } return(scripts); }