public frmControllerConfig(ControllerConfig cfg, int portNumber) : base(cfg) { InitializeComponent(); if (!this.DesignMode) { _portNumber = portNumber; SetMainTab(this.tabMain); //AddBinding("TurboSpeed", trkTurboSpeed); ctrlController0.Initialize(cfg.Keys.Mapping1); ctrlController1.Initialize(cfg.Keys.Mapping2); ctrlController2.Initialize(cfg.Keys.Mapping3); ctrlController3.Initialize(cfg.Keys.Mapping4); ctrlController0.PortNumber = portNumber; ctrlController1.PortNumber = portNumber; ctrlController2.PortNumber = portNumber; ctrlController3.PortNumber = portNumber; this.btnSelectPreset.Image = BaseControl.DownArrow; ResourceHelper.ApplyResources(this, mnuStripPreset); this.Text += ": " + ResourceHelper.GetMessage("PlayerNumber", (portNumber + 1).ToString()); } }
/// <summary> /// Retrieves the configuration file location for the individual controller. /// If using an XInput controller, pass null. /// </summary> private void GetConfigLocation(DInputController dInputController) { // Get Configuration Details ControllerConfig controllerConfig = ControllerConfig.ParseConfig(); // Set the device type ConfigType = controllerConfig.DirectInputConfigType; // If XInput/DInput if (DeviceType == InputDeviceType.DirectInput) { // If InstanceGUID or ProductGUID. if (ConfigType == DirectInputConfigType.InstanceGUID) { ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/Instances/" + dInputController.Information.InstanceGuid + ".json"; } else if (ConfigType == DirectInputConfigType.ProductGUID) { ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/" + PathSanitizer.ForceValidFilePath(dInputController.Information.ProductName) + ".json"; } } else if (DeviceType == InputDeviceType.XInput) { ConfigurationFileLocation = LoaderPaths.GetModLoaderConfigDirectory() + "/Controllers/XInput/" + "Controller_" + XInputPort + ".json"; } }
static void Main(string[] args) { log("Starting Equipment Control System..."); ControllerConfig config = GetControllerConfiguration(log); log(""); log("Creating and installing equipments..."); var equipmentController = EquipmentControllerFactory.CreateControllerUsing(config, log); log("(Please kill the application to exit.)"); log(""); log("Command examples: "); log("Command: Movement in Floor 1, Sub corridor 2"); log("Command: No movement in Floor 1, Sub corridor 2 for a minute"); log(""); while (true) { equipmentController.LogStatus(); log("---------------------------------------------------"); var command = input("Command: "); log(""); Process(command, equipmentController); } }
private ControllerConfig ReadControllerConfig(string filePath) { string configJson = ReadFile(filePath); ControllerConfig config = ReadConfigFromJsonString(configJson); return(config); }
public InstallLocation([NotNull] ControllerConfig config, [NotNull] IProcessRunner processRunner, [NotNull] IGui gui) { if (config == null) { throw new ArgumentNullException("config"); } if (processRunner == null) { throw new ArgumentNullException("processRunner"); } if (gui == null) { throw new ArgumentNullException("gui"); } this.config = config; this.processRunner = processRunner; this.gui = gui; string path = Path.Combine(config.LauncherBinDirFullPath, "bin"); path = Path.Combine(path, config.WurmUnlimitedMode ? "wu" : "wo"); path = Path.Combine(path, config.BuildCode); installDirPath = path; if (!Path.IsPathRooted(installDirPath)) { throw new InvalidOperationException("rootPath must be absolute"); } if (!Directory.Exists(installDirPath)) { Directory.CreateDirectory(installDirPath); } }
public void ShouldProcessTheCommandsAsExpected(int serial, ControllerConfig config, List <string> commands) { log($"******** start test #{serial} **********"); var equipmentController = EquipmentControllerFactory.CreateControllerUsing(config, log); var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, WriteIndented = true }; log(JsonSerializer.Serialize <ControllerConfig> (config, options)); log(""); log("Initial state:"); equipmentController.LogStatus(); foreach (var command in commands) { log("---------------------------------------------------"); log($"Input: {command}"); log(""); Process(command, equipmentController); equipmentController.LogStatus(); log(""); } log($"******** end test #{serial} **********"); log(""); log("---------------------------------------------------"); }
public StagingLocation(ControllerConfig config) { if (config == null) { throw new ArgumentNullException("config"); } var stagingDirPath = Path.Combine(config.LauncherBinDirFullPath, "stage"); if (!Path.IsPathRooted(stagingDirPath)) { throw new InvalidOperationException("rootPath must be absolute"); } if (!Directory.Exists(stagingDirPath)) { Directory.CreateDirectory(stagingDirPath); } stageDir = new DirectoryInfo(Path.Combine(stagingDirPath, "Stage")); stageDir.Create(); extractionDir = new DirectoryInfo(Path.Combine(stagingDirPath, "Extracted")); extractionDir.Create(); tempDir = new DirectoryInfo(Path.Combine(stagingDirPath, "Temp")); tempDir.Create(); ClearTempDir(); }
public MsgCmdRegister(string controllerIP_, int controllerId_) { // receive cmd register _controller = new ControllerConfig(); _controller.ip = controllerIP_; _controller.id = controllerId_; }
public LaunchController(IGuiHost host, ControllerConfig config, [NotNull] IDebug debug, [NotNull] UserSettings settings) { if (host == null) { throw new ArgumentNullException("host"); } this.host = host; if (config == null) { throw new ArgumentNullException("config"); } if (debug == null) { throw new ArgumentNullException("debug"); } if (settings == null) { throw new ArgumentNullException("settings"); } this.config = config; this.debug = debug; this.settings = settings; var updaterGui = new UpdaterGui(host, debug); host.SetContent(updaterGui); gui = updaterGui; }
private async Task OutputConnectedClientsToConsole(ControllerConfig controllerConfig, PresenceRecordingSettings presenceConfig, ILogger logger) { var connectedClients = await GetConnectedClients(controllerConfig, presenceConfig, logger); if (connectedClients?.Any() == true) { WriteConnectedClientsToConsole(connectedClients); } }
public static void ComposeConfiguration(HttpConfiguration config) { // Persistence creation var residents = new ResidentsInMemory(); var payments = new PaymentsInMemory(); CorsConfig.Configure(config); RouteConfig.Configure(config); ControllerConfig.Configure(config, payments, residents); }
public UnifiClientTests() { var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddUserSecrets <UnifiClientTests>(); var configRoot = builder.Build(); config = configRoot.GetSection("controller").Get <ControllerConfig>(); configWithInvalidSsl = configRoot.GetSection("controllerWithInvalidSslCertificate").Get <ControllerConfig>(); }
public MsgCmdRegister(int id, ControllerConfig controller, int playerID) { Head = new MessageHead() { ID = id, NodeID = 0, Type = MessageType.CMD_Register, }; _controller = controller; PlayerID = playerID; }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); ControllerConfig.RegisterDependencies(); }
public static bool CameraSetProperty(ControllerConfig config, string propStr, bool setupOk) { if (setupOk) { // Save the setting SetProperty(config, propStr); System.Windows.Forms.MessageBox.Show(Lang.GetText("@M_camera_setup_ok")); return(true); } else { System.Windows.Forms.MessageBox.Show(Lang.GetText("@M_camera_setup_error")); } return(false); }
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); //regist map MappingConfig.RegisterMaps(); //use customer controller factory ControllerConfig.SetControllerFactory(ControllerBuilder.Current); //use xml model binderprovider ModelBinderProviders.BinderProviders.Insert(0, new XMLModelBinderProvider()); //register value privider ValueProviderFactories.Factories.Insert(0, new HttpValueProviderFactory()); }
// Use this for initialization void Start() { KeyCode[] up = new KeyCode[2] { KeyCode.UpArrow, KeyCode.W }; //0 ControllerConfig.Add(up); KeyCode[] down = new KeyCode[2] { KeyCode.DownArrow, KeyCode.S }; //1 ControllerConfig.Add(down); KeyCode[] left = new KeyCode[2] { KeyCode.LeftArrow, KeyCode.A }; //2 ControllerConfig.Add(left); KeyCode[] right = new KeyCode[2] { KeyCode.RightArrow, KeyCode.D }; //3 ControllerConfig.Add(right); KeyCode[] jump = new KeyCode[2] { KeyCode.Space, KeyCode.RightShift }; //4 ControllerConfig.Add(jump); KeyCode[] control = new KeyCode[2] { KeyCode.C, KeyCode.Q }; //5 ControllerConfig.Add(control); KeyCode[] attack = new KeyCode[2] { KeyCode.X, KeyCode.E }; //6 ControllerConfig.Add(attack); KeyCode[] reset = new KeyCode[2] { KeyCode.R, KeyCode.O }; //7 ControllerConfig.Add(reset); KeyCode[] pause = new KeyCode[2] { KeyCode.Escape, KeyCode.P }; //8 ControllerConfig.Add(pause); ResolutionOptions = Screen.resolutions; foreach (Resolution res in ResolutionOptions) { Debug.Log(res.width.ToString() + " x " + res.height.ToString()); } }
private static async Task UpdateConfigDevices(ControllerConfig controllerConfig, PresenceRecordingSettings presenceConfig, ILogger logger) { Console.WriteLine("Testing configuration for Unifi Controller"); var connectedClients = await GetConnectedClients(controllerConfig, presenceConfig, logger); var wireLessClients = connectedClients.Where(client => client.IsWired == false).ToArray(); WriteConnectedClientsToConsole(wireLessClients); var clientIndexes = Prompt.GetString("Comma seperated list of client Index number (eg: 2,15,7): ").Split(",", StringSplitOptions.RemoveEmptyEntries); var clientList = new List <Sta>(); foreach (var index in clientIndexes) { clientList.Add(wireLessClients[int.Parse(index)]); } presenceConfig.PresenceIndicationMACs = clientList.Select(s => s.Mac).ToArray(); Console.WriteLine(); }
private static void MergeConfig(ControllerConfig controllerConfig, CommandOption optionSitename, CommandOption optionUserNameController, CommandOption optionPassWordController, CommandOption optionBaseUrlController) { if (optionSitename?.HasValue() == true) { controllerConfig.ControllerSiteDescription = optionSitename.Value(); } if (optionUserNameController?.HasValue() == true) { controllerConfig.UserName = optionUserNameController.Value(); } if (optionPassWordController?.HasValue() == true) { controllerConfig.Password = optionPassWordController.Value(); } if (optionBaseUrlController?.HasValue() == true) { controllerConfig.BaseUrl = optionBaseUrlController.Value(); } }
public Launcher([NotNull] ControllerConfig config) { if (config == null) { throw new ArgumentNullException("config"); } this.launcherDirPath = config.LauncherBinDirFullPath; if (!Path.IsPathRooted(launcherDirPath)) { throw new InvalidOperationException("rootPath must be absolute"); } if (!Directory.Exists(launcherDirPath)) { Directory.CreateDirectory(launcherDirPath); } }
public GlobalSettings(ControllerConfig config) { var filepath = Path.Combine(config.LauncherBinDirFullPath, "globalsettings.json"); persistent = new Persistent <Data>(filepath); persistent.Load(); if (persistent.Data.Version == 0) { persistent.Data.BaseUrlPriorityList = new List <string>() { "http://wurmassistant.azurewebsites.net/api/WurmAssistant3", "http://wurmassistant.aldurcraft.net/api/WurmAssistant3", "http://wurmassistant.aldurslab.net/api/WurmAssistant3" }; persistent.Data.Version = 1; persistent.Save(); } }
public UpdateService([NotNull] ControllerConfig controllerConfig, IStagingLocation stagingLocation) { if (controllerConfig == null) { throw new ArgumentNullException("controllerConfig"); } if (stagingLocation == null) { throw new ArgumentNullException("stagingLocation"); } this.webServiceRootUrl = controllerConfig.WebServiceRootUrl; if (webServiceRootUrl.EndsWith("/")) { webServiceRootUrl = webServiceRootUrl.Substring(0, webServiceRootUrl.Length - 1); } this.stagingLocation = stagingLocation; this.wurmAssistantService = new WurmAssistantService(webServiceRootUrl); }
/// <summary> /// Is there a Model that matches the current Controller. /// </summary> /// <returns></returns> public static bool IsSupportControllerModel() { InitManagerContext(); if (managerContext == null) { return(false); } bool isSpt = managerContext.Call <bool>("isSupportControllerModel"); Debug.Log("isSpt=" + isSpt); if (!isSpt) { return(false); } ControllerConfig cfg = GetControllerConfig(); if (cfg.modelPath != null) { // system/etc/controller/108 DirectoryInfo theFolder = new DirectoryInfo(cfg.modelPath); if (theFolder != null && theFolder.Exists) { DirectoryInfo parentFolder = theFolder.Parent; if (parentFolder != null && parentFolder.Exists) { // ParentFolder:/system/etc/controller string versionFilePath = parentFolder.FullName + "/Version.txt"; bool isExist = System.IO.File.Exists(versionFilePath); Debug.LogError("ParentFolder:" + parentFolder.FullName + "," + isExist); return(isExist); } } else { Debug.LogError("theFolder is empty, " + (theFolder == null ? "yes" : theFolder.Exists.ToString())); } } return(cfg.modelPath != null); }
private static async Task <Sta[]> GetConnectedClients(ControllerConfig controllerConfig, PresenceRecordingSettings presenceConfig, ILogger logger) { var controllerClient = new UnifiControllerClient(GetHttpClient(controllerConfig.BaseUrl, presenceConfig.SOCKS, presenceConfig.VerifySsl)); var loginResult = await controllerClient.Login(controllerConfig.UserName, controllerConfig.Password); if (loginResult == true) { var sites = await controllerClient.GetSites(); string siteName = null; if (string.IsNullOrEmpty(controllerConfig.ControllerSiteDescription) || controllerConfig.ControllerSiteDescription?.ToLower() == "default") { siteName = sites.FirstOrDefault(p => string.Compare("default", p.Name, StringComparison.InvariantCultureIgnoreCase) == 0)?.Name; } else { siteName = sites.FirstOrDefault(p => string.Compare(controllerConfig.ControllerSiteDescription, p.Desc, StringComparison.InvariantCultureIgnoreCase) == 0)?.Name; } if (siteName == null) { logger.LogError($"The controller site description {controllerConfig.ControllerSiteDescription} could not be found."); } else { var connectedDevices = await controllerClient.GetConnectedClients(siteName); return(connectedDevices); } } else { logger.LogError("Failed to log on to the controller."); } return(null); }
private void ProfileLoad_Activated(object sender, EventArgs args) { ((ToggleButton)sender).SetStateFlags(0, true); if (_inputDevice.ActiveId == "disabled" || _profile.ActiveId == null) { return; } InputConfig config = null; int pos = _profile.Active; if (_profile.ActiveId == "default") { if (_inputDevice.ActiveId.StartsWith("keyboard")) { config = new KeyboardConfig { Index = 0, ControllerType = ControllerType.JoyconPair, LeftJoycon = new NpadKeyboardLeft { StickUp = Key.W, StickDown = Key.S, StickLeft = Key.A, StickRight = Key.D, StickButton = Key.F, DPadUp = Key.Up, DPadDown = Key.Down, DPadLeft = Key.Left, DPadRight = Key.Right, ButtonMinus = Key.Minus, ButtonL = Key.E, ButtonZl = Key.Q, ButtonSl = Key.Unbound, ButtonSr = Key.Unbound }, RightJoycon = new NpadKeyboardRight { StickUp = Key.I, StickDown = Key.K, StickLeft = Key.J, StickRight = Key.L, StickButton = Key.H, ButtonA = Key.Z, ButtonB = Key.X, ButtonX = Key.C, ButtonY = Key.V, ButtonPlus = Key.Plus, ButtonR = Key.U, ButtonZr = Key.O, ButtonSl = Key.Unbound, ButtonSr = Key.Unbound } }; } else if (_inputDevice.ActiveId.StartsWith("controller")) { config = new ControllerConfig { Index = 0, ControllerType = ControllerType.ProController, DeadzoneLeft = 0.1f, DeadzoneRight = 0.1f, TriggerThreshold = 0.5f, LeftJoycon = new NpadControllerLeft { StickX = ControllerInputId.Axis0, StickY = ControllerInputId.Axis1, StickButton = ControllerInputId.Button8, DPadUp = ControllerInputId.Hat0Up, DPadDown = ControllerInputId.Hat0Down, DPadLeft = ControllerInputId.Hat0Left, DPadRight = ControllerInputId.Hat0Right, ButtonMinus = ControllerInputId.Button6, ButtonL = ControllerInputId.Button4, ButtonZl = ControllerInputId.Axis2, ButtonSl = ControllerInputId.Unbound, ButtonSr = ControllerInputId.Unbound, InvertStickX = false, InvertStickY = false }, RightJoycon = new NpadControllerRight { StickX = ControllerInputId.Axis3, StickY = ControllerInputId.Axis4, StickButton = ControllerInputId.Button9, ButtonA = ControllerInputId.Button1, ButtonB = ControllerInputId.Button0, ButtonX = ControllerInputId.Button3, ButtonY = ControllerInputId.Button2, ButtonPlus = ControllerInputId.Button7, ButtonR = ControllerInputId.Button5, ButtonZr = ControllerInputId.Axis5, ButtonSl = ControllerInputId.Unbound, ButtonSr = ControllerInputId.Unbound, InvertStickX = false, InvertStickY = false } }; } } else { string path = System.IO.Path.Combine(GetProfileBasePath(), _profile.ActiveId); if (!File.Exists(path)) { if (pos >= 0) { _profile.Remove(pos); } return; } try { using (Stream stream = File.OpenRead(path)) { config = JsonHelper.Deserialize <ControllerConfig>(stream); } } catch (JsonException) { try { using (Stream stream = File.OpenRead(path)) { config = JsonHelper.Deserialize <KeyboardConfig>(stream); } } catch { } } } SetValues(config); }
private void MainForm_Load(object sender, System.EventArgs e) { try { HideHostWindow(); var assemblyDir = Path.GetDirectoryName(this.GetType().Assembly.Location); if (assemblyDir == null) { throw new NullReferenceException("assemblyDir is null"); } var settings = new UserSettings(assemblyDir); var config = new ControllerConfig() { LauncherBinDirFullPath = assemblyDir, WebServiceRootUrl = settings.WurmAssistantWebServiceUrl, WurmAssistantExeFileName = "AldursLab.WurmAssistant3.exe", BuildCode = args.HasBuildCode ? args.BuildCode : string.Empty, WurmUnlimitedMode = args.WurmUnlimitedMode, UseRelativeDataDirPath = args.UseRelativeWaDataDir, BuildNumber = args.HasSpecificBuildNumber ? args.SpecificBuildNumber.ToString() : null }; if (args.NoArgs || args.ShowConfigWindow) { // ask user what to run... ChooseApp dialog = new ChooseApp(new WurmAssistantService(config.WebServiceRootUrl), settings); dialog.StartPosition = FormStartPosition.CenterScreen; if (dialog.ShowDialog() != DialogResult.OK) { Close(); return; } config.UseRelativeDataDirPath = dialog.RelativeDataDirPath; config.BuildNumber = dialog.HasSpecificBuildNumber ? dialog.SpecificBuildNumber.ToString() : null; config.WurmUnlimitedMode = dialog.RunUnlimited; config.BuildCode = dialog.BuildCode; } if (string.IsNullOrWhiteSpace(config.BuildCode)) { throw new InvalidOperationException("Error: BuildCode must be known at this point."); } if (config.WurmUnlimitedMode) { this.Text = "Launching Wurm Assistant Unlimited..."; this.Icon = Resources.WurmAssistantUnlimitedIcon; } else { this.Text = "Launching Wurm Assistant 3..."; } IDebug debug = new TextDebug(Path.Combine(assemblyDir, "launcherlog.txt")); debug.Clear(); var controller = new LaunchController(this, config, debug, settings); controller.Execute(); } catch (Exception exception) { MessageBox.Show(exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
public Controller(ControllerConfig confignew) { config = confignew; }
public void LoadConfig() { this.CurrentControllerConfig = StoredConfig.ControllerConfig; }
public void SetConfig(ControllerConfig config) { Config = config; }
public void Configuration(IAppBuilder app) { app.Use((context, next) => { context.Response.Headers.Remove("Server"); return(next.Invoke()); }); app.UseStageMarker(PipelineStage.PostAcquireState); // Modify the JSON serializer to serialize dates as UTC - otherwise, timezone will not be appended // to date strings and browsers will select whatever timezone suits them JsonSerializerSettings settings = JsonUtility.CreateDefaultSerializerSettings(); settings.DateTimeZoneHandling = DateTimeZoneHandling.Utc; JsonSerializer serializer = JsonSerializer.Create(settings); GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => serializer); // Load security hub in application domain before establishing SignalR hub configuration using (new SecurityHub()) { } HubConfiguration hubConfig = new HubConfiguration(); HttpConfiguration httpConfig = new HttpConfiguration(); // Enabled detailed client errors hubConfig.EnableDetailedErrors = true; // Enable GSF session management httpConfig.EnableSessions(AuthenticationOptions); // Enable GSF role-based security authentication app.UseAuthentication(AuthenticationOptions); string allowedDomainList = ConfigurationFile.Current.Settings["systemSettings"]["AllowedDomainList"]?.Value; if (allowedDomainList == "*") { app.UseCors(CorsOptions.AllowAll); } else if ((object)allowedDomainList != null) { httpConfig.EnableCors(new System.Web.Http.Cors.EnableCorsAttribute(allowedDomainList, "*", "*")); } CsvDownloadHandler.LogExceptionHandler = Program.Host.HandleException; HowlCSVDownloadHandler.LogExceptionHandler = Program.Host.HandleException; HowlCSVUploadHandler.LogExceptionHandler = Program.Host.HandleException; // Load ServiceHub SignalR class app.MapSignalR(hubConfig); // Set configuration to use reflection to setup routes httpConfig.MapHttpAttributeRoutes(); // Set configuration to use reflection to setup routes ControllerConfig.Register(httpConfig); // Load new GSF web page controllers app.UseWebPageController // Load the WebPageController class and assign its routes app.UseWebApi(httpConfig); // Setup resolver for web page controller instances app.UseWebPageController(WebServer.Default, Program.Host.DefaultWebPage, Program.Host.Model, typeof(AppModel), AuthenticationOptions); httpConfig.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; // Check for configuration issues before first request httpConfig.EnsureInitialized(); }