コード例 #1
0
ファイル: AccelGUI.cs プロジェクト: jev0n/rawaccel
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args        = ApplyOptions.GetArgs(),
                minimumTime = driverSettings.minimumTime
            };

            WriteButtonDelay();
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                RefreshToggleStateFromNewSettings();
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                throw new Exception($"Bad arguments: \n {SettingsManager.ErrorStringFrom(errors)}");
            }
        }
コード例 #2
0
        public static ICapabilityProvider Provider(DriverSettings driverSettings)
        {
            switch (driverSettings.HubType.EnumValue)
            {
            case HubType.BrowserStack:
            {
                return(new BrowserStackCapabilityProvider(driverSettings));
            }

            case HubType.SauceLabs:
            {
                return(new SauceLabsCapabilityProvider(driverSettings));
            }

            case HubType.CrossBrowserTesting:
            {
                return(new CrossBrowserTestingCapabilityProvider(driverSettings));
            }

            case HubType.Internal:
            {
                return(new InternalCapabilityProvider(driverSettings));
            }

            case HubType.None:
            {
                return(null);
            }

            default:
                throw new InvalidEnumArgumentException(
                          $"Accepted values are: {string.Join(", ", driverSettings.HubType.PermittedValues.ToArray())}");
            }
        }
コード例 #3
0
ファイル: AccelGUI.cs プロジェクト: termhn/rawaccel
 public void UpdateGraph(DriverSettings args)
 {
     AccelCharts.Calculate(
         Settings.ActiveAccel,
         args);
     AccelCharts.Bind();
 }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of BrowseViewModel class.
        /// </summary>
        public BrowseViewModel(ProgramEditor commandHistory, ProgramEditor commandInput)
        {
            DeclareCommands();

            this.commandInput            = commandInput;
            commandInput.PreviewKeyDown += commandInput_PreviewKeyDown;
            commandInput.TextChanged    += commandInput_TextChanged;

            this.commandHistory = commandHistory;
            commandHistory.PreviewMouseWheel += commandHistory_PreviewMouseWheel;

            MessageList = new MessageList();
            Settings    = DriverSettings.CreateDefaultSettings();

            //this should be removed later on
            manipulator    = new E3JManipulator(DriverSettings.CreateDefaultSettings());
            programService = new ProgramService(manipulator);

            RemotePrograms = new ObservableCollection <RemoteProgram>(new List <RemoteProgram>())
            {
                new RemoteProgram("Pierwszy", 2567, "10-03-15 11:12:56"),
                new RemoteProgram("Wtorek", 1200, "08-06-17 09:34:43"),
                new RemoteProgram("Asd", 45, "17-11-24 04:32:23"),
                new RemoteProgram("qwerty", 52789, "29-09-32 18:14:32")
            };
        }
コード例 #5
0
        private static RemoteWebDriver StartOperaDriver(DriverSettings settings)
        {
            var options = new OperaOptions();

            settings.Capabilities?.ForEach(cap => options.AddAdditionalCapability(cap.Key, cap.Value));
            if (!string.IsNullOrEmpty(settings.BrowserBinaryPath))
            {
                options.BinaryLocation = settings.BrowserBinaryPath;
            }
            if (!string.IsNullOrEmpty(settings.Proxy))
            {
                options.Proxy = new Proxy {
                    HttpProxy = settings.Proxy
                }
            }
            ;
            if (settings.BrowserBinaryPath != null)
            {
                options.BinaryLocation = settings.BrowserBinaryPath;
            }
            if (settings.CmdArgs != null)
            {
                options.AddArguments(settings.CmdArgs);
            }
            if (settings.Extensions != null)
            {
                options.AddExtensions(settings.Extensions);
            }
            return(new OperaDriver(options));
        }
コード例 #6
0
        public ChartState DetermineState(DriverSettings settings)
        {
            ChartState chartState;

            if (settings.combineMagnitudes)
            {
                if (settings.sensitivity.x != settings.sensitivity.y ||
                    settings.domainArgs.domainXY.x != settings.domainArgs.domainXY.y ||
                    settings.rangeXY.x != settings.rangeXY.y)
                {
                    chartState = XYOneGraphState;
                }
                else
                {
                    chartState = CombinedState;
                }
            }
            else
            {
                chartState = XYTwoGraphState;
            }

            chartState.Settings = settings;
            return(chartState);
        }
コード例 #7
0
        private static RemoteWebDriver StartFirefoxDriver(DriverSettings settings)
        {
            var profile = new FirefoxProfile(null, true);

            if (!string.IsNullOrEmpty(settings.Proxy))
            {
                profile.SetProxyPreferences(new Proxy {
                    HttpProxy = settings.Proxy
                });
            }
            settings.Extensions?.ForEach(ext => profile.AddExtension(ext.RelativeToBaseDirectory()));
            var options = new FirefoxOptions {
                Profile = profile, UseLegacyImplementation = false
            };

            settings.Capabilities?.ForEach(cap => options.AddAdditionalCapability(cap.Key, cap.Value));
            if (!string.IsNullOrEmpty(settings.BrowserBinaryPath))
            {
                options.BrowserExecutableLocation = settings.BrowserBinaryPath;
            }
            if (settings.CmdArgs != null)
            {
                options.AddArguments(settings.CmdArgs);
            }
            settings.ProfilePrefs?.ForEach(pref => options.SetPreference(pref.Key, (dynamic)pref.Value));
            return(new FirefoxDriver(options));
        }
コード例 #8
0
 public RawAccelSettings(
     DriverSettings accelSettings,
     GUISettings guiSettings)
 {
     AccelerationSettings = accelSettings;
     GUISettings          = guiSettings;
 }
コード例 #9
0
        private static RemoteWebDriver StartEdgeDriver(DriverSettings settings)
        {
            var options = new EdgeOptions();

            settings.Capabilities?.ForEach(cap => options.AddAdditionalCapability(cap.Key, cap.Value));
            return(new EdgeDriver(options));
        }
コード例 #10
0
ファイル: AccelGUI.cs プロジェクト: termhn/rawaccel
        public AccelGUI(
            RawAcceleration accelForm,
            AccelCalculator accelCalculator,
            AccelCharts accelCharts,
            SettingsManager settings,
            ApplyOptions applyOptions,
            Button writeButton,
            ButtonBase toggleButton,
            MouseWatcher mouseWatcher,
            ToolStripMenuItem scaleMenuItem)
        {
            AccelForm         = accelForm;
            AccelCalculator   = accelCalculator;
            AccelCharts       = accelCharts;
            ApplyOptions      = applyOptions;
            WriteButton       = writeButton;
            ToggleButton      = (CheckBox)toggleButton;
            ScaleMenuItem     = scaleMenuItem;
            Settings          = settings;
            DefaultButtonFont = WriteButton.Font;
            SmallButtonFont   = new Font(WriteButton.Font.Name, WriteButton.Font.Size * Constants.SmallButtonSizeFactor);
            MouseWatcher      = mouseWatcher;

            ScaleMenuItem.Click   += new System.EventHandler(OnScaleMenuItemClick);
            WriteButton.Click     += new System.EventHandler(OnWriteButtonClick);
            ToggleButton.Click    += new System.EventHandler(OnToggleButtonClick);
            AccelForm.FormClosing += new FormClosingEventHandler(SaveGUISettingsOnClose);

            ButtonTimerInterval = Convert.ToInt32(DriverInterop.WriteDelayMs);
            ButtonTimer         = new Timer();
            ButtonTimer.Tick   += new System.EventHandler(OnButtonTimerTick);

            ChartRefresh = SetupChartTimer();

            bool settingsActive = Settings.Startup();

            SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent();

            if (settingsActive)
            {
                LastToggleChecked    = SettingsNotDefault;
                ToggleButton.Enabled = LastToggleChecked;
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                DriverSettings active           = DriverInterop.GetActiveSettings();
                bool           activeNotDefault = !RawAccelSettings.IsDefaultEquivalent(active);

                LastToggleChecked    = activeNotDefault;
                ToggleButton.Enabled = SettingsNotDefault || activeNotDefault;
                RefreshOnRead(active);
            }

            SetupButtons();
            AccelForm.DoResize();
        }
コード例 #11
0
        public SauceLabsCapabilityProvider(DriverSettings driverSettings) : base(driverSettings)
        {
            BrowserDefaults(driverSettings.Browser.EnumValue);

            // if the version is set to latest or *, do nothing
            if (driverSettings.BrowserVersion != "Latest" && driverSettings.BrowserVersion != "*")
            {
                // set the version of the browser to use, such as Chrome 36
                Capabilities.SetCapability("version", driverSettings.BrowserVersion);
            }

            switch (driverSettings.Platform.EnumValue)
            {
            case Platform.Mac:
            {
                Capabilities.SetCapability("platform", $"OS X {driverSettings.PlatformVersion}");
                break;
            }

            case Platform.Windows:
            {
                Capabilities.SetCapability("platform", $"Windows {driverSettings.PlatformVersion}");
                break;
            }

            case Platform.Linux:
            {
                Capabilities.SetCapability("platform", $"Linux {driverSettings.PlatformVersion}");
                break;
            }

            case Platform.iOS:
            {
                Capabilities.SetCapability("appiumVersion", "1.4.10");
                Capabilities.SetCapability("platformName", driverSettings.Platform.EnumValue);
                Capabilities.SetCapability("platformVersion", driverSettings.PlatformVersion);
                Capabilities.SetCapability("browserName", "");
                Capabilities.SetCapability("deviceName", "iPhone Simulator");
                Capabilities.SetCapability("device-orientation", "portrait");
                break;
            }

            case Platform.Android:
            {
                Capabilities.SetCapability("platform", PlatformType.Android);
                Capabilities.SetCapability("platformName", driverSettings.Platform.EnumValue);
                Capabilities.SetCapability("platformVersion", driverSettings.PlatformVersion);
                Capabilities.SetCapability("browserName", "");
                break;
            }
                //case Platform.Unspecified:
                //    {
                //        return;
                //    }
            }
        }
コード例 #12
0
        public static SettingsErrors SendToDriverSafe(DriverSettings settings)
        {
            var errors = DriverInterop.GetSettingsErrors(settings);

            if (errors.Empty())
            {
                SendToDriver(settings);
            }
            return(errors);
        }
コード例 #13
0
        public SettingsErrors TryUpdateAccel(DriverSettings settings)
        {
            var errors = SendToDriverSafe(settings);

            if (errors.Empty())
            {
                ActiveAccel.UpdateFromSettings(settings);
            }
            return(errors);
        }
コード例 #14
0
        public static bool IsDefaultEquivalent(DriverSettings accelSettings)
        {
            bool wholeOrNoY = accelSettings.combineMagnitudes ||
                              accelSettings.modes.y == AccelMode.noaccel;

            return(accelSettings.sensitivity.x == 1 &&
                   accelSettings.sensitivity.y == 1 &&
                   accelSettings.rotation == 0 &&
                   accelSettings.modes.x == AccelMode.noaccel &&
                   wholeOrNoY);
        }
コード例 #15
0
        public InternalCapabilityProvider(DriverSettings driverSettings) : base(driverSettings)
        {
            BrowserDefaults(driverSettings.Browser.EnumValue);

            // if the version is set to latest or *, do nothing
            if (driverSettings.BrowserVersion != "Latest" && driverSettings.BrowserVersion != "*")
            {
                _targetBrowserVersion = driverSettings.BrowserVersion;
            }

            _platform = driverSettings.Platform.EnumValue;

            switch (_platform)
            {
            case Platform.Mac:
            {
                Capabilities.Platform = new OpenQA.Selenium.Platform(PlatformType.Mac);
                break;
            }

            case Platform.Windows:
            {
                Capabilities.Platform = new OpenQA.Selenium.Platform(PlatformType.Windows);
                break;
            }

            case Platform.Linux:
            {
                Capabilities.Platform = new OpenQA.Selenium.Platform(PlatformType.Linux);
                break;
            }

            case Platform.iOS:
            {
                Capabilities.SetCapability("platformVersion", driverSettings.PlatformVersion);
                Capabilities.SetCapability("platformName", driverSettings.Platform.EnumValue);
                break;
            }

            case Platform.Android:
            {
                Capabilities.Platform = new OpenQA.Selenium.Platform(PlatformType.Android);
                Capabilities.SetCapability("platformVersion", driverSettings.PlatformVersion);
                Capabilities.SetCapability("platformName", driverSettings.Platform.EnumValue);
                break;
            }
            }

            // if the version is set to latest or *, do nothing
            if (driverSettings.PlatformVersion != "Latest" && driverSettings.PlatformVersion != "*")
            {
                _targetPlatformVersion = driverSettings.PlatformVersion;
            }
        }
コード例 #16
0
        private static RemoteWebDriver StartIeDriver(DriverSettings settings)
        {
            var options = new InternetExplorerOptions();

            settings.Capabilities?.ForEach(cap => options.AddAdditionalCapability(cap.Key, cap.Value));
            if (settings.CmdArgs != null)
            {
                options.BrowserCommandLineArguments = string.Join(" ", settings.CmdArgs);
            }
            return(new InternetExplorerDriver(options));
        }
コード例 #17
0
        public void RefreshOnRead(DriverSettings args)
        {
            UpdateShownActiveValues(args);
            UpdateGraph(args);

            UpdateInputManagers = () =>
            {
                MouseWatcher.UpdateHandles(args.deviceID);
                DeviceIDManager.Update(args.deviceID);
            };

            UpdateInputManagers();
        }
コード例 #18
0
        public SettingsErrors TryUpdateActiveSettings(DriverSettings settings)
        {
            var errors = TryUpdateAccel(settings);

            if (errors.Empty())
            {
                RawAccelSettings.AccelerationSettings = settings;
                RawAccelSettings.GUISettings          = MakeGUISettingsFromFields();
                RawAccelSettings.Save();
            }

            return(errors);
        }
コード例 #19
0
ファイル: Form1.cs プロジェクト: m4te0/Roboty
 public Form1()
 {
     InitializeComponent();
     foreach (var port in SerialPort.GetPortNames())
     {
         comboBoxPorts.Items.Add(port);
     }
     manipulator = File.Exists("SerialSettings.json") ?
                   new E3JManipulator(DriverSettings.CreateFromSettingFile()) :
                   new E3JManipulator(DriverSettings.CreateDefaultSettings());
     manipulator.Port.DataReceived            += Port_DataReceived;
     manipulator.Port.ConnectionStatusChanged += Port_ConnectionStatusChanged;
 }
コード例 #20
0
        private static RemoteWebDriver StartChromeDriver(DriverSettings settings, MobileSettings mobile)
        {
            var options = new ChromeOptions();

            settings.Capabilities?.ForEach(cap => options.AddAdditionalCapability(cap.Key, cap.Value));
            if (!string.IsNullOrEmpty(settings.BrowserBinaryPath))
            {
                options.BinaryLocation = settings.BrowserBinaryPath;
            }
            if (!string.IsNullOrEmpty(settings.Proxy))
            {
                options.Proxy = new Proxy {
                    HttpProxy = settings.Proxy
                }
            }
            ;
            if (settings.BrowserBinaryPath != null)
            {
                options.BinaryLocation = settings.BrowserBinaryPath;
            }
            if (settings.CmdArgs != null)
            {
                options.AddArguments(settings.CmdArgs);
            }
            if (settings.Extensions != null)
            {
                options.AddExtensions(settings.Extensions.Select(ext => ext.RelativeToBaseDirectory()));
            }
            settings.ProfilePrefs?.ForEach(pref => options.AddUserProfilePreference(pref.Key, pref.Value));
            if (mobile != null && mobile.Enable)
            {
                if (!string.IsNullOrEmpty(mobile.DeviceName))
                {
                    options.EnableMobileEmulation(mobile.DeviceName);
                }
                else
                {
                    var deviceSettings = new ChromeMobileEmulationDeviceSettings
                    {
                        EnableTouchEvents = mobile.EnableTouchEvents,
                        Width             = mobile.Width,
                        Height            = mobile.Height,
                        PixelRatio        = mobile.PixelRatio
                    };
                    options.EnableMobileEmulation(deviceSettings);
                }
            }
            return(new ChromeDriver(options));
        }
コード例 #21
0
        public static RemoteWebDriver StartNewDriver(DriverSettings settings, MobileSettings mobile)
        {
            switch (settings.Browser)
            {
            case Browser.Chrome:   return(StartChromeDriver(settings, mobile));

            case Browser.Firefox:  return(StartFirefoxDriver(settings));

            //case Browser.Opera:    return StartOperaDriver(settings);
            //case Browser.Safari:   return StartSafariDriver(settings);
            //case Browser.IE:       return StartIeDriver(settings);
            //case Browser.Edge:     return StartEdgeDriver(settings);
            default:               throw new Exception("Unsupported browser");
            }
        }
コード例 #22
0
        public static bool IsDefaultEquivalent(DriverSettings accelSettings)
        {
            bool wholeOrNoY = accelSettings.combineMagnitudes ||
                              accelSettings.modes.y == AccelMode.noaccel;

            return(string.IsNullOrEmpty(accelSettings.deviceID) &&
                   accelSettings.sensitivity.x == 1 &&
                   accelSettings.sensitivity.y == 1 &&
                   accelSettings.directionalMultipliers.x <= 0 &&
                   accelSettings.directionalMultipliers.y <= 0 &&
                   accelSettings.rotation == 0 &&
                   accelSettings.snap == 0 &&
                   accelSettings.modes.x == AccelMode.noaccel &&
                   wholeOrNoY);
        }
コード例 #23
0
        public void SetActiveValues(DriverSettings settings)
        {
            SetActiveValues(
                settings.sensitivity.x,
                settings.sensitivity.y,
                settings.rotation,
                (int)settings.modes.x,
                (int)settings.modes.y,
                settings.args.x,
                settings.args.y,
                settings.combineMagnitudes);

            AccelCharts.SetLogarithmic(
                OptionSetX.Options.AccelerationType.LogarithmicCharts,
                OptionSetY.Options.AccelerationType.LogarithmicCharts);
        }
コード例 #24
0
        /// <summary>
        /// Initializes a new instance of BrowseViewModel class.
        /// </summary>
        /// <param name="commandHistory">The command history.</param>
        /// <param name="commandInput">The command input.</param>
        public BrowseViewModel(ProgramEditor commandHistory, ProgramEditor commandInput)
        {
            DeclareCommands();

            this.commandInput            = commandInput;
            commandInput.PreviewKeyDown += commandInput_PreviewKeyDown;
            commandInput.TextChanged    += commandInput_TextChanged;

            this.commandHistory = commandHistory;
            commandHistory.PreviewMouseWheel += commandHistory_PreviewMouseWheel;

            MessageList = new MessageList();
            Settings    = DriverSettings.CreateDefaultSettings();
            //this should be removed later on
            manipulator = new E3JManipulator(DriverSettings.CreateDefaultSettings());
        }
コード例 #25
0
        private static IDriverFactory _GetDriverFactory(DriverSettings driverSettings)
        {
            IDriverFactory driverFactory = null;

            if (driverSettings.HubType.EnumValue.Equals(HubType.None))
            {
                switch (driverSettings.Browser.EnumValue)
                {
                case Browser.Chrome:
                {
                    driverFactory = new ChromeDriverFactory();
                    break;
                }

                case Browser.Firefox:
                {
                    driverFactory = new FirefoxDriverFactory();
                    break;
                }
                    //TODO: handle all cases
                }
            }
            switch (driverSettings.Platform.EnumValue)
            {
            case Platform.Windows:
            case Platform.Linux:
            case Platform.Mac:
            {
                driverFactory = new RemoteWebDriverFactory();
                break;
            }

            case Platform.iOS:
            {
                driverFactory = new IOSDriverFactory();
                break;
            }

            case Platform.Android:
            {
                driverFactory = new AndroidDriverFactory();
                break;
            }
            }
            return(driverFactory);
        }
コード例 #26
0
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var newArgs = ApplyOptions.GetArgs();

            newArgs.x.speedCap = driverSettings.args.x.speedCap;
            newArgs.y.speedCap = driverSettings.args.y.speedCap;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                snap        = driverSettings.snap,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args                   = newArgs,
                minimumTime            = driverSettings.minimumTime,
                directionalMultipliers = driverSettings.directionalMultipliers,
                domainArgs             = ApplyOptions.Directionality.GetDomainArgs(),
                rangeXY                = ApplyOptions.Directionality.GetRangeXY(),
                deviceID               = DeviceIDManager.ID,
            };

            ButtonDelay(WriteButton);
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent();
                LastToggleChecked  = SettingsNotDefault;
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                new MessageDialog(errors.ToString(), "bad input").ShowDialog();
            }
        }
コード例 #27
0
        public void Init(IApi api, string dllpath)
        {
            _api     = api;
            _dllpath = dllpath;
            IniParser _ini;

            try
            {
                _ini = new IniParser(_configPath);
            }
            catch (Exception ex)
            {
                throw new PlayerCheckException(String.Format("Error loading config: {0}", ex.Message));
            }

            _enabled = _ini.GetBoolSetting(Name, "Enabled");
            if (!_enabled)
            {
                throw new PlayerCheckException(String.Format("{0} has been disabled", Name));
            }

            _checkip     = _ini.GetBoolSetting(Name, "CheckIP");
            _kickMessage = _ini.GetSetting(Name, "KickMessage");

            if (_ini.GetSetting(Name, "Mode") == "white")
            {
                _mode = Mode.Whitelist;
            }

            var settings = new DriverSettings()
            {
                Api        = api,
                Ini        = _ini,
                PluginPath = dllpath
            };

            _driver = Base.GetDriver(_ini);
            _driver.SetConfig(settings);
            api.OnBeMessageReceivedEvent += onBEMessageReceivedEvent;
        }
コード例 #28
0
ファイル: AccelGUI.cs プロジェクト: termhn/rawaccel
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var newArgs = ApplyOptions.GetArgs();

            newArgs.x.speedCap = driverSettings.args.x.speedCap;
            newArgs.y.speedCap = driverSettings.args.y.speedCap;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args                   = newArgs,
                minimumTime            = driverSettings.minimumTime,
                directionalMultipliers = driverSettings.directionalMultipliers
            };

            ButtonDelay(WriteButton);
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent();
                LastToggleChecked  = SettingsNotDefault;
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                throw new Exception($"Bad arguments:\n\n{errors}");
            }
        }
コード例 #29
0
 public static void SendToDriver(DriverSettings settings)
 {
     new Thread(() => DriverInterop.Write(settings)).Start();
 }
コード例 #30
0
ファイル: CombinedState.cs プロジェクト: jev0n/rawaccel
 public override void Calculate(ManagedAccel accel, DriverSettings settings)
 {
     Calculator.Calculate(Data.Combined, accel, settings.sensitivity.x, Calculator.SimulatedInputCombined);
 }
コード例 #31
0
ファイル: DriversXml.cs プロジェクト: Zer0Grav1ty/EDM
        //#####################################################
        //#
        //# Function that loads the file that contains the variables
        //#
        //#####################################################
        public void Load(string Path, List<string> DriverListName)
        {
            this.driverListName = DriverListName;
            this.Path = Path;

            foreach (var driverName in driverListName) {

                DriverSettings driver = new DriverSettings();

                var textReader = new StreamReader(Path + driverName.Replace(" ",string.Empty) + ".drvsettings");
                var deserializer = new XmlSerializer(typeof(DriverSettings));
                driver = (DriverSettings)deserializer.Deserialize(textReader);
                DriverList.Add(driver);
                textReader.Close();

            }
        }
コード例 #32
0
ファイル: CBRNSensorsDriver.cs プロジェクト: GULPF/SAAB-CM
        protected override WISE_RESULT OnInitialize(DriverSettings settings)
        {
            WISE_RESULT result = WISEError.WISE_OK;

            // Call base class implementation
            result = base.OnInitialize(settings);
            WISEError.CheckCallFailedEx(result);

            //
            // Process required settings
            //

            #region Process required settings

            _baseAddress = "";
            if (!settings.GetSetting("BaseAddress", ref _baseAddress))
            {
                return WISEError.CreateResultCode(WISEErrorSeverity.Error, WISEError.WISE_FACILITY_COM_ADAPTER, WISEError.WISE_INVALID_ARG);
            }

            _port = 0;
            if (!settings.GetSetting("Port", ref _port))
            {
                return WISEError.CreateResultCode(WISEErrorSeverity.Error, WISEError.WISE_FACILITY_COM_ADAPTER, WISEError.WISE_INVALID_ARG);
            }

            #endregion // Process required settings

            #region Sample code: Read required settings
            //string settingValue = "";
            //if (!settings.GetSetting("MyRequiredSetting", ref settingValue))
            //{
            //    return WISEError.CreateResultCode(WISEErrorSeverity.Error, WISEError.WISE_FACILITY_COM_ADAPTER, WISEError.WISE_INVALID_ARG);
            //}
            #endregion

            //
            // Process optional settings
            //

            #region Sample code: Read optional settings
            //int settingOptional = 0;
            //settings.GetSetting("MyOptionalSetting", ref settingOptional);
            #endregion

            //
            // TODO: Initialize global driver resources.
            //

            return result;
        }