AcUtils
A high performance abstraction layer for AccuRev
StreamsCollection.cs
Go to the documentation of this file.
1 
16 using System;
17 using System.Configuration;
18 
19 namespace AcUtils
20 {
24 
47  [ConfigurationCollection(typeof(StreamElement),
48  CollectionType=ConfigurationElementCollectionType.AddRemoveClearMap)]
49  [Serializable]
50  public sealed class StreamsCollection : ConfigurationElementCollection
51  {
52  private static ConfigurationPropertyCollection _properties;
53  static StreamsCollection()
54  {
55  _properties = new ConfigurationPropertyCollection();
56  }
57 
58  public StreamsCollection() { }
59 
60  protected override ConfigurationPropertyCollection Properties
61  {
62  get { return _properties; }
63  }
64 
65  public override ConfigurationElementCollectionType CollectionType
66  {
67  get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
68  }
69 
70  public StreamElement this[int index]
71  {
72  get { return (StreamElement)base.BaseGet(index); }
73  set
74  {
75  if (base.BaseGet(index) != null)
76  {
77  base.BaseRemoveAt(index);
78  }
79  base.BaseAdd(index, value);
80  }
81  }
82 
83  new public StreamElement this[string key]
84  {
85  get { return (StreamElement)BaseGet(key); }
86  }
87 
88  protected override ConfigurationElement CreateNewElement()
89  {
90  return new StreamElement();
91  }
92 
93  protected override object GetElementKey(ConfigurationElement element)
94  {
95  return (element as StreamElement).Stream;
96  }
97  }
98 }
An AccuRev stream from the Streams section in .exe.config.
The list of AccuRev streams from .exe.config.