private void btSave_Click(object sender, EventArgs e) { if (null != slLogger) { slLogger.Trace(">> Save PNG Click"); } if (!String.IsNullOrEmpty(_currentFilePathImg)) { String sFileName = _currentFilePathImg; try { pbCover.Image.Save(sFileName, ImageFormat.Png); _currentFilePathImg = sFileName; lbCurrentPngFile.Text = _currentFilePathImg; btSave.Enabled = true; btPictureReload.Enabled = true; MyProcessHelper pPngQuant = new MyProcessHelper(Application.StartupPath + "\\pngquant\\pngquant.exe", sFileName + " --force --ext .png --verbose"); pPngQuant.DoIt(); // pngquant "test/1.png" "test1/1.png" --force --ext .png --verbose if (null == newGame) { newGame = new ClGameStructure("", true, true); } newGame.PngMissing = false; newGame.setPicture(sFileName, (Image)(new Bitmap(pbCover.Image))); } catch (Exception ex) { if (null != slLogger) { slLogger.Fatal(ex.Message); } } } if (null != slLogger) { slLogger.Trace("<< Save PNG Click"); } }
public Form23(String sFolderPath, SimpleLogger sl, Dictionary <String, ClPS1Game> dcClPS1Games, ClVersionHelper cvh) { InitializeComponent(); _folderPath = sFolderPath; slLogger = sl; dcPs1Games = dcClPS1Games; _versionBS = cvh; newGame = null; _currentFilePathIni = String.Empty; _docHtmlStr = String.Empty; lbCurrentGameIniFile.Text = _currentFilePathIni; btSaveIni.Enabled = false; btReloadTitleDiscs.Enabled = false; btIniReload.Enabled = false; pbCover.AllowDrop = true; _currentFilePathImg = String.Empty; lbCurrentPngFile.Text = _currentFilePathImg; btSave.Enabled = false; btPictureReload.Enabled = false; }
public Form11(String sFolderPath, SimpleLogger sl, ClGameStructure myGame, ClVersionHelper cvh) { InitializeComponent(); slLogger = sl; newGame = myGame; _versionBS = cvh; _originFolderPath = sFolderPath; _folderPath = sFolderPath + "\\" + newGame.FolderIndex + cvh.GameDataFolder; _sDefaultContent = String.Empty; if (newGame.BypassLaunchScript) { tbLaunchContent.Clear(); try { using (StreamReader sr = new StreamReader(_folderPath + "\\" + "launch.sh")) { String sline = String.Empty; while ((sline = sr.ReadLine()) != null) { tbLaunchContent.AppendText(sline.Trim() + Environment.NewLine); _sDefaultContent += sline.Trim() + Environment.NewLine; } } } catch (Exception ex) { slLogger.Fatal(ex.Message); } } lbFiles.Items.Clear(); if (newGame.Filenames.Count > 0) { foreach (String s in newGame.Filenames) { lbFiles.Items.Add(s); } } }
public Form4(String sFolderPath, SimpleLogger sl, ClGameStructure myGame, ClVersionHelper cvh) { InitializeComponent(); slLogger = sl; newGame = myGame; _versionBS = cvh; _folderPath = sFolderPath + "\\" + newGame.FolderIndex + cvh.GameDataFolder; if (!newGame.CueMissing) { int cueCount = 0; foreach (String s in newGame.Filenames) { if (s.EndsWith(".cue")) { cueCount++; GroupBox gb = new GroupBox(); gb.Text = s; gb.Width = 400; gb.Height = 250; gb.Parent = flpCueFiles; TextBox tb = new TextBox(); tb.Multiline = true; tb.Parent = gb; tb.Dock = DockStyle.Top; tb.Height = 200; tb.ScrollBars = ScrollBars.Both; //tb.ReadOnly = true; if (File.Exists(_folderPath + "\\" + s)) { using (StreamReader sr = new StreamReader(_folderPath + "\\" + s)) { String sline = String.Empty; while ((sline = sr.ReadLine()) != null) { tb.AppendText(sline + Environment.NewLine); } } } Button btSave = new Button(); btSave.Text = "Save"; btSave.Parent = gb; btSave.Top = 220; btSave.Left = 4; //btSave.Enabled = false; btSave.Tag = (object)(gb); btSave.Click += cueSave; Button btAutoedit = new Button(); btAutoedit.Text = "Auto"; btAutoedit.Parent = gb; btAutoedit.Top = 220; btAutoedit.Left = 90; //btAutoedit.Enabled = false; btAutoedit.Tag = (object)(gb); btAutoedit.Click += cueAuto; } } if (cueCount > 2) { this.Width = 994; } } lbBinFiles.Items.Clear(); if (!newGame.BinMissing) { if (newGame.Filenames.Count > 0) { foreach (String s in newGame.Filenames) { if (s.EndsWith(".bin")) { lbBinFiles.Items.Add(s); } } } } }
public bool IsSame(ClGameStructure cgs) { bool b = true; if (b) { b &= (Title == cgs.Title); } if (b) { b &= (FolderIndex == cgs.FolderIndex); } if (b) { b &= (IndexAndTitle == cgs.IndexAndTitle); } if (b) { b &= (Alphatitle == cgs.Alphatitle); } if (b) { b &= (Discs == cgs.Discs); } if (b) { b &= (Publisher == cgs.Publisher); } if (b) { b &= (Developer == cgs.Developer); } if (b) { b &= (Year == cgs.Year); } if (b) { b &= (Players == cgs.Players); } if (b) { b &= (GameDataMissing == cgs.GameDataMissing); } if (b) { b &= (IniMissing == cgs.IniMissing); } if (b) { b &= (CfgMissing == cgs.CfgMissing); } if (b) { b &= (CueMissing == cgs.CueMissing); } if (b) { b &= (BinMissing == cgs.BinMissing); } if (b) { b &= (NanFolder == cgs.NanFolder); } if (b) { b &= (PngMissing == cgs.PngMissing); } if (b) { b &= (PngMultiple == cgs.PngMultiple); } if (b) { b &= (IniIncomplete == cgs.IniIncomplete); } if (b) { b &= (PngMismatch == cgs.PngMismatch); } if (b) { b &= (BadCueName == cgs.BadCueName); } if (b) { b &= (BadBinName == cgs.BadBinName); } if (b) { b &= (CueCountMisMatchDiscsCount == cgs.CueCountMisMatchDiscsCount); } if (b) { b &= (PictureFileName == cgs.PictureFileName); } if (b) { b &= (NeededSbiMissing == cgs.NeededSbiMissing); } if (b) { b &= (CommaInFilename == cgs.CommaInFilename); } if (b) { b &= (PbpMissing == cgs.PbpMissing); } if (b) { b &= (BadPbpName == cgs.BadPbpName); } if (b) { b &= (PbpCountMisMatchDiscsCount == cgs.PbpCountMisMatchDiscsCount); } if (b) { b &= (BadDiscsName == cgs.BadDiscsName); } if (b) { b &= (PbpErrors == cgs.PbpErrors); } if (b) { b &= (CueErrors == cgs.CueErrors); } if (b) { b &= (BinErrors == cgs.BinErrors); } if (b) { b &= (SbiErrors == cgs.SbiErrors); } if (b) { b &= (PngErrors == cgs.PngErrors); } if (b) { b &= (IniErrors == cgs.IniErrors); } if (b) { b &= (FileErrors == cgs.FileErrors); } if (b) { b &= (GeneralError == cgs.GeneralError); } if (b) { b &= (GeneralWarning == cgs.GeneralWarning); } if ((b) && (ErrorString != null) && (cgs.ErrorString != null)) { b &= (ErrorString.Count == cgs.ErrorString.Count); } if ((b) && (FilesBinOk != null) && (cgs.FilesBinOk != null)) { b &= (FilesBinOk.Count == cgs.FilesBinOk.Count); } if ((b) && (FilesCueOk != null) && (cgs.FilesCueOk != null)) { b &= (FilesCueOk.Count == cgs.FilesCueOk.Count); } if ((b) && (FilesSbiOk != null) && (cgs.FilesSbiOk != null)) { b &= (FilesSbiOk.Count == cgs.FilesSbiOk.Count); } if ((b) && (FilesPbpOk != null) && (cgs.FilesPbpOk != null)) { b &= (FilesPbpOk.Count == cgs.FilesPbpOk.Count); } if ((b) && (Filenames != null) && (cgs.Filenames != null)) { b &= (Filenames.Count == cgs.Filenames.Count); } return(b); }
private void btSaveAs_Click(object sender, EventArgs e) { if (null != slLogger) { slLogger.Trace(">> Save as PNG Click"); } if (Directory.Exists(_folderPath)) { sfdGeneSaveImage.InitialDirectory = _folderPath; } String sDefFile = "Game.png"; if (null == newGame) { } else { if (!String.IsNullOrEmpty(newGame.PictureFileName)) { sDefFile = newGame.PictureFileName; sfdGeneSaveImage.FileName = sDefFile; } else if (!String.IsNullOrEmpty(newGame.Discs)) { sDefFile = newGame.Discs.Split(',')[0] + ".png"; sfdGeneSaveImage.FileName = sDefFile; } } if (DialogResult.OK == sfdGeneSaveImage.ShowDialog()) { String sFileName = sfdGeneSaveImage.FileName; try { pbCover.Image.Save(sFileName, ImageFormat.Png); _currentFilePathImg = sFileName; lbCurrentPngFile.Text = _currentFilePathImg; btSave.Enabled = true; btPictureReload.Enabled = true; MyProcessHelper pPngQuant = new MyProcessHelper(Application.StartupPath + "\\pngquant\\pngquant.exe", sFileName + " --force --ext .png --verbose"); pPngQuant.DoIt(); if (null == newGame) { newGame = new ClGameStructure("", true, true); } newGame.PngMissing = false; newGame.setPicture(sFileName, (Image)(new Bitmap(pbCover.Image))); } catch (Exception ex) { if (null != slLogger) { slLogger.Fatal(ex.Message); } } } // pngquant "test/1.png" "test1/1.png" --force --ext .png --verbose if (null != slLogger) { slLogger.Trace("<< Save as PNG Click"); } }
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; }
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"); } }
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"); } }