Beispiel #1
0
        private void btnExport_Click_1(object sender, EventArgs e)
        {
            if (this.dropDownExportTo.Text == "Export to ...")
            {
                XtraMessageBox.Show("Please select export format", "Error");
                return;
            }

            var form = new SimpleBrowseForm();

            form.ShowDialog(this);
            if (form.DialogResult == DialogResult.OK)
            {
                var ext = Path.HasExtension(form.getInput());

                switch (this.dropDownExportTo.Text)
                {
                case "HTML":
                    this.treeList1.ExportToHtml(ext ? form.getInput() : Path.Combine(form.getInput(), "MovieList.html"));
                    break;

                case "PDF":
                    this.treeList1.ExportToPdf(ext ? form.getInput() : Path.Combine(form.getInput(), "MovieList.pdf"));
                    break;

                case "XML":
                    this.treeList1.ExportToXml(ext ? form.getInput() : Path.Combine(form.getInput(), "MovieList.xml"));
                    break;

                default:
                    // Should never happen
                    //XtraMessageBox.Show("Selected method is not supported!", "Error!");
                    Exporting.ExportMoviesTemplate(this.dropDownExportTo.Text, form.getInput());
                    break;
                }
            }
            else
            {
                return;
            }
        }
Beispiel #2
0
        private void btnExport_Click_1(object sender, EventArgs e)
        {
            if (this.dropDownExportTo.Text == "Export to ...")
            {
                XtraMessageBox.Show("Please select export format", "Error");
                return;
            }

            var form = new SimpleBrowseForm();
            form.ShowDialog(this);
            if (form.DialogResult == DialogResult.OK)
            {
                var ext = Path.HasExtension(form.getInput());

                switch (this.dropDownExportTo.Text)
                {
                    case "HTML":
                        this.treeList1.ExportToHtml(ext ? form.getInput() : Path.Combine(form.getInput(), "MovieList.html"));
                        break;
                    case "PDF":
                        this.treeList1.ExportToPdf(ext ? form.getInput() : Path.Combine(form.getInput(), "MovieList.pdf"));
                        break;
                    case "XML":
                        this.treeList1.ExportToXml(ext ? form.getInput() : Path.Combine(form.getInput(), "MovieList.xml"));
                        break;
                    default:
                        // Should never happen
                        //XtraMessageBox.Show("Selected method is not supported!", "Error!");
                        Exporting.ExportMoviesTemplate(this.dropDownExportTo.Text, form.getInput());
                        break;
                }
            }
            else
            {
                return;
            }
        }
Beispiel #3
0
        public static bool ExportMissingEpisodesTemplate(string tName, string path = "")
        {
            var files = GetExportTemplates();
            var exportTemplate = (from s in files where s.name == tName select s).Single();
            var template = new Template(File.ReadAllText(exportTemplate.file).ToString());
            
            var seriesList = new List<Series>();
            foreach (var series in TvDBFactory.TvDatabase)
            {
                if (series.Value.CountMissingEpisodes() > 0)
                {
                    var s = Extensions.Clone(series.Value);
                    s.Seasons.Clear();
                    seriesList.Add(s);
                    
                    var episodes = series.Value.GetMissingEpisodes();
                    foreach (var episode in episodes)
                    {
                        
                        if (!s.Seasons.ContainsKey(episode.GetSeason().SeasonNumber))
                        {
                            var season = Extensions.Clone(episode.GetSeason());
                            season.Episodes.Clear();
                            s.Seasons.Add(season.SeasonNumber, season);
                        }

                        var ep = Extensions.Clone(episode);
                        
                        s.Seasons[episode.GetSeason().SeasonNumber].Episodes.Add(ep);
                    }
                }
            }

            template.Add("series", seriesList);

            string ext = "";
            if (path == "")
            {
                var form = new SimpleBrowseForm();
                form.ShowDialog();
                if (form.DialogResult == DialogResult.OK)
                {
                    path = form.getInput();
                }
                else
                {
                    return false;
                }
            }

            ext = Path.GetExtension(path);
            if (ext == "") ext = exportTemplate.outputformat;

            File.WriteAllText(Path.Combine(path, "MissingEpisodesList." + ext), template.Render());

            return true;
        }
Beispiel #4
0
        public static bool ExportMoviesTemplate(string tName, string path = "")
        {
            var files = GetExportTemplates();
            var exportTemplate = (from s in files where s.name == tName select s).Single();
            string str = File.ReadAllText(exportTemplate.file);
            var template = new Template(str);

            BindingList<MovieModel> movies;
            var list = new List<MovieTreeList>();

            if (MovieDBFactory.IsMultiSelected)
            {
                movies = MovieDBFactory.MultiSelectedMovies;
            }
            else
            {
                movies = MovieDBFactory.MovieDatabase;
            }

            template.Add("movies", movies);

            string ext = "";
            if (path == "")
            {
                var form = new SimpleBrowseForm();
                form.ShowDialog();
                if (form.DialogResult == DialogResult.OK)
                {
                    path = form.getInput();
                }
                else
                {
                    return false;
                }
            }

            ext = Path.GetExtension(path);
            if (ext == "") ext = exportTemplate.outputformat;

            File.WriteAllText(Path.Combine(path, "MovieList." + ext), template.Render());

            return true;
        }
Beispiel #5
0
 private void btnChangeFanart_Click(object sender, EventArgs e)
 {
     var form = new SimpleBrowseForm(SimpleBrowseForm.browseType.File);
     form.ShowDialog();
     if (form.DialogResult == DialogResult.OK)
     {
         this.txtFanart.Text = form.getInput();
         ImportMoviesFactory.CurrentRecord.FanartPathOnDisk = this.txtFanart.Text;
     }
 }