public usercheck(List <ListViewItem> before, List <ListViewItem> after) { InitializeComponent(); foreach (var LVI in before) { beforelist.Items.Add(LVI); } foreach (var LVI in after) { afterlist.Items.Add(LVI); } var changes = 0; for (var a = 0; a < afterlist.Items.Count; a++) { var str1 = beforelist.Items[a].SubItems[1].Text; var str2 = afterlist.Items[a].SubItems[1].Text; var diff = str1.CompareTo(str2); if (diff != 0) { afterlist.Items[a].BackColor = Color.LightBlue; changes++; } else { afterlist.Items[a].BackColor = Color.White; } } if (changes == 0) { noChanges = true; this.Close(); return; } ListViewExtras.AutoResize(afterlist); ListViewExtras.AutoResize(beforelist); }
public static void DropInFiles(string[] files, ListView fileList) { var acceptall = false; var nochanges = false; const string YTA = "Yes To All"; const string nostr = "No"; const string noallstr = "No To All"; const string yesstr = "Yes"; const string cancelstr = "Cancel"; var l = new List <string>(); l.Add(YTA); l.Add(yesstr); l.Add(nostr); l.Add(noallstr); l.Add(cancelstr); foreach (var s in files) { var LVI = initLVI(fileList); LVI.Text = fileList.Items.Count.ToString(); LVI.Name = LVI.Text; LVI.SubItems.Add(s); Mp3File mf = null; var retrycount = 0; var retrymax = 10; retry: try { mf = new Mp3File(s); } catch (Exception exp) { retrycount++; if (retrycount >= retrymax) { MessageBox.Show("Error opening file:" + exp.ToString()); var DR = MessageBox.Show("Do you want to continue?", "option", MessageBoxButtons.YesNo); if (DR == DialogResult.No) { return; } continue; } //for a certain period, retry Thread.Sleep(100); goto retry; } LVI.Tag = mf; var sas = mf.Audio; sas.ScanWholeFile(); //clean files on entry var newData = new changes.TagHandlerUpdate(mf); if (nochanges == false) { Music_File_Info_Editor.changes.cleanMP3(newData); var changes = Music_File_Info_Editor.changes.areThereDifferences(mf, newData); var makechanges = true; if (changes && acceptall == false) { var tt = "The file:" + mf.FileName + " has a title/album/artist with blank characters at the start or end, or has multiple white space. Do you wish to fix these?"; var MMB = new MultipleMessageBox("option", tt, l); MMB.ShowDialog(); if (MMB.IsSet == false) { return; } switch (MMB.Result) { case cancelstr: return; case nostr: makechanges = false; break; case YTA: acceptall = true; break; case noallstr: makechanges = false; nochanges = true; break; } } if (makechanges) { if (Music_File_Info_Editor.changes.makeChangesAndContinue(newData, mf) == false) { return; } } } //only add if the name isnt there already var add = true; foreach (ListViewItem tt in fileList.Items) { var s1 = tt.SubItems[ListViewExtras.GetColumnNumber(fileList, "Path")].Text; if (s1.Equals(mf.FileName)) { add = false; break; } } if (add) { fileList.Items.Add(LVI); } } RefreshInfo(fileList); ListViewExtras.AutoResize(fileList); }
public void allServersToServerView() { ResetColours(GetAllCheckBoxes(filterpanel)); serverview.Items.Clear(); lvs.Enabled = false; var continueHit = new Dictionary <Control, int>(); int count = 0; int max = serversInstance.masterServers.Values.Count; foreach (Server s in serversInstance.masterServers.Values) { Controller.ToolStripText(toolStripStatusLabel1, ref statusStrip1, "Adding server " + count + "/" + max.ToString()); count++; if (inactivecheck.Checked == false && s.getVariable(Protocol.Protocol.pingSTR) == null) { ContinueHit(continueHit, inactivecheck); continue; } if (mapcheck.Checked && (s.getVariable(Protocol.Protocol.mapNameSTR) == null || s.getVariable(Protocol.Protocol.mapNameSTR) == mapdrop.Text == false)) { ContinueHit(continueHit, mapcheck); continue; } if (latencycheck.Checked && (s.getVariable(Protocol.Protocol.pingSTR) == null || (Controller.GetLatencyDrop(latencydrop) < Int32.Parse(s.getVariable(Protocol.Protocol.pingSTR))))) { ContinueHit(continueHit, latencycheck); continue; } if (punkbustercheck.Checked == false && (s.getVariable(Protocol.Protocol.punkBusterSTR) == null || s.getVariable(Protocol.Protocol.punkBusterSTR) == "1")) { ContinueHit(continueHit, punkbustercheck); continue; } if (pingcheck.Checked == false && (s.getVariable(Protocol.Protocol.maxPingSTR) == null || s.getVariable(Protocol.Protocol.pingSTR) == null || (Int32.Parse(s.getVariable(Protocol.Protocol.pingSTR)) > Int32.Parse(s.getVariable(Protocol.Protocol.maxPingSTR))))) { ContinueHit(continueHit, pingcheck); continue; } if (gametypecheck.Checked && (s.getVariable(Protocol.Protocol.gameTypeSTR) == null || gametypedrop.Text.Equals(s.getVariable(Protocol.Protocol.gameTypeSTR)) == false)) { ContinueHit(continueHit, gametypecheck); continue; } if (s.getVariable(Protocol.Protocol.clientsSTR) != null && s.getVariable(Protocol.Protocol.maxClientsSTR) != null) { if (allowfullcheck.Checked == false && Int32.Parse(s.getVariable(Protocol.Protocol.clientsSTR)) >= Int32.Parse(s.getVariable(Protocol.Protocol.maxClientsSTR))) { ContinueHit(continueHit, allowfullcheck); continue; } if (allowemptycheck.Checked == false && Int32.Parse(s.getVariable(Protocol.Protocol.clientsSTR)) <= 0) { ContinueHit(continueHit, allowemptycheck); continue; } } else if (allowemptycheck.Checked == false && s.getVariable(Protocol.Protocol.clientsSTR) == null) { ContinueHit(continueHit, allowemptycheck); continue; } if (favouritecheck.Checked == false && (s.getVariable(Protocol.Protocol.favouriteSTR) == null || Boolean.Parse(s.getVariable(Protocol.Protocol.favouriteSTR)) == false)) { ContinueHit(continueHit, favouritecheck); continue; } Controller.AddServerToServerView(s, serverview); } ListViewExtras.AutoResize(serverview); Controller.ToolStripText(toolStripStatusLabel1, ref statusStrip1, "Ready"); lvs.Enabled = true; SetColours(continueHit, serversInstance.masterServers.Values.Count); if (mapdrop.Items.Count > 0 && mapdrop.Text == "") { mapdrop.Text = mapdrop.Items[0].ToString(); } if (gametypedrop.Items.Count > 0 && gametypedrop.Text == "") { gametypedrop.Text = gametypedrop.Items[0].ToString(); } }
private void refreshFilesToolStripMenuItem_Click(object sender, EventArgs e) { Controller.RefreshInfo(fileList); ListViewExtras.AutoResize(fileList); }