public Controller ConnectbyGuid(string strGuid)
 {
     try
     {
         if (controller != null)
         {
             controller.Logoff();
             controller.Dispose();
             controller = null;
         }
         ControllerInfo myControllerInfo = null;
         Guid           myGuid           = Guid.Empty;
         if (Guid.TryParse(strGuid, out myGuid))
         {
             networkScanner.TryFind(myGuid, out myControllerInfo);
         }
         else
         {
             throw new Exception("Invalid guid string");
         }
         if (myControllerInfo == null || myControllerInfo.Availability != Availability.Available)
         {
             throw new Exception("Wrong guid string");
         }
         else
         {
             controller = Controller.Connect(myControllerInfo, ConnectionType.Standalone);
             return(controller);
         }
     }
     finally { }
 }
        public void DynamicCreation()
        {
            // ABB 自带接口扫描类
            NetworkScanner networkScanner = new NetworkScanner();

            // 条件运算符  获取控制器类型
            ControllerInfo[] controllers = networkScanner.GetControllers(chooseSocket ? NetworkScannerSearchCriterias.Virtual : NetworkScannerSearchCriterias.Real);

            if (controllers.Length > 0)
            {
                Console.WriteLine(controllers);

                // 获取控制器信息
                ABBControllerInfo = controllers[0];

                // 根据控制器信息 船舰实例
                ABBController = ControllerFactory.CreateFrom(ABBControllerInfo);
                Console.WriteLine($"Found one ABB.System Name is:{SystemName} System ID is:{SystemID} System IP is:{SystemIP}");
                // $ 起到一个占位符的作用内容包含在 {} 中,可以用于获取{}中对应内容的信息,避免了利用{0}的形式占位。  以前占位符 需要  {0}  和 变量 配合使用
            }
            else
            {
                MessageBox.Show("No ABB Robot Found!");
            }
        }
예제 #3
0
        public ICollator Create(RouteData rd)
        {
            ControllerInfo     cInfo = SiteStructure.Current[rd.Values["controller"] as string];
            IContentController cc    = Activator.CreateInstance(cInfo.Controller) as IContentController;

            return(cc.GetCollator());
        }
예제 #4
0
        internal ControllerInfo LoadController(string fileName, string dirPath)
        {
            var controllerInfo = new ControllerInfo(this, fileName, dirPath);

            Items.Add(controllerInfo);
            return(controllerInfo);
        }
예제 #5
0
        //连接函数
        private void btnConnect_Click(object sender, EventArgs e)
        {
            ListViewItem   itemSelected = listView1.SelectedItems[0];
            ControllerInfo ctrlinfo     = (ControllerInfo)itemSelected.Tag;

            if (ctrlinfo.Availability == Availability.Available)
            {
                if (ctrlinfo.IsVirtual == true)
                {
                    RBTCtroller = ControllerFactory.CreateFrom(ctrlinfo);
                    this.RBTCtroller.Logon(UserInfo.DefaultUser);
                    listView1.Enabled       = false;
                    this.button1.Enabled    = false;//“连接”为禁止
                    this.btnConnect.Enabled = false;
                }
                else
                {
                    if (MessageBox.Show("此机器人控制器为真实控S制器,确定连接", "WARNING", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        RBTCtroller = ControllerFactory.CreateFrom(ctrlinfo);
                    }
                }
                btnDisConnect.Visible = true;
                initFunc();
            }
        }
예제 #6
0
        public void IsCreatableAndCreateControllerObjectsPasses()
        {
            var eventDispatcherMap = new EventDispatcherMap(
                new AppleEventDispatcher(),
                new OrangeEventDispatcher()
                );

            var apple = new Model()
            {
                Name = "Apple"
            };
            var orange = new Model()
            {
                Name = "Orange"
            };
            var grape = new Model()
            {
                Name = "Grape"
            };

            var appleControllerInfo   = new ControllerInfo(TestEventName.Apple.ToString());
            var orangeControllerInfo  = new ControllerInfo(TestEventName.Orange.ToString());
            var unknownControllerInfo = new ControllerInfo("???");
            {// case EventDispatcherMap#IsCreatableControllerObjects() == true
                var testData = new (Model model, IViewObject viewObj, ControllerInfo[] controllerInfos, TestEventName createResultEventName)[]
예제 #7
0
        private void BuildEntryPointDescription(
            IApiDocumentation apiDocumentation,
            ControllerInfo entryPointControllerInfo,
            IHttpControllerDescriptionBuilder <EntryPointDescriptionController> entryPointControllerDescriptionBuilder)
        {
            var classUri = apiDocumentation.Context.Mappings.MappingFor(typeof(IApiDocumentation)).Classes.Select(item => item.Uri).FirstOrDefault();
            var apiDocumentationClass = apiDocumentation.Context.Create <IClass>(classUri);
            var baseUri = apiDocumentation.Context.BaseUriSelector.SelectBaseUri(new EntityId(new Uri("/", UriKind.Relative)));

            foreach (OperationInfo <Verb> operation in entryPointControllerInfo.Operations)
            {
                var url = (Uri)operation.Url;
                if (operation.UrlTemplate != null)
                {
                    var template  = new UriTemplate(baseUri + operation.UrlTemplate.TrimStart('/'));
                    var variables = operation.UnderlyingMethod.GetParameters().ToDictionary(parameter => parameter.Name, parameter => (object)parameter.DefaultValue.ToString());
                    url = template.ResolveUri(variables);
                }

                var operationId        = new EntityId(url.Combine(baseUri));
                var supportedOperation = operation.AsOperation(apiDocumentation, operationId);
                supportedOperation.MediaTypes.AddRange(ApiDescriptionBuilder.RdfMediaTypes);
                supportedOperation.Label = operation.UnderlyingMethod.Name;
                supportedOperation.Method.Add(operation.ProtocolSpecificCommand.ToString());
                var returned = apiDocumentation.Context.Create <IClass>(apiDocumentation.CreateBlankId());
                returned.SubClassOf.Add(apiDocumentationClass);
                supportedOperation.Returns.Add(returned);
                apiDocumentationClass.SupportedOperations.Add(supportedOperation);
            }

            apiDocumentation.SupportedClasses.Add(apiDocumentationClass);
        }
예제 #8
0
 private void listView1_DoubleClick_1(object sender, EventArgs e)
 {
     ListViewItem item = this.listView1.SelectedItems[0]; if (item.Tag != null)
     {
         ControllerInfo controllerInfo = (ControllerInfo)item.Tag;
         if (controllerInfo.Availability == Availability.Available)
         {
             if (controllerInfo.IsVirtual)
             {
                 this.controller = ControllerFactory.CreateFrom(controllerInfo);
                 this.controller.Logon(UserInfo.DefaultUser);
                 listView1.Items.Clear();
                 listView1.Items.Add(item);
                 EnableControllerFunctionality();
             }
             else //real controller
             {
                 if (MessageBox.Show("This is NOT a virtual controller, do you really want to connect to that?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
                 {
                     this.controller = ControllerFactory.CreateFrom(controllerInfo);
                     this.controller.Logon(UserInfo.DefaultUser);
                     listView1.Items.Clear();
                     listView1.Items.Add(item);
                     EnableControllerFunctionality();
                 }
             }
         }
         else
         {
             MessageBox.Show("Selected controller not available.");
         }
     }
 }
예제 #9
0
        /// <summary>
        /// Authenticate the user and return the UserDto with a token. The token will likely be the same token passed in.
        /// <para>This is for tokens stored in the DB. Generally we are only using them for internal applications so they do not have to keep logging in.</para>
        /// </summary>
        /// <param name="ci"></param>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public async Task <UserDto> UserAuthenticateByAccessToken(ControllerInfo ci, string accessToken)
        {
            if (string.IsNullOrEmpty(accessToken))
            {
                doApiLog(ci, ApiLogType.LoginAttempt, $"Failed: missing accessToken: [CIP].");
                return(null);
            }

            var user = await _accountDalService.spUserGetByAccessToken(accessToken);

            // check if username exists
            if (user == null || user?.PasswordHash == null || user?.PasswordSalt == null)
            {
                doApiLog(ci, ApiLogType.LoginAttempt, $"Failed: invalid accessToken: {accessToken}, [CIP].");
                return(null);
            }

            // authentication successful so copy user over.
            var userDto = _mapper.Map <UserDto>(user);

            //TODO:

            doApiLog(ci, ApiLogType.LoginAttempt, $"Success: login for accessToken: {accessToken}, [CIP].");
            return(userDto);
        }
예제 #10
0
        public void Initialize(ControllerInfo controllerInfo)
        {
            _controllerInfo = controllerInfo;
            //ctrlStandardController.Initialize(controllerInfo.Keys);

            cboControllerType.SelectedIndex = (int)_controllerInfo.ControllerType;
        }
예제 #11
0
        public frmControllerConfig(ControllerInfo controllerInfo, int portNumber, ConsoleType consoleType)
        {
            InitializeComponent();

            Entity = controllerInfo;

            AddBinding("TurboSpeed", trkTurboSpeed);
            ctrlStandardController0.Initialize(controllerInfo.Keys[0]);
            ctrlStandardController1.Initialize(controllerInfo.Keys[1]);
            ctrlStandardController2.Initialize(controllerInfo.Keys[2]);
            ctrlStandardController3.Initialize(controllerInfo.Keys[3]);

            if (portNumber == 1 && consoleType == ConsoleType.Famicom)
            {
                ctrlStandardController0.ShowMicrophone = true;
                ctrlStandardController1.ShowMicrophone = true;
                ctrlStandardController2.ShowMicrophone = true;
                ctrlStandardController3.ShowMicrophone = true;
            }

            this.btnSelectPreset.Image = BaseControl.DownArrow;

            ResourceHelper.ApplyResources(this, mnuStripPreset);

            this.Text += ": " + ResourceHelper.GetMessage("PlayerNumber", (portNumber + 1).ToString());
        }
예제 #12
0
        /// <summary>
        /// Gets the ControllerInfo collection from a list of types.
        /// </summary>
        /// <param name="targetTypes">The types that contain controllers.</param>
        /// <param name="kind">The kind of controller to get infos for (Web/API)</param>
        /// <returns></returns>
        private static IEnumerable <ControllerInfo> GetControllerInfos(IEnumerable <ControllerItem> targetTypes, ControllerKind kind)
        {
            var types           = targetTypes.Where(t => t.Kind == kind).Select(t => t.Type);
            var controllerInfos = new List <ControllerInfo>(types.Count());

            foreach (var targetType in types)
            {
                var customAttributes = targetType.GetCustomAttributes(false);
                //Ignore if controller is marked with [SkipJavascriptGeneration]
                if (customAttributes.OfType <SkipJavascriptGenerationAttribute>().Any())
                {
                    continue;
                }

                var controllerInfo = new ControllerInfo
                {
                    ControllerType      = targetType,
                    Kind                = kind,
                    UseNamespace        = customAttributes.OfType <GenerateWithNamespaceAttribute>().Any(),
                    EnableClientCaching = customAttributes.OfType <EnableClientCacheAttribute>().Any()
                };
                ApiReflector.GetActionInfos(controllerInfo, kind);

                if (controllerInfo.Actions.Any())
                {
                    controllerInfos.Add(controllerInfo);
                }
            }
            return(controllerInfos);
        }
예제 #13
0
        private void UpdateAnimationNewSystem()
        {
            var variableStorage = AnimationController.Variables;

            // character speed
            if (Physics != null && Physics.CharacterProxy != null)
            {
                Vector3 localSpeedWorldRotUnfiltered = (Physics.CharacterProxy.LinearVelocity - Physics.CharacterProxy.CharacterRigidBody.GroundVelocity) / Sync.RelativeSimulationRatio;
                var     localSpeedWorldRot           = FilterLocalSpeed(localSpeedWorldRotUnfiltered);
                variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdSpeed, localSpeedWorldRot.Length());
                float localSpeedX = localSpeedWorldRot.Dot(PositionComp.WorldMatrix.Right);
                float localSpeedY = localSpeedWorldRot.Dot(PositionComp.WorldMatrix.Up);
                float localSpeedZ = localSpeedWorldRot.Dot(PositionComp.WorldMatrix.Forward);
                variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdSpeedX, localSpeedX);
                variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdSpeedY, localSpeedY);
                variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdSpeedZ, localSpeedZ);
                const float speedThreshold2 = 0.1f * 0.1f;
                float       speedangle      = localSpeedWorldRot.LengthSquared() > speedThreshold2 ? (float)(-Math.Atan2(localSpeedZ, localSpeedX) * 180.0f / Math.PI) + 90.0f : 0.0f;
                while (speedangle < 0.0f)
                {
                    speedangle += 360.0f;
                }
                variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdSpeedAngle, speedangle);

                if (ControllerInfo.IsLocallyControlled())
                {
                    m_animTurningSpeed.Value = RotationIndicator.Y * 180.0f / (float)Math.PI;
                }
                variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdTurningSpeed, m_animTurningSpeed);

                if (OxygenComponent != null)
                {
                    variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdHelmetOpen, OxygenComponent.HelmetEnabled ? 0.0f : 1.0f);
                }

                if (Parent is MyCockpit)
                {
                    variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdLean, 0);
                }
                else
                {
                    variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdLean, m_animLeaning);
                }
            }

            if (JetpackComp != null)
            {
                AnimationController.Variables.SetValue(MyAnimationVariableStorageHints.StrIdFlying, JetpackComp.Running ? 1.0f : 0.0f);
            }

            AnimationController.Variables.SetValue(MyAnimationVariableStorageHints.StrIdFalling, GetCurrentMovementState() == MyCharacterMovementEnum.Falling ? 1.0f : 0.0f);
            MyCharacterMovementEnum movementState = GetCurrentMovementState();

            variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdFlying, movementState == MyCharacterMovementEnum.Flying ? 1.0f : 0.0f);
            variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdFalling, movementState == MyCharacterMovementEnum.Falling ? 1.0f : 0.0f);
            variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdCrouch, (WantsCrouch && !WantsSprint) ? 1.0f : 0.0f);
            variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdSitting, movementState == MyCharacterMovementEnum.Sitting ? 1.0f : 0.0f);

            variableStorage.SetValue(MyAnimationVariableStorageHints.StrIdFirstPerson, m_isInFirstPerson ? 1.0f : 0.0f);
        }
예제 #14
0
        private static IHttpControllerDescriptionBuilder <TestController> SetupHttpControllerDescriptionBuilder()
        {
            IDictionary <string, Verb> verbs = new Dictionary <string, Verb>()
            {
                { "Get", Verb.GET },
                { "List", Verb.GET },
                { "Create", Verb.POST },
                { "Update", Verb.PUT },
                { "Delete", Verb.DELETE },
                { "SetRoles", Verb.POST }
            };

            var operations = typeof(TestController)
                             .GetMethods(BindingFlags.Public | BindingFlags.Instance)
                             .Where(method => method.DeclaringType != typeof(object))
                             .Except(typeof(TestController).GetProperties(BindingFlags.Public | BindingFlags.Instance).SelectMany(property => new MethodInfo[] { property.GetGetMethod(), property.GetSetMethod() }))
                             .Select(method => CreateOperation(method, verbs[method.Name]));

            ControllerInfo <TestController> controllerInfo = new ControllerInfo <TestController>(null, (HttpUrl)UrlParser.Parse("/"), operations.ToArray());
            Mock <IHttpControllerDescriptionBuilder <TestController> > descriptionBuilder = new Mock <IHttpControllerDescriptionBuilder <TestController> >(MockBehavior.Strict);

            descriptionBuilder.As <IHttpControllerDescriptionBuilder>().Setup(instance => instance.BuildDescriptor()).Returns(controllerInfo);
            descriptionBuilder.As <IHttpControllerDescriptionBuilder>().Setup(instance => instance.GetMethodVerb(It.IsAny <MethodInfo>())).Returns <MethodInfo>(method => verbs[method.Name]);
            foreach (var operation in operations)
            {
                IEnumerable <ArgumentInfo> parameterMapping = operation.Arguments;
                descriptionBuilder.As <IHttpControllerDescriptionBuilder>().Setup(instance => instance.GetOperationUrlTemplate(operation.UnderlyingMethod, out parameterMapping))
                .Returns <MethodInfo, IEnumerable <ArgumentInfo> >((method, parameters) => operation.UrlTemplate);
            }

            return(descriptionBuilder.Object);
        }
예제 #15
0
        public ControllerInfo InitializedData()
        {
            var controllerInfoChecked = new ControllerInfo();

            if (String.IsNullOrWhiteSpace(ControllerInfo.name))
            {
                controllerInfoChecked.name = "PLC";
            }
            else
            {
                controllerInfoChecked.name = ControllerInfo.name;
            }

            switch (ControllerInfo.procesorType)
            {
            case ViewModels.Enums.ControllerType.L16ER:
                controllerInfoChecked.catalogNumber = "1769-L16ER-BB1B";
                controllerInfoChecked.productCode   = "153";
                break;

            case ViewModels.Enums.ControllerType.L18ER:
                controllerInfoChecked.catalogNumber = "1769-L18ER-BB1B";
                controllerInfoChecked.productCode   = "154";
                break;

            default:
                controllerInfoChecked.catalogNumber = "1769-L18ER-BB1B";
                controllerInfoChecked.productCode   = "154";
                break;
            }

            if (String.IsNullOrWhiteSpace(ControllerInfo.majorRev))
            {
                controllerInfoChecked.majorRev = "24";
            }
            else
            {
                controllerInfoChecked.majorRev = ControllerInfo.majorRev;
            }

            if (String.IsNullOrWhiteSpace(ControllerInfo.minorRev))
            {
                controllerInfoChecked.minorRev = "11";
            }
            else
            {
                controllerInfoChecked.minorRev = ControllerInfo.minorRev;
            }

            if (String.IsNullOrWhiteSpace(ControllerInfo.description))
            {
                controllerInfoChecked.description = controllerInfoChecked.name;
            }
            else
            {
                controllerInfoChecked.description = ControllerInfo.description;
            }

            return(controllerInfoChecked);
        }
예제 #16
0
        // 声明一个私有变量 动态创建扫描接口   创建与控制器的连接
        public void DynamicCreation()
        {
            //  建立一个扫描接口的 引用变量 networkScanner
            NetworkScanner networkScanner = new NetworkScanner();

            // 扫描接口 虚拟接口还是实际接口  条件运算符
            ControllerInfo[] controllers = networkScanner.GetControllers(chooseSocket ? NetworkScannerSearchCriterias.Virtual : NetworkScannerSearchCriterias.Real);

            // 发现控制器后
            if (controllers.Length > 0)
            {
                // 确认controller 包含哪些信息
                Console.WriteLine(controllers);

                // 提取controller中的第默认序列第一的信息
                ABBControllerinfo = controllers[0];

                Console.WriteLine(ABBControllerinfo);


                // 根据控制器的信息创建一个实例   并且可以输出  其基本信息
                ABBController = ControllerFactory.CreateFrom(ABBControllerinfo);
                Console.WriteLine($"Found one ABB.System Name is:{SystemName} System ID is:{SystemID} System IP is:{SystemIP}");
                // $ 起到一个占位符的作用内容包含在 {} 中,可以用于获取{}中对应内容的信息
            }
            else
            {
                MessageBox.Show("No ABB Robot Found.");
            }
        }
        private void ListViewRobotControlers_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            //Event try connect with robot controller choosen from listView component, and if connect then informs about it on main window
            RobotController item = (RobotController)listViewRobotControlers.SelectedItem;

            if (item.Tag != null)
            {
                ControllerInfo controllerInfo = (ControllerInfo)item.Tag;
                if
                (controllerInfo.Availability == Availability.Available)
                {
                    if (this.controller != null)
                    {
                        this.controller.Logoff();
                        this.controller.Dispose();
                        this.controller = null;
                    }
                    this.controller = ControllerFactory.CreateFrom(controllerInfo);
                    this.controller.Logon(UserInfo.DefaultUser);
                    lblSelectedController.Content    = "Połączono z wybranym kontrolerem";
                    lblSelectedController.Visibility = Visibility.Visible;

                    ConnectToRobotProgram();
                }
                else
                {
                    MessageBox.Show("Selected controller not available.");
                }
            }
        }
예제 #18
0
        /// <summary>
        /// Gets all the action infos from a controller info.
        /// </summary>
        /// <param name="controllerInfo">The controller info.</param>
        /// <param name="kind">The controller kind.</param>
        private static void GetActionInfos(ControllerInfo controllerInfo, ControllerKind kind)
        {
            var actions = controllerInfo.ControllerType.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

            foreach (var action in actions)
            {
                var customAttributes = action.GetCustomAttributes(false);
                //Ignore if controller is marked with [SkipJavascriptGeneration]
                if (customAttributes.OfType <SkipJavascriptGenerationAttribute>().Any())
                {
                    continue;
                }

                //MVC Controller actions aren't generated by default.
                if (kind == ControllerKind.Mvc && !customAttributes.OfType <GenerateJavascriptAttribute>().Any())
                {
                    continue;
                }

                ActionInfo.GetHttpVerb(action);
                controllerInfo.Actions.Add(new ActionInfo
                {
                    Name                = action.Name,
                    MethodInfo          = action,
                    Controller          = controllerInfo,
                    Verb                = ActionInfo.GetHttpVerb(action),
                    EnableClientCaching = customAttributes.OfType <EnableClientCacheAttribute>().Any() || controllerInfo.EnableClientCaching
                });
            }
        }
예제 #19
0
        public ActionResult DeleteInstances(string name, string[] urls)
        {
            ControllerInfo cInfo = SiteStructure.Current.Controllers.FirstOrDefault(ci => ci.Name == name);

            cInfo.DeleteInstances(urls);
            return(Content("OK"));
        }
예제 #20
0
        public void RegisterController_DesignerController_NotRegistersAnyRoutes()
        {
            // Arrange
            var  initializer = new DummyControllerContainerInitializer();
            Type controller  = typeof(DesignerController);

            using (new ObjectFactoryContainerRegion())
            {
                ObjectFactory.Container.RegisterType <ConfigManager, ConfigManager>(typeof(XmlConfigProvider).Name.ToUpperInvariant(), new InjectionConstructor(typeof(XmlConfigProvider).Name));

                ObjectFactory.Container.RegisterType <XmlConfigProvider, DummyConfigProvider>();

                // Act
                initializer.RegisterControllerPublic(controller);
            }

            // Assert
            ControllerInfo registration = ControllerStore.Controllers().SingleOrDefault(c => c.ControllerType == controller);

            Assert.IsNotNull(registration, "DesignerController was not registered.");

            RouteBase route = RouteTable.Routes[controller.Name];

            Assert.IsNull(route, "Route was registered for the controller.");
        }
예제 #21
0
        //records controller transforms from either interaction player or behaviour poses
        static void InitializeControllers()
        {
            if (controllers == null)
            {
                controllers = new ControllerInfo[2];
            }

            if (controllers[0] == null)
            {
                controllers[0] = new ControllerInfo()
                {
                    transform = CameraRig.leftHandAnchor, isRight = false, id = 1
                };
                controllers[0].connected = OVRInput.IsControllerConnected(OVRInput.Controller.LTouch);
                controllers[0].visible   = OVRInput.GetControllerPositionTracked(OVRInput.Controller.LTouch);
            }

            if (controllers[1] == null)
            {
                controllers[1] = new ControllerInfo()
                {
                    transform = CameraRig.rightHandAnchor, isRight = true, id = 2
                };
                controllers[1].connected = OVRInput.IsControllerConnected(OVRInput.Controller.RTouch);
                controllers[1].visible   = OVRInput.GetControllerPositionTracked(OVRInput.Controller.RTouch);
            }
        }
예제 #22
0
        private void ControllerConnected(Window owner, SDL2.SDL_Event ev)
        {
            var instance    = SDL2.SDL_GameControllerOpen(ev.cdevice.which);
            var joyInstance = SDL2.SDL_GameControllerGetJoystick(instance);
            var instanceId  = SDL2.SDL_JoystickInstanceID(joyInstance);

            var playerIndex = ControllerRegistry.Instance.GetFirstFreePlayerSlot();

            SDL2.SDL_GameControllerSetPlayerIndex(instance, playerIndex);

            var name        = SDL2.SDL_GameControllerName(instance);
            var productInfo = new ProductInfo(
                SDL2.SDL_GameControllerGetVendor(instance),
                SDL2.SDL_GameControllerGetProduct(instance)
                );

            var guid = SDL2.SDL_JoystickGetGUID(joyInstance);

            var controllerInfo = new ControllerInfo(instance, instanceId, guid, playerIndex, name, productInfo);

            ControllerRegistry.Instance.Register(instance, controllerInfo);

            owner.Game.OnControllerConnected(
                new ControllerEventArgs(controllerInfo)
                );
        }
예제 #23
0
        private static void InitGamePadList(List <GamePad> gamePads)
        {
            if (gamePads == null)
            {
                throw new ArgumentNullException();
            }

            int deviceCount = 10;
            int oldCount;

            gamePads.Clear();
            ControllerInfo[] deviceBuffer;
            while (true)
            {
                oldCount     = deviceCount;
                deviceBuffer = new ControllerInfo[deviceCount];
                if (!GetControllerGuids(deviceBuffer, ref deviceCount))
                {
                    throw new Exception();
                }
                else if (oldCount >= deviceCount)
                {
                    break;
                }
            }

            for (int i = 0; i < deviceCount; i++)
            {
                var device = deviceBuffer[i];
                gamePads.Add(new GamePad(device.Guid, new string(device.DeviceName), new string(device.InstanceName)));
            }
        }
예제 #24
0
        public void RegisterController_DummyController_IsRegisteredInStore()
        {
            // Arrange
            var  initializer = new DummyControllerContainerInitializer();
            Type controller  = typeof(DummyController);

            using (new ObjectFactoryContainerRegion())
            {
                ObjectFactory.Container.RegisterType <ConfigManager, ConfigManager>(typeof(XmlConfigProvider).Name.ToUpperInvariant(), new InjectionConstructor(typeof(XmlConfigProvider).Name));
                ObjectFactory.Container.RegisterType <XmlConfigProvider, DummyConfigProvider>();
                Config.RegisterSection <ResourcesConfig>();
                Config.RegisterSection <ProjectConfig>();

                // Act
                initializer.RegisterControllerPublic(controller);

                // Assert
                var resourceRegistered = ObjectFactory.Container.IsRegistered(typeof(DummyControllerResources), Res.GetResourceClassId(typeof(DummyControllerResources)));
                Assert.IsTrue(resourceRegistered, "String resources were not registered for the controller.");
            }

            ControllerInfo registration = ControllerStore.Controllers().SingleOrDefault(c => c.ControllerType == controller);

            Assert.IsNotNull(registration, "Controller was not registered.");

            var route = RouteTable.Routes[controller.Name];

            Assert.IsNull(route, "Route was registered for the controller.");
        }
예제 #25
0
        public ActionResult RenameInstances(string name, string[] urls, string from, string to)
        {
            ControllerInfo cInfo = SiteStructure.Current.Controllers.FirstOrDefault(ci => ci.Name == name);

            cInfo.RenameInstances(urls, from, to);
            return(Content("OK"));
        }
예제 #26
0
        private void button1_Click(object sender, EventArgs e)
        {
            ListViewItem   itemview       = listView1.SelectedItems[0];
            ControllerInfo controllerinfo = (ControllerInfo)itemview.Tag;
            Controller     aController    = ControllerFactory.CreateFrom(controllerinfo);

            aController.Logon(UserInfo.DefaultUser);
            EventLog         log = aController.EventLog; //
            EventLogCategory cat;

            cat = log.GetCategory(0);
            for (int i = 0; i < 50; i++)
            {
                try
                {
                    EventLogMessage emsg = cat.Messages[i];
                    dataGridView2.Rows.Add(emsg.Title, emsg.Timestamp);
                }
                catch (IndexOutOfRangeException)
                {
                    MessageBox.Show("EventLog okuması tamamlandı.");
                    break;
                }
            }
        }
예제 #27
0
        public ControllerListItem(ControllerInfo con, EventHandler OnRemove, EventHandler OnTest, EventHandler OnSelect)
        {
            Tag    = con;
            Click += OnSelect;
            Cursor = Cursors.Hand;
            //Name Label
            Label name = new Label()
            {
                Text     = con.FriendlyName,
                Location = new Point(10, 10),
                AutoSize = true
            };

            Controls.Add(name);
            //ConfigurationClass Label
            Label ip = new Label()
            {
                Text     = "ConfigurationClass: " + con.ConfigurationClass,
                Location = new Point(10, 30),
                AutoSize = true
            };

            Controls.Add(ip);
            //Remove Button
            Button removeButton = new Button()
            {
                Text     = "Remove",
                Tag      = con,
                Location = new Point(75, 45)
            };

            removeButton.Click += OnRemove;
            Controls.Add(removeButton);
        }
        /// <summary>
        /// Returns methodInfo found by actionName and parameters
        /// <br/>
        /// Throws exception if action was not found
        /// </summary>
        /// <param name="actionName"></param>
        /// <param name="parameterInfosFromConfig"></param>
        /// <returns></returns>
        private static MethodInfo GetMethodInfo(string actionName, IEnumerable <MyParameterInfo> parameterInfosFromConfig)
        {
            var allActions = ControllerInfo.Actions(typeof(TController));

            foreach (var methodInfo in allActions)
            {
                var parameterInfos = ParameterInfosFromAction(methodInfo);

                //'All' must be preceded with a check for 0 parameterInfos,
                // since All is always true if the list is empty (memory from HM =) )
                if (!parameterInfos.Any())
                {
                    continue;
                }

                var isMatch = parameterInfos.All(param =>
                                                 parameterInfosFromConfig.Any(MatchParameterNameAndType(param)));

                if (isMatch)
                {
                    return(methodInfo);
                }
            }

            //action not found >
            var parameterNames   = parameterInfosFromConfig.Select(parameter => parameter.Name).ToArray();
            var parametersInText = string.Join(",", parameterNames);

            throw new ArgumentException(
                      $"could not find action '{actionName}' with parameters {parametersInText}, check configured rules");
        }
예제 #29
0
    public void Move(Vector3 velocity, Vector2 input, bool standingOnPlatform = false)
    {
        UpdateRaycast();
        ControllerInfo.Reset();
        ControllerInfo.VelocityOld = velocity;
        PlayerInput = input;

        if (velocity.x != 0)
        {
            ControllerInfo.Face = (int)Mathf.Sign(velocity.x);
        }

        if (velocity.y < 0)
        {
            DescendSlope(ref velocity);
        }

        HorizontalCollisions(ref velocity);
        if (velocity.y != 0)
        {
            VerticalCollisions(ref velocity);
        }

        if (standingOnPlatform)
        {
            ControllerInfo.Bot = true;
        }

        transform.Translate(velocity);
    }
예제 #30
0
        private static void ReadFile(HttpContext context, ControllerInfo controllerInfo)
        {
            string path     = controllerInfo.Path;
            string pathFile = string.Concat(Directory.GetCurrentDirectory(), "/content", path == "/" ? "/Index.html" : path);

            // System.Environment
            if (!File.Exists(pathFile))
            {
                return;
            }

            if (path.StartsWith("/css", StringComparison.OrdinalIgnoreCase))
            {
                context.Response.ContentType = "text/css";
            }
            else
            {
                context.Response.ContentType = "text/html";
            }
            using (StreamReader sr = File.OpenText(pathFile))
            {
                string htmlLine = String.Empty;
                while ((htmlLine = sr.ReadLine()) != null)
                {
                    context.Response.WriteAsync(htmlLine);
                    context.Response.WriteAsync(Environment.NewLine);
                }
            }
        }
        /// <summary>
        /// Disposes the controllers found by the scanner.
        /// </summary>
        public void Dispose()
        {
            using (LogGroup logGroup = LogGroup.Start("Disposing the controllers.", NLog.LogLevel.Debug))
            {
                ControllerInfo[] controllers = new ControllerInfo[]{};

                Dispose(ControllerState.Controllers.ToArray());
            }
        }
        /// <summary>
        /// Creates the file name for the serialized info for the provided controller.
        /// </summary>
        /// <param name="controller">The controller to create the file name for.</param>
        /// <returns>The full file name for the serialized info for the provided controller.</returns>
        public virtual string CreateInfoFileName(ControllerInfo controller)
        {
            if (controller == null)
                throw new ArgumentNullException("controller");

            if (controller.Action == null)
                throw new ArgumentNullException("controller.Action", "No action has been set to the Action property.");

            string name = controller.TypeName + "-" + controller.Action + ".controller";

            return name;
        }
예제 #33
0
    // Use this for initialization
    protected override void Start()
    {
        base.Start();

        CollisionMask = LayerMask.GetMask("Collidable");

        PlayerInput = Vector2.zero;

        ControllerInfo = new ControllerInfo {
            Face = 1
        };
    }
 public void Setup()
 {
     var descriptionBuilder = new Mock<IHttpControllerDescriptionBuilder>(MockBehavior.Strict);
     var controllerInfo = new ControllerInfo<TestController>(
         null,
         EntryPoint,
         typeof(TestController).GetMethod("List").ToOperationInfo(EntryPoint.ToString(), Verb.GET),
         typeof(TestController).GetMethod("Get").ToOperationInfo(EntryPoint.ToString(), Verb.GET),
         typeof(TestController).GetMethod("Create").ToOperationInfo(EntryPoint.ToString(), Verb.GET),
         typeof(TestController).GetMethod("Update").ToOperationInfo(EntryPoint.ToString(), Verb.GET),
         typeof(TestController).GetMethod("Delete").ToOperationInfo(EntryPoint.ToString(), Verb.GET));
     descriptionBuilder.Setup(instance => instance.BuildDescriptor()).Returns(controllerInfo);
     _selector = new OwningResourceNamedGraphSelector(new[] { descriptionBuilder.Object });
 }
        /// <summary>
        /// Disposes the provided controllers.
        /// </summary>
        public void Dispose(ControllerInfo[] controllers)
        {
            using (LogGroup logGroup = LogGroup.Start("Disposing the controllers.", NLog.LogLevel.Debug))
            {
                foreach (ControllerInfo controller in controllers)
                {
                    ControllerState.Controllers.Remove(
                        ControllerState.Controllers[controller.Key]
                    );
                }

                DeleteInfo();
            }
        }
예제 #36
0
 public void Setup()
 {
     var method = typeof(TestController).GetMethod("Add");
     _controller = new TestController();
     _operation = new OperationInfo<Verb>(
         method,
         (HttpUrl)UrlParser.Parse("/add"),
         "/api/test/add?{?operandA}&{?operandB}",
         new Regex(".*"),
         Verb.GET,
         method.GetParameters().Select(parameter => (ValueInfo)new ArgumentInfo(parameter, FromQueryStringAttribute.For(parameter), "add?{?" + parameter.Name + "}", parameter.Name)).ToArray());
     var controllerInfo = new ControllerInfo<TestController>(null, (HttpUrl)UrlParser.Parse("api/test"), _operation);
     Mock<IHttpControllerDescriptionBuilder> controllerDescriptionBuilder = new Mock<IHttpControllerDescriptionBuilder>(MockBehavior.Strict);
     controllerDescriptionBuilder.Setup(instance => instance.BuildDescriptor()).Returns(controllerInfo);
     Mock<IControllerActivator> controllerActivator = new Mock<IControllerActivator>(MockBehavior.Strict);
     controllerActivator.Setup(instance => instance.CreateInstance(It.IsAny<Type>(), It.IsAny<IDictionary<string, object>>())).Returns(_controller);
     _delegateMapper = new DelegateMapper(new[] { controllerDescriptionBuilder.Object }, controllerActivator.Object);
 }
예제 #37
0
        /// <summary>
        /// Saves the provided controllers info to file.
        /// </summary>
        /// <param name="controllers">An array of the controllers to save to file.</param>
        public void SaveInfoToFile(ControllerInfo[] controllers)
        {
            // Logging disabled to boost performance
            //using (LogGroup logGroup = LogGroup.StartDebug("Saving the provided controllers to XML file."))
            //{
            string path = FileNamer.ControllersInfoFilePath;

            //LogWriter.Debug("Path : " + path);

            if (!Directory.Exists(Path.GetDirectoryName(path)))
                Directory.CreateDirectory(Path.GetDirectoryName(path));

            using (StreamWriter writer = File.CreateText(path))
            {
                XmlSerializer serializer = new XmlSerializer(controllers.GetType());
                serializer.Serialize(writer, controllers);
                writer.Close();
            }
            //}
        }
        // TODO: Remove if not needed
        /*[Test]
        public void ExtractControllerInfo_OneAction()
        {
            string mockFileName = "User-Create.aspx";

            ControllerScanner scanner = new ControllerScanner();

            ControllerInfo[] infos = scanner.ExtractControllerInfo(mockFileName);

            Assert.AreEqual(1, infos.Length, "Invalid number of controllers found.");
        }

        [Test]
        public void ExtractControllerInfo_TwoActions()
        {
            string mockFileName = "User-Create-Edit.aspx";

            ControllerScanner scanner = new ControllerScanner();

            ControllerInfo[] infos = scanner.ExtractControllerInfo(mockFileName);

            Assert.AreEqual(2, infos.Length, "Invalid number of controllers found.");
        }*/
        /// <summary>
        /// Creates mock controllers that can be used during testing.
        /// </summary>
        public void CreateMockControllers(ControllerFileNamer namer)
        {
            throw new NotImplementedException();

            ControllerInfo info1 = new ControllerInfo();
            info1.Action = "Create";
            info1.TypeName = "User";
            info1.ControllerType = "Test";

            /*string controller1Path = namer.CreateInfoFilePath(info1);

            if (!Directory.Exists(Path.GetDirectoryName(controller1Path)))
                Directory.CreateDirectory(Path.GetDirectoryName(controller1Path));

            using (StreamWriter writer = File.CreateText(controller1Path))
            {
                writer.Write("[mock content]");
                writer.Close();
            }*/
        }
        /// <summary>
        /// Initializes the controllers and loads all controllers to state.
        /// </summary>
        /// <param name="includeTestControllers"></param>
        public void Initialize(bool includeTestControllers)
        {
            using (LogGroup logGroup = LogGroup.StartDebug("Initializing the web controllers."))
            {
                if (StateAccess.IsInitialized)
                {
                    if (!ControllerState.IsInitialized)
                    {
                        ControllerInfo[] controllers = new ControllerInfo[]{};
                        if (IsCached)
                        {
                            LogWriter.Debug("Is cached. Loading from XML.");

                            controllers = LoadControllers();
                        }
                        else
                        {
                            LogWriter.Debug("Is not cached. Scanning from type attributes.");

                            controllers = FindControllers(includeTestControllers);
                            Saver.SaveInfoToFile(controllers);
                        }

                        Initialize(controllers);
                    }
                    else
                        LogWriter.Debug("Already initialized.");
                }
                else
                    LogWriter.Debug("State is not initialized. Skipping.");
            }
        }
예제 #40
0
        void SendInput(ControllerInfo info, string inputName, float value)
        {
            IInputListener[] listeners = info.GetListeners();

            for (int i = 0; i < listeners.Length; i++)
                listeners[i].OnAxisInput(new AxisInput(info.Name, inputName, value));
        }
예제 #41
0
        /// <summary>
        /// Finds all the controllers in the available assemblies.
        /// </summary>
        /// <param name="includeTestControllers"></param>
        /// <returns>An array of info about the controllers found.</returns>
        public override ControllerInfo[] FindControllers(bool includeTestControllers)
        {
            List<ControllerInfo> controllers = new List<ControllerInfo>();

            //using (LogGroup logGroup = LogGroup.Start("Finding controllers by scanning the attributes of the available type.", NLog.LogLevel.Debug))
            //{
            foreach (string assemblyPath in AssemblyPaths)
            {
                Assembly assembly = Assembly.LoadFrom(assemblyPath);

                if (ContainsControllers(assembly, includeTestControllers))
                {
                    try
                    {
                        foreach (Type type in assembly.GetTypes())
                        {
                            if  (IsController(type))
                            {
                                //LogWriter.Debug("Found controller type: " + type.ToString());

                                ControllerInfo controllerInfo = new ControllerInfo(type);

                                if (controllerInfo.TypeName != null && controllerInfo.TypeName != String.Empty
                                    && controllerInfo.Action != null && controllerInfo.Action != String.Empty)
                                {
                                    //LogWriter.Debug("Found match.");

                                    controllers.Add(controllerInfo);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        LogWriter.Error("Error occurred while trying to scan for controllers.");

                        LogWriter.Error(ex);
                    }
                }
            }
            //}

            return controllers.ToArray();
        }
 public void Setup()
 {
     HttpUrl requestUrl = (HttpUrl)UrlParser.Parse("/test");
     var classMapping = new Mock<IClassMapping>(MockBehavior.Strict);
     classMapping.SetupGet(instance => instance.Uri).Returns(EntityConverter.Hydra.AddFragment("ApiDocumentation"));
     var mapping = new Mock<IEntityMapping>(MockBehavior.Strict);
     mapping.SetupGet(instance => instance.Classes).Returns(new[] { classMapping.Object });
     var mappings = new Mock<IMappingsRepository>(MockBehavior.Strict);
     mappings.Setup(instance => instance.MappingFor(typeof(IApiDocumentation))).Returns(mapping.Object);
     var classEntity = new Mock<IClass>(MockBehavior.Strict);
     var baseUriSelector = new Mock<IBaseUriSelectionPolicy>(MockBehavior.Strict);
     baseUriSelector.Setup(instance => instance.SelectBaseUri(It.IsAny<EntityId>())).Returns(new Uri("http://temp.uri/"));
     var context = new Mock<IEntityContext>(MockBehavior.Strict);
     context.SetupGet(instance => instance.BaseUriSelector).Returns(baseUriSelector.Object);
     context.SetupGet(instance => instance.Mappings).Returns(mappings.Object);
     context.Setup(instance => instance.Create<IClass>(It.IsAny<EntityId>())).Returns(classEntity.Object);
     _apiDocumentation = new Mock<IApiDocumentation>(MockBehavior.Strict);
     _apiDocumentation.SetupGet(instance => instance.Context).Returns(context.Object);
     _apiDocumentation.SetupGet(instance => instance.SupportedClasses).Returns(new List<IClass>());
     _irrelevantApiDescriptionBuilder = new Mock<IApiDescriptionBuilder>(MockBehavior.Strict);
     _apiDescriptionBuilder = new Mock<IApiDescriptionBuilder<TestController>>(MockBehavior.Strict);
     _apiDescriptionBuilder.Setup(instance => instance.BuildDescription(_apiDocumentation.Object, null));
     _apiDescriptionBuilderFactory = new Mock<IApiDescriptionBuilderFactory>(MockBehavior.Strict);
     _apiDescriptionBuilderFactory.Setup(instance => instance.Create(It.Is<Type>(type => type == typeof(TestController)))).Returns(_apiDescriptionBuilder.Object);
     string callUri;
     var controllerDescription = new ControllerInfo<TestController>(
         EntryPoint,
         requestUrl.InsertSegments(0, ((HttpUrl)EntryPoint.Url).Segments),
         typeof(TestController).GetMethod("Add").ToOperationInfo(requestUrl.InsertSegments(0, ((HttpUrl)EntryPoint.Url).Segments).ToString(), Verb.GET, out callUri));
     _irrelevantControllerDescriptionBuilder = new Mock<IHttpControllerDescriptionBuilder>(MockBehavior.Strict);
     _controllerDescriptionBuilder = new Mock<IHttpControllerDescriptionBuilder<TestController>>(MockBehavior.Strict);
     _controllerDescriptionBuilder.As<IHttpControllerDescriptionBuilder>().Setup(instance => instance.BuildDescriptor()).Returns(controllerDescription);
     var entryPointControllerDescription = new ControllerInfo<EntryPointDescriptionController>(null, UrlParser.Parse("/test"));
     _entryPointControllerDescriptionBuilder = new Mock<IHttpControllerDescriptionBuilder<EntryPointDescriptionController>>(MockBehavior.Strict);
     _entryPointControllerDescriptionBuilder.As<IHttpControllerDescriptionBuilder>().Setup(instance => instance.BuildDescriptor()).Returns(entryPointControllerDescription);
     _descriptionBuilder = new ApiEntryPointDescriptionBuilder(
         _apiDescriptionBuilderFactory.Object,
         new[] { _controllerDescriptionBuilder.Object, _irrelevantControllerDescriptionBuilder.Object, _entryPointControllerDescriptionBuilder.Object });
     _descriptionBuilder.EntryPoint = EntryPoint;
 }
예제 #43
0
 public void Setup()
 {
     var method = typeof(TestController).GetMethod("Add");
     var baseUri = (HttpUrl)UrlParser.Parse("/api/test/");
     var operationUri = ((HttpUrl)UrlParser.Parse("/add")).InsertSegments(0, baseUri.Segments);
     var operation = new OperationInfo<Verb>(
         method,
         operationUri,
         operationUri + "?operandA={?operandA}&operandB={?operandB}",
         new Regex(operationUri.ToString(), RegexOptions.IgnoreCase),
         Verb.GET,
         new ArgumentInfo(method.GetParameters()[0], FromQueryStringAttribute.For(method.GetParameters()[0]), "&operandA={?operandA}", "operandA"),
         new ArgumentInfo(method.GetParameters()[1], FromQueryStringAttribute.For(method.GetParameters()[1]), "&operandB={?operandB}", "operandB"));
     var description = new ControllerInfo<TestController>(null, (HttpUrl)UrlParser.Parse("/api/test/"), operation);
     Mock<IHttpControllerDescriptionBuilder<TestController>> builder = new Mock<IHttpControllerDescriptionBuilder<TestController>>();
     builder.As<IControllerDescriptionBuilder>().Setup(instance => instance.BuildDescriptor()).Returns(description);
     Mock<IControllerActivator> activator = new Mock<IControllerActivator>();
     activator.Setup(instance => instance.CreateInstance(It.IsAny<Type>(), It.IsAny<IDictionary<string, object>>())).Returns(new TestController());
     _mapper = new DelegateMapper(new IHttpControllerDescriptionBuilder[] { builder.Object }, activator.Object);
 }
 /// <summary>
 /// Initializes the controllers and loads all controllers to state.
 /// </summary>
 /// <param name="controllers">The controllers to initialize.</param>
 public void Initialize(ControllerInfo[] controllers)
 {
     ControllerState.Controllers = new ControllerStateCollection(controllers);
 }
예제 #45
0
 public void SimulateAxisInput(ControllerInfo info, string inputName, float value)
 {
     SendInput(info, inputName, value);
 }
        private void BuildEntryPointDescription(
            IApiDocumentation apiDocumentation,
            ControllerInfo entryPointControllerInfo,
            IHttpControllerDescriptionBuilder<EntryPointDescriptionController> entryPointControllerDescriptionBuilder)
        {
            var classUri = apiDocumentation.Context.Mappings.MappingFor(typeof(IApiDocumentation)).Classes.Select(item => item.Uri).FirstOrDefault();
            var apiDocumentationClass = apiDocumentation.Context.Create<IClass>(classUri);
            var baseUri = apiDocumentation.Context.BaseUriSelector.SelectBaseUri(new EntityId(new Uri("/", UriKind.Relative)));
            foreach (OperationInfo<Verb> operation in entryPointControllerInfo.Operations)
            {
                var url = (Uri)operation.Url;
                if (operation.UrlTemplate != null)
                {
                    var template = new UriTemplate(baseUri + operation.UrlTemplate.TrimStart('/'));
                    var variables = operation.UnderlyingMethod.GetParameters().ToDictionary(parameter => parameter.Name, parameter => (object)parameter.DefaultValue.ToString());
                    url = template.ResolveUri(variables);
                }

                var operationId = new EntityId(url.Combine(baseUri));
                var supportedOperation = operation.AsOperation(apiDocumentation, operationId);
                supportedOperation.MediaTypes.AddRange(ApiDescriptionBuilder.RdfMediaTypes);
                supportedOperation.Label = operation.UnderlyingMethod.Name;
                supportedOperation.Method.Add(operation.ProtocolSpecificCommand.ToString());
                var returned = apiDocumentation.Context.Create<IClass>(apiDocumentation.CreateBlankId());
                returned.SubClassOf.Add(apiDocumentationClass);
                supportedOperation.Returns.Add(returned);
                apiDocumentationClass.SupportedOperations.Add(supportedOperation);
            }

            apiDocumentation.SupportedClasses.Add(apiDocumentationClass);
        }
예제 #47
0
 public void SimulateButtonInput(ControllerInfo info, string inputName, ButtonStates state)
 {
     SendInput(info, inputName, state);
 }
예제 #48
0
        void SendInput(ControllerInfo info, string inputName, ButtonStates state)
        {
            IInputListener[] listeners = info.GetListeners();

            for (int i = 0; i < listeners.Length; i++)
                listeners[i].OnButtonInput(new ButtonInput(info.Name, inputName, state));
        }
예제 #49
0
 public void CopyListeners(ControllerInfo info)
 {
     SetListeners(info.GetListeners());
 }
예제 #50
0
        public void SwitchListeners(ControllerInfo info)
        {
            IInputListener[] otherListeners = info.GetListeners();

            info.SetListeners(GetListeners());
            SetListeners(otherListeners);
        }
예제 #51
0
 void SendInput(ControllerInfo info, string inputName, float value)
 {
     foreach (IInputListener listener in info.GetListeners()) {
         listener.OnAxisInput(new AxisInput(info.Name, inputName, value));
     }
 }
예제 #52
0
 void SendInput(ControllerInfo info, string inputName, ButtonStates state)
 {
     foreach (IInputListener listener in info.GetListeners()) {
         listener.OnButtonInput(new ButtonInput(info.Name, inputName, state));
     }
 }