Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 2.86 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Fix FxCop Rule: Enumerations should be strongly typed
  2. namespace EPGObjectModel.IDE
  3. {
  4.     using System;
  5.     using System.Collections;
  6.     using System.Collections.Generic;
  7.     using System.Text;
  8.  
  9.     public class StringResourceCollection : CollectionBase, IEnumerator
  10.     {
  11.         #region Fields
  12.  
  13.         private int index = -1;
  14.  
  15.         #endregion Fields
  16.  
  17.         #region Properties
  18.  
  19.         public object Current
  20.         {
  21.             get { return this.List[index]; }
  22.         }
  23.  
  24.         #endregion Properties
  25.  
  26.         #region Indexers
  27.  
  28.         public EPGString this[string index]
  29.         {
  30.             get
  31.             {
  32.                 Reset();
  33.                 while (this.MoveNext())
  34.                 {
  35.                     if (((EPGString)Current).StringId == index || ((EPGString)Current).StringName.Equals(index))
  36.                         return (EPGString)Current;
  37.                 }
  38.                 return null;
  39.             }
  40.         }
  41.  
  42.         #endregion Indexers
  43.  
  44.         #region Methods
  45.  
  46.         public int Add(EPGString item)
  47.         {
  48.             try
  49.             {
  50.                 return List.Add(item);
  51.             }
  52.             catch(Exception)
  53.                 {
  54.                     throw;
  55.                 }
  56.         }
  57.  
  58.         public void Modify(string id, EPGString resourceToModify)
  59.         {
  60.             EPGString stringRes = this[id];
  61.             stringRes.DeletePermission = resourceToModify.DeletePermission;
  62.             stringRes.ModifyPermission = resourceToModify.ModifyPermission;
  63.             stringRes.StringInputLanguage = resourceToModify.StringInputLanguage;
  64.             stringRes.StringLanguage = resourceToModify.StringLanguage;
  65.             stringRes.StringName = resourceToModify.StringName;
  66.             stringRes.StringText = resourceToModify.StringText;
  67.         }
  68.  
  69.         public void Modify(EPGString resourceToModify)
  70.         {
  71.             EPGString stringRes = this[resourceToModify.StringName];
  72.             if (stringRes == null)
  73.                 return;
  74.             stringRes.DeletePermission = resourceToModify.DeletePermission;
  75.             stringRes.ModifyPermission = resourceToModify.ModifyPermission;
  76.             stringRes.StringInputLanguage = resourceToModify.StringInputLanguage;
  77.             stringRes.StringLanguage = resourceToModify.StringLanguage;
  78.             stringRes.StringName = resourceToModify.StringName;
  79.             stringRes.StringText = resourceToModify.StringText;
  80.         }
  81.  
  82.         public bool MoveNext()
  83.         {
  84.             this.index++;
  85.             return (this.index < this.List.Count);
  86.         }
  87.  
  88.         public void Remove(EPGString item)
  89.         {
  90.             try
  91.             {
  92.                 List.Remove(item);
  93.             }
  94.             catch (ArgumentException)
  95.             {
  96.                 throw;
  97.             }
  98.         }
  99.  
  100.         public void Reset()
  101.         {
  102.             index = -1;
  103.         }
  104.  
  105.         #endregion Methods
  106.     }
  107. }
  108.        
  109. IEnumerator<string>