public ActionResult Vigenere()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
 public ActionResult SHA(string id)
 {
     InputViewModel model = new InputViewModel();
     var desc = HashInfo.GetHashInfo(id);
     model.Description = desc;
     return View(model);
 }
 public ActionResult XmlToJson()
 {
     InputViewModel model = new InputViewModel();
     ViewBag.Input = "<Root><FirstName>santosh</FirstName><LastName>Singh</LastName></Root>";
     return View(model);
 }
 public ActionResult Base64()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
 public ActionResult UrlShortner()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
 public ActionResult UTFToAsci()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
        public ActionResult HexViewer(HttpPostedFileBase file)
        {
            InputViewModel viewModel = new InputViewModel();
            if (file != null && file.ContentLength > 0)
            {
                var fileStream = file.InputStream;
                viewModel.Output = HexViewer(fileStream);

            }
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field
            return View(viewModel);
        }
 public ActionResult StringToBinary()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
 public ActionResult HashMd5()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
 public ActionResult HexViewer()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
        public ActionResult HashFile(HttpPostedFileBase file)
        {
            InputViewModel viewModel = new InputViewModel();
            // Verify that the user selected a file
            if (file != null && file.ContentLength > 0)
            {

                var fileStream = file.InputStream;
                MemoryStream ms = new MemoryStream();
                fileStream.CopyTo(ms);
                viewModel.Input = "";
                var sha1 = HashAlgorithm.Create("SHA1");
                var hash = sha1.ComputeHash(ms.ToArray());
                viewModel.Output = hash.ByteToHexString();

            }
            // redirect back to the index action to show the form once again
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View(viewModel);
        }
        public ActionResult Binary(InputViewModel model)
        {
            InputViewModel viewModel = new InputViewModel();
            viewModel.Input = model.Input;
            viewModel.Output = new string(model.Input.StringToBinary().Reverse().ToArray());
            // this is the key, you could also just clear ModelState for the id field
            ModelState.Clear();

            return View("StringToBinary", viewModel);
        }
        public ActionResult Base64ToString(InputViewModel model)
        {
            InputViewModel viewModel = new InputViewModel();
            viewModel.Input = model.Input;
            try
            {
                viewModel.Output = model.Input.ConvertBase64ToString();
            }
            catch
            {
                viewModel.Output = "Invalid Base64 string";

            }
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View(viewModel);
        }
        public ActionResult SHA(InputViewModel model, string id)
        {
            var desc = HashInfo.GetHashInfo(id);

            InputViewModel viewModel = new InputViewModel();
            viewModel.Input = model.Input;
            viewModel.Output = model.Input.SHAAlgorithm(id);
            viewModel.Description = desc;
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View(viewModel);
        }
 public ActionResult HtmlToDiv()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
        public ActionResult StringM(InputViewModel model)
        {
            string pattern = @"[10]{8}";
            InputViewModel viewModel = new InputViewModel();
            System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(pattern);
            if (!r.IsMatch(model.Input))
            {
                ModelState.AddModelError("Error", "Invalid Binary Number");
                return View("StringToBinary", viewModel);
            }

            //IEnumerable<string> groups = Enumerable.Range(0, model.Input.Length / 8)
            //                            .Select(i => model.Input.Substring(i * 8, 8));
            viewModel.Input = model.Input;
            viewModel.Output = BinaryToString(model.Input);
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View("StringToBinary", viewModel);
        }
        public ActionResult HtmlToDiv(InputViewModel model)
        {
            InputViewModel viewModel = new InputViewModel();

            viewModel.Input = model.Input;
            viewModel.Output = HtmlTableToDiv(model.Input);
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field
            return View(viewModel);
        }
 public ActionResult UnicodeToString()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
 public ActionResult ImageToBase64()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
        public ActionResult UrlShortner(InputViewModel model)
        {
            InputViewModel viewModel = new InputViewModel();
            viewModel.Input = model.Input;
            viewModel.Output = GoogleResponse(model.Input);

            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View(viewModel);
        }
        public ActionResult ImageToBase64(HttpPostedFileBase file)
        {
            InputViewModel viewModel = new InputViewModel();
            if (file != null && file.ContentLength > 0)
            {
                var fileStream = file.InputStream;
                viewModel.Output = "<img alt=\"\" src=\"data:image/bmp;base64," + Convert.ToBase64String(ImageToByteArray(fileStream)) + "/>";

            }
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field
            return View(viewModel);
        }
        public ActionResult UTFToAsci(InputViewModel model)
        {
            InputViewModel viewModel = new InputViewModel();
            viewModel.Input = model.Input;
            viewModel.Output = model.Input.EncodeNonAsciiCharacters();
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View(viewModel);
        }
 public ActionResult JsonToXml()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
        public ActionResult XmlToJson(InputViewModel model)
        {
            InputViewModel viewModel = new InputViewModel();
            // To convert an XML node contained in string xml into a JSON string
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(model.Input);
            string jsonText = JsonConvert.SerializeXmlNode(doc, Newtonsoft.Json.Formatting.Indented);
            viewModel.Input = model.Input;
            viewModel.Output = jsonText;

            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View(viewModel);
        }
        public ActionResult JsonToXml(InputViewModel model)
        {
            InputViewModel viewModel = new InputViewModel();
            // To convert JSON text contained in string json into an XML node
            XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + model.Input + "}", "root");

            viewModel.Input = model.Input;
            viewModel.Output = doc.InnerXml;

            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View(viewModel);
        }
        public ActionResult Base64(InputViewModel model)
        {
            InputViewModel viewModel = new InputViewModel();
            viewModel.Input = model.Input;
            viewModel.Output = model.Input.ConvertoBase64();
            ModelState.Clear(); // this is the key, you could also just clear ModelState for the id field

            return View(viewModel);
        }
 public ActionResult CeaserCipher()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }