Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ScriptAssemblyViewModel.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.Reflection;
6 using System.Collections.ObjectModel;
7 using SiliconStudio.Presentation;
8 
9 namespace SiliconStudio.Paradox.DebugTools.ViewModels
10 {
12  {
13  public RootViewModel Parent { get; private set; }
14 
15  private readonly ScriptAssembly scriptAssembly;
16 
17  public ScriptAssemblyViewModel(ScriptAssembly scriptAssembly, RootViewModel parent)
18  {
19  if (scriptAssembly == null)
20  throw new ArgumentNullException("scriptAssembly");
21 
22  if (parent == null)
23  throw new ArgumentNullException("parent");
24 
25  Parent = parent;
26  this.scriptAssembly = scriptAssembly;
27 
28  UpdateScripts();
29  }
30 
31  public string Url
32  {
33  get
34  {
35  if (scriptAssembly.Url == null)
36  return "<anonymous assembly>";
37  return scriptAssembly.Url.TrimStart('/');
38  }
39  }
40 
41  public string Assembly
42  {
43  get
44  {
45  if (scriptAssembly.Assembly == null)
46  return "-";
47  return scriptAssembly.Assembly.ToString();
48  }
49  }
50 
51  public IEnumerable<ScriptTypeViewModel> Types { get; private set; }
52 
53  internal void UpdateScripts()
54  {
55  Types = from script in scriptAssembly.Scripts group script by script.TypeName into g select new ScriptTypeViewModel(g.Key, g, this);
56  OnPropertyChanged<ScriptAssemblyViewModel>(n => n.Types);
57  }
58  }
59 }
ScriptAssemblyViewModel(ScriptAssembly scriptAssembly, RootViewModel parent)