Ejemplo n.º 1
0
        public void ResetItemRunCounter(RunItem exItem)
        {
            exItem.RunNrOfTimes = 0;
            if (exItem.Type == ItemType.File || exItem.Type == ItemType.Directory
                ) //Move it back to general list. Settings and other stuff will always be in the priolist.
            {
                MatcherPrio.Remove(exItem.Name.ToLower());
                MatcherGeneral.Insert(exItem.Name.ToLower(), exItem);
            }

            SaveTries();
        }
Ejemplo n.º 2
0
        public void RunIndexingOnSingleFolder(FolderSearch dir)
        {
            Task.Run(() =>
            {
                try
                {
                    if (IndexingIsRunning)
                    {
                        return;
                    }
                    IndexingIsRunning = true;

                    var unorderedFiles = new HashSet <RunItem>();
                    LastIndexed        = DateTime.Now;

                    var tempBag = new HashSet <RunItem>();
                    ProcessDirectory(dir, tempBag);
                    dir.NrOfFiles = tempBag.Count;
                    foreach (var item in tempBag)
                    {
                        unorderedFiles.Add(item);
                    }

                    RunItem[] tempList = unorderedFiles.ToArray();
                    tempList           = tempList.GroupBy(p => p.URI + p.Arguments + p.Command).Select(p => p.First()).ToArray();

                    for (int i = 0; i < tempList.Length; i++)
                    {
                        Progress = i / tempList.Length * 100;
                        MatcherGeneral.Insert(tempList[i].Name.ToLower(), tempList[i]);
                        //if (!string.IsNullOrEmpty(tempList[i].Group))
                        //    TempMatcher.Insert(tempList[i].Group.ToLower(), tempList[i]);
                    }

                    NrOfPaths = MatcherGeneral.DataDictionary.Count + MatcherPrio.DataDictionary.Count;
                    SaveTries();

                    IndexingIsRunning = false;
                }
                catch (Exception e)
                {
                    Log.Error(e, $"Could not search folder {dir.Path}");
                }
            });
        }