public ActionResult Index(UserIndex ui) { if (ui.User != null) { if (!ui.Page.HasValue) { ui.Page = 1; } return(Json(userAdapter.SearchAjax(active: ui.User.Active, userType: ui.User.Type, userName: ui.User.UserName, firstName: ui.User.FirstName, lastName: ui.User.LastName, sortBy: ui.Sort, page: ui.Page.Value))); } try { object extraData = GetTypes().Data; if (extraData != null) { ui.ExtraData = JsonConvert.SerializeObject(extraData); } } catch (Exception ex) { ex.Log(); } return(View(ui)); }
public CalenderViewModel(List <string> Vendorsdatetime, UserIndex Vendor, UserQueryDTO userQuery) { UQuery = userQuery; VendorsDateTime = Vendorsdatetime; VendorModel = Vendor; GetData(); }
public Interfacer(UserIndex id) { controller = new Controller(id); gamepad = new Gamepad(); connected = controller.IsConnected; buttonstatearray = new List <KeyValuePair <Button, bool> >(); buttoncongruency = new List <KeyValuePair <Button, GamepadButtonFlags> > { new KeyValuePair <Button, GamepadButtonFlags>(Button.A, GamepadButtonFlags.A), new KeyValuePair <Button, GamepadButtonFlags>(Button.BumperLeft, GamepadButtonFlags.LeftShoulder), new KeyValuePair <Button, GamepadButtonFlags>(Button.BumperRight, GamepadButtonFlags.RightShoulder), new KeyValuePair <Button, GamepadButtonFlags>(Button.JoystickLeft, GamepadButtonFlags.LeftThumb), new KeyValuePair <Button, GamepadButtonFlags>(Button.JoystickRight, GamepadButtonFlags.RightThumb), new KeyValuePair <Button, GamepadButtonFlags>(Button.X, GamepadButtonFlags.X), new KeyValuePair <Button, GamepadButtonFlags>(Button.Y, GamepadButtonFlags.Y), new KeyValuePair <Button, GamepadButtonFlags>(Button.A, GamepadButtonFlags.A), new KeyValuePair <Button, GamepadButtonFlags>(Button.B, GamepadButtonFlags.B), new KeyValuePair <Button, GamepadButtonFlags>(Button.View, GamepadButtonFlags.Back), new KeyValuePair <Button, GamepadButtonFlags>(Button.Menu, GamepadButtonFlags.Start) }; foreach (Button button in Enum.GetValues(typeof(Button))) { buttonstatearray.Add(new KeyValuePair <Button, bool>(button, false)); } }
public XInputControllerAnalogNode() : base(XInputControllerAnalogNodeFactory.TYPESTRING) { // Prepare Execution Connection conExecuted = new ExecutionConnectorViewModel(); conExecute = new ExecutionConnectorViewModel(); this.InputExecutionConnectors.Add(conExecuted); this.OutputExecutionConnectors.Add(conExecute); // Prepare Connections conLeftThumbX = new ConnectorViewModel("LeftThumbX", typeof(NodeDataNumeric)); conLeftThumbY = new ConnectorViewModel("LeftThumbY", typeof(NodeDataNumeric)); conLeftTrigger = new ConnectorViewModel("LeftTrigger", typeof(NodeDataNumeric)); conRightThumbX = new ConnectorViewModel("RightThumbX", typeof(NodeDataNumeric)); conRightThumbY = new ConnectorViewModel("RightThumbY", typeof(NodeDataNumeric)); conRightTrigger = new ConnectorViewModel("RightTrigger", typeof(NodeDataNumeric)); //conButtons = new ConnectorViewModel("Buttons", typeof(NodeDataXInputButtons)); this.OutputConnectors.Add(conLeftThumbX); this.OutputConnectors.Add(conLeftThumbY); this.OutputConnectors.Add(conLeftTrigger); this.OutputConnectors.Add(conRightThumbX); this.OutputConnectors.Add(conRightThumbY); this.OutputConnectors.Add(conRightTrigger); //this.OutputConnectors.Add(conButtons); // State Values currentUser = UserIndex.One; controller = new SharpDX.XInput.Controller(currentUser); // Create Dialog dlgEdit = new PropertyDialog(); }
private void InsertIndex(UserIndex bodys) { var userindexs = Mapper.Map <UserIndexs>(bodys); var objindex = _indexFactory.CreateIndex <UserIndexs, IUserIndexsIndex>(userindexs.Id.ToString(), "authcore1"); objindex.Insert(userindexs); }
public ActionResult LogIn(UserLogInVM model) { if (ModelState.IsValid) { var user = db.Users.Where(u => u.email.Equals(model.LogInEmail) && u.password.Equals(model.LogInPassword)).SingleOrDefault(); if (user == null) { ModelState.AddModelError("", "Login Failed with given Information"); } else { Session["User"] = user; if (user.type.Equals("admin")) { return RedirectToAction("Profile", "Dashboard"); } return RedirectToAction("Index", "Home"); } } UserIndex userIndexModel = new UserIndex(); userIndexModel.logIn = model; ViewBag.activeTab = "login"; return View("Index", userIndexModel); }
private bool Subscribe(UserIndex controllerId, XInputSubscriptionRequest subReq, dynamic handler, string id, int povDirection = 0) { lock (stickSubscriptions.XInputSticks) { return(stickSubscriptions.Add(controllerId, subReq, handler, id, povDirection)); } }
public GameController(UserIndex index = UserIndex.Any) { _lastPressedButtons = GamepadButtonFlags.None; _controller = new Controller(index); Index = index; Deadband = GlobalDeadband; }
static void Main(string[] args) { UserIndex userIndex = new UserIndex(); userIndex.CreateIndex(); userIndex.PopulateData(); }
public void ExecuteIndex_should_not_replicate_indexes_if_convention_flag_is_not_set() { using (var sourceServer = GetNewServer(8077)) using (var source = NewRemoteDocumentStore(ravenDbServer: sourceServer)) using (var destinationServer = GetNewServer(8078)) using (var destination = NewRemoteDocumentStore(ravenDbServer: destinationServer)) { CreateDatabaseWithReplication(source, "testDB"); CreateDatabaseWithReplication(destination, "testDB"); SetupReplication(source, "testDB", destination); var userIndex = new UserIndex(); var indexStatsBeforeReplication = destination.DatabaseCommands.ForDatabase("testDB").GetStatistics().Indexes; Assert.False(indexStatsBeforeReplication.Any(index => index.Name.Equals(userIndex.IndexName, StringComparison.InvariantCultureIgnoreCase))); source.Conventions.IndexAndTransformerReplicationMode = IndexAndTransformerReplicationMode.None; userIndex.Execute(source.DatabaseCommands.ForDatabase("testDB"), source.Conventions); //since IndexAndTransformerReplicationMode = IndexAndTransformerReplicationMode.None, creation //of index on source should not trigger replication to destination var indexStatsAfterReplication = destination.DatabaseCommands.ForDatabase("testDB").GetStatistics().Indexes; Assert.False(indexStatsAfterReplication.Any(index => index.Name.Equals(userIndex.IndexName, StringComparison.InvariantCultureIgnoreCase))); } }
public void CanReplicateIndex() { var requestFactory = new HttpRavenRequestFactory(); using (var sourceServer = GetNewServer(8077)) using (var source = NewRemoteDocumentStore(ravenDbServer: sourceServer)) using (var destinationServer = GetNewServer(8078)) using (var destination = NewRemoteDocumentStore(ravenDbServer: destinationServer)) { CreateDatabaseWithReplication(source, "testDB"); CreateDatabaseWithReplication(destination, "testDB"); //turn-off automatic index replication - precaution source.Conventions.IndexAndTransformerReplicationMode = IndexAndTransformerReplicationMode.None; SetupReplication(source, "testDB", destination); //make sure not to replicate the index automatically var userIndex = new UserIndex(); source.DatabaseCommands.ForDatabase("testDB").PutIndex(userIndex.IndexName, userIndex.CreateIndexDefinition()); var indexStatsBeforeReplication = destination.DatabaseCommands.ForDatabase("testDB").GetStatistics().Indexes; Assert.False(indexStatsBeforeReplication.Any(index => index.Name.Equals(userIndex.IndexName, StringComparison.InvariantCultureIgnoreCase))); var replicationRequestUrl = string.Format("{0}/databases/testDB/replication/replicate-indexes?indexName={1}", source.Url, userIndex.IndexName); var replicationRequest = requestFactory.Create(replicationRequestUrl, "POST", new RavenConnectionStringOptions { Url = source.Url }); replicationRequest.ExecuteRequest(); var indexStatsAfterReplication = destination.DatabaseCommands.ForDatabase("testDB").GetStatistics().Indexes; Assert.True(indexStatsAfterReplication.Any(index => index.Name.Equals(userIndex.IndexName, StringComparison.InvariantCultureIgnoreCase))); } }
public async Task If_deleted_original_index_on_destination_should_simply_create_the_replacement_index() { using (var source = CreateStore()) using (var destination = CreateStore()) { var testIndex = new UserIndex(); var oldIndexDef = new IndexDefinition { Map = "from user in docs.Users\n select new {\n\tName = user.Name\n}" }; source.DatabaseCommands.PutIndex(testIndex.IndexName, oldIndexDef); var sourceDatabase = await servers[0].Server.GetDatabaseInternal(source.DefaultDatabase); var destinationDatabase = await servers[1].Server.GetDatabaseInternal(destination.DefaultDatabase); sourceDatabase.StopBackgroundWorkers(); destinationDatabase.StopBackgroundWorkers(); var sourceReplicationTask = sourceDatabase.StartupTasks.OfType <ReplicationTask>().First(); sourceReplicationTask.Pause(); SetupReplication(source.DatabaseCommands, destination); testIndex.SideBySideExecute(source); //do side-by-side index replication -> but since in the destination there is no original index, //simply create the side-by-side index as if it replaced the old index already sourceReplicationTask.ReplicateIndexesAndTransformersTask(null); var definition = destination.DatabaseCommands.GetIndex(testIndex.IndexName); Assert.NotNull(definition); Assert.True(definition.Equals(testIndex.CreateIndexDefinition(), false)); } }
public ActionResult UserResult(int?id) { try { var user = DbContext.UserChecks.FirstOrDefault(x => x.Id == id && x.IsDeleted != true); if (user == null) { return(View("UserCreate")); } user.Counter = user.Counter + 1; DbContext.SaveChanges(); var model = new UserIndex { currentid = user.Id, Name = user.Name }; return(View("UserResult", model)); } catch (Exception ex) { throw ex; } }
public IActionResult Login(string login_email, string login_password) { User user = _context.Users.Where(u => u.Email == login_email).SingleOrDefault(); if (user != null && login_password != null) // Valid email was found, and a valid/invalid password was entered { var hasher = new PasswordHasher <User>(); if (hasher.VerifyHashedPassword(user, user.Password, login_password) > 0) { HttpContext.Session.SetInt32("UserId", user.UserId); // Saving "Id" to session for View access later! // return Json(user.UserId); return(RedirectToAction("Index", "WeddingPlanner")); } } ViewBag.Email = login_email; // Pass email back to the form TempData["Error"] = "Invalid Email/Password"; // Using TempData since we just need one error flashed to the View! var UserIndex = new UserIndex() { Users = _context.Users.ToList(), // List<User> // LoginUser = new LoginUser(), // RegisterUser = new RegisterUser() }; return(View("Index", UserIndex)); }
public UserDto CheckUser(string userName, string password) { _logger.LogInformation("CheckUser: username:{0}", userName); if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(password)) { return(null); } //get from indexs,get radom id to get url for balanced solrcloud var readindex = _indexReadFactory.CreateIndex <UserIndexs, IUserIndexsIndexRead>(Guid.NewGuid().ToString(), "authcore1"); var userindexs = readindex.FirstOrDefault(new List <KeyValuePair <string, string> >(2) { new KeyValuePair <string, string>("name", userName), new KeyValuePair <string, string>("keywords", password) }); UserIndex userindex = null; if (userindexs == null) { userindex = _userrepositoryread.CheckUserIndex(userName, password); if (userindex != null)//write to indexs { var writeuserindexs = Mapper.Map <UserIndexs>(userindex); var writeindex = _indexFactory.CreateIndex <UserIndexs, IUserIndexsIndex>(writeuserindexs.Id.ToString(), "authcore1"); writeindex.Insert(writeuserindexs); } } else { userindex = Mapper.Map <UserIndex>(userindexs); } var user = _repositoryReadFactory.CreateRepository <User, IUserRepositoryRead>(userindex.UserId.ToString()).CheckUser(userName, password);// return(Mapper.Map <UserDto>(user)); }
private void InsertUpdate(user_update_insertupdate_rpc msg) { User bodys = Mapper.Map <User>(ByteConvertHelper.Bytes2Object <User>(msg.MessageBodyByte)); UserIndex user = null; bool isAdd = default(Guid).Equals(bodys.Id); lock (rpcLocker) { if (!isAdd) { user = _repository.EditUserIndex(bodys); } else { var userId = ByteConvertHelper.Bytes2Object <Guid>(msg.MessageBodyReturnByte); var newUser = _repository.Get(userId); user = _repository.InsertUserIndex(newUser); } InsertIndex(user); } if (user != null) { msg.MessageBodyReturnByte = ByteConvertHelper.Object2Bytes(user.UserId); } }
public void SetDeviceState(UserIndex index, bool isEnabled) { var name = index + "."; Connected[index] = isEnabled; AddDeviceStateValue(name + Constants.Buttons.A, isEnabled); AddDeviceStateValue(name + Constants.Buttons.B, isEnabled); AddDeviceStateValue(name + Constants.Buttons.Back, isEnabled); AddDeviceStateValue(name + Constants.Buttons.LeftBumper, isEnabled); AddDeviceStateValue(name + Constants.Buttons.LeftStick, isEnabled); AddDeviceStateValue(name + Constants.Buttons.LeftTrigger, isEnabled); AddDeviceStateValue(name + Constants.Buttons.PadDown, isEnabled); AddDeviceStateValue(name + Constants.Buttons.PadLeft, isEnabled); AddDeviceStateValue(name + Constants.Buttons.PadRight, isEnabled); AddDeviceStateValue(name + Constants.Buttons.PadUp, isEnabled); AddDeviceStateValue(name + Constants.Buttons.RightBumper, isEnabled); AddDeviceStateValue(name + Constants.Buttons.RightStick, isEnabled); AddDeviceStateValue(name + Constants.Buttons.RightTrigger, isEnabled); AddDeviceStateValue(name + Constants.Buttons.Start, isEnabled); AddDeviceStateValue(name + Constants.Buttons.X, isEnabled); AddDeviceStateValue(name + Constants.Buttons.Y, isEnabled); AddDeviceStateValue(name + Constants.Sliders.LeftStickX, isEnabled); AddDeviceStateValue(name + Constants.Sliders.LeftStickY, isEnabled); AddDeviceStateValue(name + Constants.Sliders.LeftTrigger, isEnabled); AddDeviceStateValue(name + Constants.Sliders.RightStickX, isEnabled); AddDeviceStateValue(name + Constants.Sliders.RightStickY, isEnabled); AddDeviceStateValue(name + Constants.Sliders.RightTrigger, isEnabled); }
/// <summary> /// Listens given joystick. /// </summary> /// <param name="joystickIndex">Joystick number</param> public void Listen(UserIndex joystickIndex) { var controller = new Controller(joystickIndex); if (!controller.IsConnected) { return; } var previousState = controller.GetState(); try { while (!stopListen) { var state = controller.GetState(); if (previousState.PacketNumber != state.PacketNumber) { SetTextBoxText(state, previousState); } Thread.Sleep(10); previousState = state; } } catch (Exception e) { } }
public void SpawnXInputListener(UserIndex index) { var controller = new Controller(index); if (!controller.IsConnected) { return; } new Thread(() => { try { var previousState = controller.GetState(); while (!_stopListening) { var state = controller.GetState(); if (previousState.PacketNumber != state.PacketNumber) { SetTextBoxText(state, previousState, (int)index); } Thread.Sleep(10); previousState = state; } } catch (Exception) { } } ).Start(); }
public SubscribedXIStick(UserIndex controllerId) { controller = new Controller(controllerId); SubscribedAxes = new Dictionary <int, SubscribedXIInput>(); SubscribedButtons = new Dictionary <int, SubscribedXIInput>(); SubscribedDpadDirections = new Dictionary <int, SubscribedXIInput>(); }
public async Task Conflict_then_patching_query_will_return_409_and_conflict_data() { using (var store1 = GetDocumentStore(new Options { ModifyDatabaseName = s => $"{s}_foo1", ModifyDatabaseRecord = record => { record.ConflictSolverConfig = new ConflictSolver { ResolveToLatest = false, ResolveByCollection = new Dictionary <string, ScriptResolver>() }; } })) using (var store2 = GetDocumentStore(new Options { ModifyDatabaseName = s => $"{s}_foo2", ModifyDatabaseRecord = record => { record.ConflictSolverConfig = new ConflictSolver { ResolveToLatest = false, ResolveByCollection = new Dictionary <string, ScriptResolver>() }; } })) { using (var s1 = store1.OpenSession()) { s1.Store(new User { Name = "test" }, "foo/bar"); s1.SaveChanges(); } var userIndex = new UserIndex(); store2.ExecuteIndex(userIndex); using (var s2 = store2.OpenSession()) { s2.Store(new User { Name = "test2" }, "foo/bar"); s2.SaveChanges(); } WaitForIndexing(store2); await SetupReplicationAsync(store1, store2); WaitUntilHasConflict(store2, "foo/bar"); // /indexes/Raven/DocumentsByEntityName var operation = store2.Operations.Send(new PatchByQueryOperation(new IndexQuery { Query = $"FROM INDEX '{userIndex.IndexName}' UPDATE {{ }}" })); Assert.Throws <DocumentConflictException>(() => operation.WaitForCompletion(TimeSpan.FromSeconds(15))); } }
/// <summary> /// Initializes a new instance of the <see cref="T:SharpDX.XInput.Controller" /> class. /// </summary> /// <param name="userIndex">Index of the user.</param> public Controller(UserIndex userIndex = UserIndex.Any) { if (xinput == null) { throw new NotSupportedException("XInput 1.4 or 1.3 or 9.1.0 is not installed"); } this.userIndex = userIndex; }
private bool UnSubscribe(UserIndex controllerId, XInputSubscriptionRequest subReq, string id, int povDirection = 0) { // Block the Monitor thread from polling while we update the data structures lock (stickSubscriptions.XInputSticks) { return(stickSubscriptions.Remove(controllerId, subReq, id, povDirection)); } }
public async Task <IActionResult> Index() { var model = await HttpClientAsync.Async <IList <UserModel> >(UserRoute.Index, this.Authentication); UserIndex <UserModel, UserPostModel> table = new UserIndex <UserModel, UserPostModel>(model); return(this.SearchGridConfiguration(table)); }
public void QueryGamepadQueue(UserIndex Index, out uint QueueLength, out uint ItemsInQueue, out uint TimedDurationRemaining, out uint CountDurationRemaining) { QueueLength = 0; ItemsInQueue = 0; TimedDurationRemaining = 0; CountDurationRemaining = 0; XboxConsole.SendTextCommand("autoinput user="******" queryqueue"); }
public static User GetOrAddUser(User item) { if (UserIndex.GetOrAdd(ref item)) { UserStore.Write(item); } return(item); }
/// <summary> /// Initializes a new instance of the <see cref="Controller"/> class. /// </summary> /// <param name="userIndex">Index of the user.</param> public Controller(UserIndex userIndex = UserIndex.Any) { if(xinput == null) { throw new NotSupportedException("XInput 1.4 or 1.3 or 9.1.0 is not installed"); } this.userIndex = userIndex; }
public XInputController(UserIndex userIndex) { _buttonToButtonMappings = new Dictionary <RETRO_DEVICE_ID_JOYPAD, GamepadButtonFlags>(); _analogToButtonMappings = new Dictionary <RETRO_DEVICE_ID_JOYPAD, XInputAxis>(); _analogToAnalogMappings = new Dictionary <RetroAnalogDevice, XInputAxis>(); _buttonToAnalogMappings = new Dictionary <RetroAnalogDevice, GamepadButtonFlags>(); InitController(userIndex); }
public async Task Conflict_then_data_query_will_return_409_and_conflict_data() { using (var store1 = GetDocumentStore(new Options { ModifyDatabaseName = s => $"{s}_foo1", ModifyDatabaseRecord = record => { record.ConflictSolverConfig = new ConflictSolver { ResolveToLatest = false, ResolveByCollection = new Dictionary <string, ScriptResolver>() }; } })) using (var store2 = GetDocumentStore(new Options { ModifyDatabaseName = s => $"{s}_foo2", ModifyDatabaseRecord = record => { record.ConflictSolverConfig = new ConflictSolver { ResolveToLatest = false, ResolveByCollection = new Dictionary <string, ScriptResolver>() }; } })) { using (var s1 = store1.OpenSession()) { s1.Store(new User { Name = "test" }, "foo/bar"); s1.SaveChanges(); } var userIndex = new UserIndex(); store2.ExecuteIndex(userIndex); using (var s2 = store2.OpenSession()) { s2.Store(new User { Name = "test2" }, "foo/bar"); s2.SaveChanges(); } WaitForIndexing(store2); await SetupReplicationAsync(store1, store2); WaitUntilHasConflict(store2, "foo/bar"); // /indexes/Raven/DocumentsByEntityName using (var session = store2.OpenSession()) { var exception = Assert.Throws <DocumentConflictException>(() => session.Query <User>(userIndex.IndexName).ToList()); Assert409Response(exception); } } }
public async Task If_deleted_original_index_on_destination_but_not_side_by_side_index() { using (var source = CreateStore()) using (var destination = CreateStore()) { var testIndex = new UserIndex(); var oldIndexDef = new IndexDefinition { Map = "from user in docs.Users\n select new {\n\tName = user.Name\n}" }; source.DatabaseCommands.PutIndex(testIndex.IndexName, oldIndexDef); var sourceDatabase = await servers[0].Server.GetDatabaseInternal(source.DefaultDatabase); var destinationDatabase = await servers[1].Server.GetDatabaseInternal(destination.DefaultDatabase); using (var session = source.OpenSession()) { session.Store(new User { Name = "John Doe" }); session.SaveChanges(); } WaitForIndexing(source); sourceDatabase.StopBackgroundWorkers(); destinationDatabase.StopBackgroundWorkers(); var sourceReplicationTask = sourceDatabase.StartupTasks.OfType <ReplicationTask>().First(); sourceReplicationTask.Pause(); SetupReplication(source.DatabaseCommands, destination); sourceReplicationTask.ReplicateIndexesAndTransformersTask(null); //replicate the usual index source.SideBySideExecuteIndex(testIndex); sourceReplicationTask.ReplicateIndexesAndTransformersTask(null); //replicate the side-by-side index destinationDatabase.Indexes.DeleteIndex(testIndex.IndexName); //delete the original index var sideBySideIndex = destinationDatabase.Indexes.GetIndexDefinition("ReplacementOf/" + testIndex.IndexName); Assert.NotNull(sideBySideIndex); VerifyReplacementDocumentIsThere("ReplacementOf/" + testIndex.IndexName, destinationDatabase); sourceReplicationTask.ReplicateIndexesAndTransformersTask(null); //replicate the side-by-side index again var oldIndex = destinationDatabase.Indexes.GetIndexDefinition(testIndex.IndexName); Assert.True(oldIndex.Equals(testIndex.CreateIndexDefinition(), false)); sideBySideIndex = destinationDatabase.Indexes.GetIndexDefinition("ReplacementOf/" + testIndex.IndexName); Assert.Null(sideBySideIndex); Assert.Null(destinationDatabase.Documents.Get(Constants.IndexReplacePrefix + "ReplacementOf/" + testIndex.IndexName, null)); } }
public async Task Out_of_date_side_by_side_index_will_get_updated_on_replication() { using (var source = CreateStore()) using (var destination = CreateStore()) { var testIndex = new UserIndex(); var testIndex2 = new UserIndex2(); testIndex2.SetName(testIndex.IndexName); var oldIndexDef = new IndexDefinition { Map = "from user in docs.Users\n select new {\n\tName = user.Name\n}" }; source.DatabaseCommands.PutIndex(testIndex.IndexName, oldIndexDef); var sourceDatabase = await servers[0].Server.GetDatabaseInternal(source.DefaultDatabase); var destinationDatabase = await servers[1].Server.GetDatabaseInternal(destination.DefaultDatabase); using (var session = source.OpenSession()) { session.Store(new User { Name = "John Doe" }); session.SaveChanges(); } WaitForIndexing(source); sourceDatabase.StopBackgroundWorkers(); destinationDatabase.StopBackgroundWorkers(); var sourceReplicationTask = sourceDatabase.StartupTasks.OfType <ReplicationTask>().First(); sourceReplicationTask.Pause(); SetupReplication(source.DatabaseCommands, destination); sourceReplicationTask.ReplicateIndexesAndTransformersTask(null); //replicate the usual index source.SideBySideExecuteIndex(testIndex); sourceReplicationTask.ReplicateIndexesAndTransformersTask(null); //replicate the side-by-side index //sanity check Assert.NotNull(destinationDatabase.Indexes.GetIndexDefinition("ReplacementOf/" + testIndex.IndexName)); sourceDatabase.Indexes.DeleteIndex("ReplacementOf/" + testIndex.IndexName); source.SideBySideExecuteIndex(testIndex2); //replaces the testIndex side-by-side index on source sourceReplicationTask.ReplicateIndexesAndTransformersTask(null); //should replicate the replaced side-by-sude index to destination var sideBySideIndex = destinationDatabase.Indexes.GetIndexDefinition("ReplacementOf/" + testIndex.IndexName); Assert.NotNull(sideBySideIndex); Assert.True(sideBySideIndex.Equals(testIndex2.CreateIndexDefinition(), false)); } }
/// <summary> /// Constructor for GamepadState /// </summary> /// <param name="userIndex"></param> public GamepadState(UserIndex userIndex) { UserIndex = userIndex; Controller = new Controller(userIndex); xboxControllerLock = new Mutex(false); xboxWorker = new BackgroundWorker(); xboxWorker.DoWork += XboxWorkerThread; xboxWorker.WorkerSupportsCancellation = true; xboxWorker.RunWorkerAsync(); }
public Xbox360AgarIoGamepad(UserIndex userIndex, Dictionary<GamepadButtonFlags,CommandTypes> buttonMappings = null) { controller = new Controller(userIndex); lastRTX = lastRTY = 0; if (buttonMapping == null) this.buttonMapping = Xbox360AgarIoGamepad.getDefaultButtonMap(); else this.buttonMapping = buttonMappings; gamepadName = "Xbox 360 Controller " + ((int)userIndex + 1); }
public X360Gamepad(UserIndex userIndex) { switch (userIndex) { case UserIndex.Any: index = FindUnactivatedIndex(); index = index == -1 ? 0 : index; userIndex = (UserIndex)index; break; default: index = (int)userIndex; count++; break; } index = count; controllers[count] = new Controller(userIndex); }
public static void GetMyFriends(XDevkit.IXboxConsole xbc, UserIndex userIndex) { //try //{ uint friendIndex = 0; while (true) { XONLINE_FRIEND iteratorVariable0; if (GetNextFriend(xbc, userIndex, friendIndex, out iteratorVariable0) != 0) { break; } FriendRequestStatus requestAccepted = FriendRequestStatus.RequestAccepted; if ((iteratorVariable0.dwFriendState & 0x40000000) > 0) { requestAccepted = FriendRequestStatus.RequestSent; } else if ((iteratorVariable0.dwFriendState & 0x80000000) > 0) { requestAccepted = FriendRequestStatus.RequestReceived; } FriendStatus offline = FriendStatus.Offline; if ((iteratorVariable0.dwFriendState & 1) > 0) { offline = ((FriendStatus)iteratorVariable0.dwFriendState) & ((FriendStatus)0xf0000); } ListFGamerTags[friendIndex] = iteratorVariable0.szGamertag; ListFLXuid[friendIndex] = iteratorVariable0.xuid; ListFSXuid[friendIndex] = iteratorVariable0.xuid.ToString("X16"); ListFGameID[friendIndex] = iteratorVariable0.dwTitleID.ToString("X8"); //offline; friendIndex++; } FUsersCount = (int)friendIndex; //} //catch //{ //} }
public GamepadState(int userIndex) { UserIndex = (UserIndex)userIndex; Controller = new Controller(UserIndex); }
public GamepadState(UserIndex userIndex) { UserIndex = userIndex; Controller = new Controller(userIndex); }
public XInputControllerAnalogNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut) : base(XInputControllerAnalogNodeFactory.TYPESTRING) { // Prepare Execution Connection conExecuted = new ExecutionConnectorViewModel(executeIn[0]); conExecute = new ExecutionConnectorViewModel(executeOut[0]); this.InputExecutionConnectors.Add(conExecuted); this.OutputExecutionConnectors.Add(conExecute); // Prepare Connections conLeftThumbX = new ConnectorViewModel("LeftThumbX", typeof(NodeDataNumeric), dataOut[0]); conLeftThumbY = new ConnectorViewModel("LeftThumbY", typeof(NodeDataNumeric), dataOut[1]); conLeftTrigger = new ConnectorViewModel("LeftTrigger", typeof(NodeDataNumeric), dataOut[2]); conRightThumbX = new ConnectorViewModel("RightThumbX", typeof(NodeDataNumeric), dataOut[3]); conRightThumbY = new ConnectorViewModel("RightThumbY", typeof(NodeDataNumeric), dataOut[4]); conRightTrigger = new ConnectorViewModel("RightTrigger", typeof(NodeDataNumeric), dataOut[5]); //if (dataIn.Length > 5) //{ // conButtons = new ConnectorViewModel("Buttons", typeof(NodeDataXInputButtons), dataOut[6]); //} //else //{ // conButtons = new ConnectorViewModel("Buttons", typeof(NodeDataXInputButtons)); //} this.OutputConnectors.Add(conLeftThumbX); this.OutputConnectors.Add(conLeftThumbY); this.OutputConnectors.Add(conLeftTrigger); this.OutputConnectors.Add(conRightThumbX); this.OutputConnectors.Add(conRightThumbY); this.OutputConnectors.Add(conRightTrigger); //this.OutputConnectors.Add(conButtons); // Set Name Name = (string)data["name"]; // State Values if (!Enum.TryParse<UserIndex>((string)data["currentUser"], out currentUser)) currentUser = UserIndex.One; controller = new SharpDX.XInput.Controller(currentUser); // Create Dialog dlgEdit = new PropertyDialog(); }
//static public string[] ListFGamerTags = new string[32]; //static public string[] ListFSXuid = new string[8]; //static public ulong[] ListFLXuid = new ulong[8]; //static public IEnumerable<Friend> EnumerateFriends(XDevkit.IXboxConsole xbc, UserIndex userIndex) //static public void GetMyFriends(XDevkit.IXboxConsole xbc, UserIndex userIndex) //{ // uint friendIndex = 0; // while (true) // { // XONLINE_FRIEND iteratorVariable0; // if (GetNextFriend(xbc, userIndex, friendIndex, out iteratorVariable0) != 0) // { // yield break; // } // FriendRequestStatus requestAccepted = FriendRequestStatus.RequestAccepted; // if ((iteratorVariable0.dwFriendState & 0x40000000) > 0) // { // requestAccepted = FriendRequestStatus.RequestSent; // } // else if ((iteratorVariable0.dwFriendState & 0x80000000) > 0) // { // requestAccepted = FriendRequestStatus.RequestReceived; // } // FriendStatus offline = FriendStatus.Offline; // if ((iteratorVariable0.dwFriendState & 1) > 0) // { // offline = ((FriendStatus)iteratorVariable0.dwFriendState) & ((FriendStatus)0xf0000); // } // //Friend iteratorVariable4 = new Friend(iteratorVariable0.szGamertag, iteratorVariable0.xuid, requestAccepted, offline, iteratorVariable0.wszRichPresence, iteratorVariable0.dwTitleID); // //yield return iteratorVariable4; // friendIndex++; // } //} private static uint GetNextFriend(XDevkit.IXboxConsole xbc, UserIndex userIndex, uint friendIndex, out XONLINE_FRIEND friend) { uint num2; //try //{ friend = new XONLINE_FRIEND(); XDRPCExecutionOptions options = new XDRPCExecutionOptions(XDRPCMode.Title, "xam.xex", 0x4ea); XDRPCArgumentInfo<uint> info = new XDRPCArgumentInfo<uint>((uint)userIndex); XDRPCArgumentInfo<uint> info2 = new XDRPCArgumentInfo<uint>(friendIndex); XDRPCArgumentInfo<uint> info3 = new XDRPCArgumentInfo<uint>(1); XDRPCArgumentInfo<uint> info4 = new XDRPCArgumentInfo<uint>(0, ArgumentType.Out); XDRPCArgumentInfo<uint> info5 = new XDRPCArgumentInfo<uint>(0, ArgumentType.Out); uint num = ((XDevkit.IXboxConsole)xbc).ExecuteRPC<uint>(options, new XDRPCArgumentInfo[] { info, info2, info3, info4, info5 }); if (num == 0) { options = new XDRPCExecutionOptions(XDRPCMode.Title, "xam.xex", 0x250); info5 = new XDRPCArgumentInfo<uint>(info5.Value); XDRPCArgumentInfo<uint> info6 = new XDRPCArgumentInfo<uint>(0); XDRPCStructArgumentInfo<XONLINE_FRIEND> info7 = new XDRPCStructArgumentInfo<XONLINE_FRIEND>(new XONLINE_FRIEND(), ArgumentType.Out); info4 = new XDRPCArgumentInfo<uint>(info4.Value); XDRPCArgumentInfo<uint> info8 = new XDRPCArgumentInfo<uint>(0, ArgumentType.Out); XDRPCNullArgumentInfo info9 = new XDRPCNullArgumentInfo(); num = ((XDevkit.IXboxConsole)xbc).ExecuteRPC<uint>(options, new XDRPCArgumentInfo[] { info5, info6, info7, info4, info8, info9 }); friend = info7.Value; options = new XDRPCExecutionOptions(XDRPCMode.Title, "xam.xex", 0x414); ((XDevkit.IXboxConsole)xbc).ExecuteRPC<bool>(options, new XDRPCArgumentInfo[] { info5 }); } num2 = num; //} //catch (XDRPCException exception) //{ // //throw new ProfilesException(exception); //} return num2; }
private static void FireEventsForStateChange(UserIndex inActiveController, State? inLastState, State inState) { var keysUp = new List<GamepadButtonFlags>(); var keysDown = new List<GamepadButtonFlags>(); var keysRepeated = new List<GamepadButtonFlags>(); // Check each known key in turn. foreach (GamepadButtonFlags keyEnum in Enum.GetValues(typeof(GamepadButtonFlags))) { if (keyEnum == GamepadButtonFlags.None) continue; var key = (Int32)keyEnum; // First state? Fire a key down. if (inLastState == null && ((((Int32)inState.Gamepad.Buttons) & key) == key)) { keysDown.Add((GamepadButtonFlags)key); continue; } if (inLastState == null) continue; // Key newly pressed, fire a key down. if ((((Int32)inLastState.Value.Gamepad.Buttons) & key) == 0 && ((((Int32)inState.Gamepad.Buttons) & key) == key)) { keysDown.Add((GamepadButtonFlags)key); continue; } // Key no longer pressed, fire a key up. if ((((Int32)inLastState.Value.Gamepad.Buttons) & key) == key && ((((Int32)inState.Gamepad.Buttons) & key) == 0)) { keysUp.Add((GamepadButtonFlags)key); continue; } // Key continues to be pressed, fire a key repeat. if ((((Int32)inLastState.Value.Gamepad.Buttons) & key) == key && ((((Int32)inState.Gamepad.Buttons) & key) == key)) { keysRepeated.Add((GamepadButtonFlags)key); continue; } } // Fire changes (via dispatcher.) if (Changed != null) { if (!_lastDown.ContainsKey(inActiveController)) _lastDown.Add(inActiveController, new Dictionary<GamepadButtonFlags, DateTime>()); // Fire key up events. foreach (var keyUp in keysUp) { Changed(null, new GamepadEventArgs(keyUp, false)); if (_lastDown[inActiveController].ContainsKey(keyUp)) _lastDown[inActiveController].Remove(keyUp); } // Fire key down events. foreach (var keyDown in keysDown) { Changed(null, new GamepadEventArgs(keyDown, true)); _lastDown[inActiveController][keyDown] = DateTime.UtcNow; } // Fire another key down for repeated keys (as per key repeat rate.) foreach (var keyRepeated in keysRepeated) if (!_lastDown.ContainsKey(inActiveController) || !_lastDown[inActiveController].ContainsKey(keyRepeated) || _lastDown[inActiveController][keyRepeated] < DateTime.UtcNow.Subtract(TimeSpan.FromMilliseconds(REPEAT_RATE))) { Changed(null, new GamepadEventArgs(keyRepeated, true)); _lastDown[inActiveController][keyRepeated] = DateTime.UtcNow; } } }
public GamepadDevice(UserIndex userIndex) { UserIndex = userIndex; Controller = new Controller((UserIndex)userIndex); }
public static uint GetXuidFromIndex(XDevkit.IXboxConsole xbc, UserIndex userIndex, out ulong offlineXuid) { uint num2; //try //{ XDRPCExecutionOptions options = new XDRPCExecutionOptions(XDRPCMode.Title, "xam.xex", 0x20a); XDRPCArgumentInfo<uint> info = new XDRPCArgumentInfo<uint>((uint)userIndex); XDRPCArgumentInfo<uint> info2 = new XDRPCArgumentInfo<uint>(2); XDRPCArgumentInfo<ulong> info3 = new XDRPCArgumentInfo<ulong>(0L, ArgumentType.Out); uint num = ((XDevkit.IXboxConsole)xbc).ExecuteRPC<uint>(options, new XDRPCArgumentInfo[] { info, info2, info3 }); offlineXuid = info3.Value; num2 = num; //} //catch (XDRPCException exception) //{ //} return num2; }
public static Controller GetController(UserIndex index) { sController = new Controller(index); return sController.IsConnected ? sController : null; }
public XInputControllerDigitalNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut) : base(XInputControllerDigitalNodeFactory.TYPESTRING) { // Prepare Execution Connection conExecuted = new ExecutionConnectorViewModel(executeIn[0]); conExecute = new ExecutionConnectorViewModel(executeOut[0]); this.InputExecutionConnectors.Add(conExecuted); this.OutputExecutionConnectors.Add(conExecute); // Prepare Connections conDPadUp = new ConnectorViewModel("DPadUp", typeof(NodeDataBoolean), dataOut[0]); conDPadDown = new ConnectorViewModel("DPadDown", typeof(NodeDataBoolean), dataOut[1]); conDPadLeft = new ConnectorViewModel("DPadLeft", typeof(NodeDataBoolean), dataOut[2]); conDPadRight = new ConnectorViewModel("DPadRight", typeof(NodeDataBoolean), dataOut[3]); conStart = new ConnectorViewModel("Start", typeof(NodeDataBoolean), dataOut[4]); conBack = new ConnectorViewModel("Back", typeof(NodeDataBoolean), dataOut[5]); conLeftThumb = new ConnectorViewModel("LeftThumb", typeof(NodeDataBoolean), dataOut[6]); conRightThumb = new ConnectorViewModel("RightThumb", typeof(NodeDataBoolean), dataOut[7]); conLeftShoulder = new ConnectorViewModel("LeftShoulder", typeof(NodeDataBoolean), dataOut[8]); conRightShoulder = new ConnectorViewModel("RightShoulder", typeof(NodeDataBoolean), dataOut[9]); conA = new ConnectorViewModel("A", typeof(NodeDataBoolean), dataOut[10]); conB = new ConnectorViewModel("B", typeof(NodeDataBoolean), dataOut[11]); conX = new ConnectorViewModel("X", typeof(NodeDataBoolean), dataOut[12]); conY = new ConnectorViewModel("Y", typeof(NodeDataBoolean), dataOut[13]); this.OutputConnectors.Add(conDPadUp); this.OutputConnectors.Add(conDPadDown); this.OutputConnectors.Add(conDPadLeft); this.OutputConnectors.Add(conDPadRight); this.OutputConnectors.Add(conStart); this.OutputConnectors.Add(conBack); this.OutputConnectors.Add(conLeftThumb); this.OutputConnectors.Add(conRightThumb); this.OutputConnectors.Add(conLeftShoulder); this.OutputConnectors.Add(conRightShoulder); this.OutputConnectors.Add(conA); this.OutputConnectors.Add(conB); this.OutputConnectors.Add(conX); this.OutputConnectors.Add(conY); // Set Name Name = (string)data["name"]; // State Values if (!Enum.TryParse<UserIndex>((string)data["currentUser"], out currentUser)) currentUser = UserIndex.One; controller = new SharpDX.XInput.Controller(currentUser); // Create Dialog dlgEdit = new PropertyDialog(); }
private void onButtonReleased(Controller controller, UserIndex index, GamepadButtonFlags button) { mRepeatTimer.Stop(); if (mRepeatDelayTimer.Enabled) { mRepeatDelayTimer.Stop(); } mRepeatAction = null; }
private void onRightStickMoved(Controller controller, UserIndex index, Vector2 oldDir, Vector2 newDir) { }
private void onButtonPressed(Controller controller, UserIndex index, GamepadButtonFlags button) { Action repeatAction = null; switch (button) { case GamepadButtonFlags.DPadDown: repeatAction = new Action(navigateDown); break; case GamepadButtonFlags.DPadLeft: repeatAction = new Action(navigateLeft); break; case GamepadButtonFlags.DPadRight: repeatAction = new Action(navigateRight); break; case GamepadButtonFlags.DPadUp: repeatAction = new Action(navigateUp); break; case GamepadButtonFlags.A: mDispatcher.Invoke(new Action(trySelect)); break; case GamepadButtonFlags.B: mDispatcher.Invoke(new Action(leaveScreen)); break; } if (repeatAction != null) { mRepeatAction = repeatAction; mDispatcher.Invoke(mRepeatAction); if (!mRepeatTimer.Enabled && !mRepeatDelayTimer.Enabled) { mRepeatDelayTimer.Start(); } } }
public GamepadState this[UserIndex index] { get { return gamepadStates[index]; } }
/// <summary> /// Initializes a new instance of the <see cref="GamepadState"/> class. /// </summary> /// <param name="userIndex">The index of the user whose gamepad this object should model</param> public GamepadState(UserIndex userIndex) { this.UserIndex = userIndex; this.Controller = new Controller(userIndex); }
public ControllerInput(UserIndex userIndex) { uIndex = userIndex; controller = new Controller(uIndex); }
public XInputControllerDigitalNode() : base(XInputControllerDigitalNodeFactory.TYPESTRING) { // Prepare Execution Connection conExecuted = new ExecutionConnectorViewModel(); conExecute = new ExecutionConnectorViewModel(); this.InputExecutionConnectors.Add(conExecuted); this.OutputExecutionConnectors.Add(conExecute); // Prepare Connections conDPadUp = new ConnectorViewModel("DPadUp", typeof(NodeDataBoolean)); conDPadDown = new ConnectorViewModel("DPadDown", typeof(NodeDataBoolean)); conDPadLeft = new ConnectorViewModel("DPadLeft", typeof(NodeDataBoolean)); conDPadRight = new ConnectorViewModel("DPadRight", typeof(NodeDataBoolean)); conStart = new ConnectorViewModel("Start", typeof(NodeDataBoolean)); conBack = new ConnectorViewModel("Back", typeof(NodeDataBoolean)); conLeftThumb = new ConnectorViewModel("LeftThumb", typeof(NodeDataBoolean)); conRightThumb = new ConnectorViewModel("RightThumb", typeof(NodeDataBoolean)); conLeftShoulder = new ConnectorViewModel("LeftShoulder", typeof(NodeDataBoolean)); conRightShoulder = new ConnectorViewModel("RightShoulder", typeof(NodeDataBoolean)); conA = new ConnectorViewModel("A", typeof(NodeDataBoolean)); conB = new ConnectorViewModel("B", typeof(NodeDataBoolean)); conX = new ConnectorViewModel("X", typeof(NodeDataBoolean)); conY = new ConnectorViewModel("Y", typeof(NodeDataBoolean)); this.OutputConnectors.Add(conDPadUp); this.OutputConnectors.Add(conDPadDown); this.OutputConnectors.Add(conDPadLeft); this.OutputConnectors.Add(conDPadRight); this.OutputConnectors.Add(conStart); this.OutputConnectors.Add(conBack); this.OutputConnectors.Add(conLeftThumb); this.OutputConnectors.Add(conRightThumb); this.OutputConnectors.Add(conLeftShoulder); this.OutputConnectors.Add(conRightShoulder); this.OutputConnectors.Add(conA); this.OutputConnectors.Add(conB); this.OutputConnectors.Add(conX); this.OutputConnectors.Add(conY); // State Values currentUser = UserIndex.One; controller = new SharpDX.XInput.Controller(currentUser); // Create Dialog dlgEdit = new PropertyDialog(); }
public Controller(UserIndex userIndex = UserIndex.Any) { this.userIndex = userIndex; }
public override void Edit() { dlgEdit.Value = new NodeData() { NodeName = Name, User = currentUser }; if (dlgEdit.ShowDialog() == DialogResult.OK) { Name = ((NodeData)(dlgEdit.Value)).NodeName; currentUser = ((NodeData)(dlgEdit.Value)).User; controller = new Controller(currentUser); } OnPropertyChanged("Note"); }
private void checkButtonState(Controller controller, UserIndex userIndex, Gamepad oldState, GamepadButtonFlags button) { Gamepad currentState = controller.GetState().Gamepad; if ((oldState.Buttons & button) != (currentState.Buttons & button)) { if ((currentState.Buttons & button) != 0) { buttonPressed(controller, userIndex, button); } else { buttonReleased(controller, userIndex, button); } } }
public ControllerX() { this.userIndex = new UserIndex(); //trzeba dać wyjątki gdy nie podłączony żaden pad :D // foreach (var deviceInstance in SlimDX.XInput.get.GetDevices(SlimDX.DirectInput.DeviceType.Gamepad, DeviceEnumerationFlags.AllDevices)) // this.joystickGuid = deviceInstance.InstanceGuid; this.joystick = new SlimDX.XInput.Controller(userIndex); this.vibration = new Vibration(); }
//static public string GetXUID(XDevkit.IXboxConsole xbc, string gamertag) //{ // XDRPCExecutionOptions options = new XDRPCExecutionOptions(XDRPCMode.Title, Addresses.g_XUserFindUserAddressDEV); // //((XDevkit.IXboxConsole)xbc).Call(0x81824DF8, new object[] { 0x0009000006F93463, 0, gamertag, (int)0x18, Addresses.g_freememory + 0x20, 0 }); // XDRPCStringArgumentInfo GT = new XDRPCStringArgumentInfo(gamertag, Encoding.ASCII); // XDRPCArgumentInfo<ulong> MyXUID = new XDRPCArgumentInfo<ulong>(0x0009000006F93463L); // XDRPCArgumentInfo<int> idk = new XDRPCArgumentInfo<int>(0); // XDRPCArgumentInfo<int> idk2 = new XDRPCArgumentInfo<int>((int)0x18); // XDRPCArgumentInfo<ulong> XUID = new XDRPCArgumentInfo<ulong>(0L); // uint num = ((XDevkit.IXboxConsole)xbc).ExecuteRPC<uint>(options, new XDRPCArgumentInfo[] { MyXUID, idk, GT, idk2, XUID, idk }); // return XUID.Value.ToString("X16"); //} public static void JoinParty(XDevkit.IXboxConsole xbc, UserIndex userIndex, Xuid xuidContact) { try { XDRPCExecutionOptions options = new XDRPCExecutionOptions(XDRPCMode.Title, "xam.xex", 0xb01); XDRPCArgumentInfo<uint> info = new XDRPCArgumentInfo<uint>((uint)userIndex); XDRPCArgumentInfo<ulong> info2 = new XDRPCArgumentInfo<ulong>((ulong)xuidContact); uint errorCode = ((XDevkit.IXboxConsole)xbc).ExecuteRPC<uint>(options, new XDRPCArgumentInfo[] { info, info2 }); if (errorCode != 0) { CreateExceptionFromErrorCode(errorCode); } WaitForPartyState(xbc, PartyState.XPARTY_STATE_INPARTY, TimeSpan.FromSeconds(15.0)); } catch (XDRPCException exception) { //throw new ProfilesException(exception); } }
private bool FindActiveDevice(out UserIndex FirstIndex) { for (int i = 0; i < 4; i++) { UserIndex userIndex = (UserIndex)i; Controller checkController; try { checkController = new Controller(userIndex); if (checkController.IsConnected) { FirstIndex = userIndex; return true; } } catch { } } FirstIndex = UserIndex.Any; return false; }
public XBox360PluginGlobal(UserIndex index) { controller = new Controller(index); pad = new Gamepad(); }
public Gamepad_State_SlimDX(UserIndex userIndex) { UserIndex = userIndex; Controller = new Controller(userIndex); }