public void GraficarTopUniDes(ListaTopUnidadesDestruidas lista) { sw = new StreamWriter(ruta + "\\top10u.dot"); sw.WriteLine("digraph{"); sw.WriteLine("node[shape = record]"); sw.WriteLine("subgraph clusterTop{"); sw.WriteLine("label=\"Top 10 de Jugadores con mayor porcentaje de unidades destruidas\""); NodoTopUnidadesDestruidas aux = lista.GetPrimero(); int cont = 0; while (cont < 10 && aux != null) { sw.WriteLine("top" + cont + "[label = \"Jugador: " + aux.GetId() + "\\nNumero de juegos ganados: " + aux.GetPorcentaje() + "\"];"); aux = aux.GetSiguiente(); cont++; } sw.WriteLine("}"); sw.WriteLine("}"); sw.Close(); var comando = string.Format("dot -Tjpg {0} -o {1}", ruta + "\\top10u.dot", ruta + "\\top10u.jpg"); var informacion = new System.Diagnostics.ProcessStartInfo("cmd", "/C" + comando); var proceso = new System.Diagnostics.Process(); proceso.StartInfo = informacion; proceso.Start(); proceso.WaitForExit(); }
public bool Existe(string id, double n) { NodoTopUnidadesDestruidas aux = this.primero; while (aux != null) { if (aux.GetId() == id) { double num = aux.GetPorcentaje() + n; aux.SetPorcentaje(num); return(true); } aux = aux.GetSiguiente(); } return(false); }