public void changeColor(string[] rgb) { for (int i = 0; i < Particles.Count(); i++) { Particle p = Particles.ElementAt(i); p.changeColor(rgb); } }
public void resize(int percentage) { for (int i = 0; i < Particles.Count(); i++) { Particle p = Particles.ElementAt(i); p.resize(percentage); } }
public void fixChildRefs(string newFolder) { for (int i = 0; i < Particles.Count(); i++) { Particle p = Particles.ElementAt(i); p.fixChildRefs(newFolder); } }
public void rename(string newBase) { // Gets the current old base. string reference = Particles[0].Name; string oldBase = ""; while (reference.Length > 1) { for (int i = 0; i < Particles.Length; i++) { string currStr = Particles[i].Name; if (!currStr.StartsWith(reference)) { reference = reference.Substring(0, reference.Length - 1); // start the whole for loop over again break; } else if (i == Particles.Length - 1) { oldBase = reference; reference = ""; // stop the while loop } } } // preserve the last _ if there is one. if (oldBase[oldBase.Length - 1] == '_') { oldBase = oldBase.Substring(0, oldBase.Length - 1); } // ensure we don't include stuff after the period. (.vpcf) if (oldBase.Contains('.')) { oldBase = oldBase.Substring(0, oldBase.LastIndexOf('.')); } Debug.WriteLine("Base: " + oldBase); for (int i = 0; i < Particles.Count(); i++) { string p = Particles.ElementAt(i).Path; string currName = p.Substring(p.LastIndexOf('\\') + 1); string newName = currName.Replace(oldBase, newBase); string newPath = Path.Combine(p.Substring(0, p.LastIndexOf('\\')), newName); // overwrite particles. if (File.Exists(newPath)) { File.Delete(newPath); } File.Move(p, newPath); Particles[i].Path = newPath; Particles[i].fixChildRefs(newPath.Substring(0, newPath.LastIndexOf('\\')), oldBase, newBase); } }