Example #1
0
        public void repetir()
        {
            if (minodo != null)
            {
                minodo = circular.ultimo.enlace;

                while (minodo == circular.ultimo.enlace)
                {
                    if (listBox1.SelectedIndex < listBox1.Items.Count - 1)
                    {
                        listBox1.SelectedIndex += 1;

                        minodo = minodo.enlace;
                    }
                    else
                    {
                        axWindowsMediaPlayer2.URL = añadir_canciones.FileNames[0];
                        listBox1.SelectedIndex    = 0;
                        minodo = minodo.enlace;
                    }

                    minodo = minodo.enlace;
                }
            }
            else
            {
                MessageBox.Show("\t NO HAY CANCIONES DISPONIBLES");
            }
        }
Example #2
0
 private void generarXML()
 {
     WriteHeader();
     Nodos.ForEach(x => WriteNode(x));
     Edges.ForEach(x => WriteEdge(x));
     xml.WriteEndDocument();
     xml.Close();
 }
Example #3
0
 /// <summary>
 /// Si el nodo no existe lo agrego a la lista de nodos
 /// </summary>
 /// <param name="n">Nodo a agregar</param>
 /// <returns>True si el nodo se agrego</returns>
 public bool AgregarNodo(Nodo n)
 {
     if (ExisteNodo(n))
     {
         return(false);
     }
     Nodos.Add(n);
     return(true);
 }
        public Path BaseMetodoTest(int nodoInicial, int nodoFinal)
        {
            Nodos nodosRecursivo = new Nodos(matrizAdyacencia);

            Path pathInicial = new Path();

            pathInicial.Camino.Add(nodoInicial);

            return(nodosRecursivo.IniciarAlgoritmo(nodoFinal, pathInicial));
        }
Example #5
0
    public void EncedidoConstruir(Nodos nodo)
    {
        if (MoneyCount.dinero < torretaConstruir.costo)
        {
            Debug.Log("ERES POBRE! No Puedes Construir Con Tan Poco Dinero");
            return;
        }

        MoneyCount.dinero -= torretaConstruir.costo;
        GameObject torre = (GameObject)Instantiate(torretaConstruir.prefab, nodo.GetBuildPosition(), Quaternion.identity);

        nodo.torreta = torre;
        Debug.Log("Construcción Completada! Dinero Restante: " + MoneyCount.dinero);
    }
Example #6
0
 //Agregamos las canciones a ListBox1
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         //  axWindowsMediaPlayer2.URL = path[listBox1.SelectedIndex];
         if (listBox1.SelectedIndex != -1)
         {
             axWindowsMediaPlayer2.URL = añadir_canciones.FileNames[listBox1.SelectedIndex];
             int i = listBox1.SelectedIndex;
             minodo = new Nodos(añadir_canciones.FileNames[i]);
         }
     }
     catch (IndexOutOfRangeException)
     {
     }
 }
        /*Método encargado de enviar los datos de la versión al árbol, con el fin de ser tratado para su impresíón*/
        /*Método invocado por la opción "show tree view" de Program*/

        public void VisualizacionArbolForm(string numerobuscar, string op)
        {
            int    cantidad, j;
            string nombreArchivoContenidVersion, contenidoLista, VersConte, cadenaSinUsar, contenidoVersion;

            (nombreArchivoContenidVersion, contenidoLista) = Global <object> .manejoAr.BusquedaVersion(numerobuscar);

            (cantidad, VersConte, contenidoVersion) = Global <object> .MT.DevuelveCantidadArchivosVersion(contenidoLista);

            EliminarArchivosdelDirectorio();
            Global <bool> .nodoArbol.EliminarElContenidoArbol();

            CrearArchivosenDirectoriodeUnaVersion(VersConte, op, "");
            Nodos <object> ArbolCompleto = new Nodos <object>();

            (cadenaSinUsar, ArbolCompleto) = Global <object> .MT.CrearVersionenArbol(op, "");
        }
Example #8
0
    public void BuildTurreOn(Nodos nodo)
    {
        if (Currency.moneda < turretToBuild.cost)
        {
            Debug.Log("No tienes Dinero suficiente para comprar");
            return;
        }
        Currency.moneda -= turretToBuild.cost;

        GameObject torre = (GameObject)Instantiate(turretToBuild.prefad, nodo.GetBuildPosition(), Quaternion.identity);

        nodo.torreta = torre;

        GameObject effect = (GameObject)Instantiate(buildEffect, nodo.GetBuildPosition(), Quaternion.identity);

        Destroy(effect, 5f);

        Debug.Log("Torreta Costruida! Dinero restante: " + Currency.moneda);
    }
Example #9
0
        private void generarGrafo()
        {
            while (xml.Read())
            {
                switch (xml.NodeType)
                {
                case XmlNodeType.Element:
                    if (xml.Name == "nodo")
                    {
                        if (xml.HasAttributes)
                        {
                            atributos = new Dictionary <string, string>();
                            string label = "";
                            string id    = "";
                            while (xml.MoveToNextAttribute())
                            {
                                if (xml.Name == "label")
                                {
                                    label = xml.Value;
                                }
                                else if (xml.Name == "id")
                                {
                                    id = xml.Value;
                                }
                            }
                            nodo = new Nodo(id, atributos, label);
                        }
                    }
                    else if (xml.Name == "edge")
                    {
                        if (xml.HasAttributes)
                        {
                            atributos = new Dictionary <string, string>();
                            string label   = "";
                            string origen  = "";
                            string destino = "";
                            while (xml.MoveToNextAttribute())
                            {
                                if (xml.Name == "label")
                                {
                                    label = xml.Value;
                                }
                                else if (xml.Name == "origen")
                                {
                                    origen = xml.Value;
                                }
                                else if (xml.Name == "destino")
                                {
                                    destino = xml.Value;
                                }
                            }
                            edge = new Edge(origen, destino, atributos, label);
                        }
                    }
                    else
                    {
                        key = xml.Name;
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (xml.Name == "nodo" && nodo != null)
                    {
                        Nodos.Add(nodo);
                        nodo = null;
                    }
                    else if (xml.Name == "edge" && edge != null)
                    {
                        Edges.Add(edge);
                        edge = null;
                    }
                    break;

                case XmlNodeType.Text:
                    if (nodo != null)
                    {
                        nodo.Atributos.Add(key, xml.Value);
                    }
                    else if (edge != null)
                    {
                        edge.Atributos.Add(key, xml.Value);
                    }
                    break;
                }
            }
        }
Example #10
0
        private void generarGrafo()
        {
            while (xml.Read())
            {
                switch (xml.NodeType)
                {
                case XmlNodeType.Element:
                    if (xml.Name == "node")
                    {
                        if (xml.HasAttributes)
                        {
                            atributos = new Dictionary <string, string>();
                            string label = "";
                            string id    = "";
                            while (xml.MoveToNextAttribute())
                            {
                                if (xml.Name == "labels")
                                {
                                    label = xml.Value;
                                }
                                else if (xml.Name == "id")
                                {
                                    id = xml.Value;
                                }
                            }
                            nodo = new Nodo(id, atributos, label);
                        }
                    }
                    else if (xml.Name == "data")
                    {
                        if (xml.HasAttributes)
                        {
                            while (xml.MoveToNextAttribute())
                            {
                                key = xml.Value;
                            }
                        }
                    }
                    else if (xml.Name == "edge")
                    {
                        if (xml.HasAttributes)
                        {
                            atributos = new Dictionary <string, string>();
                            string label   = "";
                            string origen  = "";
                            string destino = "";
                            while (xml.MoveToNextAttribute())
                            {
                                if (xml.Name == "label")
                                {
                                    label = xml.Value;
                                }
                                else if (xml.Name == "source")
                                {
                                    origen = xml.Value;
                                }
                                else if (xml.Name == "target")
                                {
                                    destino = xml.Value;
                                }
                            }
                            edge = new Edge(origen, destino, atributos, label);
                        }
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (xml.Name == "node" && nodo != null)
                    {
                        Nodos.Add(nodo);
                        nodo = null;
                    }
                    else if (xml.Name == "edge" && edge != null)
                    {
                        Edges.Add(edge);
                        edge = null;
                    }
                    break;

                case XmlNodeType.Text:
                    if (nodo != null)
                    {
                        nodo.Atributos.Add(key, xml.Value);
                    }
                    else if (edge != null)
                    {
                        edge.Atributos.Add(key, xml.Value);
                    }
                    break;

                case XmlNodeType.XmlDeclaration:
                    Console.WriteLine("XmlDeclaration.Name: {0}", xml.Name);
                    Console.WriteLine("XmlDeclaration.Value: {0}", xml.Value);
                    break;

                case XmlNodeType.ProcessingInstruction:
                    Console.WriteLine("ProcessingInstruction.Name: {0}", xml.Name);
                    Console.WriteLine("ProcessingInstruction.Value: {0}", xml.Value);
                    break;

                case XmlNodeType.Comment:
                    Console.WriteLine("Comment.Value: {0}", xml.Value);
                    break;
                }
            }
        }
Example #11
0
 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 // Métodos
 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 public void AgregarNodo(Nodo nuevo)
 {
     Nodos.Add(nuevo);
 }
        /*Método encargado de crear los nodos en la lista enlazada*/
        /*Es invocado por la opción "crear ver " en Program*/
        public void CrearVersionEnListaEnlazada(string contenidoCadena, string nombreVers, Nodos <object> ArbolCompleto)
        {
            /*Se agregó este nuevo bloque de if para validar si se almacenará o no un nodo*/
            if (!Global <object> .manejoAr.validarNodosVersiones() && contenidoCadena != null)
            {
                FileInfo[] archivosCarpeta = ArchivosDirectorio();
                int        ultimaVersion   = Global <object> .manejoAr.DevueveCorrelativoVersion();

                string nombreArchivoContenidVersion, contenidoLista, contenidoVersion;
                (nombreArchivoContenidVersion, contenidoLista) = Global <object> .manejoAr.BusquedaVersion(ultimaVersion.ToString());

                int    cantidad  = 0;
                string VersConte = "";
                (cantidad, VersConte, contenidoVersion) = DevuelveCantidadArchivosVersion(contenidoLista);
                int coincidencias = ComparaCarpetaconContenidoVersion(contenidoLista, archivosCarpeta);
                if (cantidad != archivosCarpeta.Length)
                {
                    Global <object> .manejoAr.agregarVersion(new Repositorio(nombreVers.Substring(11), contenidoCadena), ArbolCompleto);

                    Console.ForegroundColor = ConsoleColor.DarkCyan;
                    Console.WriteLine(Global <string> ._pathTexto + "\\" + "Se almacenó el nodo exitosamente");
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    if (coincidencias == archivosCarpeta.Length)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.WriteLine(Global <string> ._pathTexto + "\\" + "No existe ninguna modificación en la carpeta de origen");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    else
                    {
                        Global <object> .manejoAr.agregarVersion(new Repositorio(nombreVers.Substring(11), contenidoCadena), ArbolCompleto);

                        Console.ForegroundColor = ConsoleColor.DarkCyan;
                        Console.WriteLine(Global <string> ._pathTexto + "\\" + "Se almacenó el nodo exitosamente");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                }
            }
            else
            {
                if (contenidoCadena != "")
                {
                    //Si la Lista enlazada se encuentra vacía, se procede a crear un Nodo Cabeza
                    Global <object> .manejoAr.agregarVersion(new Repositorio(nombreVers.Substring(11), contenidoCadena), ArbolCompleto);

                    Console.ForegroundColor = ConsoleColor.DarkCyan;
                    Console.WriteLine(Global <string> ._pathTexto + "\\" + "Se almacenó el nodo exitosamente");
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.WriteLine(Global <string> ._pathTexto + "\\" + "No se puede crear una versión, debe existir al menos 1 archivo en el directorio");
                    Console.ForegroundColor = ConsoleColor.White;
                }
            }
        }