/// <summary> /// </summary> /// <param name="aeqp"/> /// <param name="hb"/> /// <param name="state"/> /// <param name="handled"/> public void PROCESS_STATE_CHANGED0(AoEquipment aeqp, IHandlingBatch hb, ProcessStates state, ref bool handled) { try { string status = string.Empty; if (state == ProcessStates.LastLoading || state == ProcessStates.LastUnloading) { status = LoadingStates.BUSY.ToString(); } else if (state == ProcessStates.StartSetup || state == ProcessStates.EndSetup) { status = LoadingStates.SETUP.ToString(); } if (string.IsNullOrEmpty(status)) { return; } SimulationHelper.CollectEqpPlan(hb, aeqp, status); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
/// <summary> /// </summary> /// <param name="wstep"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public IEnumerable <AoEquipment> GET_LOADABLE_EQPS0(WorkStep wstep, ref bool handled, IEnumerable <AoEquipment> prevReturnValue) { try { List <AoEquipment> equipList = new List <AoEquipment>(); if (wstep.Steps.Count == 0) { return(equipList); } List <string> list = SimulationHelper.GetLoadableList(wstep.Steps[0] as MicronBEAssyBEStep); foreach (string eqp in list) { AoEquipment aeqp = AoFactory.Current.GetEquipment(eqp); if (aeqp == null) { continue; } equipList.Add(aeqp); } return(equipList); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(IEnumerable <AoEquipment>)); } }
public static void Main(string[] args) { var ecsRoot = SimulationHelper.GenerateSimulation(3, 3, 3, 3, 1); // simulation.Tick(); }
/// <summary> /// 加载随机数 /// </summary> /// <param name="IsLogin">0未登陆 1登陆</param> private void Load_RandomList(string RandomLabelType) { #region 加载随机数 Encoding ec = Encoding.GetEncoding("utf-8"); foreach (ModelRandom m in Publish_Model.ListRandomModel.Where(p => p.RandomLabelType == RandomLabelType)) { string randContent = string.Empty; if (tempLinkUrl.ToLower() == (StrLoginDir + m.RandomUrl).ToLower()) { randContent = tempLinkContent; } else { randContent = SimulationHelper.PostPage(StrLoginDir + m.RandomUrl, m.RandomPostData, string.Empty, Publish_Model.PageEncode, ref cookieHeader); tempLinkUrl = StrLoginDir + m.RandomUrl; tempLinkContent = randContent; } string RandomCutRegex = m.RandomCutRegex; RandomCutRegex = RandomCutRegex.Replace("[参数]", "([\\S\\s]*?)"); string CutStrContent = SimulationHelper.CutStr(randContent, RandomCutRegex)[0]; if (!dic.ContainsKey(m.LabelName)) { dic.Add(m.LabelName, HttpUtility.UrlEncode(CutStrContent, ec)); } } #endregion }
/// <summary> /// 替换随机值 /// </summary> /// <param name="labelType"></param> /// <returns></returns> private void Load_RandomLabel(string labelType) { #region 加载随机数 Encoding ec = Encoding.GetEncoding("utf-8"); foreach (ModelRandom m in model.ListRandomModel.Where(p => p.RandomLabelType == labelType)) { string randContent = string.Empty; if (tempLinkUrl.ToLower() == (this.txtTestSiteAdminUrl.Text + m.RandomUrl).ToLower()) { tempLinkUrl = this.txtTestSiteAdminUrl.Text + m.RandomUrl; randContent = tempLinkContent; } else { randContent = SimulationHelper.PostPage(this.txtTestSiteAdminUrl.Text + m.RandomUrl, m.RandomPostData, string.Empty, model.PageEncode, ref this.LoginedCookies); } string RandomCutRegex = m.RandomCutRegex; RandomCutRegex = RandomCutRegex.Replace("[参数]", "([\\S\\s]*?)"); string CutStrContent = SimulationHelper.CutStr(randContent, RandomCutRegex)[0]; if (!dic.ContainsKey(m.LabelName)) { dic.Add(m.LabelName, HttpUtility.UrlEncode(CutStrContent, ec)); //dic.Add(m.LabelName, CutStrContent); } } #endregion }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="ao"/> /// <param name="now"/> /// <param name="handled"/> public void ON_END_TASK0(IHandlingBatch hb, ActiveObject ao, DateTime now, ref bool handled) { try { AoEquipment equip = ao as AoEquipment; MicronBEAssyBELot lot = hb as MicronBEAssyBELot; if (equip == null) { SimulationHelper.CollectEqpPlan(hb, equip, LoadState.BUSY.ToString()); } MicronBEAssyBEStep step = lot.CurrentStep as MicronBEAssyBEStep; //if (step.StepAction != null && step.StepAction.FWTractIn == StepActionInfo.MCP) // lot.ChildLots.Clear(); if (lot.ReservationEqp == equip) { lot.ReservationEqp = null; } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
/// <summary> /// 发送文章 /// </summary> /// <param name="mlistPost"></param> /// <param name="mClassList"></param> /// <returns></returns> public void Publish_PostData(ModelGatherItem mlistPost, ModelClassItem mClassList) { //登陆 if (string.IsNullOrEmpty(cookieHeader)) { Publish_Login(); } Load_RandomList("内容"); string postData = Publish_Model.ContentPostData; postData = ReplacePostData(postData); postData = postData.Replace("[标题]", mlistPost.Title); postData = postData.Replace("[内容]", System.Web.HttpUtility.UrlEncode(mlistPost.Content)); //替换分类 postData = postData.Replace("[分类ID]", mClassList.ClassID); postData = postData.Replace("[分类名称]", mClassList.ClassName); string htmlContent = SimulationHelper.PostPage(StrLoginDir + Publish_Model.ContentUrl, postData, StrLoginDir + Publish_Model.ContentRefUrl, Publish_Model.PageEncode, ref cookieHeader); string[] errorResult = Publish_Model.ContentErrorResult.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (string str in errorResult) { if (htmlContent.IndexOf(str) > -1) { if (Out != null) { Out(this, PublishType.PostDataOver, false, "文章发布失败!", mlistPost); } break; } } if (!string.IsNullOrEmpty(Publish_Model.ContentSuccessResult)) { if (htmlContent.IndexOf(Publish_Model.ContentSuccessResult) > -1) { if (Out != null) { Out(this, PublishType.PostDataOver, true, "文章发布成功!", mlistPost); } } else { if (Out != null) { Out(this, PublishType.PostDataOver, false, "文章发布失败!", mlistPost); } } } else { if (Out != null) { Out(this, PublishType.PostDataOver, true, "文章发布成功!", mlistPost); } } }
public void RandomSpin(int gameId, int level, string currencyCode, int numOfUsers, int numItrPerUser, decimal bet) { const int lines = Game.Lines; var timeStart = DateTime.Now; var module = SimulationHelper.GetModule(gameId); var configuration = new Configuration(); var targetRtpLevel = Math.Round(configuration.RtpLevels.FirstOrDefault(rl => rl.Level == level).Rtp, 2); var totalSummaryData = new SummaryData(); var users = SimulationHelper.GetUsers(gameId, numOfUsers, level); var spinBets = SimulationHelper.GetUserBets(users, bet, lines); var spinRequestContext = SimulationHelper.GetMockSpinRequestContext(gameId); var bonusRequestContext = SimulationHelper.GetMockBonusRequestContext(0, gameId); Parallel.ForEach(users, () => new SummaryData(), (key, state, summaryData) => { var spinBet = spinBets[key.UserId]; for (var ctr = 0; ctr < numItrPerUser; ctr++) { var spinResult = module.ExecuteSpin(level, null, spinRequestContext).Value as SpinResult; summaryData.Update(spinResult); if (spinResult.HasBonus) { var bonus = module.CreateBonus(spinResult).Value; while (!bonus.IsCompleted) { var bonusResult = SimulationHelper.ExecuteBonus(level, bonus, bonusRequestContext, configuration).Value; summaryData.UpdateBonus(bonusResult); bonus = bonusResult.Bonus; } } } return(summaryData); }, summaryData => { lock (totalSummaryData) { totalSummaryData.Sum(summaryData); } }); totalSummaryData.DisplayData(level, timeStart, targetRtpLevel); totalSummaryData.DisplayPayoutsData(bet, lines); var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 1 && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 1; Assert.True(isWithinRtp, $"RTP not matching. The result is {totalSummaryData.RtpData.OverallRtp}. Expected is {targetRtpLevel}"); }
public void FixedUpdate() { //If we are the server then update simulated objects if (mode == NetworkManagerMode.ServerOnly) { SimulationHelper.UpdateSimulationObjectData(); } }
private void ViewCMS(ModelWebPublishModule m) { LoginPostData = mPublishModuleItem.ViewPostData; string result = SimulationHelper.PostPage(m.SiteUrl + mPublishModuleItem.ViewUrl, "", m.SiteUrl + mPublishModuleItem.ViewRefUrl, mPublishModuleItem.PageEncode, ref LoginedCookies); // }
private void ServerShootWeapon(NetworkedWeapon networkedWeapon) { nextTimeToFire = Time.time + 1f / networkedWeapon.GetTCWeapon().fireRate; networkedWeapon.CurrentBulletAmount--; RpcWeaponMuzzleFlash(); SimulationHelper.SimulateCommand(playerManager, () => WeaponRayCast()); }
private void work(int index, int sfsdf) { string cookies = string.Empty, cookies1 = string.Empty; this.pbVerCode.Image = SimulationHelper.PostImage(LoginVerCodeUrl, ref cookies); if (OutCookie != null) { OutCookie(cookies); } th.Stop(); }
/// <summary> /// 创建分类 /// </summary> /// <param name="strClassName"></param> public void Publish_CreateClass(string strClassName) { //登陆 if (string.IsNullOrEmpty(cookieHeader)) { Publish_Login(); } Load_RandomList("列表"); string postData = Publish_Model.ListCreatePostData; postData = ReplacePostData(postData); string htmlContent = SimulationHelper.PostPage(StrLoginDir + Publish_Model.ListCreateUrl, Publish_Model.ListCreatePostData, StrLoginDir + Publish_Model.ListCreateRefUrl, Publish_Model.PageEncode, ref cookieHeader); string[] errorResult = Publish_Model.ListCreateError.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (string str in errorResult) { if (htmlContent.IndexOf(str) > -1) { if (Out != null) { Out(this, PublishType.CreateClassOver, false, "分类创建失败!", strClassName); } break; } } if (!string.IsNullOrEmpty(Publish_Model.ListCreateSuccess)) { if (htmlContent.IndexOf(Publish_Model.ContentSuccessResult) > -1) { if (Out != null) { Out(this, PublishType.CreateClassOver, true, "分类创建成功!", strClassName); } } else { if (Out != null) { Out(this, PublishType.CreateClassOver, false, "分类创建失败!", strClassName); } } } else { if (Out != null) { Out(this, PublishType.CreateClassOver, true, "分类创建成功!", strClassName); } } }
/// <summary> /// </summary> /// <param name="da"/> /// <param name="hb"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public bool INTERCEPT_IN0(DispatchingAgent da, IHandlingBatch hb, ref bool handled, bool prevReturnValue) { try { MicronBEAssyBEStep currentStep = hb.CurrentStep as MicronBEAssyBEStep; MicronBEAssyBELot lot = hb as MicronBEAssyBELot; if (lot.Product is AssyMcpPart) { AssyMcpPart mcpPart = lot.Product as AssyMcpPart; AssyMcpProduct mcpProduct = mcpPart.FinalProduct as AssyMcpProduct; if (mcpPart.PartChangeStep == lot.CurrentStepID) { Tuple <AssyMcpProduct, AssyMcpPart> baseKey = null; Tuple <AssyMcpProduct, AssyMcpPart> sourceKey = null; AssyMcpPart mergeMcpPart = McpHelper.GetMergeMcpPart(mcpPart); if (mcpPart.IsBase) { baseKey = Tuple.Create(mcpProduct, mcpPart); sourceKey = Tuple.Create(mcpProduct, mergeMcpPart); InputMart.Instance.MatchingLotList.Add(baseKey, lot); } else { baseKey = Tuple.Create(mcpProduct, mergeMcpPart); sourceKey = Tuple.Create(mcpProduct, mcpPart); InputMart.Instance.MatchingLotList.Add(sourceKey, lot); } List <MicronBEAssyBELot> matchLotList = SimulationHelper.MatchingMcpLot(da, baseKey, sourceKey); foreach (MicronBEAssyBELot matchLot in matchLotList) { da.ReEnter(matchLot); } return(true); } } return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(bool)); } }
/// <summary> /// Calculates the movement. /// </summary> /// <remarks>Low precision method, can be used only if wheel movements are wery small (close to zero).</remarks> /// <remarks>In this case <see cref="s"/> variable can be considered as straight line in calculation triangle (sin, cos).</remarks> /// <param name="startPoint">The start point.</param> /// <param name="leftEncoder">The left encoder.</param> /// <param name="rightEncoder">The right encoder.</param> /// <param name="geometry">The geometry.</param> /// <returns></returns> public static SimulationPoint CalculateMovement(SimulationPoint startPoint, double leftEncoder, double rightEncoder, IRobotGeometry geometry) { const double ZERO_ANGLE = 90.0; var teta0 = SimulationHelper.DegreesToRadians(startPoint.Angle - ZERO_ANGLE); var leftDistance = leftEncoder * geometry.OnePointDistance; var rightDistance = rightEncoder * geometry.OnePointDistance; var s = (leftDistance + rightDistance) / 2.0; var teta = ((leftDistance - rightDistance) / geometry.Width) + teta0; var x = s * Math.Cos(teta) + startPoint.X; var y = s * Math.Sin(teta) + startPoint.Y; return(new SimulationPoint(x, y, SimulationHelper.RadiansToDegrees(teta) + ZERO_ANGLE)); }
/// <summary> /// 测试发布内容 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTestContent_Click(object sender, EventArgs e) { this.txtHtmlView.Clear(); this.txtResultView.Clear(); model = this.GetModelXml(this.cmbModuleList.Text); Encoding ed = Encoding.GetEncoding(model.PageEncode); if (!IsLogin) { btnTestLogin_Click(null, null); } string PostData = model.ContentPostData; PostData = PostData.Replace("[标题]", this.txtTitle.Text); PostData = PostData.Replace("[内容]", this.txtContent.Text); ListItem li = (ListItem)this.cmbViewClassList.SelectedItem; PostData = PostData.Replace("[分类ID]", li.Value); PostData = PostData.Replace("[分类名称]", li.Text); //加载随机值 this.Load_RandomLabel("内容"); //替换随机值 foreach (KeyValuePair <string, string> item in dic) { PostData = PostData.Replace("[" + item.Key + "]", item.Value); } string result = string.Empty; try { result = SimulationHelper.PostPage( this.txtTestSiteAdminUrl.Text + model.ContentUrl, PostData, this.txtTestSiteAdminUrl.Text + model.ContentRefUrl, model.PageEncode, ref this.LoginedCookies); this.txtHtmlView.Clear(); this.txtHtmlView.Text = result; this.txtResultView.Clear(); this.txtResultView.Text = "内容发布成功!"; } catch (Exception ex) { this.txtHtmlView.Clear(); this.txtHtmlView.Text = result; this.txtResultView.Clear(); this.txtResultView.Text = "内容发布失败!" + ex.Message + "==" + ex.StackTrace; } }
private void StartWeb() { foreach (ModelWebPublishModule m in Model.ListModelWebPublishModule) { var mPublishModuleItem = GetModelXml(m.ModuleNameFile); if (m.IsCookiesLogin == 1) { var LoginedCookies = m.CookiesValue; var LoginPostData = mPublishModuleItem.ViewPostData; string result = SimulationHelper.PostPage(m.SiteUrl + mPublishModuleItem.ViewUrl, "", m.SiteUrl + mPublishModuleItem.ViewRefUrl, mPublishModuleItem.PageEncode, ref LoginedCookies); } } }
private void GetClassList() { LoginPostData = ""; string result = SimulationHelper.PostPage(SiteUrl + modelLogin.ListUrl, "", SiteUrl + modelLogin.ListRefUrl, modelLogin.PageEncode, ref LoginedCookies); string ClassListRegex = modelLogin.ListClassIDRegex.Replace("[参数1]", "(.*?)"); string[] aa = CollectionHelper.Instance.CutStr(result, ClassListRegex); this.txtLogView.Clear(); foreach (string str in aa) { this.combClassList.Items.Add(str); } }
/// <summary> /// 用户登陆 /// </summary> public void Publish_Login() { CacheManageHelper cache = CacheManageHelper.Instance; if (cache.Contains(this.WebSiteUrl)) { cookieHeader = cache.Get(this.WebSiteUrl) as string; Load_RandomList("登陆"); if (Publish_Type == PublishType.Login) { if (Out != null) { Out(this, PublishType.LoginOver, true, "登陆成功!", null); } } } else { string postData = Publish_Model.LoginPostData; Load_RandomList("登陆"); postData = ReplacePostData(postData); string htmlContent = SimulationHelper.PostLogin(this.StrLoginDir + Publish_Model.LoginUrl, postData, string.Empty, Publish_Model.PageEncode, ref cookieHeader); if (htmlContent.IndexOf(Publish_Model.LoginSuccessResult) > -1) { cache.Add(this.WebSiteUrl, cookieHeader); if (Publish_Type == PublishType.Login) { if (Out != null) { Out(this, PublishType.LoginOver, true, "登陆成功!", null); } } } else { if (Publish_Type == PublishType.Login) { if (Out != null) { Out(this, PublishType.LoginOver, false, "登陆失败!", null); } } } } }
private void LoginCMS() { try { string result = SimulationHelper.PostLogin(SiteUrl + modelLogin.LoginUrl, LoginPostData, SiteUrl + modelLogin.LoginRefUrl, modelLogin.PageEncode, ref LoginedCookies); foreach (string str in modelLogin.LoginErrorResult.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) { if (result.IndexOf(str) > -1) { this.txtLogView.Clear(); this.txtLogView.AppendText("登录失败!值为:" + str); return; } } if (modelLogin.LoginSuccessResult.Trim() != "") { if (result.IndexOf(modelLogin.LoginSuccessResult) > -1) { GetClassList(); //this.txtLogView.Clear(); //this.txtLogView.AppendText("登录成功!Cookies值为:" + LoginedCookies); } else { this.txtLogView.Clear(); this.txtLogView.AppendText("登录失败!没找到成功的值为:" + modelLogin.LoginSuccessResult); } } else { GetClassList(); //this.txtLogView.Clear(); //this.txtLogView.AppendText("登录成功!Cookies值为:" + LoginedCookies); } } catch (Exception ex) { this.txtLogView.Clear(); this.txtLogView.AppendText(ex.Message); } }
/// <summary> /// </summary> /// <param name="da"/> /// <param name="hb"/> /// <param name="handled"/> public void ON_DISPATCH_IN0(DispatchingAgent da, IHandlingBatch hb, ref bool handled) { try { #if DEBUG if (hb.Sample.LotID == "LOT10_L") { Console.WriteLine(); } #endif SimulationHelper.CollectEqpPlan(hb, null, LoadState.WAIT.ToString()); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="ao"/> /// <param name="now"/> /// <param name="handled"/> public void ON_START_TASK0(IHandlingBatch hb, ActiveObject ao, DateTime now, ref bool handled) { try { AoEquipment equip = ao as AoEquipment; MicronBEAssyBELot lot = hb as MicronBEAssyBELot; if (equip == null) { SimulationHelper.CollectEqpPlan(hb, equip, LoadState.BUSY.ToString()); } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
/// <summary> /// 获取分类列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTestClassList_Click(object sender, EventArgs e) { this.txtHtmlView.Clear(); this.txtResultView.Clear(); model = this.GetModelXml(this.cmbModuleList.Text); Encoding ed = Encoding.GetEncoding(model.PageEncode); if (!IsLogin) { btnTestLogin_Click(this, null); } string result = SimulationHelper.PostPage( this.txtTestSiteAdminUrl.Text + model.ListUrl, "", this.txtTestSiteAdminUrl.Text + model.ListRefUrl, model.PageEncode, ref this.LoginedCookies); this.txtHtmlView.Text = result; if (!string.IsNullOrEmpty(model.ListClassIDNameRegex)) { string CutClassRegex = model.ListClassIDNameRegex; CutClassRegex = HtmlHelper.Instance.ParseCollectionStrings(CutClassRegex); CutClassRegex = CutClassRegex.Replace("\\[参数:分类ID]", "([\\S\\s].*?)"); CutClassRegex = CutClassRegex.Replace("\\[参数:分类名称]", "([\\S\\s].*?)"); CutClassRegex = CutClassRegex.Replace("(*)", "[\\S\\s].*?"); Match mch = null; Regex reg = new Regex(CutClassRegex, RegexOptions.IgnoreCase | RegexOptions.Compiled); this.cmbClassList.Items.Clear(); this.cmbViewClassList.Items.Clear(); for (mch = reg.Match(result); mch.Success; mch = mch.NextMatch()) { string classid = mch.Groups[1].Value; string classname = mch.Groups[2].Value; this.txtResultView.AppendText(classid + "===" + classname + "\r\n"); this.cmbClassList.Items.Add(new ListItem(classid, classname)); this.cmbViewClassList.Items.Add(new ListItem(classid, classname)); } this.cmbClassList.Items.Insert(0, new ListItem("0", "请选择")); this.cmbClassList.SelectedIndex = 0; this.cmbViewClassList.Items.Insert(0, new ListItem("0", "请选择")); this.cmbViewClassList.SelectedIndex = 0; } }
/// <summary> /// 测试登陆数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTestLogin_Click(object sender, EventArgs e) { this.txtHtmlView.Clear(); model = this.GetModelXml(this.cmbModuleList.Text); Encoding ed = Encoding.GetEncoding(model.PageEncode); string PostData = model.LoginPostData; PostData = PostData.Replace("[用户名]", this.txtTestUserName.Text); PostData = PostData.Replace("[密码]", this.txtTestUserPwd.Text); //加载随机值 this.Load_RandomLabel("登陆"); //替换随机值 foreach (KeyValuePair <string, string> item in dic) { PostData = PostData.Replace("[" + item.Key + "]", item.Value); } string result = SimulationHelper.PostLogin(this.txtTestSiteAdminUrl.Text + model.LoginChkrl, PostData, model.LoginRefUrl, model.PageEncode, ref LoginedCookies); this.txtHtmlView.Text = result; foreach (string str in model.LoginErrorResult.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) { if (result.IndexOf(str) > -1) { this.txtResultView.Clear(); this.txtResultView.AppendText("登录失败!值为:" + str); return; } } if (result.IndexOf(model.LoginSuccessResult) > -1) { IsLogin = true; this.txtResultView.Clear(); this.txtResultView.AppendText("登录成功!Cookies值为:" + LoginedCookies); } else { this.txtResultView.Clear(); this.txtResultView.Text = result; } }
/// <summary> /// 获取分类 /// </summary> /// <returns></returns> public void Publish_GetClassList() { //登陆 if (string.IsNullOrEmpty(cookieHeader)) { Publish_Login(); } string postData = string.Empty; string htmlContent = SimulationHelper.PostPage(StrLoginDir + Publish_Model.ListUrl, postData, StrLoginDir + Publish_Model.ListUrl, Publish_Model.PageEncode, ref cookieHeader); string regexClassID = HtmlHelper.Instance.ParseCollectionStrings(Publish_Model.ListClassIDNameRegex); regexClassID = regexClassID.Replace("\\[参数:分类ID]", "([\\S\\s]*?)"); regexClassID = regexClassID.Replace("\\[参数:分类名称]", ".+?"); string[] ArrayClassID = CollectionHelper.Instance.CutStr(htmlContent, regexClassID); string regexClassName = HtmlHelper.Instance.ParseCollectionStrings(Publish_Model.ListClassIDNameRegex); regexClassName = regexClassName.Replace("\\[参数:分类ID]", ".+?"); regexClassName = regexClassName.Replace("\\[参数:分类名称]", "([\\S\\s]*?)"); string[] ArrayClassName = CollectionHelper.Instance.CutStr(htmlContent, regexClassName); List <ModelClassItem> dicClassList = new List <ModelClassItem>(); for (int i = 0; i < ArrayClassID.Length; i++) { string ClassID = ArrayClassID[i]; string ClassName = ArrayClassName[i]; ModelClassItem m = new ModelClassItem(); m.ClassID = ClassID; m.ClassName = ClassName; dicClassList.Add(m); } if (Out != null) { Out(this, PublishType.GetClassListOver, true, "获取分类列表成功!", dicClassList); } }
/// <summary> /// </summary> /// <param name="upWorkStep"/> /// <param name="assignEqps"/> /// <param name="context"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public List <AssignEqp> DO_FILTER_ASSIGN_EQP0(WorkStep upWorkStep, List <AssignEqp> assignEqps, JobChangeContext context, ref bool handled, List <AssignEqp> prevReturnValue) { try { List <AssignEqp> list = new List <AssignEqp>(); foreach (AssignEqp eqp in assignEqps) { if (eqp.WorkStep == null || eqp.WorkStep.OperationType == OperationType.Down) { list.Add(eqp); continue; } int properEqpCount = SimulationHelper.CalculateProperEqpCount(eqp); bool canFilter = false; canFilter = SimulationHelper.CanFilterAssignEqp(eqp); if (properEqpCount < eqp.WorkStep.LoadedEqpCount && canFilter) { #if DEBUG DateTime nowDt = FindHelper.GetNowDT(); MicronBEAssyWorkStep ws = eqp.WorkStep as MicronBEAssyWorkStep; if (eqp.WorkStep.Key.ToString() == "S0250") { Console.WriteLine(); } Logger.MonitorInfo(string.Format("Filtered -> STEP : {0}, EQP_ID : {1}, NowDT : {2}, Available Down : {3}", eqp.WorkStep.Key.ToString(), eqp.Target.EqpID, DateUtility.DbToString(FindHelper.GetNowDT()), DateUtility.DbToString(ws.AvailableDownTime))); #endif list.Add(eqp); } } return(list); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(List <AssignEqp>)); } }
/// <summary> /// 创建分类 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTestClassListCreate_Click(object sender, EventArgs e) { this.txtHtmlView.Clear(); this.txtResultView.Clear(); model = this.GetModelXml(this.cmbModuleList.Text); Encoding ed = Encoding.GetEncoding(model.PageEncode); if (!IsLogin) { btnTestLogin_Click(null, null); } string PostData = model.ListCreatePostData; PostData = PostData.Replace("[分类名称]", this.txtClassName.Text); this.Load_RandomLabel("列表"); foreach (KeyValuePair <string, string> item in dic) { PostData = PostData.Replace("[" + item.Key + "]", item.Value); } string result = string.Empty; try { result = SimulationHelper.PostPage( this.txtTestSiteAdminUrl.Text + model.ListCreateUrl, PostData, this.txtTestSiteAdminUrl.Text + model.ListCreateRefUrl, model.PageEncode, ref this.LoginedCookies); this.txtHtmlView.Clear(); this.txtHtmlView.Text = result; this.txtResultView.Clear(); this.txtResultView.Text = "创建分类成功!"; } catch (Exception ex) { this.txtHtmlView.Clear(); this.txtHtmlView.Text = result; this.txtResultView.Clear(); this.txtResultView.Text = "创建分类失败!" + ex.Message + "==" + ex.StackTrace; } }
/// <summary> /// </summary> /// <param name="step"/> /// <param name="assignedEqps"/> /// <param name="context"/> /// <param name="handled"/> public void ON_AFTER_ASSIGN_EQP0(WorkStep step, List <AssignEqp> assignedEqps, JobChangeContext context, ref bool handled) { try { Logger.MonitorInfo(string.Format("Assign Eqp -> STEP : {0}, EQP_ID : {1}, NowDT : {2}", step.Key.ToString(), assignedEqps.ElementAt(0).Target.EqpID, DateUtility.DbToString(FindHelper.GetNowDT()))); MicronBEAssyWorkStep ws = step as MicronBEAssyWorkStep; double setupTime = 0d; ws.AvailableDownTime = SimulationHelper.CalculateAvailableDownTime(step, assignedEqps.ElementAt(0), ref setupTime); Logger.MonitorInfo(string.Format("Available Down Time : {0}, Setup Time : {1}", ws.AvailableDownTime, setupTime)); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } //foreach (AssignEqp eqp in assignedEqps) //{ // eqp.Target.WakeUp(); //} }
/// <summary> /// </summary> /// <param name="aeqp"/> /// <param name="hb"/> /// <param name="handled"/> public void ON_CUSTOM_LOAD0(AoEquipment aeqp, IHandlingBatch hb, ref bool handled) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; string stepID = hb.CurrentStep.StepID; double stdLotSize = SimulationHelper.GetStdLotSize(stepID, lot.Product.LineID, lot.Product.ProductID); if (stdLotSize > 0 && stdLotSize < lot.UnitQtyDouble) { List <MicronBEAssyBELot> splitLots = SimulationHelper.GetSplitLots(lot, stdLotSize); foreach (MicronBEAssyBELot splitLot in splitLots) { splitLot.ReservationEqp = aeqp; AoFactory.Current.In(splitLot); aeqp.AddInBuffer(splitLot); SimulationHelper.CollectEqpPlan(splitLot, aeqp, LoadState.WAIT.ToString()); } string waitPlanKey = SimulationHelper.GetEqpPlanKey(lot, string.Empty, LoadState.WAIT.ToString()); if (InputMart.Instance.EqpPlans.ContainsKey(waitPlanKey)) { InputMart.Instance.EqpPlans.Remove(waitPlanKey); } } else { AoFactory.Current.In(lot); aeqp.AddInBuffer(lot); } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
public void TestFullCycle(int gameId, int level) { var timeStart = DateTime.Now; var module = SimulationHelper.GetModule(gameId); var configuration = new Configuration(); var targetRtpLevel = Math.Round(configuration.RtpLevels.FirstOrDefault(rl => rl.Level == level).Rtp, 2); var totalSummaryData = new SummaryData(); var spinRequestContext = SimulationHelper.GetMockSpinRequestContext(gameId); var bonusRequestContext = SimulationHelper.GetMockBonusRequestContext(gameId, 0); var targetWheel = MainGameEngine.GetTargetWheel(level, configuration); var userGameKey = new UserGameKey() { UserId = -1, GameId = gameId, Level = level }; var spinBet = MainGameEngine.GenerateSpinBet(spinRequestContext); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight); for (var reel1 = 0; reel1 < targetWheel[0].Count; reel1++) { for (var reel2 = 0; reel2 < targetWheel[1].Count; reel2++) { for (var reel3 = 0; reel3 < targetWheel[2].Count; reel3++) { wheel.Reels[0] = SimulationHelper.GetReelRange(targetWheel[0], reel1); wheel.Reels[1] = SimulationHelper.GetReelRange(targetWheel[1], reel2); wheel.Reels[2] = SimulationHelper.GetReelRange(targetWheel[2], reel3); var topIndices = new List <int> { reel1, reel2, reel3 }; var winPositions = MainGameEngine.GenerateWinPositions(configuration.Payline, configuration.PayTable, wheel, spinBet.LineBet, spinBet.Lines, spinBet.Multiplier); var stackedReels = MainGameEngine.GetStackedReels(wheel, configuration.PayTable); var bonusPositions = MainGameEngine.GenerateBonusPositions(stackedReels); var spinResult = new SpinResult(spinBet, wheel, winPositions, bonusPositions) { PlatformType = spinRequestContext.Platform, Level = level }; totalSummaryData.Update(spinResult); if (spinResult.HasBonus) { var bonus = module.CreateBonus(spinResult).Value; while (!bonus.IsCompleted) { var bonusResult = SimulationHelper.ExecuteBonus(level, bonus, bonusRequestContext, configuration).Value; totalSummaryData.UpdateBonus(bonusResult); bonus = bonusResult.Bonus; } } } } } totalSummaryData.DisplayData(level, timeStart, targetRtpLevel); var resultOverallRtp = Math.Round(totalSummaryData.RtpData.OverallRtp, 2); var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 0.5m && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 0.5m; Assert.True(isWithinRtp, $"RTP not matching. The result is {resultOverallRtp}. Expected is {targetRtpLevel}"); }