public ActionResult ReSetData()
        {
            string    ret      = "Deleted :)";
            string    filename = Request.Params["id"];
            DataSaver dts      = new DataSaver(false);

            dts.DeleteAllEntries(filename);
            return(Json(ret));
        }
        public ActionResult Upload()
        {
            bool      ret      = false;
            string    fileName = string.Empty;
            DataSaver dtS      = new DataSaver(false);

            dtS.CreateSubDirectory = true;
            try
            {
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    HttpPostedFileBase hpf = Request.Files[i] as HttpPostedFileBase;
                    if (hpf.ContentLength == 0)
                    {
                        continue;
                    }
                    fileName = Path.GetFileName(hpf.FileName);
                    MemoryStream ChunckStream = new MemoryStream();
                    hpf.InputStream.CopyTo(ChunckStream);
                    dtS.SaveDirectory = Path.Combine(Server.MapPath("~/Uploads/") +
                                                     Merger.getFileNameWithoutExtension(fileName, this.token));
                    dtS.SaveFile(fileName, ChunckStream.ToArray());
                    ChunckStream.Close();
                    ChunckStream.Dispose();
                }
            }
            catch { ret = false; }
            lock (lockToken)
            {
                string        FileNameWT    = Merger.getFullFileNameWithoutToken(fileName, this.token);
                string        savedFileName = Path.Combine(Server.MapPath("~/Uploads"), FileNameWT);
                List <string> temp          = DataSaver.getCustomList(FileNameWT);
                if (temp != null && temp.Count > 0)
                {
                    Merger m = new Merger(temp, savedFileName, this.token, '.');
                    if (m.CheckTheFiles())
                    {
                        m.Merge();
                        dtS.DeleteAllEntries(Merger.getFullFileNameWithoutToken(fileName, this.token));
                        ret = true;
                    }
                }
                else
                {
                    ret = true;
                }
            }
            if (ret)
            {
                return(Json("Success :)", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("Falid :(", JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult RecievedData()
        {
            string    filename = Request.Params["id"];
            int       Max      = -1;
            DataSaver dts      = new DataSaver(false);

            dts.SaveDirectory = Path.Combine(Server.MapPath("~/Uploads/") + Merger.getFileNameWithoutExtension(filename, this.token));
            DataSaver.LoadFilesNemes(Server.MapPath("~/Uploads/"), this.token);
            string        FileNameWT    = Merger.getFullFileNameWithoutToken(filename, this.token);
            string        savedFileName = Path.Combine(Server.MapPath("~/Uploads"), FileNameWT);
            List <string> temp          = DataSaver.getCustomList(FileNameWT);

            if (temp != null && temp.Count > 0)
            {
                Merger m = new Merger(temp, "", this.token, '.');
                //List<string> corruptedList =  m.getCorruptedData();
                Max = m.getlastSequenceNumber();
            }
            else
            {
                Max = dts.getLastFileChunck(filename, this.token);
            }
            return(Json(Max, JsonRequestBehavior.AllowGet));
        }