コード例 #1
0
        private void MainWindow_OnClosed(object sender, EventArgs e)
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(GarbageCan));

            using (Stream stream = File.Open(GarbagecanXML, FileMode.Create))
            {
                xmlSerializer.Serialize(stream, m_GarbageCan);
            }
            EverythingWraper.KillEverything();
        }
コード例 #2
0
 private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
 {
     try
     {
         XmlSerializer xmlSerializer = new XmlSerializer(typeof(GarbageCan));
         using (Stream stream = File.Open(GarbagecanXML, FileMode.OpenOrCreate))
         {
             m_GarbageCan = (GarbageCan)xmlSerializer.Deserialize(stream);
         }
     }
     catch (Exception)
     {
         m_GarbageCan = new GarbageCan();
     }
     DataContext = m_GarbageCan;
     EverythingWraper.StartEverything();
 }
コード例 #3
0
        private List <Garbage> ScanByEverything(Filter filter)
        {
            List <Garbage> result = new List <Garbage>();

            EverythingWraper.Everything_SetRegex(true);
            EverythingWraper.Everything_SetSearch(filter.RegularExpression);

            EverythingWraper.Everything_Query(true);

            // sort by path
            EverythingWraper.Everything_SortResultsByPath();

            int           bufsize = 260;
            StringBuilder buf     = new StringBuilder(bufsize);

            // loop through the results, adding each result to the list box.
            int totalNumber = EverythingWraper.Everything_GetNumResults();

            for (int i = 0; i < totalNumber; i++)
            {
                if (EverythingWraper.Everything_IsFolderResult(i) && !filter.ContainDirectory)
                {
                    continue;
                }
                if (EverythingWraper.Everything_IsFileResult(i) && !filter.ContainFile)
                {
                    continue;
                }

                EverythingWraper.Everything_GetResultFullPathName(i, buf, bufsize);
                string path = buf.ToString();

                if (filter.ShouldSkip(path))
                {
                    continue;
                }

                Garbage garbage = new Garbage(path);
                result.Add(garbage);
            }
            return(result);
        }