mirror of
https://github.com/4sval/FModel.git
synced 2026-04-20 00:27:43 -05:00
26 lines
756 B
C#
26 lines
756 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
namespace FModel.Views.Resources.Converters;
|
|
|
|
public class CommitMessageConverter : IValueConverter
|
|
{
|
|
public static readonly CommitMessageConverter Instance = new();
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is string commitMessage)
|
|
{
|
|
var parts = commitMessage.Split("\n\n");
|
|
return parameter?.ToString() == "Title" ? parts[0] : parts.Length > 1 ? parts[1] : string.Empty;
|
|
}
|
|
return value;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|