Пример #1
0
        public ActionResult Index(String FileNames)
        {
            //get weight pass from setweight page
            ControlStructureWeight Weight = TempData["Weight"] as ControlStructureWeight;

            ControlStructureWeight weight = new ControlStructureWeight()
            {
                ifElseIfWeight       = Weight.ifElseIfWeight,
                forWileDoWhileWeight = Weight.forWileDoWhileWeight,
                SwitchWeight         = Weight.SwitchWeight,
                CaseWeight           = Weight.CaseWeight
            };



            ControlStructureDetector controlStructure = new ControlStructureDetector();

            //set filename pass from URL
            controlStructure.SetFileName(FileNames);

            //calculate conrol structure in files
            controlStructure.ProcessFile(weight);

            List <Controlstructure> controlstructuresList = new List <Controlstructure>();

            //retun list
            controlstructuresList = controlStructure.result();

            return(View(controlstructuresList));
        }
Пример #2
0
        public ActionResult SetWeight(ControlStructureWeight controlStructureWeight, String fileName)
        {
            //set the weight
            ControlStructureWeight weight = new ControlStructureWeight()
            {
                ifElseIfWeight       = controlStructureWeight.ifElseIfWeight,
                forWileDoWhileWeight = controlStructureWeight.forWileDoWhileWeight,
                SwitchWeight         = controlStructureWeight.SwitchWeight,
                CaseWeight           = controlStructureWeight.CaseWeight
            };


            //return weight to index controller
            TempData["Weight"] = weight;
            return(RedirectToAction("Index", "ControlStrcture", new { FileNames = fileName }));
        }