Ejemplo n.º 1
0
 public ActionResult Vigenere()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
Ejemplo n.º 2
0
 public ActionResult SHA(string id)
 {
     InputViewModel model = new InputViewModel();
     var desc = HashInfo.GetHashInfo(id);
     model.Description = desc;
     return View(model);
 }
Ejemplo n.º 3
0
 public ActionResult XmlToJson()
 {
     InputViewModel model = new InputViewModel();
     ViewBag.Input = "<Root><FirstName>santosh</FirstName><LastName>Singh</LastName></Root>";
     return View(model);
 }
Ejemplo n.º 4
0
 public ActionResult Base64()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
Ejemplo n.º 5
0
 public ActionResult UrlShortner()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
Ejemplo n.º 6
0
 public ActionResult UTFToAsci()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 public ActionResult StringToBinary()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
Ejemplo n.º 9
0
 public ActionResult HashMd5()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
Ejemplo n.º 10
0
 public ActionResult HexViewer()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
 public ActionResult HtmlToDiv()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
 public ActionResult UnicodeToString()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }
Ejemplo n.º 19
0
 public ActionResult ImageToBase64()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        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);
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
 public ActionResult JsonToXml()
 {
     InputViewModel model = new InputViewModel();
     return View(model);
 }
Ejemplo n.º 24
0
        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);
        }
Ejemplo n.º 25
0
        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);
        }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
 public ActionResult CeaserCipher()
 {
     InputViewModel viewModel = new InputViewModel();
     return View(viewModel);
 }