public bool FromText(string text) { bool result = false; try { if (!IsVpdText(text)) { return(result); } Match match = new Regex(InfoGetReg, RegexOptions.IgnoreCase).Match(text); string text2 = ""; if (match.Success) { text2 = match.Groups["name"].Value; if (text2.ToLower().Contains(NameExt)) { text2 = text2.Replace(NameExt, ""); } ModelName = text2; } PoseList.Clear(); match = new Regex(BoneGetReg, RegexOptions.IgnoreCase).Match(text); while (match.Success) { string text3 = ""; Vector3 t = new Vector3(0f, 0f, 0f); Quaternion identity = Quaternion.Identity; text3 = match.Groups["name"].Value; float.TryParse(match.Groups["trans_x"].Value, out t.x); float.TryParse(match.Groups["trans_y"].Value, out t.y); float.TryParse(match.Groups["trans_z"].Value, out t.z); float.TryParse(match.Groups["rot_x"].Value, out identity.x); float.TryParse(match.Groups["rot_y"].Value, out identity.y); float.TryParse(match.Groups["rot_z"].Value, out identity.z); float.TryParse(match.Groups["rot_w"].Value, out identity.w); PoseList.Add(new PoseData(text3, identity, t)); match = match.NextMatch(); } MorphList.Clear(); match = new Regex(MorphGetReg, RegexOptions.IgnoreCase).Match(text); while (match.Success) { string text4 = ""; float result2 = 0f; text4 = match.Groups["name"].Value; float.TryParse(match.Groups["val"].Value, out result2); MorphList.Add(new MorphData(text4, result2)); match = match.NextMatch(); } result = true; return(result); } catch (Exception) { return(result); } }
public async Task <ActionResult> OnPost() { if (ModelState.IsValid) { string[] newPoses = new string[7]; string[] jsonPoses = new string[7]; string poseStr1 = HttpContext.Request.Form["NewPose_1"]; string[] poseInfo = poseStr1.Split("/"); newPoses[0] = poseInfo[2]; string poseStr2 = HttpContext.Request.Form["NewPose_2"]; poseInfo = poseStr2.Split("/"); newPoses[1] = poseInfo[2]; string poseStr3 = HttpContext.Request.Form["NewPose_3"]; poseInfo = poseStr3.Split("/"); newPoses[2] = poseInfo[2]; string poseStr4 = HttpContext.Request.Form["NewPose_4"]; poseInfo = poseStr4.Split("/"); newPoses[3] = poseInfo[2]; string poseStr5 = HttpContext.Request.Form["NewPose_5"]; poseInfo = poseStr5.Split("/"); newPoses[4] = poseInfo[2]; string poseStr6 = HttpContext.Request.Form["NewPose_6"]; poseInfo = poseStr6.Split("/"); newPoses[5] = poseInfo[2]; string poseStr7 = HttpContext.Request.Form["NewPose_7"]; poseInfo = poseStr7.Split("/"); newPoses[6] = poseInfo[2]; this.PoseList = new List <Poses>(); ChakraList = await cosmosDbService.GetChakrasAsync(); for (int i = 0; i < 7; i++) { PoseList.Add(ChakraList[i].Poses.Where(x => x.name == newPoses[i]).FirstOrDefault()); jsonPoses[i] = new JavaScriptSerializer().Serialize(PoseList[i]); } Poses[] TempArray = PoseList.ToArray(); //TempData.Set("Poses", TempArray); //TempData["jsonPoses"] = jsonPoses; TempData.Set("PoseList", PoseList.ToArray()); return(RedirectToPage("ClassPreference")); } return(Page()); }
public async Task OnGetAsync() { ChakraList = await cosmosDbService.GetChakrasAsync(); this.PoseList = new List <Poses>(); int selectedPose; Random rnd = new Random(); //Cycle thru each of the Chakras and randomly select a pose the current Chakra foreach (Chakra ch in ChakraList) { //Generate a random number between 1 and the number of poses selectedPose = rnd.Next(1, ch.Poses.Length); //Add the pose to the list PoseList.Add(ch.Poses[selectedPose]); } }
public async Task OnGetAsync() { ChakraList = await cosmosDbService.GetChakrasAsync(); //Test Serializing data to Json //String jsonChakra = JsonSerializer.Serialize<List<Chakra>>(ChakraList); this.PoseList = new List <Poses>(); int selectedPose; Random rnd = new Random(); //Cycle thru each of the Chakras and randomly select a pose the current Chakra foreach (Chakra ch in ChakraList) { //Generate a random number between 1 and the number of poses selectedPose = rnd.Next(0, ch.Poses.Length - 1); //Add the pose to the list PoseList.Add(ch.Poses[selectedPose]); } }