private void Filelistbox_SelectedIndexChanged_1(object sender, EventArgs e) { Patcheslistview.Items.Clear(); string[] patchnames = new string[1]; FileWrite File = new FileWrite(); switch(Filelistbox.SelectedIndex) { case -1: patchnames = BATTLEBIN.FindAllPatchNames(); File = BATTLEBIN; break; case 0: patchnames = BATTLEBIN.FindAllPatchNames(); File = BATTLEBIN; break; case 1: patchnames = WORLDBIN.FindAllPatchNames(); File = WORLDBIN; break; case 2: patchnames = WLDCOREBIN.FindAllPatchNames(); File = WLDCOREBIN; break; case 3: patchnames = SCUS.FindAllPatchNames(); File = SCUS; break; case 4: patchnames = REQUIREOUT.FindAllPatchNames(); File = REQUIREOUT; break; case 5: patchnames = EQUIPOUT.FindAllPatchNames(); File = EQUIPOUT; break; } int k = 1; Patcheslistview.View = View.Details; Patcheslistview.HeaderStyle = ColumnHeaderStyle.None; Patcheslistview.Columns.Add(""); Patcheslistview.Columns[0].Width = 500; //Patcheslistview.AutoResizeColumn(0,ColumnHeaderAutoResizeStyle.ColumnContent); Patches = new Patch[patchnames.Length]; foreach (string name in patchnames) { Patches[k - 1] = new Patch(); Patches[k - 1].name = name; Patcheslistview.Items.Add(k + " " + name); CheckforConflicts(name, File, Patches, k); k++; } int j = 0; foreach(Patch patch in Patches) { patch.ConvertConflicts(patchnames, File); if(patch.Conflictexists) { Patcheslistview.Items[j].BackColor = Color.Red; } j++; } }
public void CheckforConflicts(string name, FileWrite BIN, Patch[] Patches,int k) { int patchindex = 0; int otherpatchindex = 0; int[] conflictarray = new int[1]; for (patchindex = 0; patchindex < BIN.index; patchindex++) { if (name == BIN.Patchname[patchindex]) { Patches[k-1].AddOffset(BIN.startaddress[patchindex]); Patches[k-1].AddEndaddress(BIN.endaddress[patchindex]); Patches[k - 1].XMLFile = BIN.xmlfilename[patchindex]; for (otherpatchindex = 0; otherpatchindex < BIN.index; otherpatchindex++) { //if() if (BIN.startaddress[patchindex] < BIN.startaddress[otherpatchindex] && BIN.endaddress[patchindex] > BIN.startaddress[otherpatchindex]) { Patches[k-1].Conflictexists = true; Patches[k-1].AddConflict(BIN.startaddress[patchindex], otherpatchindex, BIN.startaddress[otherpatchindex]); } else if (BIN.startaddress[patchindex] > BIN.startaddress[otherpatchindex] && BIN.startaddress[patchindex] < BIN.endaddress[otherpatchindex]) { Patches[k-1].Conflictexists = true; Patches[k-1].AddConflict(BIN.startaddress[patchindex], otherpatchindex, BIN.startaddress[otherpatchindex]); } }//scan patch vs otherpatches } } #region code to scan each patch vs each other patch //for (patchindex = 0; patchindex < BIN.index; patchindex++) //{ // if (patchindex != otherpatchindex) // { // if (BIN.startaddress[patchindex] < BIN.startaddress[otherpatchindex] && // BIN.endaddress[patchindex] > BIN.startaddress[otherpatchindex]) // { // BIN.conflicts[patchindex] = true; // BIN.conflictindex[patchindex] = otherpatchindex; // conflictarray = otherpatchindex; // } // if (BIN.startaddress[patchindex] > BIN.startaddress[otherpatchindex] && // BIN.startaddress[patchindex] < BIN.endaddress[otherpatchindex]) // { // BIN.conflicts[patchindex] = true; // BIN.conflictindex[patchindex] = otherpatchindex; // } // } //} #endregion }
private void Filelistbox_SelectedIndexChanged_1(object sender, EventArgs e) { Patcheslistview.Items.Clear(); string[] patchnames = new string[1]; FileWrite File = new FileWrite(); switch (Filelistbox.SelectedIndex) { case -1: patchnames = BATTLEBIN.FindAllPatchNames(); File = BATTLEBIN; break; case 0: patchnames = BATTLEBIN.FindAllPatchNames(); File = BATTLEBIN; break; case 1: patchnames = WORLDBIN.FindAllPatchNames(); File = WORLDBIN; break; case 2: patchnames = WLDCOREBIN.FindAllPatchNames(); File = WLDCOREBIN; break; case 3: patchnames = SCUS.FindAllPatchNames(); File = SCUS; break; case 4: patchnames = REQUIREOUT.FindAllPatchNames(); File = REQUIREOUT; break; case 5: patchnames = EQUIPOUT.FindAllPatchNames(); File = EQUIPOUT; break; } int k = 1; Patcheslistview.View = View.Details; Patcheslistview.HeaderStyle = ColumnHeaderStyle.None; Patcheslistview.Columns.Add(""); Patcheslistview.Columns[0].Width = 500; //Patcheslistview.AutoResizeColumn(0,ColumnHeaderAutoResizeStyle.ColumnContent); Patches = new Patch[patchnames.Length]; foreach (string name in patchnames) { Patches[k - 1] = new Patch(); Patches[k - 1].name = name; Patcheslistview.Items.Add(k + " " + name); CheckforConflicts(name, File, Patches, k); k++; } int j = 0; foreach (Patch patch in Patches) { patch.ConvertConflicts(patchnames, File); if (patch.Conflictexists) { Patcheslistview.Items[j].BackColor = Color.Red; } j++; } }