Beispiel #1
0
        /// <summary>
        /// Method to get the file file and resolve it.
        /// </summary>
        /// <param name="basePath"></param>
        /// <param name="valuesPath"></param>
        /// <param name="cyperPath"></param>
        public List <string> ResolverForJSon(string basePath, string valuesPath, string cyperPath)
        {
            List <Base>   bases;
            ListValue     values = new ListValue();
            List <string> cyphers;

            try
            {
                //Contains a list (size M) with the base rules that will be used in Markov's algorithm
                bases = JsonConvert.DeserializeObject <List <Base> >(Resolver(basePath));

                //Contains a list of objects (size N)
                values.Values = JsonConvert.DeserializeObject <List <List <WValue> > >(Resolver(valuesPath));

                //Gets the ordered values
                var orderValues = values.GetOrderListDesc();

                //Process cyper from JSon
                cyphers = JsonConvert.DeserializeObject <List <string> >(Resolver(cyperPath));

                MarkovUitl markov = new MarkovUitl();

                return(markov.ApplyRules(bases, orderValues, cyphers));
            }
            catch (Exception ex)
            {
                throw new Exception("Cannot process the files" + ex.Message);
            }
        }