Start Sascha C# Updater UpdateInfoCollection
Die UpdateInfoCollection Drucken
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Collections;
  5.  
  6. namespace S_MzH.Update
  7. {
  8. class UpdateInfoCollection : CollectionBase
  9. {
  10. [System.Runtime.CompilerServices.IndexerName("Item")]
  11. public UpdateInfo this[int index]
  12. {
  13. get { return (UpdateInfo)this.InnerList[index]; }
  14. }
  15.  
  16. /// <summary>
  17. /// Fügt ein UpdateInfo Element der Liste hinzu.
  18. /// </summary>
  19. /// <param name="sFileName">Dateiname der zu überprüfenden Datei</param>
  20. /// <param name="sServerPath">Der Pfad in dem sich die aktuelle Datei befindet</param>
  21. /// <param name="sLocalPath">Der Pfad in dem sich die zu aktualisierende Datei befindet</param>
  22. /// <returns></returns>
  23. public int Add(string sFileName, string sServerPath, string sLocalPath)
  24. {
  25. return this.InnerList.Add(new UpdateInfo(sFileName, sServerPath, sLocalPath));
  26. }
  27.  
  28. /// <summary>
  29. /// Prüft ob ein UpdateInfo Element in der Liste enthalten ist.
  30. /// </summary>
  31. /// <param name="ui"></param>
  32. /// <returns></returns>
  33. public bool Contains(UpdateInfo ui)
  34. {
  35. return this.InnerList.Contains(ui);
  36. }
  37.  
  38. /// <summary>
  39. /// Liefert den Indes des UpdateInfo Elements
  40. /// </summary>
  41. /// <param name="ui"></param>
  42. /// <returns></returns>
  43. public int IndexOf(UpdateInfo ui)
  44. {
  45. return this.InnerList.IndexOf(ui);
  46. }
  47.  
  48. /// <summary>
  49. /// Fügt ein UpdateInfo Element an der angegeben Stelle ein
  50. /// </summary>
  51. /// <param name="index"></param>
  52. /// <param name="ui"></param>
  53. public void Insert(int index, UpdateInfo ui)
  54. {
  55. this.InnerList.IndexOf(ui, index);
  56. }
  57.  
  58. /// <summary>
  59. /// Entfernt das UpdateInfo Element aus der Liste
  60. /// </summary>
  61. /// <param name="ui"></param>
  62. public void Remove(UpdateInfo ui)
  63. {
  64. this.InnerList.Remove(ui);
  65. }
  66.  
  67. public void Sort(IComparer comp)
  68. {
  69. this.InnerList.Sort(comp);
  70. }
  71.  
  72. public void Sort(int index, int count, IComparer comp)
  73. {
  74. this.InnerList.Sort(index, count, comp);
  75. }
  76.  
  77. /// <summary>
  78. /// Liefert ein UpdateInfo Array
  79. /// </summary>
  80. /// <returns></returns>
  81. public UpdateInfo[] ToUpdateInfoArray()
  82. {
  83. if (this.InnerList.Count > 0)
  84. {
  85. UpdateInfo[] ui = new UpdateInfo[this.InnerList.Count];
  86. for (int i = 0; i < this.InnerList.Count; i++)
  87. ui[i] = (UpdateInfo)this.InnerList[i];
  88. return ui;
  89. }
  90. return null;
  91. }
  92.  
  93. /// <summary>
  94. /// Liefert ein object Array zurück
  95. /// </summary>
  96. /// <returns></returns>
  97. public object[] ToArray()
  98. {
  99. return this.InnerList.ToArray();
  100. }
  101.  
  102. public UpdateInfoCollection()
  103. { }
  104.  
  105. public UpdateInfoCollection(UpdateInfo[] ui)
  106. {
  107. this.InnerList.AddRange(ui);
  108. }
  109.  
  110. }
  111. }
  112.