// Update is called once per frame void Update() { if (SFS.IsConnected()) { SFS.ProcessEvents(); } // Create a temporary reference to the current scene. Scene currentScene = SceneManager.GetActiveScene(); // Retrieve the name of this scene. string sceneName = currentScene.name; if (sceneName == "WaitingRoom") { GetSessions(); if (!SFS.enteredGame && numSessions > 0) { if (hosting && !LaunchGameButton.interactable) { ActivateLaunchGameButton(); } GoToGame(); } Invoke("Stall", 1); } }
// Update is called once per frame void Update() { if (SFS.IsConnected()) { SFS.ProcessEvents(); } }
// Start is called before the first frame update void Start() { Debug.Log(GetAdminToken()); token = PlayerPrefs.GetString("token", "No token found"); username = PlayerPrefs.GetString("username", "noUser"); if (SFS.getSFS() == null) { // Initialize SFS2X client. This can be done in an earlier scene instead SmartFox sfs = new SmartFox(); // For C# serialization DefaultSFSDataSerializer.RunningAssembly = Assembly.GetExecutingAssembly(); SFS.setSFS(sfs); Debug.Log("SFS was null. Setting it now"); } if (!SFS.IsConnected()) { SFS.Connect(username); Debug.Log("was not connected. Connecting now"); } HostGameButton.interactable = false; LaunchGameButton.interactable = false; NewGameButton.interactable = false; SavedSessionButtonA.interactable = false; SavedSessionButtonB.interactable = false; DeleteButton.interactable = false; DeleteSessionButton.interactable = false; // if(resetFields) { // SetFields(); // } GetSessions(); }
public void CreateSession(Text savegameID) { if (!intentToDelete) { dynamic j = new JObject(); j.creator = username; j.game = "ColtExpress"; if (savegameID == null) { Debug.Log("null"); j.savegame = ""; } else { j.savegame = savegameID.text; } var request = new RestRequest("api/sessions?access_token=" + token, Method.POST) .AddParameter("application/json", j.ToString(), ParameterType.RequestBody) .AddHeader("Authorization", "Basic YmdwLWNsaWVudC1uYW1lOmJncC1jbGllbnQtcHc="); IRestResponse response = client.Execute(request); gameHash = response.Content; //HostGameButton.interactable = false; hosting = true; joined = true; InfoText.text = "You will be brought to the next scene once you launch your game!"; SFS.JoinRoom(); } }
public void JoinGame(Button gameToJoin) { gameHash = hashes[gameToJoin]; var request = new RestRequest("api/sessions/" + gameHash + "/players/" + username + "?access_token=" + token, Method.PUT) .AddHeader("Authorization", "Basic YmdwLWNsaWVudC1uYW1lOmJncC1jbGllbnQtcHc="); IRestResponse response = client.Execute(request); foreach (KeyValuePair <Button, string> entry in hashes) { entry.Key.interactable = false; } LaunchGameButton.interactable = false; //HostGameButton.interactable = false; var request2 = new RestRequest("api/sessions/" + gameHash, Method.GET) .AddHeader("Authorization", "Basic YmdwLWNsaWVudC1uYW1lOmJncC1jbGllbnQtcHc="); IRestResponse response2 = client.Execute(request2); var obj2 = JObject.Parse(response2.Content); Dictionary <string, object> sessionDetails = obj2.ToObject <Dictionary <string, object> >(); Debug.Log("SavedGame ID : " + sessionDetails["savegameid"].ToString()); GameBoard.saveGameId = sessionDetails["savegameid"].ToString(); joined = true; InfoText.text = "You will be brought to the next scene once the host launches the game!"; SFS.JoinRoom(); }
public void Test() { for (int i = 0; i < testfiles.Length; i++) { string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr", testfiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List <Partition> partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SFS(); int part = -1; for (int j = 0; j < partitions.Count; j++) { if (partitions[j].Type == "0x2F") { part = j; break; } } Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } }
public ActionResult adminOnly() { ViewBag.Message = "This is the admin only page"; using (var ctx = new SFS()) { return(View(ctx.UserProfiles.ToList())); } }
public void Logout() { ChooseCharacter.RemoveLaunchedSession(); LeaveSession(); SFS.Disconnect(); SFS.setSFS(null); SceneManager.LoadScene("Login"); }
public void EnterChooseCharacterScene() { ISFSObject obj = SFSObject.NewInstance(); ExtensionRequest req = new ExtensionRequest("gm.enterChooseCharacterScene", obj); SFS.Send(req); trace("Sent enter scene message"); }
public ActionResult ResetPassword(string un, string rt) { SFS db = new SFS(); //TODO: Check the un and rt matching and then perform following //get userid of received username var userid = (from i in db.UserProfiles where i.UserName == un select i.UserId).FirstOrDefault(); //check userid and token matches bool any = (from j in db.webpages_Membership where (j.UserId == userid) && (j.PasswordVerificationToken == rt) //the date compairing doesnt work //&& (j.PasswordVerificationTokenExpirationDate < DateTime.Now) select j).Any(); if (any == true) { //generate random password string newpassword = GenerateRandomPassword(6); //reset password bool response = WebSecurity.ResetPassword(rt, newpassword); if (response == true) { //get user emailid to send password var emailid = (from i in db.UserProfiles where i.UserName == un select i.EmailId).FirstOrDefault(); //send email string subject = "New Password"; string body = "<b>Please find the New Password</b><br/>" + newpassword; //edit it try { SendEMail(emailid, subject, body); TempData["Message"] = "Mail Sent."; } catch (Exception ex) { TempData["Message"] = "Error occured while sending email." + ex.Message; } //display message TempData["Message"] = "Success! Check email we sent. Your New Password Is " + newpassword; } else { TempData["Message"] = "Hey, avoid random request on this page."; } } else { TempData["Message"] = "Username and token not maching."; } return(View()); }
public void CharacterChoice(Button b) { character = b.name.ToUpper(); SetAllNotInteractable(); ISFSObject obj = SFSObject.NewInstance(); obj.PutUtfString("chosenCharacter", character); ExtensionRequest req = new ExtensionRequest("gm.chosenCharacter", obj); SFS.Send(req); }
public void PlayingSaveGame(Text savegameID) { if (!intentToDelete) { Debug.Log("GameID content : " + savegameID.text); ISFSObject obj2 = SFSObject.NewInstance(); obj2.PutUtfString("savegameId", savegameID.text); ExtensionRequest req = new ExtensionRequest("gm.loadSavedGame", obj2); SFS.Send(req); } }
// Update is called once per frame void Update() { if (SFS.IsConnected() && !alreadyCalled) { alreadyCalled = true; EnterChooseCharacterScene(); } if (SFS.IsConnected()) { SFS.ProcessEvents(); } }
public void OnSendMessageButtonClick() { if (msgField.text != "") { // Send public message to Room SFS.Send(new Sfs2X.Requests.PublicMessageRequest(msgField.text)); // Reset message field msgField.text = ""; } msgField.ActivateInputField(); msgField.Select(); }
static public void DeleteSaveGame(Text savegameID) { if (intentToDelete) { string adminToken = GetAdminToken(); var request = new RestRequest("api/gameservices/ColtExpress/savegames/" + savegameID.text + "?access_token=" + adminToken, Method.DELETE) .AddHeader("Authorization", "Basic YmdwLWNsaWVudC1uYW1lOmJncC1jbGllbnQtcHc="); IRestResponse response = client.Execute(request); Debug.Log("Here is the delete saved game return: " + response.ErrorMessage + " " + response.StatusCode); Debug.Log("GameID of saved game to be deleted content : " + savegameID.text); ISFSObject obj = SFSObject.NewInstance(); obj.PutUtfString("savegameId", savegameID.text); ExtensionRequest req = new ExtensionRequest("gm.deleteSavedGame", obj); SFS.Send(req); } }
// Start is called before the first frame update void Start() { Screen.SetResolution(800, 600, true); character = ""; alreadyCalled = false; info.text = "You will be brought to the game once all " + WaitingRoom.numPlayers + " players have chosen a character!"; display.text = ""; BelleIsAvailable = true; CheyenneIsAvailable = true; TucoIsAvailable = true; DjangoIsAvailable = true; DocIsAvailable = true; SFS.setChooseCharacter(); }
public SimpleMembershipInitializer() { Database.SetInitializer <SFS>(null); try { using (var context = new SFS()) { if (!context.Database.Exists()) { // Create the SimpleMembership database without Entity Framework migration schema ((IObjectContextAdapter)context).ObjectContext.CreateDatabase(); } } WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true); } catch (Exception ex) { throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex); } }
public ActionResult ForgotPassword(string UserName) { //check user existance var user = Membership.GetUser(UserName); if (user == null) { TempData["Message"] = "User Not exist."; } else { //generate password token var token = WebSecurity.GeneratePasswordResetToken(UserName); //create url with above token var resetLink = "<a href='" + Url.Action("ResetPassword", "Account", new { un = UserName, rt = token }, "http") + "'>Reset Password</a>"; //get user emailid SFS db = new SFS(); var emailid = (from i in db.UserProfiles where i.UserName == UserName select i.EmailId).FirstOrDefault(); //send mail string subject = "Password Reset Token"; string body = "<b>Please find the Password Reset Token</b><br/>" + resetLink; //edit it, currently for local host remove resetlink when live and can sent mail try { SendEMail(emailid, subject, body); TempData["Message"] = "Mail Sent."; } catch (Exception ex) { TempData["Message"] = "Error occured while sending email." + ex.Message; } //only for testing TempData["Message"] = resetLink; } return(View()); }
public void Test() { for (int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (RDB)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); Assert.AreEqual(true, image.Open(filter), _testFiles[i]); Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List <Partition> partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SFS(); int part = -1; for (int j = 0; j < partitions.Count; j++) { if (partitions[j].Type == "\"SFS\\0\"" || partitions[j].Type == "\"SFS\\2\"") { part = j; break; } } Assert.AreNotEqual(-1, part, $"Partition not found on {_testFiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), _testFiles[i]); fs.GetInformation(image, partitions[part], out _, null); Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]); Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } }
void OnApplicationQuit() { ChooseCharacter.RemoveLaunchedSession(); // Always disconnect before quitting SFS.Disconnect(); }
public Message() { SFS = new SFS(); FcsCoverage = new FCSCoverage(); EFS = new EFS(); }
// Start is called before the first frame update void Start() { SFS.setChat(); chatText.text = SFS.chatText; chatting = true; }