Beispiel #1
0
        static FileFilters makeDefaultFileFilters()
        {
            var ret = new FileFilters();

            ret.Add(makeFileFilter("*.sln"));
            return(ret);
        }
Beispiel #2
0
        void ReadFilters(out DirFilters dirFilters, out FileFilters fileFilters)
        {
            dirFilters  = makeDefaultDirFilters();
            fileFilters = makeDefaultFileFilters();
            try
            {
                var fname = Path.Combine(_rootPath, FiltersFilename);
                if (!File.Exists(fname))
                {
                    return;
                }

                var text = File.ReadAllText(fname);
                using (var json = JsonDocument.Parse(text))
                {
                    var         root = json.RootElement;
                    JsonElement dirs;
                    if (root.TryGetProperty("dirs", out dirs))
                    {
                        var edirs = dirs.EnumerateArray();
                        dirFilters = new DirFilters();
                        foreach (var d in edirs)
                        {
                            dirFilters.Add(d.GetString());
                        }
                    }
                    JsonElement files;
                    if (root.TryGetProperty("files", out files))
                    {
                        var efiles = files.EnumerateArray();
                        fileFilters = new FileFilters();
                        foreach (var f in efiles)
                        {
                            fileFilters.Add(makeFileFilter(f.GetString()));
                        }
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #3
0
 public void AddNewFileFilterEvent(object sender, EventArgs e)
 {
     FileFilters.Add(new FilterItem(NewFileFilter));
     NewFileFilter = null;
 }