Exemplo n.º 1
0
        bool CheckIfSupported(cleaner c)
        {
            bool ret;

            // quickly check if this cleaner is for windows
            ret = (c.os == "windows" || c.os == null);

            // if os is null, then check for possible windowy actions
            if (c.os == null)
            {
                foreach (option o in c.option)
                {
                    ret = o.action.Count == 0 ? false : true;
                }
            }

            return(ret);
        }
Exemplo n.º 2
0
        // since we convert linuxy paths to empty strings, we need to remove them in action lists.
        cleaner CleanUp(cleaner c)
        {
            cleaner       ret = c;
            List <action> actions_to_remove = new List <action>();

            foreach (option o in c.option)
            {
                foreach (action a in o.action)
                {
                    if (a.path == string.Empty)
                    {
                        actions_to_remove.Add(a);
                    }
                }

                foreach (action a in actions_to_remove)
                {
                    o.action.Remove(a);
                }
            }

            return(ret);
        }
        void AddSystemCleaner(bool select = false)
        {
            cleaner c = new cleaner()
            {
                id = "system",
                type = "Windows Temp and Cache",
                label = "Microsoft Windows System",
                description = "General Windows system cleaners",
                option = new List<option>()
            };

            TreeNode root = new TreeNode();
            root = new TreeNode(c.label, c.id);
            root.IsAccordionHeader = true;
            root.IsExpanded = true;
            root.Tag = c;
            root.Cleaner = c;
            root.TreeNodeChecked += TeeNode_TreeNodeChecked;
            root.TreeNodeSelected += TreeNode_TreeNodeSelected;
            root.Children = new List<TreeNode>();

            c.option.Add(MicrosoftWindows.AddClipboardCleaner());

            c.option.Add(MicrosoftWindows.AddWindowsLogsCleaner());
            c.option.Add(MicrosoftWindows.AddMemoryDumpCleaner());
            c.option.Add(MicrosoftWindows.AddMUICacheCleaner());
            c.option.Add(MicrosoftWindows.AddPrefetchCleaner());
            c.option.Add(MicrosoftWindows.AddRecycleBinCleaner());
            c.option.Add(MicrosoftWindows.AddTemporaryFilesCleaner());
            c.option.Add(MicrosoftWindows.AddUpdateUninstallersCleaner());

            foreach (option o in c.option)
            {
                o.parent_cleaner = c;

                TreeNode child = new TreeNode(o.label, o.id);
                child.Tag = o;
                child.TreeNodeChecked += TeeNode_TreeNodeChecked;
                child.TreeNodeSelected += TreeNode_TreeNodeSelected;
                child.Initialize();

                root.Children.Add(child);

                foreach (action a in o.action)
                {
                    a.parent_option = o;
                }
            }

            root.Initialize();
            root.IsInitiallySelected = select;
            this._nodes.Add(root);
        }
        public FlowDocument BuildCleanerDetails(cleaner c)
        {
            FlowDocument doc = new FlowDocument();

            Paragraph p = new Paragraph();

            // header
            Run label = new Run();
            label.Text = c.label;
            label.FontSize = 20;
            Bold label_bold = new Bold(label);
            p.Inlines.Add(label_bold);
            p.Inlines.Add(new LineBreak());

            // cleaner description
            p.Inlines.Add(new Run(c.description));
            p.Inlines.Add(new LineBreak());
            p.Inlines.Add(new LineBreak());
            p.Inlines.Add(new LineBreak());

            // cleaner options
            foreach (option o in c.option)
            {
                label = new Run();
                label.Text = o.label + ": ";
                //label.FontSize = 20;
                label_bold = new Bold(label);
                p.Inlines.Add(label_bold);
                p.Inlines.Add(new Run(o.description));
                p.Inlines.Add(new LineBreak());
                // insert actions?
                p.Inlines.Add(string.Format("There {0} {1} actions in this option.", o.action.Count == 1 ? "is" : "are", o.action.Count));
                //foreach (action a in o.action)
                //{

                //}
                p.Inlines.Add(new LineBreak());
                p.Inlines.Add(new LineBreak());
            }

            doc.Blocks.Add(p);

            return doc;
        }
        bool CheckIfSupported(cleaner c)
        {
            bool res = false;

            // just clear TTD and do not reset vars as other controls
            // in window will trigger.
            Worker.I.ClearTTD(false);

            foreach (option o in c.option)
            {
                o.parent_cleaner = c;

                foreach (action a in o.action)
                {
                    a.parent_option = o;
                }

                EnqueueOption(o);

                // do we have a new entry in TTD?
                int total_queued_work = Worker.I.TTD.Count;

                if (total_queued_work > 0)
                {
                    res = true;
                }
            }

            return res;
        }
Exemplo n.º 6
0
        // since we convert linuxy paths to empty strings, we need to remove them in action lists.
        cleaner CleanUp(cleaner c)
        {
            cleaner ret = c;
            List<action> actions_to_remove = new List<action>();

            foreach (option o in c.option)
            {
                foreach (action a in o.action)
                {
                    if (a.path == string.Empty) actions_to_remove.Add(a);
                }

                foreach (action a in actions_to_remove)
                {
                    o.action.Remove(a);
                }
            }

            return ret;
        }
Exemplo n.º 7
0
        bool CheckIfSupported(cleaner c)
        {
            bool ret;

            // quickly check if this cleaner is for windows
            ret = (c.os == "windows" || c.os == null);

            // if os is null, then check for possible windowy actions
            if (c.os == null)
            {
                foreach (option o in c.option)
                {
                    ret = o.action.Count == 0 ? false : true;
                }
            }

            return ret;
        }
Exemplo n.º 8
0
        public FlowDocument BuildCleanerDetails(cleaner c)
        {
            FlowDocument doc = new FlowDocument();

            Paragraph p = new Paragraph();

            // header
            Run label = new Run();
            label.Text = c.label;
            label.FontSize = 20;
            Bold label_bold = new Bold(label);
            p.Inlines.Add(label_bold);
            p.Inlines.Add(new LineBreak());

            // cleaner description
            p.Inlines.Add(new Run(c.description));
            p.Inlines.Add(new LineBreak());
            p.Inlines.Add(new LineBreak());
            p.Inlines.Add(new LineBreak());

            // cleaner options
            foreach (option o in c.option)
            {
                label = new Run();
                label.Text = o.label + ": ";
                //label.FontSize = 20;
                label_bold = new Bold(label);
                p.Inlines.Add(label_bold);
                p.Inlines.Add(new Run(o.description));
                p.Inlines.Add(new LineBreak());
                p.Inlines.Add(new LineBreak());
            }

            doc.Blocks.Add(p);

            return doc;
        }
Exemplo n.º 9
0
        void AddDuplicateCleaner(bool select = false)
        {
            cleaner c = new cleaner()
            {
                id = "duplicate_checker",
                label = "Duplicate Checker",
                description = "Checks for duplicate in your file system",
                option = new List<option>()
            };

            TreeNode root = new TreeNode();
            root = new TreeNode(c.label, c.id);
            root.IsAccordionHeader = true;
            root.IsExpanded = true;
            root.Tag = c;
            root.TreeNodeChecked += TeeNode_TreeNodeChecked;
            root.TreeNodeSelected += TreeNode_TreeNodeSelected;
            root.Children = new List<TreeNode>();

            // add subtree
            c.option.AddRange(AddDuplicateCheckerCleaner());

            foreach (option o in c.option)
            {
                o.parent_cleaner = c;

                TreeNode child = new TreeNode(o.label, o.id);
                child.Tag = o;
                child.TreeNodeChecked += TeeNode_TreeNodeChecked;
                child.TreeNodeSelected += TreeNode_TreeNodeSelected;
                child.Initialize();

                root.Children.Add(child);

                foreach (action a in o.action)
                {
                    a.parent_option = o;
                }
            }

            root.Initialize();
            root.IsInitiallySelected = select;
            this._nodes.Add(root);
        }