GARbro-mirror/ArcFormats/NScripter/CreateONSWidget.xaml.cs

50 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.Globalization;
using System.Windows.Controls;
using System.Windows.Data;
using GameRes.Formats.Strings;
namespace GameRes.Formats.GUI
{
/// <summary>
/// Interaction logic for CreateONSWidget.xaml
/// </summary>
public partial class CreateONSWidget : Grid
{
public CreateONSWidget ()
{
InitializeComponent ();
}
}
2015-09-01 03:38:04 +04:00
[ValueConversion (typeof (NScripter.Compression), typeof (string))]
class CompressionToStringConverter : IValueConverter
{
public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
{
2015-09-01 03:38:04 +04:00
switch ((NScripter.Compression)value)
{
2015-09-01 03:38:04 +04:00
case NScripter.Compression.SPB: return "SPB";
case NScripter.Compression.LZSS: return "LZSS";
case NScripter.Compression.NBZ: return "NBZ";
default: return arcStrings.ONSCompressionNone;
}
}
public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
{
string s = value as string;
if (!string.IsNullOrEmpty (s))
{
if ("SPB" == s)
2015-09-01 03:38:04 +04:00
return NScripter.Compression.SPB;
else if ("LZSS" == s)
2015-09-01 03:38:04 +04:00
return NScripter.Compression.LZSS;
else if ("NBZ" == s)
2015-09-01 03:38:04 +04:00
return NScripter.Compression.NBZ;
}
2015-09-01 03:38:04 +04:00
return NScripter.Compression.None;
}
}
}