Example #1
0
 private void btScrapeImg_Click(object sender, EventArgs e)
 {
     if (null != slLogger)
     {
         slLogger.Trace(">> Scrape image Click");
     }
     try
     {
         using (Bitmap bm = new Bitmap(pbTmp.Image))
         {
             pbCover.Image = ClPbHelper.ResizeImage((Image)(new Bitmap(bm)), 226, 226);
         }
     }
     catch (Exception ex)
     {
         if (null != slLogger)
         {
             slLogger.Fatal(ex.Message);
         }
     }
     if (null != slLogger)
     {
         slLogger.Trace("<< Scrape image Click");
     }
 }
Example #2
0
 private void pbCover_DragDrop(object sender, DragEventArgs e)
 {
     if (null != slLogger)
     {
         slLogger.Trace(">> Dragdrop image");
     }
     try
     {
         String[] sFileList = (String[])e.Data.GetData(DataFormats.FileDrop, false);
         if (sFileList.Length == 1)
         {
             String        sExt          = Path.GetExtension(sFileList[0]).ToLower();
             List <String> lsAcceptedExt = new List <string>()
             {
                 ".png", ".jpg", ".jpeg", ".bmp"
             };
             if (lsAcceptedExt.IndexOf(sExt) > -1)
             {
                 using (Bitmap bmPicture = new Bitmap(sFileList[0]))
                 {
                     pbCover.Image = ClPbHelper.ResizeImage((Image)(new Bitmap(bmPicture)), 226, 226);
                 }
             }
             else
             {
                 if (null != slLogger)
                 {
                     slLogger.Error("Extension " + sExt + " not accepted. Dragdrop a file with extension png, bmp, jpg or jpeg.");
                 }
             }
         }
         else
         {
             FlexibleMessageBox.Show("Only one file for drag&drop operation please.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             if (null != slLogger)
             {
                 slLogger.Error("Dragdrop only one file please.");
             }
         }
     }
     catch (Exception ex)
     {
         if (null != slLogger)
         {
             slLogger.Fatal(ex.Message);
         }
     }
     if (null != slLogger)
     {
         slLogger.Trace("<< Dragdrop image");
     }
 }
Example #3
0
        private void btChooseKeepFiles_Click(object sender, EventArgs e)
        {
            slLogger.Trace(">> Keep 2 files Click");
            String sFilename = _leftFilename + ".bak";

            if (File.Exists(sFilename))
            {
                int    i          = 0;
                String sFilenameN = sFilename + i.ToString();
                while (File.Exists(sFilenameN))
                {
                    i++;
                    sFilenameN = sFilename + i.ToString();
                }
                sFilename = sFilenameN;
            }
            ClPbHelper.SaveGameIni(sFilename, _dcRight, slLogger);
            slLogger.Trace("<< Keep 2 files Click");
        }
Example #4
0
 private void btPictureReload_Click(object sender, EventArgs e)
 {
     if (null != slLogger)
     {
         slLogger.Trace(">> Picture Reload Click");
     }
     if (newGame == null)
     {
         //
     }
     else
     if (!newGame.PngMissing)
     {
         try
         {
             using (Bitmap bm = new Bitmap(newGame.PictureFile))
             {
                 pbCover.Image = ClPbHelper.ResizeImage((Image)(new Bitmap(bm)), 226, 226);
             }
             _currentFilePathImg     = newGame.PictureFileName;
             lbCurrentPngFile.Text   = _currentFilePathImg;
             btSave.Enabled          = true;
             btPictureReload.Enabled = true;
         }
         catch (Exception ex)
         {
             if (null != slLogger)
             {
                 slLogger.Fatal(ex.Message);
             }
         }
     }
     if (null != slLogger)
     {
         slLogger.Trace("<< Picture Reload Click");
     }
 }
Example #5
0
 private void btLoad_Click(object sender, EventArgs e)
 {
     if (null != slLogger)
     {
         slLogger.Trace(">> Load image Click");
     }
     if (Directory.Exists(_folderPath))
     {
         ofdGeneLoadImage.InitialDirectory = _folderPath;
     }
     if (DialogResult.OK == ofdGeneLoadImage.ShowDialog())
     {
         String sFileName = ofdGeneLoadImage.FileName;
         try
         {
             using (Bitmap bmPicture = new Bitmap(sFileName))
             {
                 pbCover.Image = ClPbHelper.ResizeImage((Image)(new Bitmap(bmPicture)), 226, 226);
             }
             _currentFilePathImg     = sFileName;
             lbCurrentPngFile.Text   = _currentFilePathImg;
             btSave.Enabled          = true;
             btPictureReload.Enabled = true;
         }
         catch (Exception ex)
         {
             if (null != slLogger)
             {
                 slLogger.Fatal(ex.Message);
             }
         }
     }
     if (null != slLogger)
     {
         slLogger.Trace("<< Load image Click");
     }
 }
Example #6
0
        private void btChooseMerged_Click(object sender, EventArgs e)
        {
            slLogger.Trace(">> Save Merged file Click");
            String s1 = lbMergedTitle.Text.Trim();
            String s2 = lbMergedDiscs.Text.Trim();
            String s3 = lbMergedPublisher.Text.Trim();
            String s4 = lbMergedAlphaTitle.Text.Trim();
            int    i1 = 1;
            int    i2 = 1995;

            try
            {
                i1 = int.Parse(lbMergedPlayers.Text);
            }
            catch (Exception ex)
            {
                //
            }
            try
            {
                i2 = int.Parse(lbMergedYear.Text);
            }
            catch (Exception ex)
            {
                //
            }
            Dictionary <String, String> dcTosave = new Dictionary <string, string>();

            dcTosave.Add("title", s1);
            dcTosave.Add("discs", s2);
            dcTosave.Add("publisher", s3);
            dcTosave.Add("alphatitle", s4);
            dcTosave.Add("players", i1.ToString());
            dcTosave.Add("year", i2.ToString());
            ClPbHelper.SaveGameIni(_leftFilename, dcTosave, slLogger);
            slLogger.Trace("<< Save Merged file Click");
        }
Example #7
0
        public Form23(String sFolderPath, SimpleLogger sl, Dictionary <String, ClPS1Game> dcClPS1Games, ClVersionHelper cvh, ClGameStructure myGame)
        {
            InitializeComponent();
            slLogger            = sl;
            dcPs1Games          = dcClPS1Games;
            _versionBS          = cvh;
            newGame             = myGame;
            _folderPath         = sFolderPath + "\\" + newGame.FolderIndex + _versionBS.GameDataFolder;
            _currentFilePathIni = String.Empty;
            _docHtmlStr         = String.Empty;
            btSaveIni.Enabled   = false;

            if (!newGame.IniMissing)
            {
                tbGeneTitle.Text      = newGame.Title;
                tbGeneDiscs.Text      = newGame.Discs;
                tbGenePublisher.Text  = newGame.Publisher;
                tbGeneAlphaTitle.Text = newGame.Alphatitle;
                try
                {
                    nuGenePlayers.Value = (decimal)int.Parse(newGame.Players);
                }
                catch (Exception ex)
                {
                    //
                }
                try
                {
                    nuGeneYear.Value = (decimal)int.Parse(newGame.Year);
                }
                catch (Exception ex)
                {
                    //
                }
                _currentFilePathIni        = _folderPath + "\\" + "Game.ini";
                lbCurrentGameIniFile.Text  = _currentFilePathIni;
                btSaveIni.Enabled          = true;
                btReloadTitleDiscs.Enabled = true;
                btIniReload.Enabled        = true;
                tbGeneSearchText.Text      = newGame.Title;
            }

            _currentFilePathImg     = String.Empty;
            lbCurrentPngFile.Text   = _currentFilePathImg;
            btSave.Enabled          = false;
            btPictureReload.Enabled = false;

            if (!newGame.PngMissing)
            {
                try
                {
                    pbCover.Image           = ClPbHelper.ResizeImage((Image)(new Bitmap(newGame.PictureFile)), 226, 226);
                    _currentFilePathImg     = newGame.PictureFileName;
                    lbCurrentPngFile.Text   = _currentFilePathImg;
                    btSave.Enabled          = true;
                    btPictureReload.Enabled = true;
                }
                catch (Exception ex)
                {
                    if (null != slLogger)
                    {
                        slLogger.Fatal(ex.Message);
                    }
                }
            }
            pbCover.AllowDrop = true;
        }
Example #8
0
        private void btSaveIni_Click(object sender, EventArgs e)
        {
            if (null != slLogger)
            {
                slLogger.Trace(">> Save Game.ini Click");
            }
            String s1 = ClPbHelper.RemoveQuotes(tbGeneTitle.Text); // have to be not empty
            String s2 = ClPbHelper.RemoveQuotes(tbGeneDiscs.Text); // have to be not empty

            if ((!String.IsNullOrEmpty(s1)) && (!(String.IsNullOrEmpty(s2))))
            {
                String s3   = ClPbHelper.RemoveQuotes(tbGenePublisher.Text);
                String s3_5 = ClPbHelper.RemoveQuotes(tbGeneDeveloper.Text);
                String s4   = ClPbHelper.RemoveQuotes(tbGeneAlphaTitle.Text);
                int    i1   = (int)(nuGenePlayers.Value);
                int    i2   = (int)(nuGeneYear.Value);
                if (!String.IsNullOrEmpty(_currentFilePathIni))
                {
                    String sFileName = _currentFilePathIni;
                    try
                    {
                        Dictionary <String, String> dcTosave = new Dictionary <string, string>();
                        dcTosave.Add("title", s1);
                        dcTosave.Add("discs", s2);
                        dcTosave.Add("publisher", s3);
                        dcTosave.Add("developer", s3_5);
                        dcTosave.Add("alphatitle", s4);
                        dcTosave.Add("players", i1.ToString());
                        dcTosave.Add("year", i2.ToString());
                        if (null != newGame)
                        {
                            dcTosave.Add("automation", newGame.ABautomation);
                            dcTosave.Add("highres", newGame.ABhighres);
                            dcTosave.Add("imagetype", newGame.ABimagetype);
                            dcTosave.Add("memcard", newGame.ABmemcard);
                        }
                        ClPbHelper.SaveGameIni(sFileName, dcTosave, slLogger);

                        _currentFilePathIni        = sFileName;
                        lbCurrentGameIniFile.Text  = _currentFilePathIni;
                        btSaveIni.Enabled          = true;
                        btReloadTitleDiscs.Enabled = true;
                        btIniReload.Enabled        = true;

                        if (null == newGame)
                        {
                            newGame = new ClGameStructure("", true, true);
                        }
                        newGame.IniMissing = false;
                        newGame.Title      = s1;
                        newGame.Discs      = s2;
                        newGame.Publisher  = s3;
                        newGame.Developer  = s3_5;
                        newGame.Alphatitle = s4;
                        try
                        {
                            newGame.Players = i1.ToString();
                        }
                        catch (Exception ex)
                        {
                            //
                        }
                        try
                        {
                            newGame.Year = i2.ToString();
                        }
                        catch (Exception ex)
                        {
                            //
                        }
                    }
                    catch (Exception ex)
                    {
                        if (null != slLogger)
                        {
                            slLogger.Fatal(ex.Message);
                        }
                    }
                }
            }
            else
            {
                FlexibleMessageBox.Show("You have to enter at least Title and Discs to continue...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            if (null != slLogger)
            {
                slLogger.Trace("<< Save Game.ini Click");
            }
        }
Example #9
0
 private void btLoadIni_Click(object sender, EventArgs e)
 {
     if (null != slLogger)
     {
         slLogger.Trace(">> Load Game.ini Click");
     }
     if (!String.IsNullOrEmpty(_currentFilePathIni))
     {
         ofdGeneLoadIni.InitialDirectory = _currentFilePathIni.Substring(0, _currentFilePathIni.LastIndexOf("\\"));
     }
     else
     if (Directory.Exists(_folderPath))
     {
         ofdGeneLoadIni.InitialDirectory = _folderPath;
     }
     if (DialogResult.OK == ofdGeneLoadIni.ShowDialog())
     {
         String sFileName = ofdGeneLoadIni.FileName;
         try
         {
             using (StreamReader sr = new StreamReader(sFileName))
             {
                 String s;
                 tbGeneDiscs.Clear();
                 tbGeneTitle.Clear();
                 tbGeneAlphaTitle.Clear();
                 tbGenePublisher.Clear();
                 tbGeneDeveloper.Clear();
                 nuGenePlayers.Value = (decimal)1;
                 nuGeneYear.Value    = (decimal)1995;
                 while ((s = sr.ReadLine()) != null)
                 {
                     if (s.StartsWith("Discs="))
                     {
                         tbGeneDiscs.Text = ClPbHelper.RemoveQuotes(s.Substring(6));
                     }
                     else
                     if (s.StartsWith("Title="))
                     {
                         tbGeneTitle.Text = ClPbHelper.RemoveQuotes(s.Substring(6));
                     }
                     else
                     if (s.StartsWith("Publisher="))
                     {
                         tbGenePublisher.Text = ClPbHelper.RemoveQuotes(s.Substring(10));
                     }
                     else
                     if (s.StartsWith("Developer="))
                     {
                         tbGeneDeveloper.Text = ClPbHelper.RemoveQuotes(s.Substring(10));
                     }
                     else
                     if (s.StartsWith("Players="))
                     {
                         try
                         {
                             nuGenePlayers.Value = (decimal)(int.Parse(ClPbHelper.RemoveQuotes(s.Substring(8))));
                         }
                         catch (Exception ex)
                         {
                             //
                         }
                     }
                     else
                     if (s.StartsWith("Year="))
                     {
                         try
                         {
                             nuGeneYear.Value = (decimal)(int.Parse(ClPbHelper.RemoveQuotes(s.Substring(5))));
                         }
                         catch (Exception ex)
                         {
                             //
                         }
                     }
                     else
                     if (s.StartsWith("AlphaTitle="))
                     {
                         tbGeneAlphaTitle.Text = ClPbHelper.RemoveQuotes(s.Substring(11));
                     }
                 }
             }
             if (null == newGame)
             {
                 newGame = new ClGameStructure("", true, true);
             }
             newGame.IniMissing = false;
             newGame.Title      = tbGeneTitle.Text;
             newGame.Discs      = tbGeneDiscs.Text;
             newGame.Publisher  = tbGenePublisher.Text;
             newGame.Developer  = tbGeneDeveloper.Text;
             newGame.Alphatitle = tbGeneAlphaTitle.Text;
             try
             {
                 newGame.Players = ((int)(nuGenePlayers.Value)).ToString();
             }
             catch (Exception ex)
             {
                 //
             }
             try
             {
                 newGame.Year = ((int)nuGeneYear.Value).ToString();
             }
             catch (Exception ex)
             {
                 //
             }
             _currentFilePathIni        = sFileName;
             lbCurrentGameIniFile.Text  = _currentFilePathIni;
             btSaveIni.Enabled          = true;
             btReloadTitleDiscs.Enabled = true;
             btIniReload.Enabled        = true;
         }
         catch (Exception ex)
         {
             if (null != slLogger)
             {
                 slLogger.Fatal(ex.Message);
             }
         }
     }
     if (null != slLogger)
     {
         slLogger.Trace("<< Load Game.ini Click");
     }
 }
Example #10
0
 private void btChooseRight_Click(object sender, EventArgs e)
 {
     slLogger.Trace(">> Save Right file Click");
     ClPbHelper.SaveGameIni(_leftFilename, _dcRight, slLogger);
     slLogger.Trace("<< Save Right file Click");
 }