void Update() { if (Stats.life >= 50) { hpcTxt.color = new Color32(229, 198, 25, 255); scTxt.color = new Color32(229, 198, 25, 255); if (fleetSpeed < 0.2f) { GlobalFunc.setLongAbbreviation(speedCost, scTxt); } else { scTxt.text = "MAX"; } if (fleetHP < 300) { GlobalFunc.setLongAbbreviation(healthCost, hpcTxt); } else { hpcTxt.text = "MAX"; } } else { hpcTxt.color = new Color32(0, 255, 76, 255); scTxt.color = new Color32(0, 255, 76, 255); hpcTxt.text = "50%"; scTxt.text = "50%"; } }
public IActionResult ReturnBook(int bookId) { try { var auth = HttpContext.AuthenticateAsync(); var userId = Convert.ToInt32(auth.Result.Principal.Claims.First(t => t.Type.Equals(ClaimTypes.NameIdentifier))?.Value); if (!GlobalFunc.IsAdminId(userId)) { return(Ok(new { error = "Need admin authority" })); } var result = _bookRepository.ReturnBook(bookId); var borrowTime = result.Borrow_Time.ToString("yyyy-MM-dd"); var returnTime = result.Return_Time.ToString("yyyy-MM-dd"); var expireTime = result.Expire_Time.ToString("yyyy-MM-dd"); var expired = result.Expire_Time < result.Return_Time; return(Ok(new { result.Borrow_id, result.Book_id, result.Reader_id, result.State, borrowTime, returnTime, expireTime, expired })); } catch (Exception ex) { return(Ok(new { error = ex.Message })); } }
// Start is called before the first frame update void Start() { GlobalFunc.TweenShowPopup(pnlMain.transform, 0.25f); //StartCoroutine(IEAutoDestroy()); Destroy(gameObject, autoDestroyTimer); }
protected void BtnSave_Click(object sender, EventArgs e) { string ConnStr = "Provider=SQLOLEDB;Data Source=DESKTOP-SB7PUAD\\SQLEXPRESS;Initial Catalog=Shop;Integrated Security=SSPI";// הגדרת מחרוזת שתחזיק את מחרוזת ההתחברות לבסיס הנתונים string FileName = GlobalFunc.GetRandomFileName(6); string t1 = UploadPicName.FileName; string FullPath = Server.MapPath("/img/"); string FileExt = System.IO.Path.GetExtension(UploadPicName.PostedFile.FileName); FileName += FileExt; // הוספת הסימן נקודה והסימת של קובץ התמונה שהועלתה FullPath += FileName; // הוספה לנתיב התיקייה של התמונות את שם התמונה החדשה UploadPicName.SaveAs(FullPath); // שמירה של הקובץ LtlMsg.Text = FullPath; string Sql = "insert into Products(Pname,Price,Description,PicName) values ('"; Sql += TxtPname.Text + "','" + TxtPrice.Text + "','" + TxtShortDesc.Text + "','" + FileName + "')"; OleDbConnection Conn = new OleDbConnection(ConnStr); // יצירת אובייקט מסוג קונקשן- צינור התחברות לבסיס הנתונים Conn.Open(); // פתיחת החיבור לבסיס הנתונים OleDbCommand Cmd = new OleDbCommand(); // יצירת אובייקט מסוג פקודה Cmd.Connection = Conn; // אתחול המאפיין קונקשן של אובייקט הפקודה עם הקונקשן שיצרנו Cmd.CommandText = Sql; //הגדרת משפט הפקודה אותו יש לבצע Cmd.ExecuteNonQuery(); Conn.Close(); GlobalFunc.LoadProds(); Response.Redirect("ProductList.aspx"); }
public static void Main(string[] args) { GlobalFunc.InitializeConnStr(); GlobalFunc.InitializeSecret(); GlobalFunc.RefreshBookState(); CreateHostBuilder(args).Build().Run(); }
public IActionResult ModPw([FromQuery] string oldPw, [FromQuery] string newPw) { var auth = HttpContext.AuthenticateAsync(); var id = Convert.ToInt32(auth.Result.Principal.Claims.First(t => t.Type.Equals(ClaimTypes.NameIdentifier)) ?.Value); if (id >= 10000) { try { rd.ReaderPasswordChange(id, newPw, oldPw); } catch (Exception ex) { return(Ok(new { error = ex.Message })); } } else if (id < 10000 && id >= 1) { try { ad.AdminPasswordChange(id, newPw, oldPw); } catch (Exception ex) { return(Ok(new { error = ex.Message })); } } else { return(Ok(new { error = "Invalid Id" })); } return(Ok(GlobalFunc.GetBasicInfo(id))); }
public Card_Base CreateCard(Transform parent, CardInfoBase cardInfo) { Card_Base CardClass = null; if (cardInfo is CardInfo_Trump) { GameObject prefab = GlobalFunc.Load("Play/_PlayCommon/TrumpCard"); GameObject CardObject = Instantiate <GameObject>(prefab, parent); assert.set(CardObject); Card_Trump newCardClass = CardObject.GetComponent <Card_Trump>(); newCardClass.CardInfo.Clone(cardInfo); CardClass = newCardClass; } else { assert.set(cardInfo is CardInfo_Gostop); GameObject prefab = GlobalFunc.Load("Play/_PlayCommon/GostopCard"); GameObject CardObject = Instantiate <GameObject>(prefab, parent); assert.set(CardObject); Card_Gostop newCardClass = CardObject.GetComponent <Card_Gostop>(); newCardClass.CardInfo.Clone(cardInfo); CardClass = newCardClass; } assert.set(CardClass); return(CardClass); }
protected void BtnSave_Click(object sender, EventArgs e) { string ConnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\ShopDb.mdb"; string FileName = GlobalFunc.GetRandomFileName(6); string t1 = UploadPicName.FileName; string FullPath = Server.MapPath("/img/"); string FileExt = System.IO.Path.GetExtension(UploadPicName.PostedFile.FileName); FileName += FileExt; FullPath += FileName; UploadPicName.SaveAs(FullPath); LtlMsg.Text = FullPath; string Sql = "insert into T_Product(ProdName,Price,ShortDesc,LongDesc,PicName) values ('"; Sql += TxtPname.Text + "'," + TxtPrice.Text + ",'" + TxtShortDesc.Text + "','" + TxtLongDesc.InnerHtml + "','" + FileName + "')"; OleDbConnection Conn = new OleDbConnection(ConnStr); Conn.Open(); OleDbCommand Cmd = new OleDbCommand(); Cmd.Connection = Conn; Cmd.CommandText = Sql; Cmd.ExecuteNonQuery(); Conn.Close(); GlobalFuncDbS.LoadProds(); LtlMsg.Text = "המוצר עודכן בהצלחה"; LtlMsg.Text = FullPath; }
private void GET_GUIDE_INFO(ref TmpEntry entry, EndianIO readerIO, EndianIO writerIO, EndianWriter structIO) { entry.client_session = readerIO.Reader.ReadBytes(0x10).BytesToHexString(); if (conMySQL.getConsole(ref entry, true)) { if (entry.client_dateExpire >= DateTime.Now) { GlobalFunc.Write(entry.client_name); TimeSpan timeLeft = Misc.DateTimetoExact(entry.client_dateExpire.ToLocalTime(), DateTime.Now.ToLocalTime()); //string s_timeLeft = "fgt\0";//entry.client_days >= 500 ? "Life in prison.\0" : String.Format("D:{0} H:{1} M:{2}\0", entry.client_days, timeLeft.Hours, timeLeft.Minutes);//String.Format("Days {0} | Hours {1} | Minutes {2} | Seconds {3}\0", entry.client_days, timeLeft.Hours, timeLeft.Minutes, timeLeft.Seconds); int maxStatusLen = 20, maxTimeLen = 50; byte[] StatusBuff = new byte[maxStatusLen]; byte[] timeBuff = new byte[maxTimeLen]; //byte[] serialBuff = new byte[maxSerialLen]; string Status = "Authenticated\0"; string s_timeLeft = entry.client_days >= 99999 ? "Life in prison.\0" : String.Format("D:{0} H:{1} M:{2}\0", entry.client_days, timeLeft.Hours, timeLeft.Minutes); Buffer.BlockCopy(Encoding.ASCII.GetBytes(Status), 0, StatusBuff, 0, Status.Length); Buffer.BlockCopy(Encoding.ASCII.GetBytes(s_timeLeft), 0, timeBuff, 0, s_timeLeft.Length); structBuff = new byte[(sizeof(uint) * 4) + StatusBuff.Length + timeBuff.Length]; structIO = new EndianIO(structBuff, EndianStyle.BigEndian).Writer; structIO.Write(StatusBuff); structIO.Write(timeBuff); writerIO.Writer.Write(structBuff); GlobalFunc.Write("GET_GUIDE_INFO: Sent"); } } }
void Update() { if (stars < 0) { stars = 0; } if (life < lifeMin) { life = lifeMin; } if (life < lifeStop && lifeLevel > 0) { addLife(); } else if (lifeLevel > 0) { lifeTxt.text = life.ToString() + "% *MAX*"; } mineTime -= Time.deltaTime; //Player Mines if (mineTime <= 0) { stars += mines; mineTime = 1; } GlobalFunc.setLongAbbreviation(stars, starTxt); }
public bool ThrowItem(GameObject objectThrown, entityDirection directionThrown) { GameObject thrownItem = Instantiate(objectThrown, transform.position, Quaternion.identity); thrownItem.GetComponent <WeaponHandler>().parentObject = this.gameObject; thrownItem.GetComponent <Rigidbody2D>().velocity = GlobalFunc.entityDirectionToVector2(directionThrown).normalized * 5; if (thrownItem.GetComponent <WeaponHandler>().NeedsRotate) { switch (directionThrown) { case entityDirection.N: thrownItem.transform.eulerAngles = new Vector3(0, 0, 90); break; case entityDirection.E: break; case entityDirection.S: thrownItem.transform.eulerAngles = new Vector3(0, 0, -90); break; case entityDirection.W: thrownItem.transform.eulerAngles = new Vector3(0, 0, 180); break; } } return(true); }
public bool ThrowItem(int itemIndex, entityDirection directionThrown) { Item itemToThrow = inventory.Inventory[itemIndex]; if (inventory.RemoveItem(itemIndex, 1)) { GameObject thrownItem = Instantiate(itemToThrow.weaponPrefab, transform.position, Quaternion.identity); thrownItem.GetComponent <WeaponHandler>().parentObject = this.gameObject; thrownItem.GetComponent <Rigidbody2D>().velocity = GlobalFunc.entityDirectionToVector2(directionThrown).normalized * 5; if (thrownItem.GetComponent <WeaponHandler>().NeedsRotate) { switch (directionThrown) { case entityDirection.N: thrownItem.transform.eulerAngles = new Vector3(0, 0, 90); break; case entityDirection.E: break; case entityDirection.S: thrownItem.transform.eulerAngles = new Vector3(0, 0, -90); break; case entityDirection.W: thrownItem.transform.eulerAngles = new Vector3(0, 0, 180); break; } } return(true); } return(false); }
protected void BtnLog_Click(object sender, EventArgs e) { string Name = Fname.Text; string Fmail = Email.Text; string Fpass = Pass.Text; LitLog.Text = "<br/>" + "נרשמת הבצלחה" + " " + Name + "<br/>" + "שם המשתמש שלך הוא" + " " + Fmail; GlobalFunc.AddToCustomer(Fname.Text, Lname.Text, Phone.Text, Address.Text, City.Text, Email.Text, Pass.Text); GlobalFuncDbS.LoadUser(); var ArrUser = Application["ArrU"] as List <User>; for (int i = 0; i < ArrUser.Count; i++) { if (Email.Text == ArrUser[i].EMAIL && Pass.Text == ArrUser[i].PASSWORD) { Session["email"] = ArrUser[i].EMAIL; Session["Login"] = i; Response.Redirect("Default.aspx"); } } Response.Redirect("Default.aspx"); //string ConnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\ShopDb.mdb"; //string Sql = "insert into T_Customer(Fname,Lname,PhonN,Address,City,CEmail,CPaas) values ('"; //Sql += Fname.Text + "','" + Lname.Text + "','" + Phone.Text + "','" + Address.Text + "','" + City.Text + "','" + Email.Text + "','" + Pass.Text + "')"; //OleDbConnection Conn = new OleDbConnection(ConnStr); // יצירת אובייקט מסוג קונקשן- צינור התחברות לבסיס הנתונים //Conn.Open();// פתיחת החיבור לבסיס הנתונים //OleDbCommand Cmd = new OleDbCommand();// יצירת אובייקט מסוג פקודה //Cmd.Connection = Conn;// אתחול המאפיין קונקשן של אובייקט הפקודה עם הקונקשן שיצרנו //Cmd.CommandText = Sql;//הגדרת משפט הפקודה אותו יש לבצע //Cmd.ExecuteNonQuery(); //Conn.Close(); }
protected void Page_Load(object sender, EventArgs e) { int Nid = int.Parse(Request["pid"]); var ArrProd = Application["ArrP"] as List <Product>; for (int i = 0; i < ArrProd.Count; i++) { if (ArrProd[i].Pid == Nid) { string ConnStr = "Provider=SQLOLEDB;Data Source=DESKTOP-SB7PUAD\\SQLEXPRESS;Initial Catalog=Shop;Integrated Security=SSPI";// הגדרת מחרוזת שתחזיק את מחרוזת ההתחברות לבסיס הנתונים string Sql = "DELETE FROM Products where Id=" + Nid + ""; OleDbConnection Conn = new OleDbConnection(ConnStr); // creation d'objet de type 'connection'-lien avec base de donnee Conn.Open(); // ouverture du lien avec base de donnee OleDbCommand Cmd = new OleDbCommand(); // creation d'objet de type 'commande' Cmd.Connection = Conn; // אתחול המאפיין קונקשן של אובייקט הפקודה עם הקונקשן שיצרנו Cmd.CommandText = Sql; //initialisation de la commande sql Cmd.ExecuteNonQuery(); Conn.Close(); GlobalFunc.LoadProds(); Response.Redirect("ProductList.aspx"); } } }
private void HandleClient(object cObj) { TcpClient Client = (TcpClient)cObj; Tmp.Entry Entry = new Tmp.Entry(); GlobalVar.nStream = Client.GetStream(); byte[] Header = new byte[8]; Entry.IP = Client.Client.RemoteEndPoint.ToString().Split(':')[0]; GlobalFunc.Write("Client [{0}] - Connected", Entry.IP); using (PoorManStream pmStream = new PoorManStream(GlobalVar.nStream)) { using (EndianIO MainIO = new EndianIO(Header, EndianStyle.BigEndian)) { if (GlobalVar.nStream.Read(Header, 0, 8) != 8) { GlobalFunc.WriteError(ConsoleColor.Red, "[SERVER]", "Header recieved unexpected size!"); Client.Close(); } uint Command = MainIO.Reader.ReadUInt32(); int PacketSize = MainIO.Reader.ReadInt32(); byte[] Buffer = new byte[PacketSize]; using (EndianIO WriterIO = new EndianIO(pmStream, EndianStyle.BigEndian)) { using (EndianIO ReaderIO = new EndianIO(Buffer, EndianStyle.BigEndian) { Writer = new EndianWriter(pmStream, EndianStyle.BigEndian) }) { if (pmStream.Read(Buffer, 0, PacketSize) != PacketSize) { GlobalFunc.WriteError(ConsoleColor.Red, "[SERVER]", "Packet recieved unexpected size!"); Client.Close(); } switch (Command) { case (uint)cmdCode.GET_SESSION: SESSION.Get(ref Entry, WriterIO, ReaderIO); break; case (uint)cmdCode.GET_STATUS: STATUS.Get(ref Entry, WriterIO, ReaderIO); break; case (uint)cmdCode.GET_CHAL_RESPONSE: break; case (uint)cmdCode.UPDATE_PRESENCE: PRESENCE.Update(ref Entry, WriterIO, ReaderIO); break; case (uint)cmdCode.GET_XOSC: break; case (uint)cmdCode.GET_INFO: break; case (uint)cmdCode.SND_SPOOFY: break; case (uint)cmdCode.GET_MESSAGE: break; case (uint)cmdCode.GET_PATCHES: break; case (uint)cmdCode.GET_GUIDE_INFO: break; default: break; } } } } } }
public IActionResult Tips() { var auth = HttpContext.AuthenticateAsync(); var id = Convert.ToInt32(auth.Result.Principal.Claims.First(t => t.Type.Equals(ClaimTypes.NameIdentifier)) ?.Value); return(Ok(GlobalFunc.GetTips(id))); }
private void Handle_OnPlayerDie(object obj) { SoundManager.Instance.PlaySound(ESoundEffect.Explosive); m_txtFinalScore.SetText($"YOUR SCORE: {PlayerData.Instance.Player.Score}"); m_pnlGameOver.SetActive(true); GlobalFunc.TweenShowPopup(m_pnlGameOver.transform.GetChild(0)); }
public Handle() { try { ClientListener = new Thread(new ThreadStart(ListenThread)); ClientListener.Start(); GlobalVar.b_serverRunning = true; } catch { GlobalFunc.WriteError(ConsoleColor.Red, "[Handle]", "Failed to start the listener thread!"); GlobalFunc.DelayedRestart(3); } }
protected void Page_Load(object sender, EventArgs e) { RtpNew.DataSource = GlobalFunc.GetSelectedProd(); RtpNew.DataBind(); RtpB.DataSource = GlobalFunc.Search(); RtpB.DataBind(); }
public svrHandle() { try { clientListener = new Thread(new ThreadStart(listenForClients)); clientListener.Start(); Globals.b_serverRunning = true; } catch { GlobalFunc.Write("Failed to start the listen thread!"); GlobalFunc.DelayedRestart(3); } }
public int ExportFSCoreConfig(string path) { var iRet = 0; var bRet = GlobalFunc.SerializeToXml(path, _fsCoreConfig); return(iRet); }
protected void BtnUp_Click(object sender, EventArgs e) { // FUMain.SaveAs(Server.MapPath("/pics/")+ FUMain.FileName); string newfname = GlobalFunc.GetRandomFileName(8); string FileExt = Path.GetExtension(FUMain.FileName); FUMain.SaveAs(Server.MapPath("/img/") + newfname + FileExt); ltlmsg.Text = "success"; }
public static GlobalFunc Instance() { if (mGlobal == null) { mGlobal = new GlobalFunc(); } return mGlobal; }
private void GET_SESSION(ref TmpEntry entry, EndianIO readerIO, EndianIO writerIO) { bool conType = Convert.ToBoolean(readerIO.Reader.ReadInt32()); entry.client_cpukey = readerIO.Reader.ReadBytes(0x10).BytesToHexString(); if (conMySQL.getConsole(ref entry)) { entry.client_ip = IPAddr; entry.client_session = Security.RandomBytes(0x10).BytesToHexString(); conMySQL.setConsole(ref entry); GlobalFunc.Write(entry.client_session); //if (entry.client_daysUsed >= 1 && entry.client_ip != entry.client_db_curIP) { // entry.client_db_lastIP = entry.client_db_curIP; // conMySQL.addNewIP(ref entry); //} else if (entry.client_db_curIP == "") // conMySQL.addNewIP(ref entry); if (entry.client_banned) { GlobalFunc.Write("Client [{0}] Banned Client Connected\r\n - Name: {1}\r\n - CPUkey: {2}", IPAddr, entry.client_name, entry.client_cpukey); writerIO.Writer.Write((uint)respCode.RESP_STATUS_BANNED); conMySQL.setConsole(ref entry); return; } if (entry.client_enabled) { GlobalFunc.Write("Client [{0}] Authorized Client's {1}\r\n - Name: {2}\r\n - CPUkey: {3}", IPAddr, conType ? "Devkit" : "Jtag/RGH", entry.client_name, entry.client_cpukey); writerIO.Writer.Write((uint)respCode.RESP_STATUS_STEALTHED); writerIO.Writer.Write(Misc.HexStringToBytes(entry.client_session)); } else { if (conMySQL.autoUpdateTime(ref entry)) { //if (entry.client_days <= 100) { GlobalFunc.Write("Client [{0}] Day Incrimented On Time[24 Hr Timer]\r\n - Name: {1}\r\n - CPUKey: {2}", IPAddr, entry.client_name, entry.client_cpukey); writerIO.Writer.Write((uint)respCode.RESP_STATUS_DAY_STARTED); //} else writerIO.Writer.Write((uint)respCode.RESP_STATUS_STEALTHED); writerIO.Writer.Write(Misc.HexStringToBytes(entry.client_session)); } else { GlobalFunc.Write("Client [{0}] Time Expired!\r\n - Name: {1}\r\n - CPUKey: {2}", IPAddr, entry.client_name, entry.client_cpukey); writerIO.Writer.Write((uint)respCode.RESP_STATUS_EXPIRED); } } conMySQL.setConsole(ref entry); } else { GlobalFunc.Write("Client [{0}] Failed! CPUKey - {1}", IPAddr, entry.client_cpukey); writerIO.Writer.Write((uint)respCode.RESP_STATUS_EXPIRED); } }
public static void SendSummryCart(string FromEmail, string ToEmail, string Subject, string NumOrder)//שליחת מייל עם מספר הזמנה { string MsgNumOrder = ""; MsgNumOrder += "<div ></div><div>"; MsgNumOrder += "<h2 dir='rtl' style='text-align:center; color: #3366FF;'>ההזמנה בוצעה בהצלחה</h2><hr />"; MsgNumOrder += "<h4 dir='rtl' style='text-align:center; color: #3366FF'> מספר הזמנה-" + NumOrder + "</h4><br />"; MsgNumOrder += "</div>"; GlobalFunc.SendEmail(FromEmail, ToEmail, Subject, MsgNumOrder); }
public IActionResult Info() { //这里是使用 JWT 并识别身份的一个例子 //以下两行在验证通过之后用于获取我们在 payload 中自定义的那部分内容,即用户 ID var auth = HttpContext.AuthenticateAsync(); var id = Convert.ToInt32(auth.Result.Principal.Claims.First(t => t.Type.Equals(ClaimTypes.NameIdentifier)) ?.Value); return(Ok(GlobalFunc.GetBasicReaderInfoJson(id))); }
//public void AddCard_ByInfo(CardInfoBase cardInfo, Transform cardSet = null) //{ // CardList.Add(cardInfo); // // 카드 오브젝트 생성 // if( cardSet == null ) // { // cardSet = GetPlayerUI().GetCardSet(); // } // Card_Base cardClass = GameSingleton.GetPlay().CreateCard(cardSet, cardInfo); // assert.set(cardClass); // GetPlayerUI().AddCardClass(cardClass); //} public void AddCard_ByClass(Card_Base cardClass) { // 부모 연결 cardClass.transform.SetParent(GetPlayerUI().GetCardSet()); // 알파 변동 GlobalFunc.SetAlpha(cardClass.GetCardImage(), 1.0f); CardList.Add(cardClass.GetCardInfo()); GetPlayerUI().AddCardClass(cardClass); }
public IActionResult GetBooksByName([FromQuery] string name) { name = GlobalFunc.MyUrlDeCode(name, Encoding.UTF8); var bookFromRepo = _bookRepository.GetBooksByName(name); if (bookFromRepo == null) { return(Ok(new { error = $"没有名字为{name}的书籍" })); } return(Ok(bookFromRepo)); }
protected void Page_Load(object sender, EventArgs e) { if (Request["custid"] == null) { Response.Redirect("Default.aspx"); } int cusid = int.Parse(Request["custid"]); RtpD.DataSource = GlobalFunc.GetOrderDetelFCust(cusid); RtpD.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Request["pid"] == null) { Response.Redirect("ProdList.aspx"); } var ArrProd = Application["ArrP"] as List <Product>; int Pid = int.Parse(Request["pid"]); RtpCvl.DataSource = GlobalFunc.GetSomeProd(Pid); RtpCvl.DataBind(); }
public void OnBtnPauseClicked() { Log.Info("GameSceneMainCanvas.OnBtnPauseClicked()"); SoundManager.Instance.PlaySound(ESoundEffect.BtnClicked); m_pnlPause.SetActive(true); GlobalFunc.TweenShowPopup(m_pnlPause.transform.GetChild(0)); // resume game GameManager.Instance.PauseGame(); }