コード例 #1
0
        public ActionResult <string> GetBreak(string method, string str)
        {
            try
            {
                if (method == "caesar")
                {
                    Caesar caesar = new Caesar();

                    var result = caesar.Break(str);

                    SaveBreakItems(method, str, result.Item1, result.Item2);

                    return(result.Item1 + "," + result.Item2.ToString());
                }
                else if (method == "railfence")
                {
                    RailFence railFence = new RailFence();

                    var result = railFence.Break(str);

                    SaveBreakItems(method, str, result.Item1, result.Item2);

                    return(result.Item1 + "," + result.Item2.ToString());
                }
                else if (method == "affine")
                {
                    Affine affine = new Affine();

                    var result = affine.Break(str);

                    SaveBreakItems(method, str, result.Item1, result.Item2);

                    return(result.Item1 + "," + result.Item2.ToString());
                }
                else if (method == "substitution")
                {
                    Substitution substitution = new Substitution();

                    var result = substitution.Break();

                    SaveBreakItems(method, str, result.Item1, result.Item2);

                    return(result.Item1 + "," + result.Item2.ToString());
                }
            }
            catch (System.Exception e)
            {
                return(e.Message);
            }

            return("No such method!");
        }