private void TryParseDatHeader(CmpReader reader, out string version, out string comment) { version = comment = null; if (reader.OpenItem()) { while (reader.NextItem()) { if (reader.SelectionName == "version") { if (version == null) { version = reader.SelectionValue; } } else if (reader.SelectionName == "comment") { if (comment == null) { comment = reader.SelectionValue; } } } } reader.CloseItem(); }
private ClrMameProParser(DBConfig.Database info, string document, IList <Platforms> platform) { this.info = info; this.reader = new CmpReader(document); this.document = document; result = new RomDB(platform, info.Name); }
public void CharaMakeColorSelectorLips(CmpReader colorMap, int start, int length) { colorListView.Items.Clear(); for (int i = start; i < start + length; i++) { ListViewItem item = new ListViewItem(); item.Width = 48; item.Height = 48; var newColor = new SolidColorBrush(Color.FromArgb(colorMap.Colors[i].A, colorMap.Colors[i].R, colorMap.Colors[i].G, colorMap.Colors[i].B)); item.Background = newColor; item.FontSize = 14; item.Content = "D:" + (i - start); colorListView.Items.Add(item); } for (int i = 0; i < 32; i++) { ListViewItem item = new ListViewItem(); item.Width = 48; item.Height = 48; item.FontSize = 14; item.Visibility = Visibility.Collapsed; colorListView.Items.Add(item); } for (int i = 1792; i < 1792 + 96; i++) { ListViewItem item = new ListViewItem(); item.Width = 48; item.Height = 48; var newColor = new SolidColorBrush(Color.FromArgb(colorMap.Colors[i].A, colorMap.Colors[i].R, colorMap.Colors[i].G, colorMap.Colors[i].B)); item.Background = newColor; item.FontSize = 14; item.Content = "L:" + (i - (1792 - 128)); colorListView.Items.Add(item); } }
private void Form1_Load(object sender, EventArgs e) { var cmp = new CmpReader(File.ReadAllBytes("human.cmp")); for (int i = 0; i < cmp.Colors.Count; i++) { var item = new ListViewItem(i.ToString()); item.BackColor = cmp.Colors[i]; listView1.Items.Add(item); } }
public void CharaMakeColorSelector(CmpReader colorMap, int start, int length) { colorListView.Items.Clear(); for (int i = start; i < start + length; i++) { ListViewItem item = new ListViewItem(); item.Width = 48; item.Height = 48; var newColor = new SolidColorBrush(Color.FromArgb(colorMap.Colors[i].A, colorMap.Colors[i].R, colorMap.Colors[i].G, colorMap.Colors[i].B)); item.Background = newColor; item.FontSize = 18; item.Content = (i - start); colorListView.Items.Add(item); } }
public CharaMakeColorSelector(CmpReader colorMap, int start, int length, int selection) { InitializeComponent(); for (int i = start; i < start + length; i++) { var item = new ListViewItem((i - start).ToString()); item.BackColor = colorMap.Colors[i]; colorListView.Items.Add(item); } _startIndex = start; colorListView.SelectedIndices.Add(selection); }
private void TryParseGame(CmpReader reader) { if (reader.OpenItem()) { RomDB.Entry entry = new RomDB.Entry(); string name = null; string crc32 = null; string sha1 = null; string md5 = null; string size = null; bool romRead = false; while (reader.NextItem()) { if (reader.SelectionName == "name" & name == null) { name = reader.SelectionValue; } else if (reader.SelectionName == "rom" & !romRead) { if (reader.OpenItem()) { romRead = true; while (reader.NextItem()) { if (reader.SelectionName == "size" & size == null) { size = reader.SelectionValue; } else if (reader.SelectionName == "crc" & crc32 == null) { crc32 = reader.SelectionValue; } else if (reader.SelectionName == "sha1" & sha1 == null) { sha1 = reader.SelectionValue; } else if (reader.SelectionName == "md5" && md5 == null) { md5 = reader.SelectionValue; } } } reader.CloseItem(); } } if (name != null) { entry.name = name; if (size != null) { entry.size = ParseInt(size); } // Todo: report invalidly sized hashes? if (crc32 != null) { var crc32hash = new RomHash(ParseHexBytes(crc32), GetHashFlags(HashFlags.CRC32)); if (crc32hash.Value.Length == 4) { entry.Hashes.Add(crc32hash); } } if (sha1 != null) { var sha1Hash = new RomHash(ParseHexBytes(sha1), GetHashFlags(HashFlags.SHA1)); if (sha1Hash.Value.Length == 20) { entry.Hashes.Add(sha1Hash); } } if (md5 != null) { var md5Hash = new RomHash(ParseHexBytes(md5), GetHashFlags(HashFlags.MD5)); if (md5Hash.Value.Length == 16) { entry.Hashes.Add(md5Hash); } } } reader.CloseItem(); result.AddEntry(entry); } }