private ReferencedFileSave GetReferencedFileFromName(object valueToSetTo)
{
ReferencedFileSave rfs = null;
if (this.mAssociatedNamedObjectSave != null)
{
// We want to use this.AssociatedIElement so that we get
// RFS's that belong to "this". We used to use the container
// but that's not the scope of custom variables.
IElement element = this.AssociatedIElement;
if (element != null)
{
rfs = element.GetReferencedFileSaveRecursively((string)valueToSetTo);
if (rfs == null)
{
rfs = element.GetReferencedFileSaveByInstanceNameRecursively(((string)valueToSetTo).Replace("-", "_"));
}
}
}
else
{
rfs = mAssociatedIElement.GetReferencedFileSaveRecursively((string)valueToSetTo);
if (rfs == null)
{
rfs = mAssociatedIElement.GetReferencedFileSaveByInstanceNameRecursively(((string)valueToSetTo).Replace("-", "_"));
}
}
return rfs;
}