mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-18 22:45:59 +01:00
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.
30 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|