Exemplo n.º 1
0
        private async Task <List <GithubSimulationDataURL> > GetSimulationDataFromGithub()
        {
            var files = await _Client.Repository.Content.GetArchive(GITHUB_REPO_OWNER, _RepoName, ArchiveFormat.Zipball, "refs/heads/" + _BranchName);


            List <GithubSimulationDataURL> githubList = new List <GithubSimulationDataURL>();

            using (MemoryStream memoryStream = new MemoryStream(files))
            {
                using (var zipInputStream = new ZipInputStream(memoryStream))
                {
                    ZipEntry zipEntry;
                    while ((zipEntry = zipInputStream.GetNextEntry()) != null)
                    {
                        if (zipEntry.Name.Contains("Engine") && zipEntry.IsFile)
                        {
                            var          simulationName = AssetMatrixStaticFunction.ExtractStringFromPath(zipEntry.Name);
                            StreamReader reader         = new StreamReader(zipInputStream);
                            var          read           = reader.ReadToEnd();
                            githubList.Add(new GithubSimulationDataURL(read, simulationName));
                        }
                    }
                }
            }

            return(githubList);
        }
Exemplo n.º 2
0
        private List <String> GetAllCharactersFromGithubText(string value)
        {
            List <String> returnedString = new List <string>();

            string returnValue = value;

            string[] stringArray = returnValue.Split('\n');
            foreach (string s in stringArray)
            {
                if (s.Length > 0)
                {
                    returnedString.Add(AssetMatrixStaticFunction.ExtractStringFromPath(s));
                }
            }
            return(returnedString);
        }
Exemplo n.º 3
0
        private List <string> GetXMLParser(string xmlURL)
        {
            List <string> elementList = new List <string>();

            using (XmlTextReader xmlReader = new XmlTextReader(new StringReader(xmlURL)))
            {
                try
                {
                    while (xmlReader.Read())
                    {
                        //for assets
                        if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "Asset")
                        {
                            if (xmlReader.GetAttribute("AssetPath") != "" && xmlReader.GetAttribute("AssetPath") != null)
                            {
                                string sourceId = xmlReader.GetAttribute("AssetPath").ToLower();
                                sourceId = sourceId.Contains("/") ? AssetMatrixStaticFunction.TrimString(sourceId.ToLower()) : sourceId.ToLower();
                                elementList.Add(sourceId);
                            }
                        }
                        //for animations in scenes
                        if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "Scene")
                        {
                            if (xmlReader.GetAttribute("AssetPath") != "" && xmlReader.GetAttribute("AssetPath") != null)
                            {
                                string sourceId = xmlReader.GetAttribute("AssetPath").ToLower();
                                sourceId = sourceId.Contains("/") ? AssetMatrixStaticFunction.TrimString(sourceId.ToLower()) : sourceId.ToLower();
                                elementList.Add(sourceId);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Simulation Thread error :: \n" + e.Message + " \n" + e.StackTrace);
                }
            }

            return(elementList);
        }