virtual public Request <ResolveResultDTO <DataType> > Resolve( Action <Request <ResolveResultDTO <DataType> > > callback = null) { var result = GetStoredStateAsResolveResult(); var request = new LocalRequest <ResolveResultDTO <DataType> >(result); request.Execute(callback); return(request); }
public Request <ResolveResultDTO <DataType> > Resolve( ResolveRequestDTO req, Action <Request <ResolveResultDTO <DataType> > > callback = null) { var result = GetStoredEntityAsResolveResult(req); var request = new LocalRequest <ResolveResultDTO <DataType> >(result); request.Execute(callback); return(request); }
//GET: Locals/Confirm/5 public ActionResult Confirm(int id) { if (User.IsInRole("Admin")) { //find local request LocalRequest request = db.LocalRequests.Find(id); //create and save local Local local = new Local(); local.City = request.LocalCity; local.Name = request.LocalName; local.Manager = request.Email; db.Locals.Add(local); // create new user var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(db)); var UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(db)); UserManager.UserValidator = new UserValidator <ApplicationUser>(UserManager) { AllowOnlyAlphanumericUserNames = false, RequireUniqueEmail = true }; string password = System.Web.Security.Membership.GeneratePassword(12, 4); var user = new ApplicationUser(); user.Email = request.Email; user.UserName = request.Email; var result = UserManager.Create(user, password); //P@ssw0rdPassword MailMessage mm = new MailMessage("*****@*****.**", user.Email); mm.Subject = "Confirmation for account"; mm.Body = "Your local account has been accepted and added to our webside. Thank you for choosing us. You can now log in to " + "your account." + "\n"; mm.Body += "Username: "******"\nPassword: "******"smtp.gmail.com"; smtp.Port = 587; // smtp.EnableSsl = true; NetworkCredential nc = new NetworkCredential("*****@*****.**", "P@ssw0rdPassword"); smtp.UseDefaultCredentials = false; smtp.Credentials = nc; smtp.Send(mm); //add role 'Menager' to user UserManager.AddToRole(user.Id, "Manager"); //remove request db.LocalRequests.Remove(request); db.SaveChanges(); //this needs to be made with ajax call so that it will only be deleted from the table return(RedirectToAction("Requests")); } return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); }
public static JObject GetData() { if (Common.Utility.Environment.GetScope().isCore) { return(GetDataApiLayer()); } else { return(LocalRequest.GetEconomy()); } }
public bool DownloadFromJuggler() { try { byte[] resp = StringUtils.FromBase64(LocalRequest.GetDatabase()); newDataBase = BinarySerialization.NS.Deserialize <Dictionary <string, BasicSalesHistory> >(resp); Log.Success("Loaded new DB from juggler. Total item count: " + newDataBase.Count); return(true); } catch (Exception) { return(false); } }
/// <summary> /// Allows you to request an entity (from the store) and get a callback when load succeeds or fails. /// If the entity is not initially loaded, sends the usual notifications and then listens for updates /// </summary> public static Request <DataType> Resolve( string loadKey, HasEntities <DataType> store, Action <Request <DataType> > callback = null) { if (string.IsNullOrEmpty(loadKey)) { var err = new LocalRequest <DataType>("Load key cannot be null or empty"); err.Execute(callback); return(err); } var r = new DataRequest(NewResolveRequest(loadKey), store); r.Execute(callback); return(r); }
public bool Load() { try { unstickeredCache = new HashSet <Tuple <long, long> >(); byte[] resp = StringUtils.FromBase64(LocalRequest.GetEmptyStickeredDatabase()); if (LoadFromArray(BinarySerialization.NS.Deserialize <string[]>(resp, true))) { Log.Success("Loaded emptystickered DB from juggler. Total item count: " + unstickeredCache.Count); return(true); } Log.Warn("Could not load unstickered database"); return(false); } catch (Exception) { return(false); } }
override public Request <ResolveResultDTO <NetworkStatusData> > Resolve( Action <Request <ResolveResultDTO <NetworkStatusData> > > callback = null) { var nstatus = new NetworkStatusData { networkReachability = Application.internetReachability }; if (nstatus.networkReachability == NetworkReachability.NotReachable) { var res = new LocalRequest <ResolveResultDTO <NetworkStatusData> >( ResolveResultDTO <NetworkStatusData> .ResolveSucceeded(nstatus) ); res.Execute(callback); return(res); } var promise = new Promise <ResolveResultDTO <NetworkStatusData> >((resolve, reject) => { new WebRequest(NextTestUrl()).Execute(req => { nstatus.hasNetworkError = (req as WebRequest).www.isNetworkError; if (nstatus.hasNetworkError) { nstatus.lastNetworkError = DateTime.Now; } else { nstatus.lastNetworkSuccess = DateTime.Now; } resolve( ResolveResultDTO <NetworkStatusData> .ResolveSucceeded(nstatus) ); }); }); promise.Execute(callback); return(promise); }
public ActionResult DeleteRequest(FormCollection data) { if (User.IsInRole("Admin")) { int id = int.Parse(data["id"]); //find local request LocalRequest request = db.LocalRequests.Find(id); if (request == null) { return(HttpNotFound()); } else { db.LocalRequests.Remove(request); db.SaveChanges(); return(Json("{}")); } } return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); }
private void cheatSign() { if (!_status) { return; } using (LocalProto proto = new LocalProto(1338)) { LocalRequest lreq = new LocalRequest { hwid = _hwid }; proto.SendJson(lreq); DllResponse rsp = proto.ReciveJson <DllResponse>(); if (rsp.salt.Length == 0) { _status = false; showMessage("Ошибка при обмене данных. Обратитесь в поддержку.", "Обратиться", "open_url", ClientData.SUPPORT_URL); } } }
/// <inheritdoc/> public void LeaveLobby(LocalRequest request) { try { lock (this.Padlock) { if (this.LobbyMode == Mode.GameOver) { return; } if (this.AccessTokens.Remove(request.AccessToken)) { this.Broadcaster.DisconnectClient(request.AccessToken); this.PlayerCount--; } } } finally { this.ResetInactivityTimer(); } }
/// <inheritdoc/> public void StartRound(LocalRequest request) { lock (this.Padlock) { this.ResetInactivityTimer(); if (this.LobbyMode != Mode.InputMode) { return; } // Inform lobby and clients about the starting fight round this.LobbyMode = Mode.FightMode; this.Broadcaster.FightRound(this.RoundNumber); // Place enemies and process the fight round this.EcsContainer.PlaceEnemySystem.PlaceEnemies(); DateTime startTime = DateTime.Now; this.EcsContainer.ProcessFightRound(); Console.WriteLine(DateTime.Now - startTime); // Process aftermath bool didWin; if (this.EcsContainer.HasPlayerDied) { // Player lost all health points didWin = false; // Default to end game logic below } else if (this.RoundNumber == this.NumberOfRounds) { // Player survived all rounds didWin = true; // Default to end game logic below } else { // Player is not dead nor is all rounds done this.RoundNumber++; this.LobbyMode = Mode.InputMode; this.Broadcaster.InputRound(this.RoundNumber); // Update clients who joined during the round on game state. if (this.DelayedUpdate) { this.EcsContainer.UpdateClientSystem.UpdateClients(); this.DelayedUpdate = false; } // Skip end game logic below return; } int placement; if (this.Difficulty == StartGameRequest.Difficulties.HARD) { placement = HighscoreListManager.Instance.RegisterScore(this.Name, this.EcsContainer.Score); } else { placement = -1; } this.Broadcaster.EndGame(didWin, placement, this.EcsContainer.Score); this.LobbyMode = Mode.GameOver; this.Dispose(); } }
// This mode is to manage child bot processes and take use command line inputs private static void BotManagerMode() { Console.Title = "Bot Manager"; manager = new BotManager(); bool loadedOk = false; bool primetime = LocalRequest.IsPrimeTime(); if (!primetime) { return; } if (!File.Exists("settings.json")) { try { loadedOk = manager.LoadConfigurationFromData(LocalRequest.GetConfig()); } catch (Exception e) { Console.WriteLine( "Config file is missing and all instances are working."); Console.Write("Press Enter to exit..."); Console.ReadLine(); return; } } else { loadedOk = manager.LoadConfiguration("settings.json"); } if (!loadedOk) { Console.WriteLine( "Configuration file Does not exist or is corrupt. Please rename 'settings-template.json' to 'settings.json' and modify the settings to match your environment"); Console.Write("Press Enter to exit..."); Console.ReadLine(); return; } else { if (manager.ConfigObject.UseSeparateProcesses) { SetConsoleCtrlHandler(ConsoleCtrlCheck, true); } Consts.Endpoints.juggler = manager.ConfigObject.JugglerEndpoint ?? "http://steambot.noobgam.me"; Tasking.Run(manager.Nanny); if (manager.ConfigObject.AutoStartAllBots) { var startedOk = manager.StartBots(); if (!startedOk) { Console.WriteLine( "Error starting the bots because either the configuration was bad or because the log file was not opened."); Console.Write("Press Enter to exit..."); Console.ReadLine(); } } else { foreach (var botInfo in manager.ConfigObject.Bots) { if (botInfo.AutoStart) { // auto start this particual bot... manager.StartBot(botInfo.Username); } } } Console.WriteLine("Type help for bot manager commands. "); var bmi = new BotManagerInterpreter(manager); // command interpreter loop. do { Console.Write("botmgr > "); string inputText = Console.ReadLine(); if (inputText == null) { waitHandle.WaitOne(); return; } if (!String.IsNullOrEmpty(inputText)) { bmi.CommandInterpreter(inputText); } } while (!isclosing); } }