/// <summary> /// Finds a name available for a new asset. This method will try to create a name based on an existing name and will append /// "_" + (number++) on every try. The new location found is added to the known existing locations. /// </summary> /// <param name="location">The location.</param> /// <param name="newLocation">The new location.</param> /// <returns><c>true</c> if there is a new location, <c>false</c> otherwise.</returns> public bool RegisterLocation(UFile location, out UFile newLocation) { var result = FindAvailableLocation(location, containsLocation, out newLocation); ExistingLocations.Add(newLocation ?? location); return(result); }
/// <summary> /// Checks whether the <paramref name="location"/> is already contained. /// </summary> private bool IsContainingLocation(UFile location) { if (ExistingLocations.Contains(location)) { return(true); } return(ContainsLocation?.Invoke(location) ?? false); }
/// <summary> /// Finds a name available for a new asset. This method will try to create a name based on an existing name and will append /// "_" + (number++) on every try. The new location found is added to the known existing locations. /// </summary> /// <param name="location">The location.</param> /// <param name="newLocation">The new location.</param> /// <returns><c>true</c> if there is a new location, <c>false</c> otherwise.</returns> public bool RegisterLocation(UFile location, out UFile newLocation) { newLocation = location; if (IsContainingLocation(location)) { newLocation = NamingHelper.ComputeNewName(location, IsContainingLocation); } ExistingLocations.Add(newLocation); return(newLocation != location); }
/// <summary> /// Default delegate for location. /// </summary> private bool DefaultContainsLocation(UFile location) { if (ExistingLocations.Contains(location)) { return(true); } if (ContainsLocation != null) { return(ContainsLocation(location)); } return(false); }