예제 #1
0
        public void SetOptions(Options o)
        {
            DialogResult = DialogResult.Cancel;
            this.Rules = o.proper;
            defaultFilterList1.SetRules(Rules);
            FilterO = new List<FilterObject>();
            FilterObject defFiltOb;
            defFiltOb = new FilterObject();
            defFiltOb.discription = "Choose files and folders to NOT track";
            defFiltOb.Custom = true;
            defFiltOb.filter = "";
             //   defFiltOb.mode = FilterObject.FilterObjectMode.CHOOSE;
            defFiltOb.use = false;
            defFiltOb.AddToCa(this);
             //   FilterO.Add(defFiltOb);
            foreach (string listIt in o.filterList)
            {
                defFiltOb = new FilterObject();
                defFiltOb.filter = listIt;
                defFiltOb.use = true;
                defFiltOb.mode = FilterObject.FilterObjectMode.KEEP;
                FilterO.Add(defFiltOb);

            }
            if (monitor != null && FilterString != null)
            {
                customFilterList1.SetMonitor(monitor,FilterString);
            }
            customFilterList1.SetCus(FilterO);
        }
        public SelectFilterFromMonitorGroup(Options o, List<string> monitor)
        {
            InitializeComponent();
            m_options = o;
            this.FilterString = o.filterList;
            this.ResizeRedraw = true;
            this.splitContainer1.Panel1.Resize += new EventHandler(Panel1_Resize);
            cusfil = new CustomFilterList();
            FilterObject defFiltOb;
            FilterO = new List<FilterObject>();
            UserAddFilter = new List<FilterObject>();
            MgprF = new FolderTrack.Types.MGProperties();

            foreach (string listIt in FilterString)
            {
                defFiltOb = new FilterObject();
                defFiltOb.mgpro = null;
                defFiltOb.filter = listIt;
                defFiltOb.use = true;
                defFiltOb.mode = FilterObject.FilterObjectMode.KEEP;
                defFiltOb.AddToCa(this);
                FilterO.Add(defFiltOb);
                UserAddFilter.Add(defFiltOb);

            }
            foreach (GuiInfoMGProperties mgpro in o.proper)
            {
                defFiltOb = new FilterObject();
                defFiltOb.mgpro = mgpro;

                defFiltOb.filter = mgpro.description;
                defFiltOb.discription = mgpro.title;
                defFiltOb.use = mgpro.active;
                defFiltOb.mode = FilterObject.FilterObjectMode.PROFILT;
                defFiltOb.AddToCa(this);
                FilterO.Add(defFiltOb);
            }

            cusfil.SetCus(FilterO);
            cusfil.Dock = DockStyle.Fill;

            this.splitContainer1.Panel1.Controls.Add(cusfil);
            TreeNodeFromString = new Dictionary<string, TreeNode>();
            filt = new Filter();
            filt.AddFilter(FilterString);
            PopulateTree(monitor);
        }
예제 #3
0
        public void FillFilterPanelList(FolderUnit path,List<string> CurList,List<string> FilterSt)
        {
            List<string> CpyFil = new List<string>();
            if (FilterSt != null)
            {
                CpyFil.AddRange(FilterSt);
            }
            string filPath = path.externalLocation;
            if (path.type == Delimiter.FOLDER)
            {
                if (filPath.EndsWith(Convert.ToString(Path.DirectorySeparatorChar)) == false)
                {
                    filPath = filPath + Path.DirectorySeparatorChar;
                }
            }

            FilterObject fil = new FilterObject();

            fil.filter = filPath;
            fil.Custom = false;
            if (CurList.Contains(fil.filter))
            {
                fil.discription = "Exact Path (already in use)";
                fil.mode = FilterObject.FilterObjectMode.KEEP;
                fil.use = true;
            }
            else
            {
                fil.discription = "Exact Path";
                fil.mode = FilterObject.FilterObjectMode.SELECT;
                fil.use = false;
            }
            CpyFil.Remove(fil.filter);
            FilterObList.Add(fil);

            fil = new FilterObject();
            string filSla = filPath;
            if(filSla.EndsWith(Convert.ToString(Path.DirectorySeparatorChar)))
            {
                filSla = filSla.Substring(0, filSla.Length - 2);
            }

            fil.filter = ZlpPathHelper.GetDirectoryNameFromFilePath(filSla);
            if (fil.filter.EndsWith(Convert.ToString(Path.DirectorySeparatorChar)) == false)
            {
                fil.filter = fil.filter + Path.DirectorySeparatorChar;
            }
            fil.Custom = false;
            if (CurList.Contains(fil.filter))
            {
                fil.discription = "Parent Folder (already in use)";
                fil.mode = FilterObject.FilterObjectMode.KEEP;
                fil.use = true;
            }
            else
            {
                fil.discription = "Parent Folder";
                fil.mode = FilterObject.FilterObjectMode.SELECT;
                fil.use = false;
            }
            CpyFil.Remove(fil.filter);
            FilterObList.Add(fil);

            if (path.type == Delimiter.FILE && ZlpPathHelper.GetExtension(filPath).Length > 0)
            {
                string extention = "*" + ZlpPathHelper.GetExtension(filPath);
                if (extention != null && extention.Length > 0)
                {
                    fil = new FilterObject();
                    fil.filter = extention;
                    fil.Custom = false;
                    if (CurList.Contains(fil.filter))
                    {
                        fil.discription = "Extention (already in use)";
                        fil.mode = FilterObject.FilterObjectMode.KEEP;
                        fil.use = true;
                    }
                    else
                    {
                        fil.discription = "Extention";
                        fil.mode = FilterObject.FilterObjectMode.SELECT;
                        fil.use = false;
                    }
                    CpyFil.Remove(fil.filter);
                    FilterObList.Add(fil);
                }
            }

            string customPa = ZlpPathHelper.GetFileNameFromFilePath(filPath);
            if (customPa.Length == 0)
            {
                customPa = filPath.Substring(0, filPath.Length - 1);
                customPa = Path.DirectorySeparatorChar +
                           ZlpPathHelper.GetFileNameFromFilePath(customPa) +
                           Path.DirectorySeparatorChar;
            }

            fil = new FilterObject();
            fil.filter = "*" + customPa + "*";

            if (CurList.Contains(fil.filter))
            {
                fil.discription = "Custom (already in use)";
                fil.Custom = false;
                fil.mode = FilterObject.FilterObjectMode.KEEP;
                fil.use = true;
                CpyFil.Remove(fil.filter);
                FilterObList.Add(fil);

                fil = new FilterObject();
                fil.discription = "Custom";
                fil.Custom = true;
                fil.filter = "";
                fil.mode = FilterObject.FilterObjectMode.SELECT;
                fil.use = false;
                FilterObList.Add(fil);

            }
            else
            {
                fil.discription = "Custom";
                fil.Custom = true;
                fil.mode = FilterObject.FilterObjectMode.SELECT;
                fil.use = false;
                CpyFil.Remove(fil.filter);
                FilterObList.Add(fil);
            }
            foreach (string filt in CpyFil)
            {
                fil = new FilterObject();
                fil.filter = filt;
                if (CurList.Contains(filt))
                {
                    fil.discription = "Curently filtering " + filPath + " (already in use)";
                    fil.mode = FilterObject.FilterObjectMode.KEEP;
                    fil.use = true;

                }
                else
                {
                    fil.discription = "Use to filter " + filPath + " (not in use)";
                    fil.mode = FilterObject.FilterObjectMode.SELECT;
                    fil.use = false;
                }
                fil.Custom = false;

                FilterObList.Insert(0,fil);
            }

            FilterPanelList.AddData(FilterObList);
        }
예제 #4
0
        public FolderRow(FilterObject fi)
        {
            init = false;
            InitializeComponent();
            this.fi = fi;
            CustText = new TextBox();
            CustButton = new Button();
            FiltLab = new Label();
            if (this.fi.mode == FilterObject.FilterObjectMode.KEEP)
            {
                this.KeepButton = new System.Windows.Forms.Button();
                this.KeepButton.AutoSize = true;
                this.KeepButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                this.KeepButton.BackColor = System.Drawing.Color.Gainsboro;
                this.KeepButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
                this.KeepButton.Location = new System.Drawing.Point(1, 13);
                this.KeepButton.Name = "KeepButton";
                this.KeepButton.Size = new System.Drawing.Size(42, 23);
                this.KeepButton.TabIndex = 4;
                this.KeepButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.KeepButton.BackColor = Color.Transparent;
                this.KeepButton.UseVisualStyleBackColor = false;
                this.KeepButton.Click += new System.EventHandler(this.KeepButton_Click);
                this.panel2.Controls.Add(this.KeepButton);
            }
            else if (this.fi.mode == FilterObject.FilterObjectMode.SELECT)
            {
                this.ApplyCheckBox = new System.Windows.Forms.CheckBox();
                this.ApplyCheckBox.AutoSize = true;
                this.ApplyCheckBox.Location = new System.Drawing.Point(1, 13);
                this.ApplyCheckBox.Name = "ApplyCheckBox";
                this.ApplyCheckBox.Size = new System.Drawing.Size(52, 17);
                this.ApplyCheckBox.TabIndex = 4;
                this.ApplyCheckBox.Font = Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.ApplyCheckBox.BackColor = Color.Transparent;
                this.ApplyCheckBox.Text = "Apply";
                this.ApplyCheckBox.UseVisualStyleBackColor = true;
                this.ApplyCheckBox.CheckedChanged += new System.EventHandler(this.ApplyCheckBox_CheckedChanged);
                this.panel2.Controls.Add(this.ApplyCheckBox);
            }
            else if (this.fi.mode == FilterObject.FilterObjectMode.PROFILT)
            {
                this.PROButton = new System.Windows.Forms.Button();
                this.PROButton.AutoSize = true;
                this.PROButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                this.PROButton.BackColor = System.Drawing.Color.Gainsboro;
                this.PROButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
                this.PROButton.Location = new System.Drawing.Point(1, 13);
                this.PROButton.Name = "PROButton";
                this.PROButton.Size = new System.Drawing.Size(42, 23);
                this.PROButton.TabIndex = 4;
                this.PROButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.PROButton.BackColor = Color.Transparent;
                this.PROButton.UseVisualStyleBackColor = false;
                this.PROButton.Click += new EventHandler(PROButton_Click);
                this.panel2.Controls.Add(this.PROButton);
            }

            SetUpFilterObject();
            init = true;
        }
        public void HandleFilDoubleClick(object patO)
        {
            string pat = (string) patO;
            FolderUnit fole = new FolderUnit();
            fole.externalLocation = pat;
            if (ZlpIOHelper.DirectoryExists(pat))
            {
                fole.externalLocation += Path.DirectorySeparatorChar;
                fole.type = Delimiter.FOLDER;
            }
            else
            {
                fole.type = Delimiter.FILE;
            }
            FilterFileForm fiFor = new FilterFileForm(fole, FilterString, null, null);
            fiFor.ShowDialog();
            if (fiFor.DialogResult == DialogResult.OK)
            {
               FilterChangeOb list= fiFor.GetLists();
               foreach (string addl in list.addFilfer)
               {
                   filt.AddFilter(addl);
               }

               foreach (string remol in list.removeFilter)
               {
                   filt.RemoveFilter(remol);
               }

                FilterObject defFiltOb;
                List<FilterObject> Addit = new List<FilterObject>();
                foreach (string listIt in list.addFilfer)
                {
                    if (FilterString.Contains(listIt) == false)
                    {
                        defFiltOb = new FilterObject();
                        defFiltOb.filter = listIt;
                        defFiltOb.use = true;
                        defFiltOb.mode = FilterObject.FilterObjectMode.KEEP;
                        defFiltOb.AddToCa(this);
                        //Note needed because cusfil.AddFil(Addit);
                        // will do FilterO.Add(defFiltOb);
                        Addit.Add(defFiltOb);
                        FilterString.Add(listIt);
                    }

                }

                cusfil.AddFil(Addit);
                UserAddFilter.AddRange(Addit);
            }
            try
            {
                this.MonGroTreeView.Invoke(new VoidNoArgDelegate(SetFilteredFiles));
            }
            catch (InvalidOperationException)
            {
                //throw away
            }
        }