Beispiel #1
0
        private void toolStripButton_get_tgdb_Click(object sender, EventArgs e)
        {
            if (currentID == "")
            {
                return;
            }
            string entryName         = MyNesDB.GetEntry(currentID).Name;
            FormSearchTheGamesDB frm = new FormSearchTheGamesDB(entryName);

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                // Set the data
                richTextBox1.Clear();
                Game gm = GamesDB.GetGame(frm.SelectedResultID);
                richTextBox1.Text = gm.Overview;
                if (fileIndex >= 0 && fileIndex < detects.Length)
                {
                    //save
                    toolStripButton_SaveChanges_Click(sender, e);
                }
                else
                {
                    SaveFileDialog sav = new SaveFileDialog();
                    sav.Title  = Program.ResourceManager.GetString("Title_NewInfoFile");
                    sav.Filter = Program.ResourceManager.GetString("Filter_InfoFile");
                    // Determine file name
                    MyNesDBEntryInfo entry = MyNesDB.GetEntry(currentID);
                    sav.FileName = entry.Name + ".txt";
                    if (sav.ShowDialog(this) == DialogResult.OK)
                    {
                        // Save the file !
                        switch (Path.GetExtension(sav.FileName).ToLower())
                        {
                        case ".rtf":
                        case ".doc": richTextBox1.SaveFile(sav.FileName); break;

                        default: File.WriteAllLines(sav.FileName, richTextBox1.Lines, Encoding.UTF8); break;
                        }
                        // Make sure this file isn't exist for selected game
                        bool found = false;
                        if (detects != null)
                        {
                            for (int i = 0; i < detects.Length; i++)
                            {
                                if (detects[i].Path == sav.FileName)
                                {
                                    fileIndex = i;
                                    ShowCurrentFile();
                                    found = true;
                                    return;
                                }
                            }
                        }
                        if (!found)
                        {
                            // Add it !
                            MyNesDetectEntryInfo newDetect = new MyNesDetectEntryInfo();
                            newDetect.GameID   = currentID;
                            newDetect.Path     = sav.FileName;
                            newDetect.Name     = Path.GetFileNameWithoutExtension(sav.FileName);
                            newDetect.FileInfo = "";
                            MyNesDB.AddDetect("INFOS", newDetect);
                            // Refresh
                            RefreshForEntry(currentID);
                            fileIndex = detects.Length - 1;
                            ShowCurrentFile();
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void toolStripButton_search_tgdb_Click(object sender, EventArgs e)
        {
            if (currentID == "") return;
            string entryName = MyNesDB.GetEntry(currentID).Name;
            FormSearchTheGamesDB frm = new FormSearchTheGamesDB(entryName);
            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                TheGamesDBAPI.Game gm = TheGamesDBAPI.GamesDB.GetGame(frm.SelectedResultID);
                FormTheGamesDBImageMode frm2 = new FormTheGamesDBImageMode(gm.Images);
                if (frm2.ShowDialog(this) == DialogResult.OK)
                {
                    // Browse for a folder
                    FolderBrowserDialog fol = new FolderBrowserDialog();

                    string selectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);

                    switch (MODE)
                    {
                        case DetectMode.COVERS:
                            {
                                if (Program.Settings.Database_FoldersCovers != null)
                                    if (Program.Settings.Database_FoldersCovers.Count > 0)
                                        selectedPath = Program.Settings.Database_FoldersCovers[0];
                                break;
                            }
                        case DetectMode.SNAPS:
                            {
                                if (Program.Settings.Database_FoldersSnapshots != null)
                                    if (Program.Settings.Database_FoldersSnapshots.Count > 0)
                                        selectedPath = Program.Settings.Database_FoldersSnapshots[0];
                                break;
                            }
                    }
                    fol.SelectedPath = selectedPath;
                    fol.Description = Program.ResourceManager.GetString("Title_ChooseWhereToDownloadTheFiles");
                    if (fol.ShowDialog(this) == DialogResult.OK)
                    {
                        List<string> links = new List<string>();
                        if (frm2.SelectedBanners)
                        {
                            for (int i = 0; i < gm.Images.Banners.Count; i++)
                                links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.Banners[i].Path);
                        }
                        else if (frm2.SelectedBoxArtBack)
                        {
                            links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.BoxartBack.Path);
                        }
                        else if (frm2.SelectedBoxArtFront)
                        {
                            links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.BoxartFront.Path);
                        }
                        else if (frm2.SelectedFanart)
                        {
                            for (int i = 0; i < gm.Images.Fanart.Count; i++)
                                links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.Fanart[i].Path);
                        }
                        else if (frm2.SelectedScreenshots)
                        {
                            for (int i = 0; i < gm.Images.Screenshots.Count; i++)
                                links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.Screenshots[i].Path);
                        }
                        FormDownloadFiles down = new FormDownloadFiles(fol.SelectedPath, links.ToArray(), entryName);
                        if (down.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                        {
                            if (down.DownloadedPaths.Count > 0)
                            {
                                foreach (string file in down.DownloadedPaths)
                                {
                                    // Make sure this file isn't exist for selected game
                                    bool found = false;
                                    if (detects != null)
                                    {
                                        foreach (MyNesDetectEntryInfo inf in detects)
                                        {
                                            if (inf.Path == file)
                                            {
                                                found = true; break;
                                            }
                                        }
                                    }
                                    if (!found)
                                    {
                                        // Add it !
                                        MyNesDetectEntryInfo newDetect = new MyNesDetectEntryInfo();
                                        newDetect.GameID = currentID;
                                        newDetect.Path = file;
                                        newDetect.Name = Path.GetFileNameWithoutExtension(file);
                                        newDetect.FileInfo = "";
                                        MyNesDB.AddDetect(MODE.ToString(), newDetect);
                                    }
                                }
                                RefreshForEntry(currentID);
                            }
                            // Save folder 
                            switch (MODE)
                            {
                                case DetectMode.COVERS:
                                    {
                                        if (Program.Settings.Database_FoldersCovers != null)
                                            if (!Program.Settings.Database_FoldersCovers.Contains(fol.SelectedPath))
                                                Program.Settings.Database_FoldersCovers.Insert(0, fol.SelectedPath);
                                        break;
                                    }
                                case DetectMode.SNAPS:
                                    {
                                        if (Program.Settings.Database_FoldersSnapshots != null)
                                            if (!Program.Settings.Database_FoldersSnapshots.Contains(fol.SelectedPath))
                                                Program.Settings.Database_FoldersSnapshots.Insert(0, fol.SelectedPath);
                                        break;
                                    }
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void toolStripButton_get_tgdb_Click(object sender, EventArgs e)
        {
            if (currentID == "") return;
            string entryName = MyNesDB.GetEntry(currentID).Name;
            FormSearchTheGamesDB frm = new FormSearchTheGamesDB(entryName);
            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                // Set the data
                richTextBox1.Clear();
                Game gm = GamesDB.GetGame(frm.SelectedResultID);
                richTextBox1.Text = gm.Overview;
                if (fileIndex >= 0 && fileIndex < detects.Length)
                {
                    //save
                    toolStripButton_SaveChanges_Click(sender, e);
                }
                else
                {
                    SaveFileDialog sav = new SaveFileDialog();
                    sav.Title = Program.ResourceManager.GetString("Title_NewInfoFile");
                    sav.Filter = Program.ResourceManager.GetString("Filter_InfoFile");
                    // Determine file name
                    MyNesDBEntryInfo entry = MyNesDB.GetEntry(currentID);
                    sav.FileName = entry.Name + ".txt";
                    if (sav.ShowDialog(this) == DialogResult.OK)
                    {
                        // Save the file !
                        switch (Path.GetExtension(sav.FileName).ToLower())
                        {
                            case ".rtf":
                            case ".doc": richTextBox1.SaveFile(sav.FileName); break;
                            default: File.WriteAllLines(sav.FileName, richTextBox1.Lines, Encoding.UTF8); break;
                        }
                        // Make sure this file isn't exist for selected game
                        bool found = false;
                        if (detects != null)
                        {
                            for (int i = 0; i < detects.Length; i++)
                            {
                                if (detects[i].Path == sav.FileName)
                                {

                                    fileIndex = i;
                                    ShowCurrentFile();
                                    found = true;
                                    return;
                                }
                            }
                        }
                        if (!found)
                        {
                            // Add it !
                            MyNesDetectEntryInfo newDetect = new MyNesDetectEntryInfo();
                            newDetect.GameID = currentID;
                            newDetect.Path = sav.FileName;
                            newDetect.Name = Path.GetFileNameWithoutExtension(sav.FileName);
                            newDetect.FileInfo = "";
                            MyNesDB.AddDetect("INFOS", newDetect);
                            // Refresh
                            RefreshForEntry(currentID);
                            fileIndex = detects.Length - 1;
                            ShowCurrentFile();
                        }
                    }
                }
            }
        }
Beispiel #4
0
        private void toolStripButton_search_tgdb_Click(object sender, EventArgs e)
        {
            if (currentID == "")
            {
                return;
            }
            string entryName         = MyNesDB.GetEntry(currentID).Name;
            FormSearchTheGamesDB frm = new FormSearchTheGamesDB(entryName);

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                TheGamesDBAPI.Game      gm   = TheGamesDBAPI.GamesDB.GetGame(frm.SelectedResultID);
                FormTheGamesDBImageMode frm2 = new FormTheGamesDBImageMode(gm.Images);
                if (frm2.ShowDialog(this) == DialogResult.OK)
                {
                    // Browse for a folder
                    FolderBrowserDialog fol = new FolderBrowserDialog();

                    string selectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);

                    switch (MODE)
                    {
                    case DetectMode.COVERS:
                    {
                        if (Program.Settings.Database_FoldersCovers != null)
                        {
                            if (Program.Settings.Database_FoldersCovers.Count > 0)
                            {
                                selectedPath = Program.Settings.Database_FoldersCovers[0];
                            }
                        }
                        break;
                    }

                    case DetectMode.SNAPS:
                    {
                        if (Program.Settings.Database_FoldersSnapshots != null)
                        {
                            if (Program.Settings.Database_FoldersSnapshots.Count > 0)
                            {
                                selectedPath = Program.Settings.Database_FoldersSnapshots[0];
                            }
                        }
                        break;
                    }
                    }
                    fol.SelectedPath = selectedPath;
                    fol.Description  = Program.ResourceManager.GetString("Title_ChooseWhereToDownloadTheFiles");
                    if (fol.ShowDialog(this) == DialogResult.OK)
                    {
                        List <string> links = new List <string>();
                        if (frm2.SelectedBanners)
                        {
                            for (int i = 0; i < gm.Images.Banners.Count; i++)
                            {
                                links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.Banners[i].Path);
                            }
                        }
                        else if (frm2.SelectedBoxArtBack)
                        {
                            links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.BoxartBack.Path);
                        }
                        else if (frm2.SelectedBoxArtFront)
                        {
                            links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.BoxartFront.Path);
                        }
                        else if (frm2.SelectedFanart)
                        {
                            for (int i = 0; i < gm.Images.Fanart.Count; i++)
                            {
                                links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.Fanart[i].Path);
                            }
                        }
                        else if (frm2.SelectedScreenshots)
                        {
                            for (int i = 0; i < gm.Images.Screenshots.Count; i++)
                            {
                                links.Add(TheGamesDBAPI.GamesDB.BaseImgURL + gm.Images.Screenshots[i].Path);
                            }
                        }
                        FormDownloadFiles down = new FormDownloadFiles(fol.SelectedPath, links.ToArray(), entryName);
                        if (down.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                        {
                            if (down.DownloadedPaths.Count > 0)
                            {
                                foreach (string file in down.DownloadedPaths)
                                {
                                    // Make sure this file isn't exist for selected game
                                    bool found = false;
                                    if (detects != null)
                                    {
                                        foreach (MyNesDetectEntryInfo inf in detects)
                                        {
                                            if (inf.Path == file)
                                            {
                                                found = true; break;
                                            }
                                        }
                                    }
                                    if (!found)
                                    {
                                        // Add it !
                                        MyNesDetectEntryInfo newDetect = new MyNesDetectEntryInfo();
                                        newDetect.GameID   = currentID;
                                        newDetect.Path     = file;
                                        newDetect.Name     = Path.GetFileNameWithoutExtension(file);
                                        newDetect.FileInfo = "";
                                        MyNesDB.AddDetect(MODE.ToString(), newDetect);
                                    }
                                }
                                RefreshForEntry(currentID);
                            }
                            // Save folder
                            switch (MODE)
                            {
                            case DetectMode.COVERS:
                            {
                                if (Program.Settings.Database_FoldersCovers != null)
                                {
                                    if (!Program.Settings.Database_FoldersCovers.Contains(fol.SelectedPath))
                                    {
                                        Program.Settings.Database_FoldersCovers.Insert(0, fol.SelectedPath);
                                    }
                                }
                                break;
                            }

                            case DetectMode.SNAPS:
                            {
                                if (Program.Settings.Database_FoldersSnapshots != null)
                                {
                                    if (!Program.Settings.Database_FoldersSnapshots.Contains(fol.SelectedPath))
                                    {
                                        Program.Settings.Database_FoldersSnapshots.Insert(0, fol.SelectedPath);
                                    }
                                }
                                break;
                            }
                            }
                        }
                    }
                }
            }
        }