public static string AddStep(step st) { StepResult str = new StepResult(); if (string.IsNullOrWhiteSpace(st.id)) { st.id = Guid.NewGuid().ToString("N"); } string uuid = st.id; str.name = st.name; str.stage = Stage.pending; if (st.listParamenters != null) { str.parameters = st.listParamenters; } if (st.listAttachment != null) { str.attachments = st.listAttachment; } str.description = st.description; _instance.StartStep(uuid, str); return(uuid); }
/// <summary> /// Init for /// </summary> /// <param name="stream">Stream</param> public void InitFor(FuzzingStream stream, int index) { step s = new step(); // Max changes s.MaxChanges = MaxChanges.Get(); if (FuzzPercentType == EFuzzingPercentType.PeerStream) { // Fill indexes long length = stream.Length; for (long x = Math.Max(1, (long)((length * FuzzPercent.Get()) / 100.0)); x >= 0; x--) { ulong value; do { value = Math.Min((ulong)length, ValidOffset.Get()); }while (!s.FuzzIndex.Contains(value)); s.FuzzIndex.Add(value); } } stream.Variables["Config_" + index.ToString()] = s; }
public int CalcPrice([FromBody] step step) { //var json = JsonConvert.SerializeObject(step); //var price = ctx.price.FromSql("calc1 @step={0}", json).FirstOrDefault(); //return price.value; return(100); }
public void StepStorageTest() { var storage = new StepStorage(); var step1 = new step(); var step2 = new step(); var step3 = new step(); storage.Put(step1); Assert.AreEqual(2, storage.Get().Count); Assert.AreEqual(step1, storage.Last); new Thread(() => { storage.Put(step2); Thread.Sleep(100); Assert.AreEqual(2, storage.Get().Count); Assert.AreEqual(step2, storage.Last); }).Start(); new Thread(() => { storage.Put(step3); Assert.AreEqual(2, storage.Get().Count); Assert.AreEqual(step3, storage.Last); }).Start(); }
private void writehead(step s) { info.step = s; string x = JsonUtility.ToJson(info); File.WriteAllText(Path.Combine(patchdir_rw, headname), x); }
public IActionResult steps(int id) { if (id > 0) { var treeList = new List <step>(); var _testSpace = _context.TestSpace.First(t => t.Id == id); treeList = _testSpace.spaceModel().toSteplList(); return(Json(treeList)); } else { var treeList = new List <step>(); int userID = User.userID(); var bsList = (from t in _context.BlockStep where t.UserId == userID select new { blockID = t.Id, describe = t.Name, attrsString = t.Attrs }).ToList(); foreach (var bs in bsList) { var _tmp = new step(); _tmp.blockID = bs.blockID; _tmp.name = $"Block.{bs.blockID}"; _tmp.describe = bs.describe; _tmp.attrs = JsonConvert.DeserializeObject <Dictionary <string, string> >(bs.attrsString); treeList.Add(_tmp); } return(Json(treeList)); } }
void generateWall(int dirIndex, step nowStep) { GameObject obj = Resources.Load("Cube") as GameObject; GameObject ChildObject = Instantiate(obj); ChildObject.transform.parent = transform; if (dirIndex == 0) { ChildObject.transform.localPosition = new Vector3(nowStep.startPos.x * wallLen - offsetX + halfWallLen, halfWallLen, nowStep.startPos.y * wallLen - offsetZ); ChildObject.transform.localScale = new Vector3(0.05f, wallLen * scaleOffset, wallLen * scaleOffset); } else if (dirIndex == 1) { ChildObject.transform.localPosition = new Vector3(nowStep.startPos.x * wallLen - offsetX, halfWallLen, nowStep.startPos.y * wallLen - offsetZ + halfWallLen); ChildObject.transform.localScale = new Vector3(wallLen * scaleOffset, wallLen * scaleOffset, 0.05f); } else if (dirIndex == 2) { ChildObject.transform.localPosition = new Vector3(nowStep.startPos.x * wallLen - offsetX - halfWallLen, halfWallLen, nowStep.startPos.y * wallLen - offsetZ); ChildObject.transform.localScale = new Vector3(0.05f, wallLen * scaleOffset, wallLen * scaleOffset); } else if (dirIndex == 3) { ChildObject.transform.localPosition = new Vector3(nowStep.startPos.x * wallLen - offsetX, halfWallLen, nowStep.startPos.y * wallLen - offsetZ - halfWallLen); ChildObject.transform.localScale = new Vector3(wallLen * scaleOffset, wallLen * scaleOffset, 0.05f); } }
public async Task <ActionResult> EditSequence(string steps, Dictionary <string, string> updates) { // USE TWO LISTS // Only send query to db to update and no need for server to send back updated list every time. // First list will be used to update on server. List <step> listOfSteps = new List <step>(); // Second list will be used to update list on the client-side display. No need to get new updated list from server. List <step> passListToView = JsonConvert.DeserializeObject <List <step> >(steps); // Initialise empty row to store our row to be updated step rowNumber = new step(); foreach (KeyValuePair <string, string> item in updates) { if (int.TryParse(item.Key, out int key) && int.TryParse(item.Value, out int value)) { listOfSteps = JsonConvert.DeserializeObject <List <step> >(steps); rowNumber = listOfSteps.FirstOrDefault(x => x.Number == key); rowNumber.Number = value; HttpResponseMessage response = await client.PutAsJsonAsync(String.Format("{0}/{1}", urlPath, rowNumber.StepID.ToString()), rowNumber); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { passListToView.FirstOrDefault(x => x.StepID == rowNumber.StepID).Number = value; } } } return(Json(JsonConvert.SerializeObject(passListToView), JsonRequestBehavior.AllowGet)); }
public override void Process(step context) { context.name = Name; context.status = status.passed; context.start = _started.HasValue ? _started.Value.ToUnixEpochTime() : AllureResultsUtils.TimeStamp; context.title = Title; }
public async Task <ActionResult> Create([Bind(Include = "ProcedureID,StepID,Content,DiagramURL,Number")] step step) { int countSteps = 0; List <int> listOfNumbers = new List <int>(); List <step> stepInfo = new List <step>(); // Send request to find web api REST service for steps HttpResponseMessage getResponse = await client.GetAsync(urlPath); // Check if response is successful if (getResponse.IsSuccessStatusCode) { var responseDetail = getResponse.Content.ReadAsStringAsync().Result; // Deserialise to find all steps belonging to chosen procedure stepInfo = JsonConvert.DeserializeObject <List <step> >(responseDetail).FindAll(x => x.ProcedureID == ProcedureController.procID); if (stepInfo.Count() == 0) { countSteps = 1; } else { countSteps = stepInfo.Select(x => (int)x.Number).ToList().Max() + 1; } } step.ProcedureID = ProcedureController.procID; step.Number = countSteps; HttpResponseMessage response = await client.PostAsJsonAsync(urlPath, step); response.EnsureSuccessStatusCode(); return(RedirectToAction("Details", "Procedure", new { id = ProcedureController.procID })); }
public IHttpActionResult Putstep(decimal id, step step) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != step.id_step) { return(BadRequest()); } db.Entry(step).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!stepExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Step4(mycook.Models.recipe usermode, FormCollection fc) { string test = fc["txttest_step"]; List <String> steps = test.Split(',').ToList(); List <step> steps_half = new List <step>(); if (steps.Count == 1 && steps[0] == " ") { ViewData["STEPS"] = "Data was saved successfully."; return(View("CreateRecipeStep3")); } else { } foreach (String st in steps) { step ste = new step(); ste.description = st; ste.number_order = steps.IndexOf(st) + 1; steps_half.Add(ste); } Session["steps"] = steps_half; return(View("CreateRecipeStep4")); }
public ActionResult DeleteConfirmed(decimal id) { step step = db.steps.Find(id); db.steps.Remove(step); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "ProcedureID,StepID,Content,DiagramURL,Number")] step step) { step.ProcedureID = ProcedureController.procID; HttpResponseMessage response = await client.PutAsJsonAsync(String.Format("{0}/{1}", urlPath, step.StepID.ToString()), step); response.EnsureSuccessStatusCode(); return(RedirectToAction("Details", "Procedure", new { id = ProcedureController.procID })); }
public void _Finish() { GameState = step.finish; //terminé // arrêt chrono // scores //propose menu pour restart !!!!!! }
public override void Process(step context) { status status = (Throwable != null && Throwable.GetType().ToString().Contains("Assert")) ? status.failed : status.broken; context.status = status; }
/// <summary> /// 通过记录的步骤结构体来返回上一步 /// </summary> /// <param name="_step"></param> void Back(step _step) { ReliveChess(_step.killId); MoveStone(_step.moveId, new Vector3(_step.xFrom, 1f, _step.zFrom)); this.turnManager.SendMove(_step, true); HidePath(); if (_selectedId != -1) { _selectedId = -1; } }
public List <string> tryresume(string patchfile, ref bool isbroken) { List <string> fails = null; this.patchfile = patchfile; step s = readhead(); if (s == step.INVA) { isbroken = true; return(null); } isbroken = false; if (s == step.FINISH) { return(null); } switch (s) { case step.BEGIN: goto BEGIN; case step.PATCH: goto PATCH; case step.DELETE: goto DELETE; case step.APPLY: goto APPLY; case step.VERIFY: goto VERIFY; case step.FINISH: goto FINISH; } BEGIN: step_patch(); PATCH: step_delete(); DELETE: step_apply(); APPLY: fails = step_verify(); if (fails != null) { return(fails); } VERIFY: step_finish(patchfile); FINISH: return(null); }
public IActionResult Create(step step, IFormFile image, string returnUrl = null) { if (ModelState.IsValid) { this.repository.AddEntity(step, image); return(RedirectToLocal(returnUrl)); } ViewData["ParentId"] = step.insuranceId; ViewData["ReturnUrl"] = returnUrl; return(View(step)); }
public ActionResult Edit([Bind(Include = "id_step,id_recipe,description,number_order")] step step) { if (ModelState.IsValid) { db.Entry(step).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_recipe = new SelectList(db.recipes, "id_recipe", "name_recipe", step.id_recipe); return(View(step)); }
public IHttpActionResult Getstep(decimal id) { step step = db.steps.Find(id); if (step == null) { return(NotFound()); } return(Ok(step)); }
public IHttpActionResult Poststep(step step) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.steps.Add(step); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = step.id_step }, step)); }
public void update_Step_Round(Board board) { board.round++; if (board.seed > 0) { state = step.UMUNIA; } else { state = step.UTEZA_NA_NDRAZI; } }
/// <summary> /// 悔棋,退回一步 /// </summary> public void BackOne() { if (_steps.Count == 0) { return; } step tmpStep = _steps[_steps.Count - 1]; _steps.RemoveAt(_steps.Count - 1); Back(tmpStep); }
void Start() { wallLen = 10.0f / (float)Math.Max(mapWidth, mapHeight); halfWallLen = wallLen / 2.0f; offsetX = wallLen * ((float)mapWidth / 2.0f) + halfWallLen; offsetZ = wallLen * ((float)mapHeight / 2.0f) + halfWallLen; map = new short[mapHeight + 2, mapWidth + 2]; for (int i = 0; i < mapHeight + 2; i++) { for (int j = 0; j < mapWidth + 2; j++) { if (i == 0 || j == 0 || i == mapHeight + 2 - 1 || j == mapWidth + 2 - 1) { map[i, j] = -1; } else { map[i, j] = 0; } } } int tmpInt; ArrayList arrayRand = new ArrayList(); System.Random random = new System.Random((int)DateTime.Now.Ticks); step tmpStep = new step(new Vector2(1, 1), new Vector2(1, 1)); myStack.Push(tmpStep); while (myStack.Count > 0) { tmpStep = (step)myStack.Pop(); if (map[(int)tmpStep.startPos.y, (int)tmpStep.startPos.x] == 1) { continue; } map[(int)tmpStep.startPos.y, (int)tmpStep.startPos.x] = 1; arrayRand.Clear(); while (arrayRand.Count < 4) { tmpInt = random.Next(0, 4); if (!arrayRand.Contains(tmpInt)) { arrayRand.Add(tmpInt); } } foreach (int value in arrayRand) { forward(value, tmpStep); } } }
/// <summary> /// Конструктор формы /// </summary> /// <param name="cells"></param> /// <param name="_evol"></param> /// <param name="_r_surv"></param> /// <param name="_r_born"></param> /// <param name="_check"></param> public CadrForm(byte[,] cells, byte[,] _evol, bool[] _r_surv, bool[] _r_born, bool _check) { InitializeComponent(); Cells = (byte[,])cells.Clone(); Evol = (byte[,])_evol.Clone(); r_surv = (bool[])_r_surv.Clone(); r_born = (bool[])_r_born.Clone(); if (_check) s = CellAutomaton.CellularAutomaton; else s = CellAutomaton.CellularAutomatonNT; }
/// <summary> /// 当玩家完成回合时调用(包括该玩家的动作/移动) /// </summary> /// <param name="player">玩家引用</param> /// <param name="turn">回合索引</param> /// <param name="move">移动对象数据</param> /// <param name="photonPlayer">Photon player.</param> public void OnPlayerFinished(PhotonPlayer photonPlayer, int turn, object move) { Debug.Log("OnTurnFinished: " + photonPlayer + " turn: " + turn + " action: " + move); if (!photonPlayer.IsLocal) { step tmpStep = new step(); tmpStep = (step)move; MoveStone(tmpStep.moveId, tmpStep.killId, new Vector3(tmpStep.xTo, 1f, tmpStep.zTo)); } }
/// <summary> /// 新建案例时默认的空案例 /// </summary> /// <returns></returns> private string tmpCase() { var csm = new testCase(); csm.steps = new List <step>(); var step = new step(); csm.steps.Add(step); step.name = "emptyStep"; step.describe = "起始空节点"; step.spaceID = -1;//空sapce step.attrs = new Dictionary <string, string>(); return(JsonConvert.SerializeObject(csm)); }
public IHttpActionResult Deletestep(decimal id) { step step = db.steps.Find(id); if (step == null) { return(NotFound()); } db.steps.Remove(step); db.SaveChanges(); return(Ok(step)); }
/// <summary> /// 通过记录的步骤结构体来返回上一步 /// </summary> /// <param name="_step"></param> void Back(step _step) { if (_step.killId != GlobalConst.NOCHESS) { ReliveChess(_step.killId); } MoveChessman(_step.moveId, _step.xFrom, _step.zFrom, GlobalConst.NOCHESS); HidePath(); if (_selectedId != GlobalConst.NOCHESS) { _selectedId = GlobalConst.NOCHESS; } }
// GET: steps/Details/5 public ActionResult Details(decimal id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } step step = db.steps.Find(id); if (step == null) { return(HttpNotFound()); } return(View(step)); }
public bool isStepAdded( string LessonStep, int stepNumb ) { if (!stepExists( LessonStep )) { try { step st = new step() { lessonStep = LessonStep, stepNumber = stepNumb }; MOE_DB.steps.InsertOnSubmit( st ); MOE_DB.SubmitChanges(); return true; } catch (Exception ex) { return false; }//try catch } else return false; }
partial void Deletestep(step instance);
partial void Updatestep(step instance);
partial void Insertstep(step instance);