Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
UFileToUri.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 an instance of the <see cref="Uri"/> class.
12  /// </summary>
13  public class UFileToUri : OneWayValueConverter<UFileToUri>
14  {
15  /// <inheritdoc/>
16  public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
17  {
18  if (value == null)
19  return null;
20 
21  try
22  {
23  var uri = new Uri((UFile)value);
24  return uri;
25  }
26  catch
27  {
28  return null;
29  }
30  }
31  }
32 }
override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Definition: UFileToUri.cs:16
This converter will convert an UFile to an instance of the Uri class.
Definition: UFileToUri.cs:13
Android.Net.Uri Uri
Definition: HtmlElement.cs:8
Defines a normalized file path. See UPath for details. This class cannot be inherited.
Definition: UFile.cs:13