-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[addon] show application Version as ETS (#50)
* [addon] show application Version as ETS The ETS shows the version of the application as hex number with a minor version after a point. This behavior is recreated with this change. * [CodeFactor] changes related to CodeFactor hints * Add ETS version as new textbox * Update MainWindow.xaml.cs * Update MainWindow.xaml.cs * add ETS version textbox to application tab * show only numeric numbers in ETS version textbox If there is a version 12(dez) in ETS version field should not show "C". Now it shows nothing, if there is a not numeric ETS version. * change converter to minor version numbers 10...15 In ETS versions from 10 to 15 (0xA...0xF) are displayed as x.10...x.15 For example version 2.13 is 45(dec) = 0x2D
- Loading branch information
Showing
6 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1044,4 +1044,4 @@ private async void ClickCheckVersion(object sender, RoutedEventArgs e) | |
} | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters