Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
CustomTemplatingSession.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.Collections;
5 using System.Collections.Generic;
6 using System.Dynamic;
7 using System.Runtime.Serialization;
8 using Microsoft.VisualStudio.TextTemplating;
9 
10 namespace SiliconStudio.ProjectTemplating
11 {
12  internal class CustomTemplatingSession : ITextTemplatingSession
13  {
14  private readonly dynamic expando;
15  private readonly IDictionary<string, object> backend;
16 
17  public CustomTemplatingSession(ExpandoObject expando)
18  {
19  if (expando == null) throw new ArgumentNullException("expando");
20  Id = Guid.NewGuid();
21  this.expando = expando;
22  this.backend = expando;
23  }
24 
25  public dynamic Dynamic
26  {
27  get
28  {
29  return expando;
30  }
31  }
32 
33  public bool Equals(ITextTemplatingSession other)
34  {
35  return ReferenceEquals(this, other);
36  }
37 
38  public bool Equals(Guid other)
39  {
40  return Id == other;
41  }
42 
43  public Guid Id { get; set; }
44 
45  public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
46  {
47  return backend.GetEnumerator();
48  }
49 
50  public void Add(KeyValuePair<string, object> item)
51  {
52  backend.Add(item);
53  }
54 
55  public void Clear()
56  {
57  backend.Clear();
58  }
59 
60  public bool Contains(KeyValuePair<string, object> item)
61  {
62  return backend.Contains(item);
63  }
64 
65  public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
66  {
67  backend.CopyTo(array, arrayIndex);
68  }
69 
70  public bool Remove(KeyValuePair<string, object> item)
71  {
72  return backend.Remove(item);
73  }
74 
75  public int Count
76  {
77  get
78  {
79  return backend.Count;
80  }
81  }
82 
83  public bool IsReadOnly
84  {
85  get
86  {
87  return backend.IsReadOnly;
88  }
89  }
90 
91  public bool ContainsKey(string key)
92  {
93  return backend.ContainsKey(key);
94  }
95 
96  public void Add(string key, object value)
97  {
98  backend.Add(key, value);
99  }
100 
101  public bool Remove(string key)
102  {
103  return backend.Remove(key);
104  }
105 
106  public bool TryGetValue(string key, out object value)
107  {
108  return backend.TryGetValue(key, out value);
109  }
110 
111  public object this[string key]
112  {
113  get
114  {
115  object value;
116  backend.TryGetValue(key, out value);
117  return value;
118  }
119  set
120  {
121  backend[key] = value;
122  }
123  }
124 
126  {
127  get
128  {
129  return backend.Keys;
130  }
131  }
132 
133  public ICollection<object> Values
134  {
135  get
136  {
137  return backend.Values;
138  }
139  }
140 
141 
142  IEnumerator IEnumerable.GetEnumerator()
143  {
144  return GetEnumerator();
145  }
146 
147  public void GetObjectData(SerializationInfo info, StreamingContext context)
148  {
149  throw new NotImplementedException();
150  }
151  }
152 }
A resource that is accessible by both the GPU (read only) and the CPU (write only). A dynamic resource is a good choice for a resource that will be updated by the CPU at least once per frame. To update a dynamic resource, use a Map method.
Keys
Enumeration for keys.
Definition: Keys.cs:8
SiliconStudio.Paradox.Input.Keys Keys
One bounding volume completely contains another.
The remove mixin to remove a mixin from current mixins.