diff --git a/Kaenx.Creator/Converter/IntToVersion.cs b/Kaenx.Creator/Converter/IntToVersion.cs new file mode 100644 index 0000000..f481bf3 --- /dev/null +++ b/Kaenx.Creator/Converter/IntToVersion.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using System.Windows.Data; +using System.Linq; + +namespace Kaenx.Creator.Converter +{ + public class IntToVersion : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + decimal majorVersion = Math.Floor((decimal)((int)value/16)); + int minorVersion = (int)value % 16; + return $"{majorVersion}.{minorVersion}"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + int majorVersion; + int minorVersion; + + if(value.ToString().Contains('.')) + { + string[] versions = value.ToString().Split('.'); + + if(!int.TryParse(versions[0], out majorVersion)) + majorVersion = 0; + + if(!int.TryParse(versions[1], out minorVersion)) + minorVersion = 0; + + if(minorVersion > 15) + { + minorVersion /= 10; + if(minorVersion > 15) + minorVersion = 15; + } + }else + { + if(!int.TryParse(value.ToString(), out majorVersion)) + majorVersion = 0; + + minorVersion = 0; + } + + majorVersion *= 16; + + return majorVersion + minorVersion; + } + } +} diff --git a/Kaenx.Creator/MainWindow.xaml b/Kaenx.Creator/MainWindow.xaml index 1298634..9a08128 100644 --- a/Kaenx.Creator/MainWindow.xaml +++ b/Kaenx.Creator/MainWindow.xaml @@ -17,6 +17,7 @@ Title="Kaenx-Creator" Height="720" Width="1300"> + @@ -658,6 +659,9 @@ + + + diff --git a/Kaenx.Creator/MainWindow.xaml.cs b/Kaenx.Creator/MainWindow.xaml.cs index 9f4356b..c5ca29f 100644 --- a/Kaenx.Creator/MainWindow.xaml.cs +++ b/Kaenx.Creator/MainWindow.xaml.cs @@ -1044,4 +1044,4 @@ private async void ClickCheckVersion(object sender, RoutedEventArgs e) } } } -} \ No newline at end of file +} diff --git a/Kaenx.Creator/Properties/Resources.Designer.cs b/Kaenx.Creator/Properties/Resources.Designer.cs index 377f3b5..f1d75c7 100644 --- a/Kaenx.Creator/Properties/Resources.Designer.cs +++ b/Kaenx.Creator/Properties/Resources.Designer.cs @@ -410,6 +410,15 @@ public static string prop_vers { return ResourceManager.GetString("prop_vers", resourceCulture); } } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Veröffentlichen ähnelt. + /// + public static string prop_etsvers { + get { + return ResourceManager.GetString("prop_etsvers", resourceCulture); + } + } /// /// Sucht eine lokalisierte Zeichenfolge, die Veröffentlichen ähnelt. diff --git a/Kaenx.Creator/Properties/Resources.de.resx b/Kaenx.Creator/Properties/Resources.de.resx index 778670e..30b0b8d 100644 --- a/Kaenx.Creator/Properties/Resources.de.resx +++ b/Kaenx.Creator/Properties/Resources.de.resx @@ -273,6 +273,10 @@ Version + + ETS Version + + Busstrom diff --git a/Kaenx.Creator/Properties/Resources.resx b/Kaenx.Creator/Properties/Resources.resx index 0ba55d5..0d861ee 100644 --- a/Kaenx.Creator/Properties/Resources.resx +++ b/Kaenx.Creator/Properties/Resources.resx @@ -273,6 +273,10 @@ Version + + ETS Version + + Bus Current