Example #1
0
 public bool RemoveList(string key)
 {
     if (!string.IsNullOrEmpty(key) && !string.IsNullOrWhiteSpace(key) &&
         ContentList != null && ContentList.ContainsKey(key))
     {
         ContentList.Remove(key);
         OnPropertyChanged();
         return(true);
     }
     return(false);
 }
 private void RemoveContentFromContentLists(string contentName)
 {
     for (int index = 0; index < DisplayContentList.Count; index++)
     {
         var content = DisplayContentList[index];
         if (content.Name == contentName)
         {
             DisplayContentList.Remove(content);
             ContentList.Remove(content);
         }
     }
 }
Example #3
0
        public void TestMethod1()
        {
            string assemblyPath = Assembly.GetExecutingAssembly().Location;
            string workDirPath  = Path.GetDirectoryName(assemblyPath);
            string dbPath       = Path.Combine(workDirPath, "testdb.sqlite");
            var    contentList  = new ContentList(dbPath);

            contentList.Clear();
            string testPath      = assemblyPath;
            var    testTimestamp = File.GetLastWriteTime(testPath).ToUnixTimestamp();

            contentList.Add(testPath, testTimestamp, removed: false);
            Assert.IsTrue(contentList.ContainsKey(testPath));
            Assert.AreEqual(1, contentList.Count);
            Assert.AreEqual(contentList.Keys.First(), testPath);
            Assert.IsTrue(contentList.TryGetValue(testPath, out int storedTimestamp, out bool removed));
            Assert.AreEqual(testTimestamp, storedTimestamp);
            contentList.Remove(testPath);
            Assert.AreEqual(0, contentList.Count);
            contentList.Dispose();
            File.Delete(dbPath);
        }
Example #4
0
 public void Remove(string content)
 {
     ContentList.Remove(content);
 }