mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
955 B
28 lines
955 B
using ErsatzTV.Core.Domain; |
|
|
|
namespace ErsatzTV.Application.Graphics; |
|
|
|
public static class Mapper |
|
{ |
|
public static GraphicsElementViewModel ProjectToViewModel(GraphicsElement graphicsElement) |
|
{ |
|
string fileName = Path.GetFileName(graphicsElement.Path); |
|
fileName = graphicsElement.Kind switch |
|
{ |
|
GraphicsElementKind.Text => $"text/{fileName}", |
|
GraphicsElementKind.Image => $"image/{fileName}", |
|
GraphicsElementKind.Subtitle => $"subtitle/{fileName}", |
|
GraphicsElementKind.Motion => $"motion/{fileName}", |
|
GraphicsElementKind.Script => $"script/{fileName}", |
|
_ => graphicsElement.Path |
|
}; |
|
|
|
string name = fileName; |
|
if (!string.IsNullOrWhiteSpace(graphicsElement.Name)) |
|
{ |
|
name = $"{graphicsElement.Name} ({fileName})"; |
|
} |
|
|
|
return new GraphicsElementViewModel(graphicsElement.Id, name, fileName); |
|
} |
|
}
|
|
|