public void BcdToIntTest() { int validValueCount = 0; for (int i = 0; i <= byte.MaxValue; i++) { var hex = $"{i:X2}"; var result = Regex.Match(hex, @"\d{2}"); if (result.Success) { int.Parse(hex).Should().Be(IfoParser.BcdToInt((byte)i)); Console.Write($"[{hex}->{IfoParser.BcdToInt((byte)i):D3}] "); ++validValueCount; } else { Console.Write($"({hex}->{IfoParser.BcdToInt((byte)i):D3}) "); } Console.Write((i + 1) % 8 == 0 ? Environment.NewLine : string.Empty); } Console.WriteLine($"Valid BCD Code under 8 bit: {validValueCount}"); }
private void OpenIfoFile(string fileName) { Clear(); textBoxIfoFileName.Text = fileName; // List vob files string path = Path.GetDirectoryName(fileName); string onlyFileName = Path.GetFileNameWithoutExtension(fileName); string searchPattern = onlyFileName.Substring(0, onlyFileName.Length - 1) + "?.VOB"; listBoxVobFiles.Items.Clear(); for (int i = 1; i < 30; i++) { string vobFileName = searchPattern.Replace("?", i.ToString(CultureInfo.InvariantCulture)); if (File.Exists(Path.Combine(path, vobFileName))) { listBoxVobFiles.Items.Add(Path.Combine(path, vobFileName)); } } if (listBoxVobFiles.Items.Count == 0) { searchPattern = onlyFileName.Substring(0, onlyFileName.Length - 1) + "PGC_01_?.VOB"; for (int i = 1; i < 30; i++) { string vobFileName = searchPattern.Replace("?", i.ToString(CultureInfo.InvariantCulture)); if (File.Exists(Path.Combine(path, vobFileName))) { listBoxVobFiles.Items.Add(Path.Combine(path, vobFileName)); } } } using (var ifoParser = new IfoParser(fileName)) { if (!string.IsNullOrEmpty(ifoParser.ErrorMessage)) { Clear(); MessageBox.Show(ifoParser.ErrorMessage); return; } // List info labelIfoFile.Text = _language.IfoFile + ": " + ifoParser.VideoTitleSetVobs.VideoStream.Resolution; bool isPal = ifoParser.VideoTitleSetVobs.VideoStream.Standard.Equals("PAL", StringComparison.OrdinalIgnoreCase); if (isPal) { radioButtonPal.Checked = true; } else { radioButtonNtsc.Checked = true; } // List languages comboBoxLanguages.Items.Clear(); foreach (string s in ifoParser.VideoTitleSetVobs.GetAllLanguages()) { comboBoxLanguages.Items.Add(s); } if (comboBoxLanguages.Items.Count > 0) { comboBoxLanguages.SelectedIndex = 0; } // Save palette (Color LookUp Table) if (ifoParser.VideoTitleSetProgramChainTable.ProgramChains.Count > 0) { Palette = ifoParser.VideoTitleSetProgramChainTable.ProgramChains[0].ColorLookupTable; } ifoParser.Dispose(); } buttonStartRipping.Enabled = listBoxVobFiles.Items.Count > 0; }
private void OpenIfoFile(string fileName) { Clear(); textBoxIfoFileName.Text = fileName; // List vob files string path = Path.GetDirectoryName(fileName); string onlyFileName = Path.GetFileNameWithoutExtension(fileName); string searchPattern = onlyFileName.Substring(0, onlyFileName.Length - 1) + "?.VOB"; listBoxVobFiles.Items.Clear(); for (int i = 1; i < 30; i++) { string vobFileName = searchPattern.Replace("?", i.ToString(CultureInfo.InvariantCulture)); if (File.Exists(Path.Combine(path, vobFileName))) listBoxVobFiles.Items.Add(Path.Combine(path, vobFileName)); } if (listBoxVobFiles.Items.Count == 0) { searchPattern = onlyFileName.Substring(0, onlyFileName.Length - 1) + "PGC_01_?.VOB"; for (int i = 1; i < 30; i++) { string vobFileName = searchPattern.Replace("?", i.ToString(CultureInfo.InvariantCulture)); if (File.Exists(Path.Combine(path, vobFileName))) listBoxVobFiles.Items.Add(Path.Combine(path, vobFileName)); } } using (var ifoParser = new IfoParser(fileName)) { if (!string.IsNullOrEmpty(ifoParser.ErrorMessage)) { Clear(); MessageBox.Show(ifoParser.ErrorMessage); return; } // List info labelIfoFile.Text = _language.IfoFile + ": " + ifoParser.VideoTitleSetVobs.VideoStream.Resolution; bool isPal = ifoParser.VideoTitleSetVobs.VideoStream.Standard.Equals("PAL", StringComparison.OrdinalIgnoreCase); if (isPal) radioButtonPal.Checked = true; else radioButtonNtsc.Checked = true; // List languages comboBoxLanguages.Items.Clear(); foreach (string s in ifoParser.VideoTitleSetVobs.GetAllLanguages()) comboBoxLanguages.Items.Add(s); if (comboBoxLanguages.Items.Count > 0) comboBoxLanguages.SelectedIndex = 0; // Save palette (Color LookUp Table) if (ifoParser.VideoTitleSetProgramChainTable.ProgramChains.Count > 0) Palette = ifoParser.VideoTitleSetProgramChainTable.ProgramChains[0].ColorLookupTable; ifoParser.Dispose(); } buttonStartRipping.Enabled = listBoxVobFiles.Items.Count > 0; }