/// <summary> /// Calculate the value from the ordered list of versions. /// </summary> /// <remarks> /// Iterate thru the versions from most specific to most general. /// For each version first resolve the GUID placeholders then insert /// the previously calculated version in the more general version. /// Stop this loop when either the top level is reached or if the /// resulting version is not marked as 'Combine' (which means it must be 'Override'). /// </remarks> public ConfigItemVersion CalcValue() { Guid mostSpecificUID = Versions[0].UID; if (_CalculatedValue == null) { if (_ApplicationParameter == CfgSystem.First) return Versions[0]; ConfigItemVersion specializedVersion = _ApplicationParameter; if (specializedVersion != null) specializedVersion.ResolveGuids(); for (int i = 0; i < Versions.Length; i++) { ConfigItemVersion version = Versions[i]; version.ResolveGuids(); ConfigItemVersion result = version.Insert(specializedVersion); if (!result.Combine) { _CalculatedValue = result; break; } version = result; specializedVersion = version; } } _CalculatedValue.UID = mostSpecificUID; return _CalculatedValue; }
/// <summary> /// Defines how the given more specific version can be inserted into placeholders of this version. /// </summary> /// <param name="general"></param> /// <returns></returns> public abstract ConfigItemVersion Insert(ConfigItemVersion specific);