Example #1
0
        private IEnumerable<string> getAllTags()
        {
            List<string> tags;
            using (FileDataModelContainer db = new FileDataModelContainer()) {
                var query = from c in db.TagTable
                            select c.tag;
                //tags = query.ToList<string>();
                tags = query.Distinct().ToList<string>();
                //foreach (TagTable tag in query) {
                //    Console.WriteLine("query = " + tag.tag);
                //}
            }

            return tags;
        }
Example #2
0
        private IEnumerable <string> getAllTags()
        {
            List <string> tags;

            using (FileDataModelContainer db = new FileDataModelContainer()) {
                var query = from c in db.TagTable
                            select c.tag;
                //tags = query.ToList<string>();
                tags = query.Distinct().ToList <string>();
                //foreach (TagTable tag in query) {
                //    Console.WriteLine("query = " + tag.tag);
                //}
            }

            return(tags);
        }
Example #3
0
        private IEnumerable <string> insertTags(IEnumerable <string> tags)
        {
            IEnumerable <string> newtags = null;

            using (FileDataModelContainer db = new FileDataModelContainer()) {
                var query = from c in db.TagTable
                            //where !tags.Contains(c.tag)
                            select c.tag;
                newtags = tags.Except(query).ToList();
                foreach (string t in newtags)
                {
                    TagTable tabtable = new TagTable();
                    tabtable.tag = t;
                    db.AddToTagTable(tabtable);
                }
                db.SaveChanges();
            }
            return(newtags);
        }
Example #4
0
        private void setDetailView()
        {
            var panel = ViewSplitContainer.Panel2;

            detailview = new DetailView();
            detailview.OnChagedName += (sender, args) =>
            {
                updataListviewItem(getActiveListView(), args.guid, args.key, args.data);

                using (FileDataModelContainer db = new FileDataModelContainer())
                {
                    var query = from c in db.FileTable
                                where c.guid == args.guid
                                select c;
                    foreach (FileTable ftable in query)
                    {
                        ftable.name = args.data;
                    }

                    db.SaveChanges();
                }
            };
            detailview.OnChagedComment += (sender, args) =>
            {
                updataListviewItem(getActiveListView(), args.guid, args.key, args.data);

                using (FileDataModelContainer db = new FileDataModelContainer())
                {
                    var query = from c in db.FileTable
                                where c.guid == args.guid
                                select c;
                    foreach (FileTable ftable in query)
                    {
                        ftable.comment = args.data;
                    }

                    db.SaveChanges();
                }
            };
            detailview.Dock = DockStyle.Fill;
            panel.Controls.Add(detailview);
        }
Example #5
0
        private void insertFileData(IEnumerable<string> fullpaths, List<string> tags)
        {
            using (FileDataModelContainer db = new FileDataModelContainer()) {

                foreach (string fullpath in fullpaths) {
                    string strguid = Win32.getObjectID(fullpath).ToString();
                    var query = from c in db.FileTable
                                where c.guid == strguid
                                select c;

                    if(query.Count() == 0){
                        FileInfo fileinfo = new FileInfo(fullpath);
                        //FileTable filetable = new FileTable(){
                        //    guid=strguid,
                        //    name=fileinfo.Name,
                        //    ext=fileinfo.Extension,
                        //    comment="",
                        //    createtime=fileinfo.CreationTime
                        //};

                        FileTable filetable = new FileTable();
                            filetable.guid = strguid;
                            filetable.name = fileinfo.Name;
                            filetable.size = fileinfo.Length;
                            filetable.ext = fileinfo.Extension;
                            filetable.comment = "";
                            filetable.creationtime = fileinfo.CreationTime;
                            filetable.lastwritetime = fileinfo.LastWriteTime;

                        db.AddToFileTable(filetable);
                        db.SaveChanges();

                        foreach (string tag in tags) {
                            filetable.TagTable.Add(new TagTable() { tag = tag, FileTable = filetable });
                        }
                        //var fquery = from c in db.FileTable
                        //            where c.guid == strguid
                        //            select c;

                        //foreach (FileTable f in fquery) {
                        //db.AttachTo(filetable.EntityKey.EntitySetName,
                       //     new FileTable() { filetableid = filetable.filetableid });
                       //     foreach (string tag in tags) {
                        //        db.AddToTagTable(new TagTable() { tag = tag, FileTable = filetable });
                        //    }

                        //}
                        //TagTable tagtable = new TagTable() { id = filetable.TagTable.id };
                        //db.AttachTo("FileTable", new FileTable() { filetableid = filetable.filetableid });
                        //foreach (string tag in tags) {
                        //    db.AddToTagTable(new TagTable() { tag = tag, FileTable = filetable });
                        //}

                    }else{
                        foreach (FileTable filetable in query) {

                            //var queryt = from c in db.TagTable
                            //             where c.FileTable.filetableid == filetable.filetableid
                            //             select c.tag;
                            foreach (string tag in tags) {
                                //Console.WriteLine("tag = " + tag);
                                filetable.TagTable.Add(new TagTable() { tag = tag, FileTable = filetable });
                            }
                            //db.AttachTo("FileTable", new FileTable() { filetableid = filetable.filetableid });
                            //foreach (string tag in tags) {
                            //    //db.AddToTagTable(new TagTable() { tag = tag, FileTable = filetable });
                            //    filetable.TagTable.Add(new TagTable() { tag = tag, FileTable = filetable });
                            //}
                        }
                    }
                }

                db.SaveChanges();
            }
        }
Example #6
0
        private IEnumerable<string> insertTags(IEnumerable<string> tags)
        {
            IEnumerable<string> newtags = null;
            using (FileDataModelContainer db = new FileDataModelContainer()) {

                var query = from c in db.TagTable
                            //where !tags.Contains(c.tag)
                            select c.tag;
                newtags = tags.Except(query).ToList();
                foreach(string t in newtags){
                    TagTable tabtable = new TagTable();
                    tabtable.tag = t;
                    db.AddToTagTable(tabtable);
               }
                db.SaveChanges();
            }
            return newtags;
        }
Example #7
0
        private void insertFileData(IEnumerable <string> fullpaths, List <string> tags)
        {
            using (FileDataModelContainer db = new FileDataModelContainer()) {
                foreach (string fullpath in fullpaths)
                {
                    string strguid = Win32.getObjectID(fullpath).ToString();
                    var    query   = from c in db.FileTable
                                     where c.guid == strguid
                                     select c;

                    if (query.Count() == 0)
                    {
                        FileInfo fileinfo = new FileInfo(fullpath);
                        //FileTable filetable = new FileTable(){
                        //    guid=strguid,
                        //    name=fileinfo.Name,
                        //    ext=fileinfo.Extension,
                        //    comment="",
                        //    createtime=fileinfo.CreationTime
                        //};

                        FileTable filetable = new FileTable();
                        filetable.guid          = strguid;
                        filetable.name          = fileinfo.Name;
                        filetable.size          = fileinfo.Length;
                        filetable.ext           = fileinfo.Extension;
                        filetable.comment       = "";
                        filetable.creationtime  = fileinfo.CreationTime;
                        filetable.lastwritetime = fileinfo.LastWriteTime;

                        db.AddToFileTable(filetable);
                        db.SaveChanges();

                        foreach (string tag in tags)
                        {
                            filetable.TagTable.Add(new TagTable()
                            {
                                tag = tag, FileTable = filetable
                            });
                        }
                        //var fquery = from c in db.FileTable
                        //            where c.guid == strguid
                        //            select c;

                        //foreach (FileTable f in fquery) {
                        //db.AttachTo(filetable.EntityKey.EntitySetName,
                        //     new FileTable() { filetableid = filetable.filetableid });
                        //     foreach (string tag in tags) {
                        //        db.AddToTagTable(new TagTable() { tag = tag, FileTable = filetable });
                        //    }

                        //}
                        //TagTable tagtable = new TagTable() { id = filetable.TagTable.id };
                        //db.AttachTo("FileTable", new FileTable() { filetableid = filetable.filetableid });
                        //foreach (string tag in tags) {
                        //    db.AddToTagTable(new TagTable() { tag = tag, FileTable = filetable });
                        //}
                    }
                    else
                    {
                        foreach (FileTable filetable in query)
                        {
                            //var queryt = from c in db.TagTable
                            //             where c.FileTable.filetableid == filetable.filetableid
                            //             select c.tag;
                            foreach (string tag in tags)
                            {
                                //Console.WriteLine("tag = " + tag);
                                filetable.TagTable.Add(new TagTable()
                                {
                                    tag = tag, FileTable = filetable
                                });
                            }
                            //db.AttachTo("FileTable", new FileTable() { filetableid = filetable.filetableid });
                            //foreach (string tag in tags) {
                            //    //db.AddToTagTable(new TagTable() { tag = tag, FileTable = filetable });
                            //    filetable.TagTable.Add(new TagTable() { tag = tag, FileTable = filetable });
                            //}
                        }
                    }
                }

                db.SaveChanges();
            }
        }
Example #8
0
        private void TagTreeView_MouseDown(object sender, MouseEventArgs e)
        {
            var      pt = new Point(e.X, e.Y);
            TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);

            ((TreeView)sender).SelectedNode = DestinationNode;

            TreeNode selnode = ((TreeView)sender).SelectedNode;

            if (selnode != null && selnode.Tag != null)
            {
                if (e.Button == MouseButtons.Left)
                {
                    var selecttag = (string)selnode.Tag;
                    var listview  = getActiveListView();
                    if (listview == null)
                    {
                        var tabpage = OpenNewTab(selecttag);
                        listview = tabListviewMap[tabpage];

                        //FileListView<TableData> filelistview = listview as FileListView<TableData>;
                        //filelistview.inputData(datas);
                        //filelistview.setitem();
                        //OpenNewTab(tagdb.selectFileData(new string[] { (string)selnode.Tag }), (string)selnode.Tag);
                    }
                    else
                    {
                        getTabControl().SelectedTab.Text = selecttag;

                        //getTabControl().SelectedTab.Text = (string)selnode.Tag;
                        //listview.Items.Clear();
                        //UpdateListView(listview, tagdb.selectFileData(new string[] { (string)selnode.Tag }));
                    }

                    var datas = new List <TableData>();
                    using (FileDataModelContainer db = new FileDataModelContainer()) {
                        //db.FileTable.Where(c => c.ext == "ok").Select(s => s);
                        var query = from c in db.FileTable
                                    where c.TagTable.Any(t => t.tag.Contains(selecttag))
                                    select c;
                        foreach (FileTable f in query)
                        {
                            string stag = String.Empty;

                            var tagquery = from c in db.TagTable
                                           where c.FileTable.filetableid == f.filetableid
                                           select c.tag;

                            datas.Add(new TableData(f.guid, f.name, f.size, f.ext, tagquery.ToList <string>(), f.comment, f.creationtime, f.lastwritetime));
                        }
                    }

                    FileListView <TableData> filelistview = listview as FileListView <TableData>;
                    filelistview.inputData(datas);
                    filelistview.setitem();
                }
                else if (e.Button == MouseButtons.Middle)
                {
                    //OpenNewTab(tagdb.selectFileData(new string[] { (string)selnode.Tag }), (string)selnode.Tag);
                }
            }
        }
Example #9
0
        public MainForm()
        {
            InitializeComponent();

            setDetailView();

            AddTagMenuItem.Click += (sender, e) =>
            {
                InputForm    input = new InputForm();
                DialogResult res   = input.ShowDialog(this);
                if (res == DialogResult.OK)
                {
                    string tag = input.input;
                    if (tag.Length > 0)
                    {
                        //tagdb.insertTag(new string[] { input.input });
                        //IEnumerable<string> newtags = insertTags(new string[] { input.input });
                        string[] newtags = tag.Split(' ');
                        foreach (string newtag in newtags)
                        {
                            TreeNode tagnode = TagTreeView.Nodes["TagNode"].Nodes.Add(newtag);
                            tagnode.Tag = newtag;
                        }
                    }
                }
            };

            ToolStripMenuItem openfolder = new ToolStripMenuItem("open folder");

            openfolder.Click += (sender, e) => {
                var listview = getActiveListView() as FileListView <TableData>;
                var datas    = listview.getSelectItemData();
                if (datas.Count() > 0)
                {
                    string guid = datas.ElementAt(0).guid;
                    string path = Win32.getFullPathByObjectID(Win32.FILEGUID.parse(guid));

                    //ProcessStartInfo psi = new ProcessStartInfo();

                    //FileInfo info = new FileInfo(path);
                    //psi.FileName = info.Directory.FullName;
                    //psi.Verb = "open";
                    //System.Diagnostics.Process.Start(psi);
                    System.Diagnostics.Process.Start("EXPLORER.EXE", @"/select," + path);
                }
            };
            ListViewContextMenu.Items.Add(openfolder);

            ToolStripMenuItem openitem = new ToolStripMenuItem("open");

            openitem.Click += (sender, e) =>
            {
                var listview = getActiveListView() as FileListView <TableData>;
                var datas    = listview.getSelectItemData();
                if (datas.Count() > 0)
                {
                    string guid = datas.ElementAt(0).guid;
                    string path = Win32.getFullPathByObjectID(Win32.FILEGUID.parse(guid));
                    System.Diagnostics.Process.Start("Notepad", path);
                }
            };
            ListViewContextMenu.Items.Add(openitem);

            //tagdb.Connection();
            //tagdb.createTable();

            //sqlitewrap.Connection();
            createTable();

            //string[] tags = tagdb.getAllTags();
            IEnumerable <string> tags = getAllTags();
            TreeNode             node = TagTreeView.Nodes["TagNode"];

            foreach (string tag in tags)
            {
                TreeNode tagnode = node.Nodes.Add(tag);
                tagnode.Tag = tag;
            }

            getTabControl().Selecting += (sender, e) =>
            {
                if (tabListviewMap.ContainsKey(e.TabPage))
                {
                    ListViewPanel.Controls.Remove(tabListviewMap[e.TabPage]);
                }
            };

            getTabControl().Selected += (sender, e) =>
            {
                var control = ListViewPanel.Controls[0];
                if (control != null)
                {
                    ListViewPanel.Controls.Remove(control);
                }

                if (tabListviewMap.ContainsKey(e.TabPage))
                {
                    ListViewPanel.Controls.Add(tabListviewMap[e.TabPage]);
                }
            };

            SearchComboBox.KeyPress += (sender, e) =>
            {
                if (e.KeyChar == '\r')
                {
                    e.Handled = true;
                    string text = SearchComboBox.Text;

                    var tabpage  = OpenNewTab(text);
                    var listview = tabListviewMap[tabpage];
                    if (text.IndexOf(",") == -1)
                    {
                        var values = text.Split(' ', ' ');

                        var datas = new List <TableData>();

                        using (FileDataModelContainer db = new FileDataModelContainer()) {
                            //db.FileTable.Where(c => c.ext == "ok").Select(s => s);
                            //var query = from c in db.FileTable
                            //            where c.comment.Contains(text) || c.name.Contains(text) || c.TagTable.Any(t => t.tag.Contains(text))
                            //            select c;
                            //foreach (FileTable f in query) {
                            //    string stag = String.Empty;

                            //    var tagquery = from c in db.TagTable
                            //                   where c.FileTable.filetableid == f.filetableid
                            //                   select c.tag;

                            //    datas.Add(new TableData(f.guid, f.name, f.size, f.ext, tagquery.ToList<string>(), f.comment, f.creationtime, f.lastwritetime));
                            //}
                            string[] targets = { "name", "comment", "ext" };
                            var      query   = from c in db.FileTable
                                               select c;
                            var        contains  = typeof(string).GetMethod("Contains");
                            var        paramExpr = Expression.Parameter(typeof(FileTable), "c");
                            Expression mainExpr  = null;

                            foreach (string target in targets)
                            {
                                Expression bodyExpr = null;
                                foreach (var o in values)
                                {
                                    if (o.Length == 0)
                                    {
                                        continue;
                                    }

                                    if (bodyExpr == null)
                                    {
                                        // d.FileName.Contains("値")のコードと等価
                                        bodyExpr = Expression.Call(
                                            Expression.Property(paramExpr, target), contains, Expression.Constant(o)
                                            );
                                    }
                                    else
                                    {
                                        // 既に式があればOR演算する
                                        bodyExpr = Expression.AndAlso(
                                            bodyExpr,
                                            Expression.Call(
                                                Expression.Property(paramExpr, target), contains, Expression.Constant(o)
                                                )
                                            );
                                    }
                                }
                                if (mainExpr == null)
                                {
                                    mainExpr = bodyExpr;
                                }
                                else
                                {
                                    mainExpr = Expression.OrElse(mainExpr, bodyExpr);
                                }
                            }

                            if (values.Length != 0)
                            {
                                var res = query.Where(Expression.Lambda <Func <FileTable, bool> >(mainExpr, paramExpr));

                                foreach (FileTable f in res)
                                {
                                    string stag = String.Empty;

                                    var tagquery = from c in db.TagTable
                                                   where c.FileTable.filetableid == f.filetableid
                                                   select c.tag;

                                    datas.Add(new TableData(f.guid, f.name, f.size, f.ext, tagquery.ToList <string>(), f.comment, f.creationtime, f.lastwritetime));
                                }
                            }
                        }

                        FileListView <TableData> filelistview = listview as FileListView <TableData>;
                        filelistview.inputData(datas);
                        filelistview.setitem();
                    }
                    else
                    {
                        string[] strs = text.Split(',');
                    }
                    //OpenNewTab();
                }
            };
        }
Example #10
0
        private void TagTreeView_MouseDown(object sender, MouseEventArgs e)
        {
            var pt = new Point(e.X, e.Y);
            TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);
            ((TreeView)sender).SelectedNode = DestinationNode;

            TreeNode selnode = ((TreeView)sender).SelectedNode;
            if (selnode != null && selnode.Tag != null)
            {
                if (e.Button == MouseButtons.Left)
                {
                    var selecttag = (string)selnode.Tag;
                    var listview = getActiveListView();
                    if (listview == null)
                    {
                        var tabpage = OpenNewTab(selecttag);
                        listview = tabListviewMap[tabpage];

                        //FileListView<TableData> filelistview = listview as FileListView<TableData>;
                        //filelistview.inputData(datas);
                        //filelistview.setitem();
                        //OpenNewTab(tagdb.selectFileData(new string[] { (string)selnode.Tag }), (string)selnode.Tag);
                    }
                    else
                    {
                        getTabControl().SelectedTab.Text = selecttag;

                        //getTabControl().SelectedTab.Text = (string)selnode.Tag;
                        //listview.Items.Clear();
                        //UpdateListView(listview, tagdb.selectFileData(new string[] { (string)selnode.Tag }));
                    }

                    var datas = new List<TableData>();
                    using (FileDataModelContainer db = new FileDataModelContainer()) {
                        //db.FileTable.Where(c => c.ext == "ok").Select(s => s);
                        var query = from c in db.FileTable
                                    where c.TagTable.Any(t => t.tag.Contains(selecttag))
                                    select c;
                        foreach (FileTable f in query) {
                            string stag = String.Empty;

                            var tagquery = from c in db.TagTable
                                           where c.FileTable.filetableid == f.filetableid
                                           select c.tag;

                            datas.Add(new TableData(f.guid, f.name, f.size, f.ext, tagquery.ToList<string>(), f.comment, f.creationtime, f.lastwritetime));
                        }
                    }

                    FileListView<TableData> filelistview = listview as FileListView<TableData>;
                    filelistview.inputData(datas);
                    filelistview.setitem();
                }
                else if (e.Button == MouseButtons.Middle)
                {

                    //OpenNewTab(tagdb.selectFileData(new string[] { (string)selnode.Tag }), (string)selnode.Tag);
                }
            }
        }
Example #11
0
        private void setDetailView()
        {
            var panel = ViewSplitContainer.Panel2;

            detailview = new DetailView();
            detailview.OnChagedName += (sender, args) =>
            {
                updataListviewItem(getActiveListView(), args.guid, args.key, args.data);

                using (FileDataModelContainer db = new FileDataModelContainer())
                {
                    var query = from c in db.FileTable
                                where c.guid == args.guid
                                select c;
                    foreach (FileTable ftable in query)
                    {
                        ftable.name = args.data;
                    }

                    db.SaveChanges();
                }
            };
            detailview.OnChagedComment += (sender, args) =>
            {
                updataListviewItem(getActiveListView(), args.guid, args.key, args.data);

                using (FileDataModelContainer db = new FileDataModelContainer())
                {
                    var query = from c in db.FileTable
                                where c.guid == args.guid
                                select c;
                    foreach (FileTable ftable in query)
                    {
                        ftable.comment = args.data;
                    }

                    db.SaveChanges();
                }
            };
            detailview.Dock = DockStyle.Fill;
            panel.Controls.Add(detailview);
        }
Example #12
0
        public MainForm()
        {
            InitializeComponent();

            setDetailView();

            AddTagMenuItem.Click += (sender, e) =>
            {
                InputForm input = new InputForm();
                DialogResult res = input.ShowDialog(this);
                if(res == DialogResult.OK){
                    string tag = input.input;
                    if (tag.Length > 0) {
                        //tagdb.insertTag(new string[] { input.input });
                        //IEnumerable<string> newtags = insertTags(new string[] { input.input });
                        string[] newtags = tag.Split(' ');
                        foreach (string newtag in newtags)
                        {
                            TreeNode tagnode = TagTreeView.Nodes["TagNode"].Nodes.Add(newtag);
                            tagnode.Tag = newtag;
                        }
                    }
                }
            };

            ToolStripMenuItem openfolder = new ToolStripMenuItem("open folder");
            openfolder.Click += (sender, e) => {
                var listview = getActiveListView() as FileListView<TableData>;
                var datas = listview.getSelectItemData();
                if (datas.Count() > 0) {
                    string guid = datas.ElementAt(0).guid;
                    string path = Win32.getFullPathByObjectID(Win32.FILEGUID.parse(guid));

                    //ProcessStartInfo psi = new ProcessStartInfo();

                    //FileInfo info = new FileInfo(path);
                    //psi.FileName = info.Directory.FullName;
                    //psi.Verb = "open";
                    //System.Diagnostics.Process.Start(psi);
                    System.Diagnostics.Process.Start("EXPLORER.EXE", @"/select," + path);

                }
            };
            ListViewContextMenu.Items.Add(openfolder);

            ToolStripMenuItem openitem = new ToolStripMenuItem("open");
            openitem.Click += (sender, e) =>
            {
                var listview = getActiveListView() as FileListView<TableData>;
                var datas = listview.getSelectItemData();
                if (datas.Count() > 0) {
                    string guid = datas.ElementAt(0).guid;
                    string path = Win32.getFullPathByObjectID(Win32.FILEGUID.parse(guid));
                    System.Diagnostics.Process.Start("Notepad", path);
                }
            };
            ListViewContextMenu.Items.Add(openitem);

            //tagdb.Connection();
            //tagdb.createTable();

            //sqlitewrap.Connection();
            createTable();

            //string[] tags = tagdb.getAllTags();
            IEnumerable<string> tags = getAllTags();
            TreeNode node = TagTreeView.Nodes["TagNode"];
            foreach (string tag in tags)
            {
                TreeNode tagnode = node.Nodes.Add(tag);
                tagnode.Tag = tag;
            }

            getTabControl().Selecting += (sender, e) =>
            {
                if(tabListviewMap.ContainsKey(e.TabPage))
                {
                    ListViewPanel.Controls.Remove(tabListviewMap[e.TabPage]);
                }
            };

            getTabControl().Selected += (sender, e) =>
            {
                var control = ListViewPanel.Controls[0];
                if (control !=null) ListViewPanel.Controls.Remove(control);

                if (tabListviewMap.ContainsKey(e.TabPage))
                {
                    ListViewPanel.Controls.Add(tabListviewMap[e.TabPage]);
                }
            };

            SearchComboBox.KeyPress += (sender, e) =>
            {
                if (e.KeyChar == '\r')
                {
                    e.Handled = true;
                    string text = SearchComboBox.Text;

                    var tabpage = OpenNewTab(text);
                    var listview = tabListviewMap[tabpage];
                    if (text.IndexOf(",") == -1)
                    {
                        var values = text.Split(' ', ' ');

                        var datas = new List<TableData>();

                        using (FileDataModelContainer db = new FileDataModelContainer()) {
                            //db.FileTable.Where(c => c.ext == "ok").Select(s => s);
                            //var query = from c in db.FileTable
                            //            where c.comment.Contains(text) || c.name.Contains(text) || c.TagTable.Any(t => t.tag.Contains(text))
                            //            select c;
                            //foreach (FileTable f in query) {
                            //    string stag = String.Empty;

                            //    var tagquery = from c in db.TagTable
                            //                   where c.FileTable.filetableid == f.filetableid
                            //                   select c.tag;

                            //    datas.Add(new TableData(f.guid, f.name, f.size, f.ext, tagquery.ToList<string>(), f.comment, f.creationtime, f.lastwritetime));
                            //}
                            string[] targets = {"name","comment","ext"};
                            var query = from c in db.FileTable
                                        select c;
                            var contains = typeof(string).GetMethod("Contains");
                            var paramExpr = Expression.Parameter(typeof(FileTable), "c");
                            Expression mainExpr = null;

                            foreach (string target in targets)
                            {
                                Expression bodyExpr = null;
                                foreach (var o in values)
                                {
                                    if (o.Length == 0) continue;

                                    if (bodyExpr == null)
                                    {
                                        // d.FileName.Contains("値")のコードと等価
                                        bodyExpr = Expression.Call(
                                            Expression.Property(paramExpr, target), contains, Expression.Constant(o)
                                        );

                                    }
                                    else
                                    {
                                        // 既に式があればOR演算する
                                        bodyExpr = Expression.AndAlso(
                                            bodyExpr,
                                            Expression.Call(
                                                Expression.Property(paramExpr, target), contains, Expression.Constant(o)
                                            )
                                        );
                                    }
                                }
                                if (mainExpr == null)
                                {
                                    mainExpr = bodyExpr;
                                }
                                else
                                {
                                    mainExpr = Expression.OrElse(mainExpr, bodyExpr);
                                }
                            }

                            if(values.Length != 0){

                                var res = query.Where(Expression.Lambda<Func<FileTable, bool>>(mainExpr, paramExpr));

                                foreach (FileTable f in res)
                                {
                                    string stag = String.Empty;

                                    var tagquery = from c in db.TagTable
                                                   where c.FileTable.filetableid == f.filetableid
                                                   select c.tag;

                                    datas.Add(new TableData(f.guid, f.name, f.size, f.ext, tagquery.ToList<string>(), f.comment, f.creationtime, f.lastwritetime));
                                }

                            }

                        }

                        FileListView<TableData> filelistview = listview as FileListView<TableData>;
                        filelistview.inputData(datas);
                        filelistview.setitem();
                    }
                    else
                    {
                        string[] strs = text.Split(',');

                    }
                    //OpenNewTab();
                }
            };
        }