in csharp/NativeUtils/ResourceLoader.cs [1313:1353]
private ResourceLoader FromInternal(Type clazz, string resourcePathTemplate, bool substituteVariables)
{
if (null == resourcePathTemplate)
throw new ArgumentNullException(nameof(resourcePathTemplate));
if (null != _resourcePrefix)
throw new ArgumentException("Resource path is already specified!");
if (null != _class)
{
if (null != clazz && clazz != _class)
throw new ArgumentException($"Parent class is already set: %s: {_class}");
}
else
{
if (null != clazz)
_class = clazz;
else
{
Type stackClass = VariablesMapper.TryDetectCaller();
_class = stackClass != null ? stackClass : this.GetType();
}
}
_resourcePathTemplate = resourcePathTemplate;
string pattern = substituteVariables
? VariablesMapper.Substitute(resourcePathTemplate) : resourcePathTemplate;
string[] parts = pattern.Split('*');
_resourcePrefix = _resourceSuffix = null;
_resourceSuffix = parts.Length > 1 ? parts[1] : null;
// TODO: Improve handling of '*', currently we allow directly specified filename again
//if (parts.Length < 2)
//throw new ArgumentException("Resource path template must contain * character. Example: \"MyCompany.Resources.$(OS).x$(ARCH).*\"");
if (parts.Length > 2)
throw new ArgumentException("Resource path template must contain exactly one * character!");
_resourcePrefix = parts[0];
return this;
}