void OnDestroy() { UT.assert(closed == true); }
private static void RunTest() { UT.print("-------- MListTest start --------"); MList <int> l = new MList <int>(); // insert first l.AddLast(1); l.AssertValid(); print(l); l.AddFirst(2); l.AssertValid(); print(l); l.AddFirst(3); print(l); // insert before var it = l.Iterator(); it.AssertValid(); it.Next(); it.InsertBefore(-1); it.AssertValid(); print(l); it.InsertBefore(0); it.AssertValid(); l.AssertValid(); print(l); // "-1 0 1 2 3" while (it.HasNext()) { it.Next(); } it.InsertBefore(2); it.AssertValid(); l.AssertValid(); print(l); // "-1 0 1 2 2 3" l = new MList <int>(); // fill list for (int i = 0; i < FILL_SIZE; i++) { l.AddLast(100 + i); } print(l); UT.assert(l.Size() == FILL_SIZE); // iterator insert and remove it = l.Iterator(); while (it.Next()) { it.InsertAfter(555555); l.AssertValid(); if (it.Next()) { it.Remove(); } l.AssertValid(); } it.InsertAfter(123456); print(l); l.AssertValid(); // remove last it = l.Iterator(); while (it.HasNext()) { it.Next(); } it.Remove(); l.AssertValid(); l.RemoveAll(); l.AssertValid(); UT.assert(l.Size() == 0); // empty by iterator l = new MList <int>(); for (int i = 0; i < 2; i++) { l.AddLast(10 + i); } it = l.Iterator(); while (it.Next()) { l.AssertValid(); it.AssertValid(); it.Remove(); l.AssertValid(); it.AssertValid(); } // test remove last iterator l = new MList <int>(); for (int i = 0; i < 2; i++) { l.AddLast(10 + i); } it = l.Iterator(); it.Next(); l.Remove(it); l.AssertValid(); UT.print("-------- MListTest end --------"); }
private void _Show_PlayerInfo(COMDT_PLAYERINFO info, uint force, int levelIndex, string headurl = "", COMDT_GAME_VIP_CLIENT nobeVip = null) { if (info == null || info.szName == null) { return; } this.nameText.text = UT.Bytes2String(info.szName); this.levelText.text = info.dwLevel.ToString(); if (string.IsNullOrEmpty(headurl)) { this.HttpImage.GetComponent <Image>().SetSprite(CUIUtility.s_Sprite_Dynamic_Icon_Dir + Singleton <BurnExpeditionController> .get_instance().model.GetRandomRobotIcon(levelIndex), this.map_fromScript, true, false, false, false); } else { UT.SetHttpImage(this.HttpImage, headurl); } Image component = this.enemyNode.transform.FindChild("PlayerIcon/NobeIcon").GetComponent <Image>(); Image component2 = this.enemyNode.transform.FindChild("PlayerIcon/pnlSnsHead/NobeImag").GetComponent <Image>(); if (nobeVip != null) { if (component) { MonoSingleton <NobeSys> .GetInstance().SetNobeIcon(component, (int)nobeVip.dwCurLevel, false); } if (component2) { MonoSingleton <NobeSys> .GetInstance().SetHeadIconBk(component2, (int)nobeVip.dwHeadIconId); } } this.enemy_node_0.CustomSetActive(false); this.enemy_node_1.CustomSetActive(false); this.enemy_node_2.CustomSetActive(false); for (int i = 0; i < info.astChoiceHero.Length; i++) { COMDT_CHOICEHERO cOMDT_CHOICEHERO = info.astChoiceHero[i]; if (cOMDT_CHOICEHERO != null && cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.dwHeroID != 0u) { this._Show_Enemy_Heros(i, cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.dwHeroID, string.Empty, (int)cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.wLevel, (int)cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.wStar, cOMDT_CHOICEHERO.stBurningInfo.dwBloodTTH, cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.dwHeroID); } } this.SymbolLevel.CustomSetActive(false); for (int j = 0; j < info.astChoiceHero.Length; j++) { COMDT_CHOICEHERO cOMDT_CHOICEHERO2 = info.astChoiceHero[j]; if (cOMDT_CHOICEHERO2 != null && cOMDT_CHOICEHERO2.stBaseInfo.stCommonInfo.dwHeroID != 0u) { int symbolLvWithArray = CSymbolInfo.GetSymbolLvWithArray(cOMDT_CHOICEHERO2.SymbolID); if (symbolLvWithArray > 0) { this.SymbolLevel.CustomSetActive(true); Utility.GetComponetInChild <Text>(this.SymbolLevel, "Text").text = symbolLvWithArray.ToString(); } break; } } BurnExpeditionModel model = Singleton <BurnExpeditionController> .get_instance().model; uint[] array = model.Get_Buffs(levelIndex); this._Show_Buff(this._GetBuffNode(0), (int)array[0], false); this._Show_Buff(this._GetBuffNode(1), (int)array[1], false); this._Show_Buff(this._GetBuffNode(2), (int)array[2], false); this._Show_Buff_Selected_Index(model.curSelect_BuffIndex); }
public void Check_Box_Info(uint goldNum, uint burn_num) { CUIFormScript cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm("UGUI/Form/Common/Form_Award.prefab", false, true); Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "bg/Title").text = UT.GetText("Burn_Box_Award"); GameObject gameObject = Utility.FindChild(cUIFormScript.gameObject, "IconContainer"); CUIListScript component = gameObject.GetComponent <CUIListScript>(); if (goldNum > 0u && burn_num > 0u) { component.SetElementAmount(2); } else { component.SetElementAmount(1); } int num = 0; if (goldNum > 0u) { this.Set_Award(gameObject, num, CUIUtility.s_Sprite_Dynamic_Icon_Dir + "90001", goldNum.ToString(), UT.GetText("Burn_Info_Coin"), cUIFormScript); num++; } if (burn_num > 0u) { this.Set_Award(gameObject, num, CUIUtility.s_Sprite_Dynamic_Icon_Dir + "90008", burn_num.ToString(), UT.GetText("Burn_Info_yuanzheng"), cUIFormScript); num++; } }
public async Task <ActionResult> Login(LoginViewModel model) { AuthenticationManager.SignOut(); model.UserName = model.UserName.Replace(" ", ""); bool sign = false; bool UserAPI = false; string ErrorMessage = null; UserToken UserTokenAPI = new UserToken(); var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, false, shouldLockout : false); try { var httpWebRequest = WebRequest.Create("https://my.marinehealth.asia/api/auth/mobile"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = "{\"Email\":\"" + model.UserName + "\"," + "\"Password\":\"" + model.Password + "\"}"; streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); } string responsezec; WebResponse response = await httpWebRequest.GetResponseAsync(); using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { responsezec = await reader.ReadToEndAsync(); } } UserTokenAPI = JsonConvert.DeserializeObject <UserToken>(responsezec); UserAPI = true; response.Close(); } catch { UserAPI = false; } if (result == SignInStatus.Success && UserAPI) { try { if (UserTokenAPI.Status == "Success") { sign = true; } else if (UserTokenAPI.Status == "TooManyAttempts") { ErrorMessage = "Cлишком много попыток, пожалуйста, попробуйте еще раз позже"; } else { ErrorMessage = "Имя пользователя или пароль указаны неверно."; } } catch { } } else if (UserAPI) { if (UserTokenAPI.Status == "Success") { var User = await UserManager.FindByNameAsync(model.UserName); if (User == null) { var user = new ApplicationUser { UserName = model.UserName, Email = model.UserName }; var CreateUserResult = await UserManager.CreateAsync(user, model.Password); if (CreateUserResult.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); sign = true; } } else { string code = await UserManager.GeneratePasswordResetTokenAsync(User.Id); var ResertPasswordResult = await UserManager.ResetPasswordAsync(User.Id, code, model.Password); if (ResertPasswordResult.Succeeded) { sign = true; } await SignInManager.PasswordSignInAsync(model.UserName, model.Password, false, shouldLockout : false); } sign = true; } else { if (UserTokenAPI.Status == "TooManyAttempts") { ErrorMessage = "Cлишком много попыток, пожалуйста, попробуйте еще раз позже"; } else { ErrorMessage = "Имя пользователя или пароль указаны неверно."; } } } ModelState.AddModelError("", ErrorMessage); if (sign) { UT UserToken = await db.UTs.FirstOrDefaultAsync(e => e.UserName == model.UserName); if (UserToken != null && UserTokenAPI != null) { if (UserToken.Token != UserTokenAPI.Token) { UserToken.Token = UserTokenAPI.Token; await db.SaveChangesAsync(); } } else { UT newUserToken = new UT(); newUserToken.UserName = model.UserName; newUserToken.Token = UserTokenAPI.Token; newUserToken.Date = DateTime.Now.AddHours(6); db.UTs.Add(newUserToken); await db.SaveChangesAsync(); } return(RedirectToAction("Initialize", "User", new { language = model.Language })); } AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); ViewBag.language = model.Language; return(View(model)); }
public void plane(UT lr_join = UT.ut_open, UT tb_join = UT.ut_open) { GenerateTile(); float x_sh_inc = shear.x * x_inc; float y_sh_inc = shear.z * y_inc; float x_sh_inc2 = x_sh_inc * (1 + y_sh_inc / y_end); float y_sh_inc2 = y_sh_inc * (1 + x_sh_inc / x_end); float x_cross = x_end + x_sh_inc - x_sh_inc2; float y_cross = y_end + y_sh_inc - y_sh_inc2; for (var i = 0; i < raw_verts.Count; i++) { var vert = raw_verts[i]; float x = vert.x; vert.x += (shear.x * x_inc) * (vert.z / y_end); vert.x *= x_end / x_cross; vert.z += (shear.z * y_inc) * (x / x_end); vert.z *= y_end / y_cross; raw_verts[i] = vert; } for (var i = 0; i < raw_verts.Count; i++) { var vert = raw_verts[i]; if (lr_join == UT.ut_twist && (vert.x < -Mathf.Epsilon || vert.x > x_end - Mathf.Epsilon)) { vert.z = -vert.z; } if (lr_join == UT.ut_twist2 && (vert.x < -Mathf.Epsilon || vert.x > x_end - Mathf.Epsilon)) { vert.z = y_end - vert.z; } if (lr_join == UT.ut_twist3 && (vert.x < -Mathf.Epsilon || vert.x > x_end - Mathf.Epsilon)) { vert.z = 1.5f * y_end - vert.z % y_end; } if (tb_join == UT.ut_twist && (vert.z < -Mathf.Epsilon || vert.z > y_end - Mathf.Epsilon)) { vert.x = -vert.x; } if (tb_join == UT.ut_twist2 && (vert.z < -Mathf.Epsilon || vert.z > y_end - Mathf.Epsilon)) { vert.x = x_end - vert.x; } if (tb_join == UT.ut_twist3 && (vert.z < -Mathf.Epsilon || vert.z > y_end - Mathf.Epsilon)) { vert.x = 1.5f * x_end - vert.x % x_end; } if (tb_join == UT.ut_join2 && (vert.z < -Mathf.Epsilon || vert.z > y_end - Mathf.Epsilon)) { vert.x = 0.5f * x_end - vert.x % x_end; } if (lr_join != UT.ut_open) { vert.x = vert.x + x_end % x_end - Mathf.Epsilon; } if (tb_join != UT.ut_open) { vert.z = vert.z + y_end % y_end - Mathf.Epsilon; } raw_verts[i] = vert; } }
protected void DumpElements(IEnumerable <IUnitTestElement> elements, string path) { using (UT.ReadLock()) { var reportedElements = new HashSet <IUnitTestElement>(elements); var roots = new HashSet <IUnitTestElement>(); var orphanedElements = new HashSet <IUnitTestElement>(); var invalidChildren = new HashSet <IUnitTestElement>(); foreach (var unitTestElement in reportedElements) { if (unitTestElement.Parent != null && !reportedElements.Contains(unitTestElement.Parent)) { orphanedElements.Add(unitTestElement); } if (unitTestElement.Parent != null && !unitTestElement.Parent.Children.Contains(unitTestElement)) { invalidChildren.Add(unitTestElement); } if (unitTestElement.Parent == null) { roots.Add(unitTestElement); } } ExecuteWithGold(path, file => { foreach (var element in OrderById(roots)) { DumpElement(file, element, reportedElements, string.Empty); } if (orphanedElements.Count > 0) { file.WriteLine(); file.WriteLine(); file.WriteLine("Section: Has parent, but parent wasn't reported"); file.WriteLine(); foreach (var element in OrderById(orphanedElements)) { DumpElement(file, element, reportedElements, string.Empty); } } if (orphanedElements.Count > 0) { file.WriteLine(); file.WriteLine(); file.WriteLine("Section: Has parent, but parent doesn't have it among children"); file.WriteLine(); foreach (var element in OrderById(invalidChildren)) { DumpElement(file, element, reportedElements, string.Empty); } } }); } }
public void UpdateListElenment(GameObject element, CMail mail) { int currentUTCTime = CRoleInfo.GetCurrentUTCTime(); Text componetInChild = Utility.GetComponetInChild <Text>(element, "Title"); Text componetInChild2 = Utility.GetComponetInChild <Text>(element, "MailTime"); GameObject obj = Utility.FindChild(element, "New"); GameObject obj2 = Utility.FindChild(element, "ReadMailIcon"); GameObject obj3 = Utility.FindChild(element, "UnReadMailIcon"); GameObject obj4 = Utility.FindChild(element, "CoinImg"); Text componetInChild3 = Utility.GetComponetInChild <Text>(element, "From"); CUIHttpImageScript componetInChild4 = Utility.GetComponetInChild <CUIHttpImageScript>(element, "HeadBg/imgHead"); GameObject obj5 = null; Text text = null; GameObject gameObject = Utility.FindChild(element, "OnlineBg"); if (gameObject != null) { obj5 = gameObject.gameObject; } GameObject gameObject2 = Utility.FindChild(element, "Online"); if (gameObject2 != null) { text = gameObject2.GetComponent <Text>(); } componetInChild.set_text(mail.subject); componetInChild2.set_text(Utility.GetTimeBeforString((long)((ulong)mail.sendTime), (long)currentUTCTime)); bool flag = mail.mailState == COM_MAIL_STATE.COM_MAIL_UNREAD; obj.CustomSetActive(flag); if (mail.mailType == CustomMailType.SYSTEM) { obj2.CustomSetActive(!flag); obj3.CustomSetActive(flag); componetInChild3.set_text(string.Empty); componetInChild4.gameObject.CustomSetActive(false); obj4.CustomSetActive(false); obj5.CustomSetActive(false); if (text != null) { text.gameObject.CustomSetActive(false); } } else if (mail.mailType == CustomMailType.FRIEND) { obj5.CustomSetActive(false); if (text != null) { text.gameObject.CustomSetActive(false); } obj2.CustomSetActive(false); obj3.CustomSetActive(false); componetInChild3.set_text(mail.from); componetInChild4.gameObject.CustomSetActive(true); if (mail.subType == 3) { obj4.CustomSetActive(false); componetInChild4.SetImageSprite(CGuildHelper.GetGuildHeadPath(), this.m_CUIForm); } else { obj4.CustomSetActive(true); if (!CSysDynamicBlock.bFriendBlocked) { COMDT_FRIEND_INFO friendByName = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend); if (friendByName == null) { friendByName = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.SNS); } if (friendByName != null) { string url = Utility.UTF8Convert(friendByName.szHeadUrl); componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url)); } } } } else if (mail.mailType == CustomMailType.FRIEND_INVITE) { obj5.CustomSetActive(true); if (text != null) { text.gameObject.CustomSetActive(true); } obj2.CustomSetActive(false); obj3.CustomSetActive(false); componetInChild3.set_text(string.Empty); componetInChild4.gameObject.CustomSetActive(true); obj4.CustomSetActive(false); Transform transform = element.transform.FindChild("invite_btn"); GameObject obj6 = null; if (transform != null) { obj6 = transform.gameObject; } if (mail.relationType == 1) { GuildMemInfo guildMemberInfoByUid = CGuildHelper.GetGuildMemberInfoByUid(mail.uid); Singleton <CMailSys> .instance.AddGuildMemInfo(guildMemberInfoByUid); } this.SetEventParams(element, mail); string text2; string url2; bool flag2 = !this.GetOtherPlayerState((COM_INVITE_RELATION_TYPE)mail.relationType, mail.uid, mail.dwLogicWorldID, out text2, out url2); string processTypeString = this.GetProcessTypeString((CMailSys.enProcessInviteType)mail.processType); componetInChild.set_text(string.Format("{0} {1}", mail.subject, processTypeString)); if (text != null) { text.set_text(text2); } componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url2)); if (flag2) { CUIUtility.GetComponentInChildren <Image>(componetInChild4.gameObject).set_color(CUIUtility.s_Color_GrayShader); } else { CUIUtility.GetComponentInChildren <Image>(componetInChild4.gameObject).set_color(CUIUtility.s_Color_Full); } obj6.CustomSetActive(!flag2); } else if (mail.mailType == CustomMailType.ASK_FOR) { obj2.CustomSetActive(false); obj3.CustomSetActive(false); componetInChild3.set_text(mail.from); componetInChild4.gameObject.CustomSetActive(true); obj4.CustomSetActive(false); obj5.CustomSetActive(false); if (text != null) { text.gameObject.CustomSetActive(false); } if (!CSysDynamicBlock.bFriendBlocked) { CFriendModel.FriendType friendType = CFriendModel.FriendType.GameFriend; COMDT_FRIEND_INFO friendByName2 = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend); if (friendByName2 == null) { friendType = CFriendModel.FriendType.SNS; friendByName2 = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.SNS); } if (friendByName2 != null) { string url3 = Utility.UTF8Convert(friendByName2.szHeadUrl); componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url3)); UT.ShowFriendData(friendByName2, element.GetComponent <FriendShower>(), FriendShower.ItemType.Normal, false, friendType, Singleton <CUIManager> .GetInstance().GetForm(CMailSys.MAIL_FORM_PATH), true); } } } }
public JsonResult VcselScreenData() { string IP = Request.UserHostName; string compName = DetermineCompName(IP); var wf = Request.Form["wf"].Trim(); var x = UT.O2I(Request.Form["x"]).ToString(); var y = UT.O2I(Request.Form["y"]).ToString(); var rest = ""; if (wf.Length != 9 || !wf.Contains("-")) { rest = "<span style='color:red'>WAFER NUMBER WRONG</span>"; var ret1 = new JsonResult(); ret1.MaxJsonLength = Int32.MaxValue; ret1.Data = new { wf = wf, x = "X: " + x, y = "Y: " + y, ar = "Array: ", ap = "AP: ", rest = rest }; return(ret1); } var xlist = new List <int>(); var probe = ProbeTestData.GetApSizeByWafer(wf, x, y); if (string.IsNullOrEmpty(probe.ApSize)) { if (ProbeTestData.HasData(wf)) { rest = "<span style='color:red'>NO DATA</span>"; } else { rest = "<span style='color:red'>" + ProbeTestData.PrepareWaferAPSizeData(wf) + "</span>"; } } else { var aps = UT.O2D(probe.ApSize); if (aps > 6.5) { var array = UT.O2I(probe.APVal1); if (array > 1) { var idx = (UT.O2I(x) - 1) / array; var firstx = idx * array + 1; xlist.Add(firstx); for (var i = 1; i < array; i++) { xlist.Add(firstx + i); } var matchfail = false; foreach (var tempx in xlist) { probe = ProbeTestData.GetApSizeByWafer(wf, tempx.ToString(), y); if (!string.IsNullOrEmpty(probe.ApSize) && UT.O2D(probe.ApSize) <= 6.5) { matchfail = true; break; } } if (matchfail) { rest = "<span style='color:red'>FAIL</span>"; } else { rest = "<span style='color:green'>PASS</span>"; } } else { rest = "<span style='color:green'>PASS</span>"; } } else { rest = "<span style='color:red'>FAIL</span>"; } } ProbeTestData.UpdateQueryHistory(wf, x, y, compName, rest); foreach (var tmpx in xlist) { ProbeTestData.UpdateQueryHistory(wf, tmpx.ToString(), y, compName, rest); } var ret = new JsonResult(); ret.MaxJsonLength = Int32.MaxValue; ret.Data = new { wf = wf, x = "X: " + x, y = "Y: " + y, ar = "Array: 1x" + probe.APVal1, ap = "AP: " + probe.ApSize, rest = rest }; return(ret); }
private void _Show_Icon(Image img, uint configID) { if (configID != 0) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { img.SetSprite(CUIUtility.s_Sprite_Dynamic_Icon_Dir + masterRoleInfo.GetHeroSkinPic(configID), this.map_fromScript, true, false, false); } else { Singleton <CUIManager> .GetInstance().OpenMessageBox(string.Format(UT.GetText("Burn_Error_Show_Hero"), configID), false); } } }
// Use this for initialization void Start() { UT.setMainMono(this); SceneRoot.instance.setRoot(uiRoot); FrameWork.instance.init(); }
public void setSprite(string child, Sprite spr) { Image img = UT.getComponent <Image>(rootObject(), child); img.sprite = spr; }
public static void Poster() { posthead: Random r = new Random(Guid.NewGuid().GetHashCode()); try { if (Event_GroupMessage.ProtectCount >= 3) { Log($"trapped in bug:{ReportBUGTime},{GetTickCount()}"); if (ReportBUGTime > 0) { if (GetTickCount() >= ReportBUGTime) { Log($"Unlimited network:{Event_GroupMessage.ProtectCount}/ ms", ConsoleColor.Red); ReportBUGTime = 0; string bugr = $"{DateTime.Now.ToString()}\n" + "机器人在处理消息时发现消息流量异常,可能机器人进程被长时间挂起。" + "为了避免机器人继续处理消息导致暴走,已经切断消息处理。" + "请持有32766级别以上权限的用户发送.bugclose解除切断。" + $"\n异常消息流量:{Event_GroupMessage.ProtectCount}条/毫秒\n\n若无人协助,则切断将在{Event_GroupMessage.ProtectCount * 10}秒后解除。"; new QQ(pCQ, 1361778219).SendPrivateMessage(bugr); List <GroupInfo> gi = pCQ.GetGroupList(); foreach (GroupInfo gii in gi) { //gii.Group.SendGroupMessage(bugr); } } } Event_GroupMessage.ProtectCount--; Thread.Sleep(10000); goto posthead; } if (r.Next(0, 1000) == 88) { if (DateTime.Now.Hour >= 7 && DateTime.Now.Hour < 24) { List <GroupInfo> lg = pCQ.GetGroupList(); Event_GroupMessage.Artifical(lg[r.Next(0, lg.Count)].Group); } } //OSU if (LastOSUTime == DateTime.Now.Hour && DateTime.Now.Minute == 30) { Storage ignore = new Storage("ignore"); if (ignore.getkey("577344771", "artist") == "√") { goto NoPOSU; } LastOSUTime = (DateTime.Now.Hour + 1) % 24; Group droid = new Group(pCQ, 577344771); List <GroupMemberInfo> gml = droid.GetGroupMemberList(); GroupMemberInfo gmi = gml[r.Next(0, gml.Count)]; long qq = gmi.QQ.Id; string targett = MessagePoster.ptList[r.Next(0, MessagePoster.ptList.Count)]; ScriptDrawer.Draw("C:\\DataArrange\\PTemple\\" + targett + ".txt", MessagePoster.workpath + "\\data\\image\\" + targett + ".png", "[qq]", qq.ToString(), "[nick]", gmi.Nick, "[card]", gmi.Card == "" ? gmi.Nick : gmi.Card, "[sex]", gmi.Sex.ToString(), "[age]", gmi.Age.ToString(), "[group]", "577344771" ); droid.SendGroupMessage("现在是 " + DateTime.Now.Hour + "时30分 不整,恭喜幸运小朋友:" + CQApi.CQCode_At(qq) + "\n" + CQApi.CQCode_Image(targett + ".png")); } NoPOSU: //BlackDied if (DateTime.Now.Hour == 24 || DateTime.Now.Hour == 0) { if (DateTime.Now.Month == 3 && DateTime.Now.Day == 27) { if (!HasSendDie) { List <GroupInfo> gi = pCQ.GetGroupList(); foreach (GroupInfo gii in gi) { gii.Group.SendGroupMessage("今天。是黑嘴去世" + (DateTime.Now.Year - 2015) + "周年的日子。在这里打扰了大家,非常抱歉。\n黑嘴,名字来源于本机作者的一只狗,这只狗在本机作者的精神支柱上有很大的作用【虽然这听起来很荒唐】,它也渐渐在本机主人的脑子里逐渐扭曲抽象成了一种精神依靠。\n祝你在天堂快乐,黑嘴。 -3.27\n不接受任何对此条消息的议论。"); } HasSendDie = true; } } } //Moring Protection Storage sys = new Storage("system"); if (DateTime.Now.Hour >= 3 && DateTime.Now.Hour <= 5) { if (sys.getkey("root", "sleep") != "zzz") { sys.putkey("root", "sleep", "zzz"); QQ master = new QQ(pCQ, 1361778219); master.SendPrivateMessage("主人晚安~"); Console.Clear(); Log("[SLEEP] zzzzzzz"); logid = Guid.NewGuid().ToString(); //Application.Restart(); //System.Diagnostics.Process.Start(workpath + "\\CQA.exe", "/account 3529296290"); //System.Environment.Exit(0); } Thread.Sleep(1000); goto posthead; } if (sys.getkey("root", "sleep") == "zzz") { Log("[WAKE UP] ouch"); QQ master = new QQ(pCQ, 1361778219); master.SendPrivateMessage("主人早上好~"); sys.putkey("root", "sleep", "!!"); } Group g; //Say try { for (int i = 0; i < delays.Count; i++) { resay: delaymsg dm = delays[i]; if (GetTickCount() >= dm.time) { if (dm.voice == true) { SpeechSynthesizer reader = new SpeechSynthesizer(); string fname = GetTickCount().ToString(); reader.SetOutputToWaveFile( workpath + "\\data\\record\\say_" + fname + ".wav", new SpeechAudioFormatInfo(32000, AudioBitsPerSample.Sixteen, AudioChannel.Mono) ); reader.Rate = -2 + new Random(Guid.NewGuid().GetHashCode()).Next(0, 4); reader.Volume = 100; //reader.SelectVoice("Microsoft Lili"); PromptBuilder builder = new PromptBuilder(); builder.AppendText(dm.msg); Log("Speak started at :" + GetTickCount()); reader.Speak(builder); Log("Speak successfully :" + GetTickCount()); reader.Dispose(); if (dm.kind == 0) { new Group(pCQ, dm.group).SendGroupMessage(CQApi.CQCode_Record("say_" + fname + ".wav")); } else { new QQ(pCQ, dm.group).SendPrivateMessage(CQApi.CQCode_Record("say_" + fname + ".wav")); } } else { Log("Send successfully."); if (dm.kind == 0) { new Group(pCQ, dm.group).SendGroupMessage(dm.msg); } else { new QQ(pCQ, dm.group).SendPrivateMessage(dm.msg); } } delays.Remove(dm); goto resay; } } } catch { } //Undertale if (UT.targetg != 0) { if (GetTickCount() - UT.tick >= 20000) { g = new Native.Csharp.Sdk.Cqp.Model.Group(pCQ, UT.targetg); if (UT.winstr == "") { g.SendGroupMessage("nobody passed round" + UT.round + ",answer:" + UT.role); } else { g.SendGroupMessage("answer:" + UT.role + "\n" + UT.winstr); } if (UT.round == 5) { string playstr = ""; for (int i = 0; i < UT.ps.Count; i++) { playstr = playstr + CQApi.CQCode_At(UT.ps[i].qq) + " " + (int)(UT.ps[i].score * 10) / 10 + " points\n"; } UT.targetg = 0; g.SendGroupMessage("game closed\n" + playstr); } else { UT.nextRound(); UT.tick = GetTickCount(); g.SendGroupMessage("round " + UT.round + "(result:20s later):" + UT.dialog); } } } //Hot Poster string fstr = ""; string estr = ""; string[] qtemp; HotMsg hhmsg = new HotMsg(); for (int s = 0; s < Manager.mHot.data.Count; s++) { hhmsg = (HotMsg)Manager.mHot.data[s]; if (DateTime.Now.Hour >= 22 && hhmsg.hasup == false && TenClockLock == false) { TenClockLock = true; Log("Annouce:" + hhmsg.group, ConsoleColor.Green); qtemp = hhmsg.banqq.Split(';'); for (int i = 0; i < qtemp.Length - 1; i++) { estr = estr + CQApi.CQCode_At(Convert.ToInt64(qtemp[i])); } qtemp = hhmsg.qq.Split(';'); for (int i = 0; i < qtemp.Length - 1; i++) { fstr = fstr + CQApi.CQCode_At(Convert.ToInt64(qtemp[i])); } hhmsg.hasup = true; g = new Native.Csharp.Sdk.Cqp.Model.Group(pCQ, Convert.ToInt64(hhmsg.group)); g.SendGroupMessage(hhmsg.msg); Manager.mHot.data[s] = hhmsg; } } //Homework network string f = "0"; if (File.Exists("C:\\DataArrange\\homeworklock.bin")) { f = File.ReadAllText("C:\\DataArrange\\homeworklock.bin", Encoding.UTF8); } if (Convert.ToInt64(f) == 1) { Log("New homework recevied !", ConsoleColor.Green); f = File.ReadAllText("C:\\DataArrange\\homework.bin", Encoding.UTF8); g = new Native.Csharp.Sdk.Cqp.Model.Group(pCQ, 817755769); g.SendGroupMessage("[今日作业推送消息]\n" + f + "\n————来自黑嘴稽气人的自动推送"); File.WriteAllText("C:\\DataArrange\\homeworklock.bin", "0"); } f = ""; if (File.Exists("C:\\DataArrange\\announcer.bin")) { f = File.ReadAllText("C:\\DataArrange\\announcer.bin", Encoding.UTF8); } if (f != "") { Log("Announce:" + f, ConsoleColor.Green); string[] p = f.Split('\\'); long gr = 0; if (p[0] == "class") { gr = 817755769; } if (p[0] == "inter") { gr = 554272507; } g = new Native.Csharp.Sdk.Cqp.Model.Group(pCQ, gr); switch (p[1]) { case ("hlesson"): f = "今天上午的网课出炉啦~\n地址:{url}\n往期网课精彩回顾:https://space.bilibili.com/313086171/channel/detail?cid=103565 ".Replace("{url}", p[2]); break; case ("lesson"): f = "今天全天的网课出炉啦~\n地址:{url}\n往期网课精彩回顾:https://space.bilibili.com/313086171/channel/detail?cid=103565 ".Replace("{url}", p[2]); break; case ("default"): f = p[2]; break; default: Log("Unkown announce .", ConsoleColor.Red); return; } g.SendGroupMessage("[通知]\n" + f + "\n————来自黑嘴稽气人的自动推送"); File.WriteAllText("C:\\DataArrange\\announcer.bin", ""); } } catch (Exception err) { Log(err.StackTrace + "\n" + err.Message, ConsoleColor.Red); } Thread.Sleep(1000); goto posthead; }
public async Task <IHttpActionResult> Login(LoginBindingModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } bool sign = false; bool UserAPI = false; string ErrorMessage = null; UserToken UserTokenAPI = new UserToken(); try { var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://my.marinehealth.asia/api/auth/mobile"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = "{\"Email\":\"" + model.UserName + "\"," + "\"Password\":\"" + model.Password + "\"}"; streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); } string responsezec; WebResponse response = await httpWebRequest.GetResponseAsync(); using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { responsezec = await reader.ReadToEndAsync(); } } UserTokenAPI = JsonConvert.DeserializeObject <UserToken>(responsezec); UserAPI = true; response.Close(); } catch { UserAPI = false; } ApplicationUser result = await UserManager.FindAsync(model.UserName, model.Password); if (result != null && UserAPI) { try { if (UserTokenAPI.Status == "Success") { sign = true; } else if (UserTokenAPI.Status == "TooManyAttempts") { ErrorMessage = "Cлишком много попыток, пожалуйста, попробуйте еще раз позже"; } else { ErrorMessage = "Имя пользователя или пароль указаны неверно."; } } catch { } } else if (UserAPI) { if (UserTokenAPI.Status == "Success") { var User = await UserManager.FindByNameAsync(model.UserName); if (User == null) { var user = new ApplicationUser() { UserName = model.UserName, Email = model.UserName }; IdentityResult CreateUserResult = await UserManager.CreateAsync(user, model.Password); if (!CreateUserResult.Succeeded) { return(GetErrorResult(CreateUserResult)); } try { if (UserTokenAPI.Token != null) { var rqstinfus = WebRequest.Create("https://my.marinehealth.asia/api/proxy/userprofile/get?includeSensitiveData=false"); var Httprqstinfus = (HttpWebRequest)rqstinfus; Httprqstinfus.PreAuthenticate = true; Httprqstinfus.Headers.Add("AuthToken", UserTokenAPI.Token); Httprqstinfus.Accept = "application/json"; string responseiu; WebResponse responseiuw = await Httprqstinfus.GetResponseAsync(); using (Stream stream = responseiuw.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { responseiu = await reader.ReadToEndAsync(); } } MHUserInfo MHUserInfo = JsonConvert.DeserializeObject <MHUserInfo>(responseiu); if (MHUserInfo.ImageFileName != null && MHUserInfo.Contacts.Count > 0) { MHUserInfo.ImageFileName = "https://my.marinehealth.asia/files/users/" + MHUserInfo.Contacts[0].UserId + "/images/" + MHUserInfo.ImageFileName; } UserInfo UserInfoNew = new UserInfo(); UserInfoNew.Lname = MHUserInfo.LastName; UserInfoNew.Fname = MHUserInfo.FirstName; UserInfoNew.Image = MHUserInfo.ImageFileName; UserInfoNew.UserName = model.UserName; UserInfoNew.LevelId = MHUserInfo.LevelId == null ? 0 : MHUserInfo.LevelId; UserInfoNew.RegTime = DateTime.Now.AddHours(6); db.UserInfoes.Add(UserInfoNew); JVLO jvnew = new JVLO(); jvnew.OV = 1; jvnew.TBB = 0; jvnew.UserName = model.UserName; jvnew.X = 1; db.JVLOes.Add(jvnew); await db.SaveChangesAsync(); } sign = true; } catch { sign = false; } } else { string code = await UserManager.GeneratePasswordResetTokenAsync(User.Id); var ResertPasswordResult = await UserManager.ResetPasswordAsync(User.Id, code, model.Password); if (ResertPasswordResult.Succeeded) { sign = true; } } } else { if (UserTokenAPI.Status == "TooManyAttempts") { ErrorMessage = "Cлишком много попыток, пожалуйста, попробуйте еще раз позже"; } else { ErrorMessage = "Имя пользователя или пароль указаны неверно."; } } } if (sign) { UT UserToken = await db.UTs.FirstOrDefaultAsync(e => e.UserName == model.UserName); if (UserToken != null && UserTokenAPI != null) { if (UserToken.Token != UserTokenAPI.Token) { UserToken.Token = UserTokenAPI.Token; } await db.SaveChangesAsync(); } else { UT newUserToken = new UT(); newUserToken.UserName = model.UserName; newUserToken.Token = UserTokenAPI.Token; newUserToken.Date = DateTime.Now.AddHours(6); db.UTs.Add(newUserToken); await db.SaveChangesAsync(); } return(Ok()); } return(BadRequest(ErrorMessage)); }
public async Task <ActionResult> Initialize(string language) { try { string UserName = GetUserName(); UT UserToken = await db.UTs.FirstOrDefaultAsync(e => e.UserName == UserName); if (UserToken != null) { var rqstinfus = WebRequest.Create("https://my.marinehealth.asia/api/proxy/userprofile/get?includeSensitiveData=false"); var Httprqstinfus = (HttpWebRequest)rqstinfus; Httprqstinfus.PreAuthenticate = true; Httprqstinfus.Headers.Add("AuthToken", UserToken.Token); Httprqstinfus.Accept = "application/json"; string responseiu; WebResponse responseiuw = Httprqstinfus.GetResponse(); using (Stream stream = responseiuw.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { responseiu = reader.ReadToEnd(); } } MHUserInfo MHUserInfo = JsonConvert.DeserializeObject <MHUserInfo>(responseiu); if (MHUserInfo.ImageFileName != null && MHUserInfo.Contacts.Count > 0) { MHUserInfo.ImageFileName = "https://my.marinehealth.asia/files/users/" + MHUserInfo.Contacts[0].UserId + "/images/" + MHUserInfo.ImageFileName; } UserInfo UserInfo = await db.UserInfoes.FirstOrDefaultAsync(e => e.UserName == UserName); if (UserInfo != null) { UserInfo.Lname = MHUserInfo.LastName; UserInfo.Fname = MHUserInfo.FirstName; UserInfo.Image = MHUserInfo.ImageFileName; UserInfo.LevelId = MHUserInfo.LevelId == null ? 0 : MHUserInfo.LevelId; } else { UserInfo UserInfoNew = new UserInfo(); UserInfoNew.Lname = MHUserInfo.LastName; UserInfoNew.Fname = MHUserInfo.FirstName; UserInfoNew.Image = MHUserInfo.ImageFileName; UserInfoNew.UserName = UserName; UserInfoNew.LevelId = MHUserInfo.LevelId == null ? 0 : MHUserInfo.LevelId; UserInfoNew.RegTime = DateTime.Now.AddHours(6); db.UserInfoes.Add(UserInfoNew); JVLO jv = await db.JVLOes.FirstOrDefaultAsync(e => e.UserName == UserName); if (jv == null) { JVLO jvnew = new JVLO(); jvnew.OV = 1; jvnew.TBB = 0; jvnew.UserName = UserName; jvnew.X = 1; db.JVLOes.Add(jvnew); } } await db.SaveChangesAsync(); return(RedirectToAction("Modules", "Learning", new { language = language })); } } catch { } string ActionName = "Initialize"; return(RedirectToAction("ErrorLogOff", "Account", new { language = language, ActionName = ActionName })); }
/// <summary>Returns a hash code for this instance.</summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return UT.GetHashCode(); }
private void setGameUT() { HighLogic.CurrentGame.flightState.universalTime = UT.GetValueOrDefault(); }
// easy private string Solve(string[] water, double V, double X) { var uts = new UT[water.Length]; for (int i = 0; i < water.Length; ++i) { var split = StringToSA(water[i]); uts[i] = new UT { vol = double.Parse(split[0]), temp = double.Parse(split[1]) }; } if (uts.Length == 1) { if (Math.Abs(uts[0].temp - X) > EPS) { return(imposs); } return(V / uts[0].vol + ""); } if (uts.Length == 2) { bool aSame = false; bool bSame = false; if (Math.Abs(uts[0].temp - X) < EPS) { aSame = true; } if (Math.Abs(uts[1].temp - X) < EPS) { bSame = true; } if (aSame & bSame) { return(V / (uts[0].vol + uts[1].vol) + ""); } if (aSame) { return(V / (uts[0].vol) + ""); } if (bSame) { return(V / (uts[1].vol) + ""); } var v0 = V * (X - uts[1].temp) / (uts[0].temp - uts[1].temp); var v1 = V * (X - uts[0].temp) / (uts[1].temp - uts[0].temp); if (v0 < 0 || v1 < 0) { return(imposs); } return(Math.Max(v0 / uts[0].vol, v1 / uts[1].vol) + ""); } throw new Exception(); }
public void Check_Box_Info(uint goldNum, uint burn_num) { CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm("UGUI/Form/Common/Form_Award.prefab", false, true); Utility.GetComponetInChild <Text>(formScript.gameObject, "bg/Title").text = UT.GetText("Burn_Box_Award"); GameObject container = Utility.FindChild(formScript.gameObject, "IconContainer"); for (int i = 0; i < container.transform.childCount; i++) { container.transform.GetChild(i).gameObject.CustomSetActive(false); } int index = 1; if (goldNum > 0) { this.Set_Award(container, index, CUIUtility.s_Sprite_Dynamic_Icon_Dir + "90001", goldNum.ToString(), UT.GetText("Burn_Info_Coin"), formScript); index++; } if (burn_num > 0) { this.Set_Award(container, index, CUIUtility.s_Sprite_Dynamic_Icon_Dir + "90008", burn_num.ToString(), UT.GetText("Burn_Info_yuanzheng"), formScript); index++; } }