public bool TakeScreenshot(string filePath, int?timeout = 5000) { if (WaitDomContentLoaded(timeout)) { try { Task.Run(() => page.ScreenshotAsync(filePath, true)) .GetAwaiter().GetResult(); return(true); } catch (Exception ex) { ErrorLog.Add(ex.Message); LastError = ex; } } return(false); }
// sends an request to the remote server (async) private void SendRequestAsync(string name, Uri remotePath, FileTransferCallback callback, DelegateRequest caller) { try { caller.BeginInvoke(name, remotePath, delegate(IAsyncResult iar) { var c = (DelegateRequest)iar.AsyncState; c.EndInvoke(iar); callback.Invoke(FileTransferResult.Success); }, caller); } catch (Exception e) { ErrorLog.Add(this, e.Message); callback.Invoke(FileTransferResult.Failure); } }
private Texture2D GetTexture() { try { if (ButtonState == ButtonStates.Off) { return(ScreenManager.Textures2D[GameTextures2D.ButtonOff]); } else { return(ScreenManager.Textures2D[GameTextures2D.ButtonOn]); } }catch (Exception exception) { ErrorLog.Add(exception); return(new Texture2D(ScreenManager.GraphicsDeviceMgr.GraphicsDevice, 10, 10)); } }
public ActionResult Account(string firstName, string lastName, string address, string email, string city, string webAddress , string phone, string mobilePhone, string nationalCode, string userName, string password) { ViewBag.Title = "اطلاعات حساب کاربری"; Customer tk = new Customer(); try { tk.Id = long.Parse(Session["customer_id"].ToString()); tk = tk.GetOne(); tk.UserName = userName; if (!string.IsNullOrEmpty(password)) { var data = Encoding.ASCII.GetBytes(password); var md5 = new MD5CryptoServiceProvider(); var md5data = md5.ComputeHash(data); var hashedPassword = Encoding.ASCII.GetString(md5data); tk.Password = hashedPassword; } tk.FirstName = firstName; tk.LastName = lastName; tk.Address = address; tk.Email = email; tk.City = city; tk.WebAddress = webAddress; tk.Phone = phone; tk.MobilePhone = mobilePhone; tk.NationalCode = nationalCode; tk.Update(); ViewBag.SuccessMessage = "اطلاعات شما به روز رسانی گردید"; } catch (Exception ex) { ErrorLog log = new ErrorLog(); log.Description = ex.Message; if (ex.InnerException != null) { log.Description += ";" + ex.Message; } log.ErrorDate = DateTime.Now; log.Add(); } return(View(tk)); }
public AdvancedDemoLevels() { try { LevelTitle = "Advanced Demo Levels"; GridWidth = 7; GridHeight = 5; // 5 levels AddLevel(new AdvancedDemo001()); AddLevel(new AdvancedDemo002()); AddLevel(new AdvancedDemo003()); AddLevel(new AdvancedDemo004()); AddLevel(new AdvancedDemo005()); AddLevel(new AdvancedDemo006()); }catch (Exception exception) { ErrorLog.Add(exception); } }
/// <summary> /// 保存错误日志 /// </summary> /// <param name="model"></param> public void SaveLog(ErrorLogModel model) { ErrorLog log = new ErrorLog() { SiteID = model.SiteID, UserID = model.UserID, CreateAt = DateTime.Now, Title = model.Title.Left(100), Content = model.Content, IP = model.IP, IPAddress = IPAgent.GetAddress(model.IP), ErrorID = model.RequestID }; using (DbExecutor db = NewExecutor()) { log.Add(db); } }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, int x, int y) { try { // Draw the slider's background ScreenManager.Sprites.DrawString(ScreenManager.Fonts[GameFonts.GameFont], Text, new Vector2(x, y), FontColor); ScreenManager.Sprites.Draw(ScreenManager.Textures2D[GameTextures2D.WhiteBox], new Rectangle(x + 220, y, Width, Height), BackgroundColor); ScreenManager.Sprites.Draw(ScreenManager.Textures2D[GameTextures2D.WhiteBox], new Rectangle(x + 221, y + 1, GetWidth() - 2, Height - 2), ForegroundColor); } catch (Exception exception) { ErrorLog.Add(exception); } }
protected void PurchaseGameMenuItem() { try { var gp = Gamer.SignedInGamers[InputManager.LastPlayer].Privileges; if (gp.AllowPurchaseContent) { Guide.ShowMarketplace(InputManager.LastPlayer); } else { ErrorLog.Add("You need to log in with an XBox Live Membership to purchase the game."); } } catch (Exception exception) { ErrorLog.Add(exception); } }
public ButtonTypes GetType(int x, int y) { try { if (MapButtonTypes[y, x] == 2) { return(ButtonTypes.TwoState); } else { return(ButtonTypes.ThreeState); } } catch (Exception exception) { ErrorLog.Add(exception); return(ButtonTypes.TwoState); } }
public ClassicDemoLevels() { try { LevelTitle = "Classic Demo Levels"; GridWidth = 7; GridHeight = 5; // 35 levels AddLevel(new ClassicDemo001()); AddLevel(new ClassicDemo002()); AddLevel(new ClassicDemo003()); AddLevel(new ClassicDemo004()); AddLevel(new ClassicDemo005()); AddLevel(new ClassicDemo006()); }catch (Exception exception) { ErrorLog.Add(exception); } }
// builds the list of files to transfer (async) private void BuildTransferList(DelegateTransfer callback, BuildTransferListAsync caller) { try { // calls wether BuildUploadList or BuildDownloadList async caller.BeginInvoke( delegate(IAsyncResult iar) { var c = (BuildTransferListAsync)iar.AsyncState; c.EndInvoke(iar); callback(true); }, caller); } catch (Exception e) { ErrorLog.Add(this, e.Message); callback(false); } }
protected void XMLTag() { string strMessage = ""; string strID = ""; string strGameLogId = "-1"; if (Session["Event_IDNo"] != null) { strID = Session["Event_IDNo"].ToString(); // Response.Write(strID); try { ConnectionStringSettings connSettings = ConfigurationManager.ConnectionStrings["ConnString"]; SqlConnection conn = new SqlConnection(connSettings.ConnectionString); using (conn) { SqlCommand cmd = new SqlCommand("usp_SelectGameLogId", conn); cmd.CommandType = CommandType.StoredProcedure; conn.Open(); SqlParameter parm_ID = new SqlParameter("@ID", SqlDbType.VarChar, 50); parm_ID.Value = strID; cmd.Parameters.Add(parm_ID); this.GLId.Text = cmd.ExecuteScalar().ToString(); cmd.Dispose(); } } catch (Exception ex) { ErrorLog.Add(strID, HttpContext.Current.Request.ServerVariables["PATH_INFO"].ToString(), ex.ToString(), "XMLTag"); } } else { strMessage = "請至網銀登入後才可以進行遊戲喔!"; ErrorLog.Add(HttpContext.Current.User.Identity.Name, HttpContext.Current.Request.ServerVariables["PATH_INFO"].ToString(), "Session 抓不到值!!", "XMLTag"); } if (strGameLogId == "") { strMessage = "您目前已選完抽籤機會!再去交易吧!"; } }
private void PrepArrays(int gridSize) { try { MapButtonTypes = new int[gridSize, gridSize]; MapButtonStates = new int[gridSize, gridSize]; for (var x = 0; x < gridSize; x++) { for (var y = 0; y < gridSize; y++) { MapButtonTypes[x, y] = 2; MapButtonStates[x, y] = 0; } } } catch (Exception exception) { ErrorLog.Add(exception); } }
public void AddErrorLog(string error) { Context.Send(o => { var keyvalue = ErrorLog.FirstOrDefault(kv => kv.Key == error); if (keyvalue != null) { keyvalue.Value++; } else { var keyVal = new KeyValue { Key = error, Value = 1 }; ErrorLog.Add(keyVal); } }, null); }
// creates a list of all local files (async) private void AnalyzeNewVersion(DelegateTransfer callback) { try { // call GetLocalFiles method async var caller = new GetLocalFilesAsync(GetLocalFiles); caller.BeginInvoke(ulLocalPath, delegate(IAsyncResult iar) { var c = (GetLocalFilesAsync)iar.AsyncState; ulLocalFiles = caller.EndInvoke(iar); callback(ulLocalFiles != null); }, caller); } catch (Exception e) { ErrorLog.Add(this, e.Message); callback(false); } }
public ActionResult Modify(string bankId, string sheba, string cart, string number, string bank, string status) { string permissions = ""; int stat = 0; if (HasPermission("[cart]", ref permissions, ref stat)) { return(RedirectToAction("AccessDeny")); } ViewBag.permissions = permissions; ViewBag.stat = stat; ViewBag.Title = "ویرایش حساب/کارت بانکی "; BankAccount tk = new BankAccount(); try { tk.Id = long.Parse(bankId); tk = tk.GetOne(); tk.BankId = int.Parse(bank); tk.Status = int.Parse(status); tk.Sheba = sheba; tk.CardNumber = cart; tk.AccountNumber = number; tk.Update(); return(RedirectToAction("Index", "Cart")); } catch (Exception ex) { ErrorLog log = new ErrorLog(); log.Description = ex.Message; if (ex.InnerException != null) { log.Description += ";" + ex.Message; } log.ErrorDate = DateTime.Now; log.Add(); } return(View(tk)); }
public override void Update(GameTime gameTime) { try { OffY = 0 - (_credits.Count * 20); _y -= 1; if (_y < OffY) { ScreenManager.RemoveScreen(this); } if (InputManager.GameButtonPressed(GameButtons.Decline)) { ScreenManager.RemoveScreen(this); } base.Update(gameTime); } catch (Exception exception) { ErrorLog.Add(exception); } }
protected void AddLevel(GameLevel lvl) { try { for (var y = 0; y < GridHeight; y++) { for (var x = 0; x < GridWidth; x++) { if (LevelGrid[x, y] == null) { LevelGrid[x, y] = lvl; return; } } } } catch (Exception exception) { ErrorLog.Add(exception); } }
public ActionResult Ctype() { ViewBag.Title = "ثبت نوع توکن جدید"; TokenType tk = new TokenType(); try { } catch (Exception ex) { ErrorLog log = new ErrorLog(); log.Description = ex.Message; if (ex.InnerException != null) { log.Description += ";" + ex.Message; } log.ErrorDate = DateTime.Now; log.Add(); } return(View(tk)); }
public ActionResult Display(long Id) { string permissions = ""; int stat = 0; if (HasPermission("[receipt]", ref permissions, ref stat)) { return(RedirectToAction("AccessDeny")); } ViewBag.permissions = permissions; ViewBag.stat = stat; ViewBag.Title = "اطلاعات فیش پرداختی"; BankReceipt tk = new BankReceipt(); try { tk.Id = Id; tk = tk.GetOne(); Order ord = new Order(); ord.Id = tk.OrderId; ord = ord.GetOne(); ViewBag.Count = ord.Count; // if (tk.Statuse==2) // { // return RedirectToAction("", "Receipt"); //d } } catch (Exception ex) { ErrorLog log = new ErrorLog(); log.Description = ex.Message; if (ex.InnerException != null) { log.Description += ";" + ex.Message; } log.ErrorDate = DateTime.Now; log.Add(); } return(View(tk)); }
public ActionResult Display(string ticketId, string message) { ViewBag.Title = "مشاهده تیکت"; try { Ticket tk = new Ticket(); tk.Id = long.Parse(ticketId); tk = tk.GetOne(); tk.Status = 1; tk.StatusDate = DateTime.Now; tk.Update(); TicketContent tkc = new TicketContent(); tkc.Content = message; tkc.CustomerId = long.Parse(Session["customer_id"].ToString()); tkc.RegisterDate = DateTime.Now; tkc.TicketId = tk.Id; tkc.Add(); return(RedirectToAction("Index", "Ticket")); } catch (Exception ex) { ErrorLog log = new ErrorLog(); log.Description = ex.Message; if (ex.InnerException != null) { log.Description += ";" + ex.Message; } log.ErrorDate = DateTime.Now; log.Add(); } Dictionary <string, string> parameter = new Dictionary <string, string>(); parameter.Add("TicketId", ticketId); List <TicketContent> model = new TicketContent().GetAll(parameter); ViewBag.Id = ticketId; return(View(model)); }
private int CountOff() { try { var ct = 0; for (int x = 0; x < _level.MapSize; x++) { for (int y = 0; y < _level.MapSize; y++) { if (_buttons[x, y].ButtonState == ButtonStates.Off) { ct++; } } } return(ct); }catch (Exception exception) { ErrorLog.Add(exception); return(int.MinValue); } }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { try { var sprites = ScreenManager.Sprites; ScreenManager.Sprites.Draw(ScreenManager.Textures2D[GameTextures2D.MainBack], new Rectangle(0, 0, 640, 480), Color.Gray); DrawCenterString("Level Cleared", 10, ScreenManager.Fonts[GameFonts.TitleFont]); var font = ScreenManager.Fonts[GameFonts.GameStatusFont]; DrawCenterString("Par", 150, font); DrawCenterString(_par.ToString(CultureInfo.InvariantCulture), 200, font); DrawCenterString("Moves", 250, font); DrawCenterString(_moves.ToString(CultureInfo.InvariantCulture), 300, font); DrawCenterString("Score", 350, font); DrawCenterString(_score.ToString(CultureInfo.InvariantCulture), 400, font); base.Draw(gameTime); }catch (Exception exception) { ErrorLog.Add(exception); } }
public override void Update(GameTime gameTime) { try { if (InputManager.GameButtonPressedOrHeld(GameButtons.Up)) { IndexLocation -= 1; } if (InputManager.GameButtonPressedOrHeld(GameButtons.Down)) { IndexLocation += 1; } if (IndexLocation > Options.Count - 1) { IndexLocation = 0; } if (IndexLocation < 0) { IndexLocation = Options.Count - 1; } Options[IndexLocation].Update(gameTime); if (InputManager.GameButtonPressed(GameButtons.Accept)) { DataManager.SaveScores(); ScreenManager.ChangeScreens(this, new MainMenu()); } if (InputManager.GameButtonPressed(GameButtons.Decline)) { ScreenManager.ChangeScreens(this, new MainMenu()); } base.Update(gameTime); } catch (Exception exception) { ErrorLog.Add(exception); } }
// writes full version config public bool Save(string path) { try { XmlDocument doc = new XmlDocument(); XmlNode files = doc.CreateElement("files"); foreach (TransferFile f in Files) { XmlAttribute name = doc.CreateAttribute("path"); name.Value = f.name; XmlNode size = doc.CreateElement("size"); size.InnerText = f.size.ToString(); XmlNode hash = doc.CreateElement("hash"); hash.InnerText = f.hash; XmlNode file = doc.CreateElement("file"); file.Attributes.Append(name); file.AppendChild(size); file.AppendChild(hash); files.AppendChild(file); } doc.AppendChild(files); doc.Save(path); return(true); } catch (Exception e) { ErrorLog.Add(this, e.Message); } return(false); }
internal bool AppendVariable(string variableName) { TreeNode child = new TreeNode(); child.type = nodeType.number; switch (variableName) { case "PI": child.val = PI.value; child.name = child.val.ToString(); break; default: ErrorLog.Add(new ErrorMessage("Unknown variable can't be appendend")); return(false); } child.numericalEvaluation = true; children.Insert(0, child); //clear the static visualization output string: output = string.Empty; return(true); }
internal bool AppendKeyword(string keyword) { TreeNode child = new TreeNode(); child.type = nodeType.number; switch (keyword) { case "ANS": Complex tokenVal = (Complex)OutputLog.returnValues.Last(); child.val = tokenVal; child.name = tokenVal.ToString(); break; default: ErrorLog.Add(new ErrorMessage("Unknown variable can't be appendend")); return(false); } child.numericalEvaluation = true; children.Insert(0, child); //clear the static visualization output string: output = string.Empty; return(true); }
private void InitBoard(GameLevel lvl) { try { _moves = 0; _buttons = new Button[lvl.MapSize, lvl.MapSize]; for (var x = 0; x < lvl.MapSize; x++) { for (var y = 0; y < lvl.MapSize; y++) { var btn = new Button(lvl.GetType(x, y)); btn.ButtonState = lvl.GetState(x, y); btn.Position.X = x * (470 / lvl.MapSize) + 5; btn.Position.Y = y * (470 / lvl.MapSize) + 5; btn.Size = new Coordinates2D((470 / lvl.MapSize) - 5, (470 / lvl.MapSize) - 5); _buttons[x, y] = btn; } } }catch (Exception exception) { ErrorLog.Add(exception); } }
private bool LevelCleared() { try { var ct = _level.MapSize * _level.MapSize; for (int x = 0; x < _level.MapSize; x++) { for (int y = 0; y < _level.MapSize; y++) { if (_buttons[x, y].ButtonState == ButtonStates.Off) { ct--; } } } return(ct == 0); } catch (Exception exception) { ErrorLog.Add(exception); return(false); } }
public override void Draw(GameTime gameTime) { try { var ts = ScreenManager.GraphicsDeviceMgr.GraphicsDevice.Viewport.TitleSafeArea; var fs = ScreenManager.Fonts[GameFonts.MainMenuFont].MeasureString("Press Start"); var center = new Vector2(320, 240); ScreenManager.Sprites.Draw(ScreenManager.Textures2D[GameTextures2D.MainBack], new Rectangle(0, 0, 640, 480), Color.Gray); ScreenManager.Sprites.DrawString( ScreenManager.Fonts[GameFonts.MainMenuFont], "Press Start", new Vector2( center.X - (fs.X / 2), center.Y - (fs.Y / 2)), Color.White); base.Draw(gameTime); } catch (Exception exception) { ErrorLog.Add(exception); } }