diff --git a/source/Cosmos.System2/Network/ARP/ARPCache.cs b/source/Cosmos.System2/Network/ARP/ARPCache.cs index 02219c7c5..b963d1c25 100644 --- a/source/Cosmos.System2/Network/ARP/ARPCache.cs +++ b/source/Cosmos.System2/Network/ARP/ARPCache.cs @@ -6,6 +6,7 @@ */ using System; +using System.Collections.Generic; using Cosmos.HAL.Network; namespace Cosmos.System.Network.ARP @@ -18,7 +19,7 @@ namespace Cosmos.System.Network.ARP /// /// Cache. /// - private static TempDictionary cache; + private static Dictionary cache; /// /// Ensure cache exists. @@ -28,7 +29,7 @@ namespace Cosmos.System.Network.ARP { if (cache == null) { - cache = new TempDictionary(); + cache = new Dictionary(); } } diff --git a/source/Cosmos.System2/Network/IPV4/ICMPClient.cs b/source/Cosmos.System2/Network/IPV4/ICMPClient.cs index 6e7171b15..cee7a74ea 100644 --- a/source/Cosmos.System2/Network/IPV4/ICMPClient.cs +++ b/source/Cosmos.System2/Network/IPV4/ICMPClient.cs @@ -21,7 +21,7 @@ namespace Cosmos.System.Network.IPv4 /// /// Clients dictionary. /// - private static TempDictionary clients; + private static Dictionary clients; /// /// Destination address. @@ -39,7 +39,7 @@ namespace Cosmos.System.Network.IPv4 /// Thrown on fatal error (contact support). static ICMPClient() { - clients = new TempDictionary(); + clients = new Dictionary(); } /// diff --git a/source/Cosmos.System2/Network/IPv4/UDP/UdpClient.cs b/source/Cosmos.System2/Network/IPv4/UDP/UdpClient.cs index 8faa8167f..25eb5b1a4 100644 --- a/source/Cosmos.System2/Network/IPv4/UDP/UdpClient.cs +++ b/source/Cosmos.System2/Network/IPv4/UDP/UdpClient.cs @@ -20,7 +20,7 @@ namespace Cosmos.System.Network.IPv4.UDP /// /// Clients dictionary. /// - private static TempDictionary clients; + private static Dictionary clients; /// /// Local port. @@ -46,7 +46,7 @@ namespace Cosmos.System.Network.IPv4.UDP /// Thrown on fatal error (contact support). static UdpClient() { - clients = new TempDictionary(); + clients = new Dictionary(); } /// diff --git a/source/Cosmos.System2/Network/NetworkStack.cs b/source/Cosmos.System2/Network/NetworkStack.cs index 6b45c266c..5ba6da6ef 100644 --- a/source/Cosmos.System2/Network/NetworkStack.cs +++ b/source/Cosmos.System2/Network/NetworkStack.cs @@ -31,11 +31,11 @@ namespace Cosmos.System.Network /// /// Get address dictionary. /// - internal static TempDictionary AddressMap { get; private set; } + internal static Dictionary AddressMap { get; private set; } /// /// Get address dictionary. /// - internal static TempDictionary MACMap { get; private set; } + internal static Dictionary MACMap { get; private set; } /// /// Initialize the Network Stack to prepare it for operation. @@ -43,8 +43,8 @@ namespace Cosmos.System.Network /// Thrown on fatal error (contact support). public static void Init() { - AddressMap = new TempDictionary(); - MACMap = new TempDictionary(); + AddressMap = new Dictionary(); + MACMap = new Dictionary(); } /// diff --git a/source/Cosmos.System2/Network/TempDictionary.cs b/source/Cosmos.System2/Network/TempDictionary.cs deleted file mode 100644 index 72c071564..000000000 --- a/source/Cosmos.System2/Network/TempDictionary.cs +++ /dev/null @@ -1,177 +0,0 @@ -/* -* PROJECT: Aura Operating System Development -* CONTENT: An other dictionnary class -* PROGRAMMERS: Valentin Charbonnier -* Port of Cosmos Code. -*/ - -using System; -using System.Collections.Generic; - -namespace Cosmos.System.Network -{ - /// - /// TempDictionary template class. - /// - /// TempDictionary type name. - internal class TempDictionary - { - private List mKeys; - private List mValues; - - /// - /// Get the number of elements in the list. - /// - public int Count { get; private set; } - - /// - /// Create new inctanse of the class. - /// - /// Thrown on fatal error (contact support). - public TempDictionary() - : this(2) - { } - - /// - /// Create new inctanse of the class, with a specified initial size. - /// - /// Initial size. - /// Thrown if initialSize is less than 0. - public TempDictionary(int initialSize) - { - this.mKeys = new List(initialSize); - this.mValues = new List(initialSize); - } - - /// - /// Get TempDictionary{TValue} keys array. - /// - public TKey[] Keys - { - get - { - return this.mKeys.ToArray(); - } - } - - /// - /// Get TempDictionary{TValue} values array. - /// - public TValue[] Values - { - get - { - return this.mValues.ToArray(); - } - } - - /// - /// Get and set the element with the specified key. - /// - /// Key of an element. - /// TValue value. - /// (set) Thrown if no element with the specified key is found. - public TValue this[UInt32 key] - { - get - { - for (int i = 0; i < mKeys.Count; i++) - { - if (mKeys[i].Equals(key)) - { - return mValues[i]; - } - } - - return default(TValue); - } - set - { - for (int i = 0; i < mKeys.Count; i++) - { - if (mKeys[i].Equals(key)) - { - mValues[i] = value; - return; - } - } - - throw new ArgumentOutOfRangeException("key", "Key not found"); - } - } - - /// - /// Check if the key exists in the TempDictionary{TValue}. - /// - /// Key to check if exists. - /// bool value. - public bool ContainsKey(TKey key) - { - for (int i = 0; i < mKeys.Count; i++) - { - if (mKeys[i].Equals(key)) - { - return true; - } - } - - return false; - } - - /// - /// Adds an object at the end of the TempDictionary{TValue}. - /// - /// Object key. - /// Object value. - /// Thrown if key already exists. - public void Add(TKey key, TValue val) - { - if (ContainsKey(key) == true) - { - throw new ArgumentException("key", "Key already exists"); - } - - mKeys.Add(key); - mValues.Add(val); - } - - /// - /// Removes the element with the specified key of the TempDictionary{TValue}. - /// - /// Key of the item to remove. - /// Thrown on fatal error (contact support). - public void Remove(TKey key) - { - int idx = mKeys.IndexOf(key); - if (idx != -1) - { - this.Remove(idx); - } - } - - /// - /// Removes the element at the specified index of the TempDictionary{TValue}. - /// - /// Index of the item to remove. - /// Thrown if no such index exists in the TempDictionary. - public void Remove(int index) - { - if (index > mKeys.Count - 1) - { - throw new ArgumentOutOfRangeException("index", "No such index"); - } - - mKeys.RemoveAt(index); - mValues.RemoveAt(index); - } - - /// - /// Removes all elements from the TempDictionary{TValue}. - /// - public void Clear() - { - mKeys.Clear(); - mValues.Clear(); - } - } -}