Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
UFileToString.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Globalization;
5 
6 using SiliconStudio.Core.IO;
7 
8 namespace SiliconStudio.Presentation.ValueConverters
9 {
10  /// <summary>
11  /// This converter will convert an <see cref="UFile"/> to its string representation.
12  /// </summary>
13  public class UFileToString : ValueConverterBase<UFileToString>
14  {
15  /// <inheritdoc/>
16  public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
17  {
18  var ufile = (UFile)value;
19  return ufile.ToString().Replace('/', '\\');
20  }
21 
22  public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
23  {
24  var str = (string)value;
25  return new UFile(str);
26  }
27  }
28 }
override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
This converter will convert an UFile to its string representation.
override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Defines a normalized file path. See UPath for details. This class cannot be inherited.
Definition: UFile.cs:13