示例#1
0
        private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }

            IDatabaseDriver      database = context.DatabaseDriver;
            DataGridViewRow      row      = dataGridView1.SelectedRows[0];
            PsxDatacenterPreview preview  = (PsxDatacenterPreview)row.DataBoundItem;

            if (row.DataBoundItem == null)
            {
                return;
            }

            if (pictureBox1.BackgroundImage != null)
            {
                pictureBox1.BackgroundImage.Dispose();
            }

            pictureBox1.BackgroundImage  = null;
            propertyGrid1.SelectedObject = null;
            galleria1.GalleriaModel      = new EmptyGalleriaModel();
            textBox1.Text = String.Empty;

            if (preview != null)
            {
                if (!preview.HasAdditionalData)
                {
                    return;
                }
            }

            PsxDatacenterGame game = database.PsxDc_GetSpecificGame(preview.Id);

            propertyGrid1.SelectedObject      = game;
            pictureBox1.BackgroundImage       = Image.FromStream(new MemoryStream(game.Cover));
            pictureBox1.BackgroundImageLayout = ImageLayout.Zoom;
            textBox1.Text = game.Description;

            List <byte[]> screenshots = database.PsxDc_GetScreenshots(preview.Id).ToList();
            List <Image>  images      = screenshots.ConvertAll(x => Image.FromStream(new MemoryStream(x, false)));

            Galleria.DefaultGalleriaModel galleriaModel = new Galleria.DefaultGalleriaModel();
            galleria1.GalleriaModel = galleriaModel;
            galleriaModel.AddRange(images);
        }
示例#2
0
        private void TreeListView1_SelectionChanged(object sender, EventArgs e)
        {
            galleria1.GalleriaModel      = new EmptyGalleriaModel();
            propertyGrid1.SelectedObject = null;
            notesTextBox.Text            = "";
            pictureBox1.BackgroundImage  = null;

            var selectedObject = treeListView1.SelectedObject;

            if (selectedObject == null)
            {
                return;
            }

            VndbSearchResult releaseResult = selectedObject as VndbSearchResult;

            if (releaseResult != null)
            {
                VndbRelease release = database.Vndb_GetReleaseById(releaseResult.RID);
                propertyGrid1.SelectedObject = release;
                notesTextBox.Text            = release.Notes;
                if (releaseResult.Vns.Length == 1)
                {
                    selectedObject = releaseResult.Vns[0];
                }
                else
                {
                    return;
                }
            }

            VndbVnResult vnResult = selectedObject as VndbVnResult;

            if (vnResult != null)
            {
                VndbVn vn = database.Vndb_GetVnById(vnResult.VNID);
                propertyGrid1.SelectedObject = vn;
                if (vn.Screens.Count > 0)
                {
                    Galleria.DefaultGalleriaModel galleriaModel = new Galleria.DefaultGalleriaModel();
                    galleria1.GalleriaModel = galleriaModel;
                    galleriaModel.AddRange(vn.Screens);
                }

                notesTextBox.Text = vn.Description;
                bool showImage = true;
                if (vn.ImageNSFW)
                {
                    if (!context.Ini.ContainsKey("vndb"))
                    {
                        showImage = false;
                    }

                    IniSection iniSection = context.Ini["vndb"];
                    if (!iniSection.ContainsKey("hideNsfw"))
                    {
                        showImage = false;
                    }

                    int hideNsfw = Convert.ToInt32(iniSection["hideNsfw"]);
                    showImage = hideNsfw == 0;
                }

                if (showImage)
                {
                    pictureBox1.BackgroundImage       = vn.Image;
                    pictureBox1.BackgroundImageLayout = ImageLayout.Zoom;
                }

                return;
            }

            MessageBox.Show("???");
        }
示例#3
0
        private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }

            IDatabaseDriver database = context.DatabaseDriver;
            DataGridViewRow row      = dataGridView1.SelectedRows[0];
            AlbumListEntry  entry    = (AlbumListEntry)row.DataBoundItem;

            if (entry == null)
            {
                return;
            }

            if (lastRowSelected == entry.id)
            {
                return;
            }
            lastRowSelected = entry.id;

            pictureBox1.BackgroundImage = database.Vgmdb_GetAlbumCover(entry.id);

            /*
             *  [x] postgres.public.dump_vgmdb_album_arbituaryproducts
             *  [x] postgres.public.dump_vgmdb_album_artist_arbitrary
             *  [x] postgres.public.dump_vgmdb_album_artist_type
             *  [x] postgres.public.dump_vgmdb_album_artists
             *  [x] postgres.public.dump_vgmdb_album_classification
             *  [x] postgres.public.dump_vgmdb_album_cover
             *  [x] postgres.public.dump_vgmdb_album_disc_track_translation
             *  [x] postgres.public.dump_vgmdb_album_disc_tracks
             *  [x] postgres.public.dump_vgmdb_album_discs
             *  [x] postgres.public.dump_vgmdb_album_label_arbiturary
             *  [x] postgres.public.dump_vgmdb_album_label_roles
             *  [x] postgres.public.dump_vgmdb_album_labels
             *  [x] postgres.public.dump_vgmdb_album_mediaformat
             *  [x] postgres.public.dump_vgmdb_album_relatedalbum
             *  [x] postgres.public.dump_vgmdb_album_releaseevent
             *  [x] postgres.public.dump_vgmdb_album_reprints
             *  [x] postgres.public.dump_vgmdb_album_titles
             *  [x] postgres.public.dump_vgmdb_album_types
             *  [x] postgres.public.dump_vgmdb_album_websites
             *  [ ] postgres.public.dump_vgmdb_albums
             */
            Album model = new Album();

            model.Products       = database.Vgmdb_FindProductNamesByAlbumId(entry.id).ToArray();
            model.Artists        = database.Vgmdb_FindArtistNamesByAlbumId(entry.id).ToArray();
            model.Classification = entry.classificationName;
            model.RelatedAlbums  = database.Vgmdb_FindRelatedAlbums(entry.id).ToArray();
            model.ReleaseEvent   = database.Vgmdb_GetReleaseEvent(entry.id);
            model.Reprints       = database.Vgmdb_FindReprints(entry.id).ToArray();
            model.TypeName       = entry.typeName;
            model.Websites       = database.Vgmdb_GetWebsites(entry.id).ToArray();
            if (entry.date.HasValue)
            {
                model.Date = entry.date.Value.ToShortDateString();
            }
            else
            {
                model.Date = "???";
            }
            model.Publisher = entry.publisher;

            Galleria.DefaultGalleriaModel galleriaModel = new Galleria.DefaultGalleriaModel();
            galleria1.GalleriaModel = galleriaModel;
            galleriaModel.AddRange(database.FindCoversByAlbumId(entry.id));
            galleria1.GalleriaModel = galleriaModel;
            galleria1.Visible       = galleriaModel.Count > 0;

            Tuple <string, int, int, string, int>[] trackTuples = database.Vgmdb_FindTrackDataByAlbum(entry.id).ToArray();
            model.Tracks = Array.ConvertAll(trackTuples, x => new Track(x));

            model.Labels      = database.Vgmdb_FindLabelNamesByAlbumId(entry.id).ToArray();
            model.MediaFormat = entry.mediaformatName;

            notesTextBox.Text = entry.notes;

            propertyGrid1.SelectedObject = model;
        }