Exemple #1
0
        public Dictionary <char, int> getMap(string path)
        {
            List <String> mapa = _fileService.leerMapa(path);

            Dictionary <char, int> map = new Dictionary <char, int>();

            string [] clave_valor;
            string    claveString = "";
            string    valorString = "";

            char claveaux;
            int  valoraux;

            foreach (string strMap in mapa)
            {
                clave_valor = _stringFilterService.obtenerParClaveValor(strMap);
                claveString = clave_valor[0];
                valorString = clave_valor[1];

                valoraux = obtenerValorAdmisible(valorString);
                if (esClaveAdmisible(claveString) && valoraux != -1)
                {
                    claveaux = claveString[0];
                    try{
                        map.Add(claveaux, valoraux);
                    }
                    catch (ArgumentException ae)
                    {
                        String            msg         = $"Clave Duplicada '{claveaux}' - Dirijase  al archivo \"./mapaAlfa.txt\" para correjirlo";
                        ExpectedException myException = new ExpectedException(msg, ae, true);
                        throw myException;
                    }
                }
            }
            return(map);
        }