예제 #1
0
        public BackgroundOutputDevice(IOutputDevice outputDevice, Func <string, string> process, Dispatcher dispatcher)
            : this(outputDevice, process)
        {
            Dispatcher = dispatcher;

            this.StartTask();
        }
예제 #2
0
 /// <summary>
 /// Finds a device that is connected to the brick by id
 /// </summary>
 /// <typeparam name="T">Any device LargeMotor, ColorSensor etc.</typeparam>
 /// <param name="id">id of the device</param>
 /// <returns><c>T</c> if found otherwise <c>null</c></returns>
 /// <exception cref="DeviceException">device found is not of the expected device type of <c>T</c></exception>
 /// <exception cref="System.ArgumentNullException">id is required</exception>
 public T FindDevice <T>(string id) where T : Device
 {
     if (string.IsNullOrWhiteSpace(id))
     {
         throw new ArgumentNullException(nameof(id));
     }
     if (typeof(IInputDevice).IsAssignableFrom(typeof(T)))
     {
         IInputDevice device = IOPort.FindInputDevice(id);
         if (device == null)
         {
             return(null);
         }
         T obj = Activator.CreateInstance <T>();
         if (device.Type != obj.Type)
         {
             throw new DeviceException($"{obj.Type} expected but found {device.Type}");
         }
         return((T)device);
     }
     else
     {
         IOutputDevice device = IOPort.FindOutputDevice(id);
         if (device == null)
         {
             return(null);
         }
         T obj = Activator.CreateInstance <T>();
         if (device.Type != obj.Type)
         {
             throw new DeviceException($"{obj.Type} expected but found {device.Type}");
         }
         return((T)device);
     }
 }
예제 #3
0
        private ElementsToSingleController(IEnumerable <Element> elements, IOutputDevice controllerDevice, int controllerOutputCount, int startingOutputIndex, int outputsPerElement)
        {
            if (elements == null)
            {
                throw new ArgumentNullException("elements");
            }
            if (controllerDevice == null)
            {
                throw new ArgumentNullException("controllerDevice");
            }
            if (startingOutputIndex < 0 || startingOutputIndex >= controllerOutputCount)
            {
                throw new IndexOutOfRangeException("Starting output index invalid for the controller.");
            }
            if (outputsPerElement < 1 || outputsPerElement > controllerOutputCount)
            {
                throw new InvalidOperationException("Invalid output count.");
            }
            //if(outputsPerElement >= (controllerOutputCount - startingOutputIndex)) throw new InvalidOperationException("Not enough outputs to patch.");

            _startingOutputIndex        = startingOutputIndex;
            _outputsPerElement          = outputsPerElement;
            _elementComponents          = elements.Select(VixenSystem.Elements.GetDataFlowComponentForElement).ToArray();
            _controllerOutputComponents = Enumerable.Range(_startingOutputIndex, controllerOutputCount - _startingOutputIndex).Select(x => VixenSystem.ControllerManagement.GetDataFlowComponentForOutput(controllerDevice, x)).ToArray();
        }
예제 #4
0
 public Canvas2D(
     IRenderingSettingsProvider renderingSettingsProvider,
     IOutputDevice outputDevice)
 {
     _outputDevice = outputDevice;
     Initialize(renderingSettingsProvider);
 }
예제 #5
0
 public TimeManager(
     IOutputDevice outputDevice,
     ISimulationManager simulationManager)
 {
     this.outputDevice      = outputDevice;
     this.simulationManager = simulationManager;
 }
        /// <summary>
        /// Plays MIDI events contained in the specified <see cref="MidiFile"/>.
        /// </summary>
        /// <param name="midiFile"><see cref="MidiFile"/> containing events to play.</param>
        /// <param name="outputDevice">Output MIDI device to play events through.</param>
        /// <param name="clockSettings">Settings of the internal playback's clock.</param>
        /// <exception cref="ArgumentNullException">
        /// <para>One of the following errors occured:</para>
        /// <list type="bullet">
        /// <item>
        /// <description><paramref name="midiFile"/> is <c>null</c>.</description>
        /// </item>
        /// <item>
        /// <description><paramref name="outputDevice"/> is <c>null</c>.</description>
        /// </item>
        /// </list>
        /// </exception>
        public static void Play(this MidiFile midiFile, IOutputDevice outputDevice, MidiClockSettings clockSettings = null)
        {
            ThrowIfArgument.IsNull(nameof(midiFile), midiFile);
            ThrowIfArgument.IsNull(nameof(outputDevice), outputDevice);

            midiFile.GetTrackChunks().Play(midiFile.GetTempoMap(), outputDevice, clockSettings);
        }
예제 #7
0
        private bool cmd_scan(CommandContext ctx, Command cmd, IOutputDevice outputDevice)
        {
            // Grab the manifest
            var manifest = ModuleRegistry.GetModule <ConfigSystem>().GetConfig <Manifest>(ctx, "Manifest");

            if (manifest == null)
            {
                outputDevice.WriteStaticLine("$redFailed to load the manifest");
                ctx.ErrorFlag = true;
                return(true);
            }

            // Iterate each game
            foreach (var game in manifest.Games)
            {
                if (!ScanForGame(ctx, game))
                {
                    continue;
                }
                ctx.LocatedGame = game;
                break;
            }

            if (ctx.LocatedGame == null)
            {
                outputDevice.WriteStaticLine("$redNo recognised games found in current directory");
                ctx.ErrorFlag = true;
                return(true);
            }

            outputDevice.WriteStaticLine($"$whiteIdentified game $green{ctx.LocatedGame.Name}");

            return(true);
        }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Playback"/> with the specified
        /// collection of timed objects, tempo map and output MIDI device to play events through.
        /// </summary>
        /// <param name="timedObjects">Collection of timed objects to play.</param>
        /// <param name="tempoMap">Tempo map used to calculate events times.</param>
        /// <param name="outputDevice">Output MIDI device to play <paramref name="timedObjects"/> through.</param>
        /// <param name="clockSettings">Settings of the internal playback's clock.</param>
        /// <exception cref="ArgumentNullException"><paramref name="timedObjects"/> is null. -or-
        /// <paramref name="tempoMap"/> is null. -or- <paramref name="outputDevice"/> is null.</exception>
        public Playback(IEnumerable <ITimedObject> timedObjects, TempoMap tempoMap, IOutputDevice outputDevice, MidiClockSettings clockSettings = null)
            : this(timedObjects, tempoMap, clockSettings)
        {
            ThrowIfArgument.IsNull(nameof(outputDevice), outputDevice);

            OutputDevice = outputDevice;
        }
예제 #9
0
 /// <summary>
 /// Prints this module's info to the specified output device
 /// </summary>
 /// <param name="outputDevice">The device to write to</param>
 /// <param name="init">Is the session just starting?</param>
 public void PrintInfo(IOutputDevice outputDevice, bool init)
 {
     if (!init)
     {
         outputDevice.WriteStaticLine($"$whiteModule $green{Name} $whiteversion $yellow{Version}");
     }
 }
예제 #10
0
 public static void Unlock(this IOutputDevice outputDevice)
 {
     if (Monitor.IsEntered(outputDevice.Locking))
     {
         Monitor.Exit(outputDevice.Locking);
     }
 }
예제 #11
0
        private bool cmd_hash(CommandContext ctx, Command cmd, IOutputDevice outputDevice)
        {
            if (!ctx.Engine.ExecuteCommand("scan") || ctx.LocatedGame == null)
            {
                return(false);
            }

            foreach (var file in ctx.LocatedGame.ScanData.KeyFiles)
            {
                if (!File.Exists(file.Path))
                {
                    continue;
                }

                var md5    = MD5.Create();
                var stream = File.OpenRead(file.Path);
                var hash   = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower();

                outputDevice.WriteStaticLine($"$grayCurrent hash for $white{file.Path}:");
                outputDevice.WriteStaticLine($"$gray{hash}");
                outputDevice.WriteStaticLine("");
                outputDevice.WriteStaticLine($"$grayKnown hash for $white{file.Path}:");
                outputDevice.WriteStaticLine($"$gray{(string.IsNullOrEmpty(file.Hash) ? "Unknown" : file.Hash)}");
                outputDevice.WriteStaticLine("");

                if (cmd.SimpleArgs.Length > 0 && cmd.SimpleArgs[0] == "save")
                {
                    // TODO: Update and save in uMod.Manifest.json
                }
            }

            return(true);
        }
예제 #12
0
 public ShowClientsWithBlackStatusStrategy(ILoggerService loggerService, IClientManager clientManager, ITableDrawer tableDrawer, IOutputDevice outputDevice)
 {
     this.loggerService = loggerService;
     this.clientManager = clientManager;
     this.tableDrawer   = tableDrawer;
     this.outputDevice  = outputDevice;
 }
        private XElement _WriteDisabledController(IOutputDevice controllerDevice)
        {
            XElement element = new XElement(ELEMENT_CONTROLLER,
                                            new XAttribute(ATTR_ID, controllerDevice.Id));

            return(element);
        }
예제 #14
0
        public FaderPort()
        {
            _inputDevice  = InputDevice.GetByName("FaderPort");
            _outputDevice = OutputDevice.GetByName("FaderPort");

            if (_inputDevice == null)
            {
                throw new InvalidOperationException("Unable to connect to FaderPort input device.");
            }

            if (_outputDevice == null)
            {
                throw new InvalidOperationException("Unable to connect to FaderPort output device.");
            }

            _inputDevice.EventReceived += OnInputEvent;
            _inputDevice.StartEventsListening();
            _outputDevice.PrepareForEventsSending();

            var nativeEvent = new NoteOnEvent((SevenBitNumber)0, (SevenBitNumber)0x64)
            {
                Channel = (FourBitNumber)1
            };

            Console.WriteLine("Switching FaderPort to native mode.");
            _outputDevice.SendEvent(nativeEvent);
            ClearAllLights();

            _cts           = new CancellationTokenSource();
            _blinkerThread = new Thread(BlinkerMain);
            _blinkerThread.Start();
        }
예제 #15
0
 public CommandParser(
     IOutputDevice outputDevice,
     ILoggerService loggerService)
 {
     this.outputDevice  = outputDevice;
     this.loggerService = loggerService;
 }
예제 #16
0
        private bool cmd_cd(CommandContext ctx, Command cmd, IOutputDevice outputDevice)
        {
            if (cmd.SimpleArgs.Length == 0)
            {
                ctx.WorkingDirectory = Path.GetFullPath(".");
            }
            else
            {
                var newPath = Path.Combine(ctx.WorkingDirectory, string.Join(" ", cmd.SimpleArgs));
                if (File.Exists(newPath))
                {
                    outputDevice.WriteStaticLine($"$red{Path.GetFileName(newPath)} is a file!");
                }
                else if (!Directory.Exists(newPath))
                {
                    outputDevice.WriteStaticLine($"$red{Path.GetFileName(newPath)} does not exist!");
                }
                else
                {
                    newPath = Path.GetFullPath(newPath);
                    var lastC = newPath[newPath.Length - 1];
                    if (lastC == '\\' || lastC == '/')
                    {
                        newPath = newPath.Substring(0, newPath.Length - 1);
                    }
                    ctx.WorkingDirectory = newPath;
                }
            }

            return(true);
        }
예제 #17
0
        public void SetOutputDevice(IOutputDevice outputDevice)
        {
            if (_outputDevice != null && _outputDevice.IsOpen)
            {
                _outputDevice.Close();
            }

            if (outputDevice != null)
            {
                _outputDevice        = outputDevice;
                _device.OutputDevice = _outputDevice;

                if (!_outputDevice.IsOpen)
                {
                    _outputDevice.Open();
                }
            }
            else
            {
                _outputDevice        = null;
                _device.OutputDevice = null;
            }

            OnPropertyChanged(nameof(OutputDevice));
        }
        /// <summary>
        /// Retrieves an instance of the <see cref="Playback"/> for playing MIDI events contained in
        /// the specified <see cref="MidiFile"/>.
        /// </summary>
        /// <param name="midiFile"><see cref="MidiFile"/> containing events to play.</param>
        /// <param name="outputDevice">Output MIDI device to play events through.</param>
        /// <param name="clockSettings">Settings of the internal playback's clock.</param>
        /// <returns>An instance of the <see cref="Playback"/> for playing MIDI events contained in
        /// the <paramref name="midiFile"/>.</returns>
        /// <exception cref="ArgumentNullException">
        /// <para>One of the following errors occured:</para>
        /// <list type="bullet">
        /// <item>
        /// <description><paramref name="midiFile"/> is <c>null</c>.</description>
        /// </item>
        /// <item>
        /// <description><paramref name="outputDevice"/> is <c>null</c>.</description>
        /// </item>
        /// </list>
        /// </exception>
        public static Playback GetPlayback(this MidiFile midiFile, IOutputDevice outputDevice, MidiClockSettings clockSettings = null)
        {
            ThrowIfArgument.IsNull(nameof(midiFile), midiFile);
            ThrowIfArgument.IsNull(nameof(outputDevice), outputDevice);

            return(GetPlayback(midiFile.GetTrackChunks(), midiFile.GetTempoMap(), outputDevice, clockSettings));
        }
예제 #19
0
 /// <summary>
 /// 参考ストリームを再生するために出力の再初期化が必要かどうか
 /// </summary>
 /// <param name="outputChannel">出力チャンネル</param>
 /// <param name="freq">サンプリング周波数</param>
 /// <param name="chans">チャンネル数</param>
 /// <param name="useFloat">データ型が浮動小数点(float)かどうか</param>
 /// <returns>再構成が必要かどうか</returns>
 public static bool RebuildRequired(IOutputDevice outputChannel, uint freq, uint chans, bool useFloat)
 {
     if (outputChannel == null || outputChannel.Freq != freq || outputChannel.Chans != chans)
     {
         return(true);
     }
     return(false);
 }
예제 #20
0
 public Computer(IOutputDevice outputDevice, BoardSide boardNum, Player opponent = null, bool afterLoad = false) : base(boardNum, Players.Computer, opponent, outputDevice)
 {
     if (!afterLoad)
     {
         AddShips();
     }
     _chosenDir = Enumerable.Repeat(false, 4).ToArray();
 }
예제 #21
0
 public static void TryLock(this IOutputDevice outputDevice, out bool lockTaken)
 {
     lockTaken = Monitor.IsEntered(outputDevice.Locking);
     if (!lockTaken)
     {
         Monitor.TryEnter(outputDevice.Locking, ref lockTaken);
     }
 }
예제 #22
0
 public SerialPortWatcher(IInvoker invoker, IOutputDevice output)
     : base(invoker, output)
 {
     foreach (var port in ComPort.GetComPorts())
     {
         Devices.Add(port);
     }
 }
예제 #23
0
파일: Game.cs 프로젝트: JacDev/Battleship
 public Game(ChosenLanguageModel chosenLanguage, IOutputDevice outputDevice, IInputDevice inputDevice)
 {
     _chosenLanguage = chosenLanguage;
     _outputDevice   = outputDevice;
     _inputDevice    = inputDevice;
     _canLoadGame    = false;
     MakeGame();
 }
예제 #24
0
 public OutputDeviceTypeInfo(string assemblyQualifiedTypeName, string typeName, string typeFullName
                             , string sourceFileName, object tag
                             , IOutputDevice componentExample)
     : base(assemblyQualifiedTypeName, typeName, typeFullName
            , componentExample.DefaultName, componentExample.Version, componentExample.Author, componentExample.Description
            , sourceFileName, tag)
 {
 }
예제 #25
0
 public ReadClientsStrategy(
     IOutputDevice outputDevice,
     IHttpRequestManager httpRequestManager,
     IInputDevice inputDevice)
 {
     this.inputDevice        = inputDevice;
     this.outputDevice       = outputDevice;
     this.httpRequestManager = httpRequestManager;
 }
        public void Init()
        {
            _compoundStrategy = MockRepository.GenerateMock <ICompoundStrategy>();
            _repository       = MockRepository.GenerateMock <IRepository>();
            _outputDevice     = MockRepository.GenerateMock <IOutputDevice>();
            _loanMatcher      = MockRepository.GenerateMock <ILoanMatcher>();

            _calculator = new Calculator(_compoundStrategy, _repository, _outputDevice, _loanMatcher);
        }
 public TransacactionsStrategy(
     IOutputDevice outputDevice,
     IHttpRequestManager httpRequestManager,
     IInputDevice inputDevice)
 {
     this.inputDevice        = inputDevice;
     this.outputDevice       = outputDevice;
     this.httpRequestManager = httpRequestManager;
 }
예제 #28
0
 public BalancesStrategy(
     IOutputDevice outputDevice,
     IHttpRequestManager httpRequestManager,
     IInputDevice inputDevice)
 {
     this.outputDevice       = outputDevice;
     this.httpRequestManager = httpRequestManager;
     this.inputDevice        = inputDevice;
 }
예제 #29
0
 public HardwareUpdateThread(IOutputDevice outputDevice)
 {
     OutputDevice = outputDevice;
     _thread = new Thread(_ThreadFunc) {Name = string.Format("{0} update", outputDevice.Name), IsBackground = true};
     _finished = new EventWaitHandle(false, EventResetMode.ManualReset);
     _updateSignalerSync = new AutoResetEvent(false);
     _pauseSignal = new ManualResetEvent(true);
     _localTime = new Stopwatch();
 }
예제 #30
0
        private ControllerShape _CreateShapeFromController(IOutputDevice controller)
        {
            ControllerShape controllerShape = _MakeControllerShape(controller);

            if (controllerShape != null)
            {
                _controllerShapes.Add(controllerShape);
            }
            return(controllerShape);
        }
예제 #31
0
 public void AddBuilds(IOutputDevice outputDevice, IEnumerable<string> inputs)
 {
     Log.Information($"=> VsoMonitor[{name}] - AddBuilds({outputDevice.Name}, {inputs})");
     var buildIds = inputs.Select(i =>
     {
         var parts = i.Split(':');
         return new BuildKey(Guid.Parse(parts[0]), int.Parse(parts[1]));
     });
     buildStates.Add(outputDevice, buildIds.ToDictionary(b => b, b => BuildState.Unknown));
 }
예제 #32
0
 public static void IdleForLock(this IOutputDevice outputDevice, out bool lockTaken)
 {
     lockTaken = Monitor.IsEntered(outputDevice.Locking);
     while (!lockTaken)
     {
         Monitor.TryEnter(outputDevice.Locking, ref lockTaken);
         Application.DoEvents();
         Thread.Yield();
     }
 }
예제 #33
0
    public void Dispose()
    {
      Log.Debug("OutputDeviceManager.Dispose()");

      if (_outputDevice != null)
      {
        Log.Debug("Disposing output device");

        _outputDevice.Dispose();
        _outputDevice = null;

        Log.Debug("Disposing output device factory");
        _outputDeviceFactory.Dispose();
      }
    }
예제 #34
0
        public DelcomDeviceInfo(DelcomDevice delcomDevice, IOutputDevice configuredDevice, IOutputConfiguration delcomConfiguration)
        {
            IndicateCommand = new DelegateCommand(Indicate);

            Device = delcomDevice;

            if (configuredDevice != null)
            {
                Name = configuredDevice.Name;
                Profile = configuredDevice.Profile.Id.ToString();
            }
            else
            {
                for (int i = 0;; i++)
                {
                    var currentname = defaultName + " #" + i;
                    if (delcomConfiguration.OutputDevices.All(d => d.Name != currentname))
                    {
                        Name = currentname;
                        break;
                    }
                }
            }
        }
 public OutputDeviceSleepTimeActualValue(IOutputDevice outputDevice)
     : base(string.Format("Output device sleep time (actual) [{0}]", outputDevice.Name))
 {
 }
예제 #36
0
 private ControllerShape _CreateShapeFromController(IOutputDevice controller)
 {
     ControllerShape controllerShape = _MakeControllerShape(controller);
     if (controllerShape != null)
         _controllerShapes.Add(controllerShape);
     return controllerShape;
 }
예제 #37
0
 public OutputDeviceUpdateTimeValue(IOutputDevice outputDevice)
     : base(string.Format("Output device update time [{0}]" ,outputDevice.Name ))
 {
 }
 public OutputDeviceSleepTimeRequestedValue(IOutputDevice outputDevice)
     : base(string.Format("Output device sleep time (requested) [{0}]", outputDevice.Name ))
 {
 }
예제 #39
0
        private ControllerShape _MakeControllerShape(IOutputDevice controller)
        {
            // TODO: deal with other controller types (smart controllers)
            OutputController outputController = controller as OutputController;
            if (outputController == null)
                return null;

            ControllerShape controllerShape = (ControllerShape)project.ShapeTypes["ControllerShape"].CreateInstance();
            controllerShape.Title = controller.Name;
            controllerShape.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_NO_CONNECTIONS;
            controllerShape.FillStyle = project.Design.FillStyles["Controller"];

            diagramDisplay.InsertShape(controllerShape);
            diagramDisplay.Diagram.Shapes.SetZOrder(controllerShape, 1);
            diagramDisplay.Diagram.AddShapeToLayers(controllerShape, _visibleLayer.Id);

            if (controllerShape.DataFlowComponent != null) {
                if (!_dataFlowComponentToShapes.ContainsKey(controllerShape.DataFlowComponent))
                    _dataFlowComponentToShapes[controllerShape.DataFlowComponent] = new List<FilterSetupShapeBase>();
                _dataFlowComponentToShapes[controllerShape.DataFlowComponent].Add(controllerShape);
            }

            if (_controllerToControllerShape.ContainsKey(outputController))
                throw new Exception("controller->shape map already has an entry when it shouldn't");
            _controllerToControllerShape[outputController] = controllerShape;

            for (int i = 0; i < outputController.OutputCount; i++) {
                CommandOutput output = outputController.Outputs[i];
                OutputShape outputShape = (OutputShape)project.ShapeTypes["OutputShape"].CreateInstance();
                outputShape.SetController(outputController);
                outputShape.SetOutput(output);
                outputShape.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_WITH_CONNECTIONS;
                outputShape.FillStyle = project.Design.FillStyles["Output"];

                if (output.Name.Length <= 0)
                    outputShape.Title = String.Format("{0} [{1}]", outputController.Name, (i + 1));
                else
                    outputShape.Title = output.Name;

                diagramDisplay.InsertShape(outputShape);
                diagramDisplay.Diagram.Shapes.SetZOrder(outputShape, 2);
                diagramDisplay.Diagram.AddShapeToLayers(outputShape, _visibleLayer.Id);

                controllerShape.ChildFilterShapes.Add(outputShape);
            }

            return controllerShape;
        }
예제 #40
0
    /// <summary>
    /// Resets the outputdevice manager to its uninitialized state.
    /// </summary>
    public void ResetInputStream()
    {
      Log.Debug("OutputDeviceManager.ResetInputStream()");

      if (_initialized)
      {
        _initialized = false;

        Log.Debug("Stopping output device");

        if (_outputDevice.DeviceState == DeviceState.Started)
          _outputDevice.Stop();

        Log.Debug("Disposing output device");

        _outputDevice.Dispose();
        _outputDevice = null;
      }
    }
예제 #41
0
        private async void AddActiveDevice(IOutputConfiguration moduleConfiguration, IOutputDevice outputDevice)
        {
            var outputDeviceInfo = new DeviceViewModel(outputDevice, moduleConfiguration, globalConfig.InputDevices, mediator);

            var mapping = globalConfig.Mappings.Single(m => m.OutputDeviceId == outputDevice.Id);
            if (mapping != null)
            {
                foreach (var inputGroup in mapping.InputGroups)
                {
                    var inputDevice = globalConfig.InputDevices.Single(i => i.Id == inputGroup.InputDeviceId);
                    var inputSelector = inputSelectors[inputDevice.Key];
                    await inputSelector.SetDevice(inputDevice);
                    inputSelector.SelectInputs(inputGroup.Inputs);
                    outputDeviceInfo.InputSelectors.Add(inputSelector);
                    outputDeviceInfo.AvailableInputDevices.Remove(inputDevice);
                }
            }

            ActiveDevices.Add(outputDeviceInfo);
        }
예제 #42
0
        private OutputShape _MakeOutputShape(IOutputDevice controller, int outputIndex)
        {
            // TODO: deal with other controller types (smart controllers)
            OutputController outputController = controller as OutputController;
            if (outputController == null)
                return null;

            CommandOutput output = outputController.Outputs[outputIndex];
            OutputShape outputShape = (OutputShape) project.ShapeTypes["OutputShape"].CreateInstance();
            outputShape.SetController(outputController);
            outputShape.SetOutput(output, outputIndex);
            outputShape.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_WITH_CONNECTIONS;
            outputShape.FillStyle = project.Design.FillStyles["Output"];

            if (output.Name.Length <= 0)
                outputShape.Title = string.Format("{0} [{1}]", outputController.Name, (outputIndex + 1));
            else
                outputShape.Title = output.Name;

            diagramDisplay.InsertShape(outputShape);
            diagramDisplay.Diagram.Shapes.SetZOrder(outputShape, 2);
            diagramDisplay.Diagram.AddShapeToLayers(outputShape, _visibleLayer.Id);

            _addShapeToDataFlowMap(outputShape, _dataFlowComponentToShapes);

            return outputShape;
        }
예제 #43
0
 public IDataFlowComponent GetDataFlowComponentForOutput(IOutputDevice controller, int outputIndex)
 {
     return
         _controllerFacadeParticipants.Select(x => x.GetDataFlowComponentForOutput(controller, outputIndex)).Where(
             x => x != null).FirstOrDefault();
 }
예제 #44
0
 private ControllerShape _CreateShapeFromController(IOutputDevice controller, IEnumerable<int> outputs)
 {
     ControllerShape controllerShape = _MakeControllerShape(controller, outputs);
     _addControllerShapeToList(controllerShape, _controllerShapes);
     return controllerShape;
 }
예제 #45
0
        private ControllerShape _MakeControllerShape(IOutputDevice controller, IEnumerable<int> outputs)
        {
            // TODO: deal with other controller types (smart controllers)
            OutputController outputController = controller as OutputController;
            if (outputController == null)
                return null;

            ControllerShape controllerShape = (ControllerShape)project.ShapeTypes["ControllerShape"].CreateInstance();
            controllerShape.Title = controller.Name;
            controllerShape.Controller = controller;
            controllerShape.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_NO_CONNECTIONS;
            controllerShape.FillStyle = project.Design.FillStyles["Controller"];
            controllerShape.HeaderHeight = SHAPE_GROUP_HEADER_HEIGHT;

            diagramDisplay.InsertShape(controllerShape);
            diagramDisplay.Diagram.Shapes.SetZOrder(controllerShape, 1);
            diagramDisplay.Diagram.AddShapeToLayers(controllerShape, _visibleLayer.Id);

            _addShapeToDataFlowMap(controllerShape, _dataFlowComponentToShapes);
            _addControllerShapeToControllerMap(controllerShape, _controllerToControllerShape);

            List<int> sortedOutputs = outputs.ToList();
            sortedOutputs.Sort();

            foreach (int output in sortedOutputs) {
                _CreateOutputShape(controllerShape, output);
            }

            return controllerShape;
        }
예제 #46
0
 public void AddOutputDevice(int port, IOutputDevice device)
 {
     if (_outputDevices.ContainsKey(port))
     {
         _outputDevices.Remove(port);
     }
     _outputDevices.Add(port, device);
 }
예제 #47
0
 public void AddBuilds(IOutputDevice outputDevice, IEnumerable<string> inputs)
 {
     Log.Information($"=> TeamCityMonitor[{name}].AddBuilds");
     buildStates.Add(outputDevice, inputs.ToDictionary(b => b, b => BuildState.Unknown));
 }
예제 #48
0
 public ConfigBuilder WithOutputDevice(IOutputDevice device)
 {
     config.OutputDevices.Add(device);
     return this;
 }
예제 #49
0
 public RouletteGame(IRoulette roulette, IOutputDevice outputDevice)
 {
     _bets = new List<IBet>();
     _roulette = roulette;
     _outputDevice = outputDevice;
 }
예제 #50
0
파일: Z48IO.cs 프로젝트: EntityFX/Spectrum
 public Z48IO(IInputDevice keyboard, IOutputDevice video)
 {
     _keyboard = keyboard;
     _video = video;
 }
예제 #51
0
 public void AddOutputDevice(IOutputDevice outputDevice)
 {
     Log.Information("=> DelcomConfiguration.AddOutputDevice");
     outputDevices.Add(outputDevice);
 }
예제 #52
0
    /// <summary>
    /// Sets the Bass inputstream and initializes the outputdevice.
    /// </summary>
    /// <param name="stream">The stream delivering the input data for this output device.</param>
    /// <param name="passThrough">Sets the passthrough mode.</param>
    public void SetInputStream(BassStream stream, bool passThrough)
    {
      Log.Debug("OutputDeviceManager.SetInputStream()");

      ResetInputStream();

      Log.Debug("Instantiating output device");
      _outputDevice = _outputDeviceFactory.CreateOutputDevice();

      Log.Debug("Calling SetInputStream()");
      _outputDevice.SetInputStream(stream, passThrough);
      _initialized = true;
    }