DS4Windows.X360Device.Open C# (CSharp) 메소드

Open() 공개 메소드

public Open ( String DevicePath ) : System.Boolean
DevicePath String
리턴 System.Boolean
        public override Boolean Open(String DevicePath)
        {
            m_Path = DevicePath;
            m_WinUsbHandle = (IntPtr)INVALID_HANDLE_VALUE;

            if (GetDeviceHandle(m_Path))
            {
                m_IsActive = true;
            }

            return true;
        }

Usage Example

예제 #1
0
 public bool Start(bool showlog = true)
 {
     if (x360Bus.Open() && x360Bus.Start())
     {
         if (showlog)
         {
             LogDebug(Properties.Resources.Starting);
         }
         DS4Devices.isExclusiveMode = UseExclusiveMode;
         if (showlog)
         {
             LogDebug(Properties.Resources.SearchingController);
             LogDebug(DS4Devices.isExclusiveMode ?  Properties.Resources.UsingExclusive: Properties.Resources.UsingShared);
         }
         try
         {
             DS4Devices.findControllers();
             IEnumerable <DS4Device> devices = DS4Devices.getDS4Controllers();
             int ind = 0;
             DS4LightBar.defualtLight = false;
             foreach (DS4Device device in devices)
             {
                 if (showlog)
                 {
                     LogDebug(Properties.Resources.FoundController + device.MacAddress + " (" + device.ConnectionType + ")");
                 }
                 WarnExclusiveModeFailure(device);
                 DS4Controllers[ind]  = device;
                 device.Removal      -= DS4Devices.On_Removal;
                 device.Removal      += this.On_DS4Removal;
                 device.Removal      += DS4Devices.On_Removal;
                 touchPad[ind]        = new Mouse(ind, device);
                 device.LightBarColor = MainColor[ind];
                 if (!DinputOnly[ind])
                 {
                     x360Bus.Plugin(ind);
                 }
                 device.Report += this.On_Report;
                 TouchPadOn(ind, device);
                 //string filename = ProfilePath[ind];
                 ind++;
                 if (showlog)
                 {
                     if (System.IO.File.Exists(appdatapath + "\\Profiles\\" + ProfilePath[ind - 1] + ".xml"))
                     {
                         string prolog = Properties.Resources.UsingProfile.Replace("*number*", ind.ToString()).Replace("*Profile name*", ProfilePath[ind - 1]);
                         LogDebug(prolog);
                         Log.LogToTray(prolog);
                     }
                     else
                     {
                         string prolog = Properties.Resources.NotUsingProfile.Replace("*number*", (ind).ToString());
                         LogDebug(prolog);
                         Log.LogToTray(prolog);
                     }
                 }
                 if (ind >= 4) // out of Xinput devices!
                 {
                     break;
                 }
             }
         }
         catch (Exception e)
         {
             LogDebug(e.Message);
             Log.LogToTray(e.Message);
         }
         running = true;
     }
     return(true);
 }
All Usage Examples Of DS4Windows.X360Device::Open