Пример #1
0
        public List <string> searchFiles(string[] data)
        {
            lock (loadFilesLock)
            {
                List <string> urls = new List <string>();

                foreach (string file in data)
                {
                    var dataJson = DatabaseFilesEntity.FromJson(file);

                    if (UtilityTools.ContainsAll(dataJson.Title.ToLower(), UtilityTools.GetWords(txtFilesSearchResults.Text.ToLower())) && dataJson.Title.Contains(selectedFilesQuality) && dataJson.Type.Contains(selectedFilesFileType) && dataJson.Host.Contains(selectedFilesHost))
                    {
                        urls.Add(dataJson.ToJson());
                    }
                }
                return(urls);
            }
        }
Пример #2
0
        public void showSelectedFiles(string[] files)
        {
            BackGroundWorker.RunWorkAsync <List <string> >(() => searchFiles(files), (data) =>
            {
                if (tabFiles.InvokeRequired)
                {
                    loadFilesCallBack b = new loadFilesCallBack(showSelectedFiles);
                    Invoke(b, new object[] { files });
                }
                else
                {
                    ComponentResourceManager resources = new ComponentResourceManager(typeof(frmOpenTheatre));
                    cmboBoxFilesSort.SelectedIndex     = 0; dataGridFiles.Rows.Clear();
                    cmboBoxFilesHost.Items.Clear(); cmboBoxFilesHost.Items.Add(resources.GetString("cmboBoxFilesHost.Items"));
                    cmboBoxFilesFormat.Items.Clear(); cmboBoxFilesFormat.Items.Add(resources.GetString("cmboBoxFilesFormat.Items"));

                    foreach (string jsonData in data)
                    {
                        var dataJson     = DatabaseFilesEntity.FromJson(jsonData);
                        string dateAdded = dataJson.DateAdded;
                        if (dataJson.DateAdded != "-")
                        {
                            dateAdded = UtilityTools.getTimeAgo(Convert.ToDateTime(dataJson.DateAdded));
                        }
                        dataGridFiles.Rows.Add(dataJson.Type, dataJson.Title, dataJson.Size, dateAdded, dataJson.Host, dataJson.URL);
                        if (!(cmboBoxFilesFormat.Items.Contains(dataJson.Type)))
                        {
                            cmboBoxFilesFormat.Items.Add(dataJson.Type);
                        }
                        if (!(cmboBoxFilesHost.Items.Contains(dataJson.Host)))
                        {
                            cmboBoxFilesHost.Items.Add(dataJson.Host);
                        }
                    }

                    cmboBoxFilesHost.DropDownWidth = DropDownWidth(cmboBoxFilesHost);
                    imgSpinner.Visible             = false;
                }
            });
        }
Пример #3
0
        // return list that contains file
        public static string getContainingListOfURL(string fileUrl)
        {
            foreach (string file in frmOpenTheatre.dataMovies)
            {
                var data = OMDbEntity.FromJson(file);
                if (data.Sources.Contains(fileUrl))
                {
                    return("Movie");
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesMovies)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return("Movie");
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesSeries)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return("Episode");
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesAnime)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return("Anime");
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesSubtitles)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return("Subtitle");
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesTorrents)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return("Torrent");
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesArchives)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return("Archive");
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesLocal)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return("Local");
                }
            }

            return("null");
        }
Пример #4
0
        // return list that contains file
        public static string getContainingListOfURL(string fileUrl)
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmOpenTheatre));

            foreach (string file in frmOpenTheatre.dataMovies)
            {
                var data = OMDbEntity.FromJson(file);
                if (data.Sources.Contains(fileUrl))
                {
                    return(resources.GetString("cmboBoxBookmarksType.Items1"));
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesVideo)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return(resources.GetString("cmboBoxBookmarksType.Items2"));
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesAudio)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return(resources.GetString("cmboBoxBookmarksType.Items2"));
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesEbooks)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return(resources.GetString("cmboBoxBookmarksType.Items3"));
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesSubtitles)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return(resources.GetString("cmboBoxBookmarksType.Items4"));
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesTorrents)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return(resources.GetString("cmboBoxBookmarksType.Items5"));
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesArchives)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return(resources.GetString("cmboBoxBookmarksType.Items6"));
                }
            }
            foreach (string file in frmOpenTheatre.dataFilesLocal)
            {
                var data = DatabaseFilesEntity.FromJson(file);
                if (data.URL == fileUrl)
                {
                    return(resources.GetString("cmboBoxBookmarksType.Items7"));
                }
            }

            return("null");
        }