public WoWMapper(IInputPlugin InputDevice) { inputDevice = InputDevice; windowScanner = new WindowScanner(); // Watches for WoW window/process inputMapper = new InputMapper(windowScanner); // Handles input conversion to the game inputMonitor = new InputMonitor(inputDevice, inputMapper); // Watches for controller input inputDevice.Settings.Settings.Read("TouchMode", out touchState); inputDevice.OnButtonDown += DoButtonDown; inputDevice.OnButtonUp += DoButtonUp; if (inputDevice.Peripherals.Touchpad) inputDevice.OnTouchpadMoved += DoTouchPad; int tLeft, tRight; inputDevice.Settings.Settings.Read("TriggerLeft", out tLeft); inputDevice.Settings.Settings.Read("TriggerRight", out tRight); inputDevice.Thresholds = new InputThresholds() { TriggerLeft = tLeft, TriggerRight = tRight }; inputDevice.Enabled = true; }
public HapticsModule(IInputPlugin Device) { hapticDevice = Device; lightbarThread = new Thread(LightbarThread); lightbarThread.Start(); rumbleThread = new Thread(RumbleThread); rumbleThread.Start(); }
public static IInputPlugin GetInputPlugin() { if (currentInputPlugin == null) { currentInputPlugin = new JohnnyInputPlugin(); } return(currentInputPlugin); }
public InputMonitor(IInputPlugin Device, InputMapper Mapper) { inputMapper = Mapper; inputDevice = Device; movementThread = new Thread(MovementThread); mouseThread = new Thread(MouseThread); movementThread.Start(); mouseThread.Start(); }
public TransferResult Transfer(IInputPlugin inputPlugin, IOutputPlugin outputPlugin) { _log.InfoFormat("Transfer started"); try { int counter = 0; while (true) { try { _log.Info("Reading next item from input plugin"); if (!inputPlugin.Read(out IDictionary <string, object> item)) { break; } _log.Info("Writing item to output plugin"); outputPlugin.Write(item); counter++; } catch (Exception itemEx) when(!_stopOnItemError) { _log.Warn(itemEx); } } TransferResult success = new TransferResult { Id = 1, Text = "Success", ItemsTransfered = counter }; _log.InfoFormat("Items transfered successfully"); _log.Debug(success.Text + "--> Number of items transfered: " + success.ItemsTransfered); return(success); } catch (Exception e) { TransferResult notCompleted = new TransferResult { Id = 2, Text = "Transfer not completed" + e.Message, ItemsTransfered = 0 }; _log.InfoFormat("Items transfered not successfully"); _log.Debug(notCompleted.Text + "--> Number of items transfered: " + notCompleted.ItemsTransfered); return(notCompleted); } finally { _log.InfoFormat("Items transfer ended"); _log.Debug("Disposing resources"); } }
private ContentManagerCore() { datafolder = System.Configuration.ConfigurationSettings.AppSettings["DataFolder"]; if (!Directory.Exists(datafolder) && !File.Exists(datafolder + "\\conf.xml") && ApplicationDeployment.IsNetworkDeployed) datafolder = ApplicationDeployment.CurrentDeployment.DataDirectory + "\\" + datafolder; this.slidegen = new SlideGenerator(datafolder + "\\conf.xml"); if (System.Configuration.ConfigurationSettings.AppSettings["InputMethod"] == "HTTP") this.input = new InputHTTP(this); else if (System.Configuration.ConfigurationSettings.AppSettings["InputMethod"] == "WCF") this.input = new InputWCF(this); else { MessageBox.Show("There is no InputMethod key in the configuration file", "Error: Bad Configuration"); } this.engine = new BroadcastEngine(slidegen); this.engine.setSlideCart(this.getAutoSlides()); this.engine.startAutoBroadcast(); }
public InputService(IInputPlugin activeInputPlugin) { _activeInputPlugin = activeInputPlugin; }
private void InitializePlugin(string DllFile) { if (inputDevice != null) { // Dispose old plugin inputDevice.Kill(); } Type pluginType = typeof(IInputPlugin); string pluginPath = Path.Combine("plugins", DllFile); if(!File.Exists(pluginPath)) { MessageBox.Show("Error loading input plugin: file not found", "WoWmapper", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var pluginName = AssemblyName.GetAssemblyName(pluginPath); Assembly pluginAssembly; pluginAssembly = Assembly.Load(pluginName); Type[] types = pluginAssembly.GetTypes(); foreach (Type type in types) { if (type.GetInterface(pluginType.FullName) != null) { inputDevice = (IInputPlugin)Activator.CreateInstance(type, new object[] { true }); break; } } if (wowMapper != null) { wowMapper.Dispose(); } wowMapper = new WoWMapper(inputDevice); inputDevice.Settings.Settings.Read("TouchMode", out touchState); }
public TestGame(IGraphicsPlugin graphics, IInputPlugin input, IAudioPlugin audio, ITimerPlugin timer, IResourceContext resourceContext) : base(graphics, input, audio, timer, resourceContext) { timer.TargetFps = 30; }
/// <summary> /// Builds pipelines for data processing, will perform segregation of nodes to minimize node processing duplication /// </summary> /// <returns>prepared pipelines</returns> private static PipelineExecutor[] BuildPipelines() { if (specialNodes.SyncInformation.SyncNodes.Length == 0) { return(BuildLinearPipeline()); } //Build Pipelines with sync pipeline segregation int[] inputNodeIds = new int[inputs.Length]; for (var i = 0; i < inputs.Length; i++) { inputNodeIds[i] = inputs[i].nodeId; } Dictionary <int, InputData[]> groupInputLookup = new Dictionary <int, InputData[]>(); Dictionary <int, SyncSplitGroup> nodeToGroup = new Dictionary <int, SyncSplitGroup>(); //find groups which have input nodes foreach (SyncSplitGroup group in specialNodes.SyncInformation.NodeGroups) { List <InputData> inputs = new List <InputData>(); foreach (int nodeId in group.ControllingNodes) { if (inputNodeIds.Contains(nodeId)) { IInputPlugin plugin = PluginStore.getInputPlugin(dependencyGraph[nodeId].Type); if (!group.Input) { // Gather initial quantity requirements group.Input = true; group.RequiredPipes = plugin.InputDataQuantity(NodeValueOrInput(nodeId)); } else if (group.RequiredPipes != plugin.InputDataQuantity(NodeValueOrInput(nodeId))) { throw new InputPluginQuantityMismatchException(); } inputs.Add(new InputData(nodeId, plugin)); } nodeToGroup.Add(nodeId, group); } groupInputLookup.Add(group.SyncNodeId, inputs.ToArray()); } //check group dependencies are valid foreach (SyncSplitGroup group in specialNodes.SyncInformation.NodeGroups) { if (group.SyncNodeId == -1) { continue; //nodes outside of sync blocks } foreach (int dependent in group.Dependents) { SyncSplitGroup otherGroup = nodeToGroup[dependent]; if (otherGroup.Input) { throw new PipelineException("Co-dependent sync nodes with inputs are not supported"); } if (group.linked == null) { otherGroup.linked = group; } else { throw new PipelineException("Multi-Sync segmentation is not supported"); } } } //create new pipelines bool postBuildLinkRequired = false; List <PipelineExecutor> executors = new List <PipelineExecutor>(); foreach (SyncSplitGroup group in specialNodes.SyncInformation.NodeGroups) { if (group.linked != null) { group.RequiredPipes = group.linked.RequiredPipes; } else if (group.linked == null && !group.Input) { group.RequiredPipes = 1; } //Prepare pipelines if (group.linked == null) { group.pipes = new PipelineExecutor[group.RequiredPipes]; for (int i = 0; i < group.RequiredPipes; i++) { group.pipes[i] = new PipelineExecutor(dependencyGraph, staticData, i, specialNodes, InputDirectory, OutputDirectory); } } else { postBuildLinkRequired = true; } if (group.Input) { PrepareInputData(groupInputLookup[group.SyncNodeId], group.pipes); } if (group.pipes != null) { executors.AddRange(group.pipes); } } if (postBuildLinkRequired) { foreach (SyncSplitGroup group in specialNodes.SyncInformation.NodeGroups) { if (group.linked != null && group.pipes == null) { group.pipes = group.linked.pipes; } } } //Update sync nodes with trigger pipelines for (var i = 0; i < specialNodes.SyncInformation.NodeGroups.Count; i++) { SyncSplitGroup group = specialNodes.SyncInformation.NodeGroups[i]; if (group.CalledBy == -2) { continue; } int expectedPipes = ExtractSyncGroup(group.CalledBy).RequiredPipes; ExtractNodeSlot(group.CalledBy).StateInfo(expectedPipes, group.pipes); } return(executors.ToArray()); }
public InputData(int nodeId, IInputPlugin plugin) { this.nodeId = nodeId; this.plugin = plugin; }
protected GameContext(IGraphicsPlugin graphics, IInputPlugin input, IAudioPlugin audio, ITimerPlugin timer, IResourceContext predefinedResources) { Timer = timer; Graphics = graphics; Input = input; Audio = audio; var sprites = predefinedResources.GetPredefinedSprites(this); Sprites = new IndexedResourceManager <GameSprite>(sprites); var sounds = predefinedResources.GetPredefinedSounds(this); Sounds = new IndexedResourceManager <GameSound>(sounds); var backgrounds = predefinedResources.GetPredefinedBackgrounds(this); Backgrounds = new IndexedResourceManager <GameBackground>(backgrounds); var fonts = predefinedResources.GetPredefinedFonts(this); Fonts = new IndexedResourceManager <GameFont>(fonts); var paths = predefinedResources.GetPredefinedPaths(this); Paths = new IndexedResourceManager <GamePath>(paths); var scripts = predefinedResources.GetPredefinedScripts(this); Scripts = new IndexedResourceManager <GameScript>(scripts); var timelines = predefinedResources.GetPredefinedTimelines(this); Timelines = new IndexedResourceManager <GameTimeline>(timelines); var objects = predefinedResources.GetPredefinedObjects(this); Objects = new IndexedResourceManager <GameObject>(objects); foreach (var gameObject in Objects) { gameObject.OnRegisterEvents(); } Instances = new IndexedResourceManager <IInstance>(100001); var rooms = predefinedResources.GetPredefinedRooms(this); Rooms = new IndexedResourceManager <GameRoom>(rooms); RoomOrder = rooms.Select(r => r.Id).ToList(); var triggers = predefinedResources.GetPredefinedTriggers(this); Triggers = new IndexedResourceManager <ITrigger>(triggers); Instances.SetNextIndex(predefinedResources.NextInstanceId); Sprites.SetNextIndex(predefinedResources.NextSpriteId); Objects.SetNextIndex(predefinedResources.NextObjectId); Rooms.SetNextIndex(predefinedResources.NextRoomId); Graphics.Load += Graphics_Load; Graphics.Draw += Graphics_Update; Input.KeyPress += Input_KeyPress; Library = new StandardLibrary(this); Init(); }
private ContentManagerCore() { try { debug = System.Configuration.ConfigurationManager.AppSettings["debug"].Equals("true"); datafolder = System.Configuration.ConfigurationManager.AppSettings["DataFolder"]; tmpfolder = System.Configuration.ConfigurationManager.AppSettings["TmpFolder"]; if (!Directory.Exists(datafolder) && !File.Exists(datafolder + "\\config.xml") && ApplicationDeployment.IsNetworkDeployed) datafolder = ApplicationDeployment.CurrentDeployment.DataDirectory + "\\" + datafolder; if (!Directory.Exists(tmpfolder) && ApplicationDeployment.IsNetworkDeployed) tmpfolder = ApplicationDeployment.CurrentDeployment.DataDirectory + "\\" + tmpfolder; try { if (!Directory.Exists(tmpfolder)) Directory.CreateDirectory(tmpfolder); this.slidegen = new SlideGenerator(datafolder + "\\config.xml", datafolder + "\\variables.xml", datafolder, tmpfolder); } catch (Exception e) { MessageBox.Show(e.Message); Environment.Exit(1); } try { if (CMSConfig.inputtype.ToUpper() == "HTTP") this.input = new InputHTTPKayak(this); else if (CMSConfig.inputtype.ToUpper() == "WCF") this.input = new InputWCF(this); else { MessageBox.Show("There is no InputMethod key in the configuration file", "Error: Bad Configuration"); Environment.Exit(1); } } catch (Exception e) { MessageBox.Show(e.Message); } this.engine = new BroadcastEngine(slidegen); this.engine.setSlideCart(this.getAutoSlides()); if(this.engine.slidecart.Count != 0) this.engine.startAutoBroadcast(); } catch(Exception e) { MessageBox.Show("Error when starting: "+e.Message); } }
public FakeGameContext(IGraphicsPlugin graphics, IInputPlugin input, IAudioPlugin audio, ITimerPlugin timer, IResourceContext resources) : base(graphics, input, audio, timer, resources) { }