File: EffectTechniqueCollection.cs

package info (click to toggle)
monogame 2.5.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,060 kB
  • ctags: 10,325
  • sloc: cs: 65,996; xml: 591; makefile: 22; ansic: 8
file content (50 lines) | stat: -rw-r--r-- 1,417 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.Xna.Framework.Graphics
{
    public class EffectTechniqueCollection : IEnumerable<EffectTechnique>
    {
		// Modified to be a list instead of dictionary object because a dictionary does not guarantee
		// the order is kept as it is a hash key.
		internal List <EffectTechnique> _techniques = new List<EffectTechnique> ();
        //Dictionary<string, EffectTechnique> _techniques = new Dictionary<string, EffectTechnique>();

        public EffectTechnique this[int index]
        {
            get { return _techniques [index]; }
            set { _techniques [index] = value; }
        }

        public EffectTechnique this[string name]
        {
            get {
				foreach (EffectTechnique technique in _techniques) {
					if (technique.Name == name)
						return technique;
				}
				return null;
		}
            set {

				var technique = this[name];
				if (technique != null)
					technique = value;
				else
					_techniques.Add(value);
			}
        }

        public IEnumerator<EffectTechnique> GetEnumerator()
        {
            return _techniques.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _techniques.GetEnumerator();
        }
    }
}