public static ArrayList GetDuplicateSseqsList(string pSdatPath) { string fullPath = Path.GetFullPath(pSdatPath); ArrayList ret = null; if (!File.Exists(fullPath)) { throw new FileNotFoundException(String.Format("Cannot find file <{0}>", fullPath)); } else { if (Sdat.IsSdat(fullPath)) { using (FileStream fs = File.OpenRead(fullPath)) { Sdat sdat = new Sdat(); sdat.Initialize(fs, fullPath); ret = sdat.GetDuplicatesList(); } } } return(ret); }
private void LoadComboBox(string pSourcePath) { Smap.SmapSeqStruct s; this.dataGridSseq.Rows.Clear(); if (Sdat.IsSdat(pSourcePath)) { Smap smap = SdatUtil.GetSmapFromSdat(pSourcePath); DataGridViewRow row = new DataGridViewRow(); if ((smap.SseqSection != null) && (smap.SseqSection.Length > 0)) { // get duplicates list ArrayList duplicatesList = SdatUtil.GetDuplicateSseqsList(pSourcePath); // setup volume tracking struct this.sseqVolumeList = new Mk2sfWorker.VolumeChangeStruct[smap.SseqSection.Length]; // foreach (Smap.SmapSeqStruct s in smap.SseqSection) for (int i = 0; i < smap.SseqSection.Length; i++) { s = smap.SseqSection[i]; row = new DataGridViewRow(); row.CreateCells(this.dataGridSseq); row.Cells[1].Value = s.number.ToString("x4"); if (!String.IsNullOrEmpty(s.name)) { row.Cells[0].Value = true; row.Cells[2].Value = s.fileID.ToString(); row.Cells[3].Value = s.size.ToString().PadLeft(6, '0'); row.Cells[4].Value = s.name.ToString(); row.Cells[5].Value = s.bnk.ToString(); row.Cells[6].Value = s.vol.ToString(); row.Cells[7].Value = s.cpr.ToString(); row.Cells[8].Value = s.ppr.ToString(); row.Cells[9].Value = s.ply.ToString(); // add volume tracking this.sseqVolumeList[i].oldValue = s.vol; this.sseqVolumeList[i].newValue = s.vol; // check for duplicate if (duplicatesList.Contains(i)) { row.Cells[0].Value = false; row.DefaultCellStyle.BackColor = Color.Crimson; } } else { row.Cells[0].Value = false; } this.dataGridSseq.Rows.Add(row); } } } }