Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Nautilus/Extensions/GeneralExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,29 @@ public static string TrimClone(this string @this)
return pos >= 0 ? @this.Remove(pos) : @this;
}

/// <summary>
/// Removes the (Instance) text from the end of names, recursively. Primarily helpful for programmatic
/// material name comparisons.
/// </summary>
/// <param name="originalString">The name from which to remove the Instance string.</param>
/// <returns>The altered name if any trailing '(Instance)' strings were found, otherwise the uneffected
/// name.</returns>
public static string TrimInstance(string originalString)
{
string returnValue = originalString;
string instanceString = " (Instance)";

// We avoid using .Replace() here to account for users possibly including the instance string at the beginning
// Or in the middle of their material names. Not likely to happen, but better safe than sorry.
if (originalString.EndsWith(instanceString))
{
returnValue = originalString.Substring(0, originalString.Length - instanceString.Length);
return TrimInstance(returnValue);
}

return returnValue;
}

/// <summary>
/// Adds a message and increases the life of it, instead of spamming it.
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions Nautilus/Nautilus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,16 @@
<ItemGroup>
<None Include="DocFX\logo.png" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'SN.STABLE|AnyCPU'">
<None Remove="Resources\MatFilePathMapSN.resources" />
<EmbeddedResource Include="Resources\MatFilePathMapSN.resources" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'BZ.STABLE|AnyCPU'">
<None Remove="Resources\MatFilePathMapBZ.resources" />
<EmbeddedResource Include="Resources\MatFilePathMapBZ.resources" />
</ItemGroup>

<Import Project="..\PostBuild.targets" />
</Project>
Binary file added Nautilus/Resources/MatFilePathMapBZ.resources
Binary file not shown.
Binary file added Nautilus/Resources/MatFilePathMapSN.resources
Binary file not shown.
Loading