Files
StarterNG/StarterNG/Views/Depot/TextureMenuItems.cs
maj00r 82429010d4 Rework the depot, warehouse and vehicle base
A consist added to the warehouse gets a name there. The crew type stays through
loading a consist. The vehicle base window replaces the texture base. The depot
follows consists changed on the scenarios page, also with the warehouse tab
left open.
2026-11-01 16:06:16 +01:00

30 lines
1.1 KiB
C#

using System.IO;
using Avalonia.Controls;
using Avalonia.Input.Platform;
using StarterNG.Domain;
using StarterNG.Domain.Vehicles;
namespace StarterNG.Views;
/// <summary>What the lists of liveries offer about a livery itself.</summary>
internal static class TextureMenuItems
{
/// <param name="owner">A control of the window, for its clipboard.</param>
public static void Add(ContextMenu menu, Control owner, VehicleTexture texture)
{
menu.AddItem(App.Loc["CopyTextureName"], async () =>
{
if (TopLevel.GetTopLevel(owner)?.Clipboard is { } clipboard)
await clipboard.SetTextAsync(Consist.Base(texture.Skinfile));
});
menu.AddItem(App.Loc["OpenTextureFolder"], () => Infrastructure.Diagnostics.OpenOrReport(FolderOf(texture)));
}
private static string FolderOf(VehicleTexture texture)
{
string dir = Path.Combine(Directory.GetCurrentDirectory(), "dynamic",
texture.Directory.Replace('/', Path.DirectorySeparatorChar).TrimEnd('\\', '/'));
return Directory.Exists(dir) ? dir : Path.Combine(Directory.GetCurrentDirectory(), texture.Directory);
}
}