Beispiel #1
0
        public ContentResult getSubTree() // (string chunkName)
        {
            string answerString = "";

            try
            {
                string isMergedString = Request.Form["isMerged"];
                bool isMerged = false;
                if (isMergedString == "true")
                    isMerged = true;
                string porpName = Request.Form["propertyName"];
                var ft = new HugoBotWebApplication.Discretistation.FileHandler();

                string pathToChunk = Session["correntPathToIndex"].ToString() + "/" + porpName;
                byte[] chuckAsByteArr = ft.GetChunk(pathToChunk);

                var answer = Data.loadKarmaSubTree(chuckAsByteArr, isMerged);
                answerString = JsonConvert.SerializeObject(answer, Formatting.Indented);
            }
            catch(Exception ex)
            {
                var xs = 124124;
            }

            return Content(answerString);
        }
Beispiel #2
0
        public void loadFiles()
        {
            StatesConverter cnvLabels;
            EntitiesData datEnts;

            try
            {
                var ft = new HugoBotWebApplication.Discretistation.FileHandler(); 
                string pathWithClass = Session["correntPathToIndex"].ToString();
                var ansFromGetChunks = ft.GetChunks(pathWithClass); // we don't use this data, this is just init for chunk creation
                TestMemory._chunkesLargerThanZero = new List<string>(ansFromGetChunks);

                // ask for index file
                pathWithClass += "/index";
                indexFileAsByteArr = ft.GetChunk(pathWithClass); // ask for index file

                // ask for entities file
                string datasetGUID = ((Dataset)Session["dataset"]).Path;
                byte[] entitiesByteArr = ft.GetFile(datasetGUID + "/entities");

                // ask for states file
                string pathWithDiscConfig = (string)Session["discConfig"];
                string pathToState = pathWithDiscConfig + "/states";
                byte[] statesByteArr = ft.GetStates(pathToState);

                // load states file
                cnvLabels = new StatesConverter(statesByteArr);

                // load enetites file
                datEnts = new EntitiesData(entitiesByteArr);


                // create curResultsObject
                LoadLegoResultsDataset(indexFileAsByteArr, cnvLabels, datEnts);

                // assiggn curResult to class that not goint to be deleted after uploading
                TestMemory.curResults = this.curResults;

                TestMemory.index = getIndex();
            }
            catch(Exception ex)
            {
                var axax = 1;
            }
        }
Beispiel #3
0
        public JsonResult getEntites()
        {
            var answer = new
            {
                header = new List<string>(),
                rows = new List<List<string>>()
            };

            try
            {
                string dataPath = ((Dataset)Session["dataset"]).Path;
                var ft = new HugoBotWebApplication.Discretistation.FileHandler();
                byte[] b = ft.GetFile(dataPath + "/entities");

                using (StreamReader reader = new StreamReader(new MemoryStream(b), Encoding.Default))
                {
                    // get and set attributes names
                    var line = reader.ReadLine();
                    var values = line.Split(',');

                    foreach (string attributeName in values)
                    {
                        answer.header.Add(attributeName);
                    }

                    int indexLine = 0;
                    while (reader.EndOfStream == false)
                    {
                        answer.rows.Add(new List<string>());
                        var splits = reader.ReadLine().Split(',');
                        for (int i = 0; i < splits.Length; i++) // 1 for skipping the id Column
                        {
                            string valueToEnter = splits[i];
                            answer.rows[indexLine].Add(valueToEnter);
                        }
                        indexLine++;
                    }
                }
            }
            catch { }
            return Json(answer, JsonRequestBehavior.AllowGet);
        }
Beispiel #4
0
        public object[] getIndex()
        {
            List<object> l = new List<object>();

            try
            {
                string correntPath = Session["correntPathToIndex"].ToString();

                var ft = new HugoBotWebApplication.Discretistation.FileHandler();

                var ansFromGetChunks = ft.GetChunks(correntPath);

                correntPath += "/index";
                var indexBeforeParse = ft.GetChunk(correntPath);

                l = FileConvertor.parseByteArrToIndex(indexBeforeParse);
            }
            catch { }
            return l.ToArray();
        }