Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ScriptTypeViewModel.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6 using SiliconStudio.Paradox.Framework.MicroThreading;
7 using SiliconStudio.Paradox.Extensions;
8 using System.Windows.Input;
10 using SiliconStudio.Presentation;
11 
12 namespace SiliconStudio.Paradox.DebugTools.ViewModels
13 {
15  {
16  public ScriptAssemblyViewModel Parent { get; private set; }
17  public IEnumerable<ScriptMethodViewModel> Methods { get; private set; }
18 
19  private readonly string typeName;
20 
21  public ScriptTypeViewModel(string typeName, IEnumerable<ScriptEntry2> scriptEntries, ScriptAssemblyViewModel parent)
22  {
23  if (typeName == null)
24  throw new ArgumentNullException("typeName");
25 
26  if (scriptEntries == null)
27  throw new ArgumentNullException("scriptEntries");
28 
29  if (parent == null)
30  throw new ArgumentNullException("parent");
31 
32  Parent = parent;
33  this.typeName = typeName;
34 
35  Methods = scriptEntries.Select(item => new ScriptMethodViewModel(item, this));
36  }
37 
38  public string[] Namespaces
39  {
40  get
41  {
42  string ns = Namespace;
43  return ns != null ? ns.Split('.') : null;
44  }
45  }
46 
47  public string Namespace
48  {
49  get
50  {
51  string[] elements = typeName.Split('.');
52 
53  if (elements.Length == 1)
54  return null; // namespace-less type
55 
56  return string.Join(".", elements.Take(elements.Length - 1));
57  }
58  }
59 
60  public string[] TypeNames
61  {
62  get
63  {
64  return TypeName.Split('+'); // to get nested types
65  }
66  }
67 
68  public string TypeName
69  {
70  get
71  {
72  return typeName.Split('.').Last();
73  }
74  }
75 
76  public string FullName
77  {
78  get
79  {
80  return typeName;
81  }
82  }
83  }
84 }
ScriptTypeViewModel(string typeName, IEnumerable< ScriptEntry2 > scriptEntries, ScriptAssemblyViewModel parent)