public void Remove(string path) { for (int i = 0; i < this.Files.Count; i++) { Md5Resource item = this.Files[i]; if (item.Path == path) { this.Files.Remove(item); } } }
/// <summary> /// Removes the MD5 resource associated with the Path given /// </summary> /// <param name="path"></param> public void Remove(String path) { // Loop through all MD5s and remove any that match the path for (int i = 0; i < Files.Count; i++) { Md5Resource file = Files[i]; if (file.Path == path) { Files.Remove(file); Debug.WriteLine(new LogMessage("Remove", "Removing stale MD5 from the CacheManager"), LogType.Info.ToString()); } } }
public void Add(string path, string md5) { foreach (Md5Resource resource in this.Files) { if (resource.Path == path) { return; } } Md5Resource item = new Md5Resource { Path = path, MD5 = md5, CacheDate = DateTime.Now }; this.Files.Add(item); }
/// <summary> /// Adds a MD5 to the CacheManager /// </summary> /// <param name="path"></param> /// <param name="md5"></param> public void Add(String path, String md5) { // First check to see if this path is in the collection foreach (Md5Resource file in Files) { if (file.Path == path) { return; } } // We need to generate the MD5 and store it for later Md5Resource md5Resource = new Md5Resource(); md5Resource.Path = path; md5Resource.MD5 = md5; md5Resource.CacheDate = DateTime.Now; // Add the resource to the collection Files.Add(md5Resource); System.Diagnostics.Debug.WriteLine(new LogMessage("Add", "Adding new MD5 to CacheManager"), LogType.Info.ToString()); }
/// <summary> /// Adds a MD5 to the CacheManager /// </summary> /// <param name="path"></param> /// <param name="md5"></param> public void Add(String path, String md5) { // First check to see if this path is in the collection foreach (Md5Resource file in Files) { if (file.Path == path) return; } // We need to generate the MD5 and store it for later Md5Resource md5Resource = new Md5Resource(); md5Resource.Path = path; md5Resource.MD5 = md5; md5Resource.CacheDate = DateTime.Now; // Add the resource to the collection Files.Add(md5Resource); System.Diagnostics.Debug.WriteLine(new LogMessage("Add", "Adding new MD5 to CacheManager"), LogType.Info.ToString()); }