public RunListener(IConsole console, IOutput output, TimingRunListener timer) { _console = console; _timer = timer; _output = output; _summary = new FailedSpecificationsSummary(new VerboseOutput(console), console); }
internal CommandLine(IBuildEnvironment buildEnvironment, ICmdParser cmdParser, ICmdArguments cmdArguments, IOutput output) { _buildEnvironment = buildEnvironment; _cmdParser = cmdParser; _cmdArguments = cmdArguments; _output = output; }
internal InteractiveMode(ICmdArguments cmdArguments, ISelectionMenu selectionMenu, IOutput output, IInteractiveModeMenuEntry[] interactiveModeMenuEntries) { _cmdArguments = cmdArguments; _selectionMenu = selectionMenu; _output = output; _interactiveModeMenuEntries = interactiveModeMenuEntries; }
public Server( IHttpListener listener, IEndpointProvider endpointProvider, IOutput output, ISoapDecoder soapDecoder, ILogger logger, IContentTypeProvider contentTypeProvider, IWebRequestFactory webRequestFactory) { this.listener = listener; this.endpointProvider = endpointProvider; this.output = output; this.soapDecoder = soapDecoder; this.logger = logger; this.contentTypeProvider = contentTypeProvider; this.webRequestFactory = webRequestFactory; try { listener.Prefixes.Add(endpointProvider.ServerBaseUrl); } catch (ArgumentException ex) { throw new FailException( string.Format( "While attempting to listen on URL '{1}': {0}", ex.Message, endpointProvider.ServerBaseUrl), ex); } logger.Info("Listening on: {0}", endpointProvider.ServerBaseUrl); }
public Interpreter(CPU cpu, Memory memory, Random random, IOutput output) { _cpu = cpu; _memory = memory; _random = random; _output = output; }
public SlackService([NotNull] IOutput output, [NotNull] string webHookSubUrl) { if (output == null) throw new ArgumentNullException("output"); if (webHookSubUrl == null) throw new ArgumentNullException("webHookSubUrl"); this.output = output; this.webHookSubUrl = webHookSubUrl; }
public ChangelogBuilder([NotNull] ReleaseDirInfo[] releaseDirs, [NotNull] IOutput output) { if (releaseDirs == null) throw new ArgumentNullException("releaseDirs"); if (output == null) throw new ArgumentNullException("output"); this.releaseDirs = releaseDirs; this.output = output; }
public RaceModule(IRaceData raceDataStream, IOutput output) { Before += ctx => { String message = String.Format("{0} : [Host: {1}] {2}", DateTime.Now, ctx.Request.UserHostAddress, ctx.Request.Url.ToString()); output.WriteLine(message); String token = ctx.Request.Headers["X-Hamstring-Token"].SingleOrDefault(); if (token == null || token.Trim() != SERVICE_TOKEN) { output.WriteLine("=== ACCESS DENIED ==="); return HttpStatusCode.Forbidden; } return ctx.Response; }; Get["/races"] = routeParameters => { var races = raceDataStream.UpcomingRaces(); return Response.AsJson(races); }; After += ctx => { //http://en.wikipedia.org/wiki/List_of_HTTP_header_fields ctx.Response.Headers.Add("X-Powered-By", "HamstringFX.RaceService"); ctx.Response.Headers.Add("X-Version", "1.0"); }; }
public void Report(IOutput output) { foreach (var q in _qs) { output.Out(q.ToString()); } }
/// <summary> /// Creates a new recording session object /// </summary> /// <param name="midiInput">Expected to be injected</param> public RecordSession(IMidiInput midiInput, IOutput output, IVirtualKeyBoard virtualKeyboard) { _midiInput = midiInput; _output = output; _virtualKeyboard = virtualKeyboard; Init(); }
private static void SerializableWriter( IOutput output, object obj ) { SerializationInfo info = new SerializationInfo( obj.GetType( ), new FormatterConverter( ) ); ( ( ISerializable )obj ).GetObjectData( info, output.Context ); output.WriteSerializationInfo( info, info.FullTypeName != obj.GetType().FullName ); }
public void Report(IOutput output) { JavaScriptSerializer s = new JavaScriptSerializer(); string serialize = s.Serialize(_qs); output.Out(serialize); }
/// <summary> /// This method is called whenever the value of a output in the Outputs property changes its value.<br /> /// It updates the internal arry holding the values for the DMX channels of the universe specified. /// </summary> /// <param name="Output">The output.</param> /// <exception cref="System.Exception">The OutputValueChanged event handler for ArtNet node {0} (controlling Dmx universe {1}) has been called by a sender which is not a DmxOutput..Build(Name, Universe)</exception> /// <exception cref="System.ArgumentOutOfRangeException">ArtNet node {0} has received a update for a illegal dmx channel number ({1})..Build(Name, O.DmxChannel)</exception> public override void OnOutputValueChanged(IOutput Output) { if (!(Output is DMXOutput)) { throw new Exception("The OutputValueChanged event handler for ArtNet node {0} (controlling Dmx universe {1}) has been called by a sender which is not a DmxOutput.".Build(Name, Universe)); } DMXOutput O = (DMXOutput)Output; if (!O.DmxChannel.IsBetween(1, 512)) { Log.Exception("ArtNet node {0} has received a update for a illegal dmx channel number ({1}).".Build(Name, O.DmxChannel)); throw new ArgumentOutOfRangeException("ArtNet node {0} has received a update for a illegal dmx channel number ({1}).".Build(Name, O.DmxChannel)); } lock (UpdateLocker) { if (DMXData[O.DmxChannel - 1] != O.Value) { DMXData[O.DmxChannel - 1] = O.Value; if (O.DmxChannel > LastDMXChannel) { LastDMXChannel = O.DmxChannel; } UpdateRequired = true; } } }
public MsDeployPackage(ILog log, IShell shell, TemplateConfigurer config, IOutput output) { _log = log; _shell = shell; _config = config; _output = output; }
public int SuggestPotentialPreconditions(IOutput output) { Contract.Requires(output != null); Contract.Ensures(Contract.Result<int>() >= 0); return 0; }
public void EvaluateFormat(object current, Format format, ref bool handled, IOutput output, FormatDetails formatDetails) { if (format != null && format.HasNested) return; var formatText = format != null ? format.Text : ""; TimeSpan fromTime; if (current is TimeSpan) { fromTime = (TimeSpan)current; } else if (current is DateTime && formatText.StartsWith("timestring")) { formatText = formatText.Substring(10); fromTime = DateTime.Now.Subtract((DateTime)current); } else { return; } var timeTextInfo = GetTimeTextInfo(formatDetails.Provider); if (timeTextInfo == null) { return; } var formattingOptions = TimeSpanFormatOptionsConverter.Parse(formatText); var timeString = TimeSpanUtility.ToTimeString(fromTime, formattingOptions, timeTextInfo); output.Write(timeString, formatDetails); handled = true; }
public Cpu(IMemory memory, IInput input, IOutput output) { _memory = memory; In = input; Out = output; Registers = new byte[16]; Commands = new Dictionary<byte, Command> { {0x01, new IncCommand(this)}, {0x02, new DecCommand(this)}, {0x03, new MovCommand(this)}, {0x04, new MovcCommand(this)}, {0x05, new LslCommand(this)}, {0x06, new LsrCommand(this)}, {0x07, new JmpCommand(this)}, {0x0A, new JfeCommand(this)}, {0x0B, new RetCommand(this)}, {0x0C, new AddCommand(this)}, {0x0D, new SubCommand(this)}, {0x0E, new XorCommand(this)}, {0x0F, new OrCommand(this)}, {0x10, new InCommand(this)}, {0x11, new OutCommand(this)} }; }
/// <summary> /// RunState constructor. /// </summary> /// <param name="modelState">Model state.</param> /// <param name="output">Output implementation.</param> public RunState( ModelState modelState, IOutput output) { this.ModelState = modelState; this.Output = output; }
internal ResultResponse(ResponseFrame frame) : base(frame) { Kind = (ResultResponseKind) BEBinaryReader.ReadInt32(); switch (Kind) { case ResultResponseKind.Void: Output = new OutputVoid(TraceID); break; case ResultResponseKind.Rows: Output = new OutputRows(BEBinaryReader, frame.RawStream is BufferedProtoBuf, TraceID); break; case ResultResponseKind.SetKeyspace: Output = new OutputSetKeyspace(BEBinaryReader.ReadString()); break; case ResultResponseKind.Prepared: Output = new OutputPrepared(BEBinaryReader); break; case ResultResponseKind.SchemaChange: Output = new OutputSchemaChange(BEBinaryReader, TraceID); break; default: throw new DriverInternalError("Unknown Event Type"); } }
public OutputLogViewModel(IOutput writer, OutputLog control) { // Store values. Writer = writer; Control = control; // Create objects. Strings = new StringLibrary(); Lines = new ObservableCollection<OutputLineViewModel>(); scrollDelay = new DelayedAction(0.1, ScrollToBottom); // Create brushes. dividerColor = new SolidColorBrush(Colors.Black) { Opacity = 0.1 }; lineBreakColor = new SolidColorBrush(Color.FromArgb(255, 255, 0, 228)) { Opacity = 0.4 }; // Create commands. ClearCommand = new DelegateCommand<Button>(m => Clear(), m => IsClearButtonEnabled); // Wire up events. writer.WrittenTo += HandleWrittenTo; writer.Cleared += delegate { Clear(); }; writer.BreakInserted += delegate { InsertBreak(); }; // Finish up. UpdateLineMargin(); }
public SocketSniffer(NetworkInterfaceInfo nic, Filters<IPPacket> filters, IOutput output) { this.outputQueue = new BlockingCollection<TimestampedData>(); this.filters = filters; this.output = output; this.bufferManager = new BufferManager(BUFFER_SIZE, MAX_RECEIVE); this.receivePool = new ConcurrentStack<SocketAsyncEventArgs>(); var endPoint = new IPEndPoint(nic.IPAddress, 0); // IPv4 this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP); this.socket.Bind(endPoint); this.socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.HeaderIncluded, true); // Enter promiscuous mode try { this.socket.IOControl(IOControlCode.ReceiveAll, BitConverter.GetBytes(1), new byte[4]); } catch (Exception ex) { Console.WriteLine("Unable to enter promiscuous mode: {0}", ex); throw; } }
private void InitOutputs(Cabinet Cabinet) { if (Cabinet.Outputs.Contains(OutputNameRed)) { _OutputRed = Cabinet.Outputs[OutputNameRed]; } else { _OutputRed = null; } if (Cabinet.Outputs.Contains(OutputNameGreen)) { _OutputGreen = Cabinet.Outputs[OutputNameGreen]; } else { _OutputGreen = null; } if (Cabinet.Outputs.Contains(OutputNameBlue)) { _OutputBlue = Cabinet.Outputs[OutputNameBlue]; } else { _OutputBlue = null; } }
internal BuildHeaderWriter(IClock clock, IBuildEnvironment buildEnvironment, IOutput output, ICmdArguments cmdArguments) { _clock = clock; _buildEnvironment = buildEnvironment; _output = output; _cmdArguments = cmdArguments; }
public bool Execute(string subject, IQueueTools tools, IOutput log) { IEnumerable<QueueDescriptor> queueDescriptors; if(_options.Public) { queueDescriptors = tools.GetPublicQueuesByMachine(_options.Machine, TransactionFromFlags(_options.Transactional, _options.NonTransactional)); } else { queueDescriptors = tools.GetPrivateQueues(_options.Machine, TransactionFromFlags(_options.Transactional, _options.NonTransactional)); } if(!string.IsNullOrEmpty(_options.Filter)) { queueDescriptors = Filter(_options.Filter, queueDescriptors); } IReporter r; if(!string.IsNullOrEmpty(_options.DumpFile)) { r = new JsonFileReporter(queueDescriptors, _options.DumpFile); } else { r = new LineReporter(queueDescriptors); } r.Report(log); return true; }
public ScoreControl(IUnityContainer container, IOutput output, IMidiInput midiInput, IInputEvents inputEvents, IMediaServiceHost mediaServiceHost, IVirtualKeyBoard virtualKeyboard, ILogger logger, XScore musicScore) : this() { _container = container; _output = output; _intputEvents = inputEvents; _midiInput = midiInput; _virtualKeyboard = virtualKeyboard; _musicScore = musicScore; _mediaServiceHost = mediaServiceHost; _logger = logger; _updateScrollTimer = new Timer(ScrollTimerHandler, null, Timeout.Infinite, _scrollTimingPerdiod); _scoreParser = new ScoreParser(_musicScore, ScoreGrid); _scoreParser.Render(); ScoreGrid.Width = _scoreParser.GetMaxHorizontalPosition(); nextBarDetails = new BarDetails(); nextBarDetails.NoteTime = 0; nextBarDetails.XCoord = 0; _intputEvents.MessageReceived += HandleInputEvent; _midiInput.StartRecording(); ConfigureSongEventController(); }
internal ResultResponse(Frame frame) : base(frame) { //Handle result flags if ((frame.Header.Flags & FrameHeader.HeaderFlag.Warning) != 0) { Warnings = Reader.ReadStringList(); } if ((frame.Header.Flags &FrameHeader.HeaderFlag.CustomPayload) != 0) { CustomPayload = Reader.ReadBytesMap(); } Kind = (ResultResponseKind) Reader.ReadInt32(); switch (Kind) { case ResultResponseKind.Void: Output = new OutputVoid(TraceId); break; case ResultResponseKind.Rows: Output = new OutputRows(frame.Header.Version, Reader, TraceId); break; case ResultResponseKind.SetKeyspace: Output = new OutputSetKeyspace(Reader.ReadString()); break; case ResultResponseKind.Prepared: Output = new OutputPrepared(frame.Header.Version, Reader); break; case ResultResponseKind.SchemaChange: Output = new OutputSchemaChange(Reader, TraceId); break; default: throw new DriverInternalError("Unknown ResultResponseKind Type"); } }
/// <summary> /// Saves a named field, by accessing its value using reflection /// </summary> public static void SaveNamedField( IOutput output, RuntimeTypeHandle objTypeHandle, object obj, string fieldName ) { Type objType = Type.GetTypeFromHandle( objTypeHandle ); FieldInfo fieldInfo = objType.GetField( fieldName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance ); object field = fieldInfo.GetValue( obj ); output.Write( field ); }
public bool Execute(string subject, IQueueTools tools, IOutput log) { foreach(var m in tools.Tail(subject)) { log.Out(m.ToString()); } return true; }
public void Format(IOutput output, CommandMapper commandMapper, IEnumerable<IParameterMapper> mappers, ICommandParameterParser parser) { foreach (var line in this.Format(commandMapper, mappers, parser)) { output.WriteLine(line); } }
public PruneHistoryCommand(IOutput output, IDuplicateFinder duplicateFinder, IRememberHashCodes history) { DuplicateFinder = duplicateFinder; _output = output; History = history; }
//============================================================ // <T>序列化内容到输出流内。</T> // // @param output 输出流 //============================================================ public void Serialize(IOutput output) { InnerSerialize(output, this); }
/// <summary> /// Constructor added for testing purpose /// </summary> /// <param name="output"></param> internal ConsoleLogger(IOutput output) { ConsoleLogger.Output = output; }
/// <summary> /// Generates the OUTPUT clause. /// </summary> /// <param name="prev">A predecessor object.</param> /// <param name="columns">Are specified columns in OUTPUT clause. If null, then output clause is omitted.</param> public static OutputChainer Output(this IOutput prev, params Column[] columns) { return(new OutputChainer((Chainer)prev, columns, null)); }
public FastCharger(IOutput output) { this.output = output; }
public void process(IOutput output) { throw new NotImplementedException(); }
public override void PartOne(IInput input, IOutput output) { var elves = int.Parse(input.Content.AsSpan()); var elf = PlayGame(elves); output.WriteProperty("Elf", elf);
/// Method to be implemented in sub-classes for retrieving the state of /// process unit(s) represented by the ProcessUnits. protected abstract void GetProcessState(ProcessUnits slice, IOutput output);
//============================================================ // <T>序列化内容到输出流。</T> // // @param output 输出流 //============================================================ public override void OnSerialize(IOutput output) { base.OnSerialize(output); }
internal Executor(IOutput output, ITestPlatformEventSource testPlatformEventSource) { this.Output = output; this.testPlatformEventSource = testPlatformEventSource; this.showHelp = true; }
public CommandLineHelpCommand(ICommandRepository commandRepository, IOutput output) { CommandRepository = commandRepository; Output = output; }
/// Method to be implemented in sub-classes for setting the state of /// process unit(s) represented by the ProcessUnits. protected void SetProcessState(ProcessUnits slice, EProcessAction action, ERole role, EProcessState targetState, string annotation, IEnumerable <string> documents, bool consolidateIfNeeded, IOutput output) { string[] paths = null, files = null; int processed = 0, skipped = 0, errored = 0, invalid = 0; EProcessState state; _security.CheckPermissionFor(ETask.ProcessManagement); if (role != ERole.Default) { _security.CheckRole(role); } // Convert document references if (documents != null) { var docs = documents.ToArray(); paths = new string[docs.Length]; files = new string[docs.Length]; for (int i = 0; i < docs.Length; ++i) { paths[i] = Path.GetDirectoryName(docs[i]); files[i] = Path.GetFileName(docs[i]); } } // Iterate over process units, performing action var PUs = GetProcessUnits(slice); output.InitProgress("Processing " + action.ToString(), PUs.Length); foreach (var pu in PUs) { var access = _security.GetProcessUnitAccessRights(pu, out state); if (state == targetState) { _log.FineFormat("{1} {2} is already at {2}", ProcessUnitType, pu, targetState); skipped++; } else if (IsValidStateTransition(action, pu, state, targetState) && HasSufficientAccess(action, pu, access, state) && CanAction(action, pu, consolidateIfNeeded, output)) { try { SetProcessState(pu, action, targetState, annotation, paths, files); processed++; } catch (HFMException ex) { _log.Error(string.Format("Unable to {0} {1} {2}", action, ProcessUnitType, pu), ex); errored++; } } else { invalid++; } if (output.IterationComplete()) { break; } } output.EndProgress(); _log.InfoFormat("Results for {0} of {1} {2}s: {3} successful, {4} skipped, {5} errored, {6} invalid", action, PUs.Length, ProcessUnitType, processed, skipped, errored, invalid); if (errored > 0) { throw new Exception(string.Format("Failed to {0} {1} {2}s", action, errored, ProcessUnitType)); } }
// To be able to change the status of a process unit, it needs to be: // unlocked, calculated, and valid protected bool CanAction(EProcessAction action, POV pu, bool consolidateIfNeeded, IOutput output) { bool ok = true; if (action == EProcessAction.Promote || action == EProcessAction.SignOff || action == EProcessAction.Submit || action == EProcessAction.Approve || action == EProcessAction.Publish) { ok = CheckCalcStatus(action, pu, consolidateIfNeeded, output); ok = ok && CheckValidationStatus(action, pu); } return(ok); }
protected bool CheckCalcStatus(EProcessAction action, POV pu, bool consolidateIfNeeded, IOutput output) { bool ok = false; var calcStatus = _session.Data.GetCalcStatus(pu); if (_log.IsDebugEnabled) { var cs = StringUtilities.Join(ECalcStatusExtensions.GetCellStatuses(calcStatus), ", "); _log.DebugFormat("Process unit calculation status for {0}: ({1})", pu, cs); } if (ECalcStatus.OK.IsSet(calcStatus) || ECalcStatus.OKButSystemChanged.IsSet(calcStatus) || ECalcStatus.NoData.IsSet(calcStatus)) { if (ECalcStatus.Locked.IsSet(calcStatus)) { _log.ErrorFormat("Cannot {0} {1} {2} as it has been locked", action, ProcessUnitType, pu); } else { _log.TraceFormat("Calculation status check passed for {0} of {1}", action, pu); ok = true; } } else if (consolidateIfNeeded) { if (ECalcStatus.NeedsCalculate.IsSet(calcStatus)) { _session.Calculate.CalculatePOV(pu, false); } else { _session.Calculate.ConsolidatePOV(pu, EConsolidationType.Impacted, output); } ok = true; } else { _log.ErrorFormat("Cannot {0} {1} {2} until it has been consolidated", action, ProcessUnitType, pu); } return(ok); }
public void Setup() { output = Substitute.For <IOutput>(); uut = new Display(output); }
protected BasicSpeaker(int lowestDmp, int highestDmp, double power, int amount, IOutput output) { LowestDmp = lowestDmp; HighestDmp = highestDmp; Power = power; Amount = amount; Output = output; }
/// Method to be implemented in sub-classes for retrieving the state of /// process unit(s) represented by the ProcessUnits. protected abstract void GetHistory(POV processUnit, IOutput output);
/// <summary> /// Initializes a new instance of the <see cref="TestableBlameLogger"/> class. /// </summary> /// <param name="output"> /// The output. /// </param> /// <param name="blameReaderWriter"> /// The blame Reader Writer. /// </param> internal TestableBlameLogger(IOutput output, IBlameReaderWriter blameReaderWriter) : base(output, blameReaderWriter) { }
public void EnumProcessState(ProcessUnits slice, IOutput output) { GetProcessState(slice, output); }
internal TestableEnableBlameArgumentExecutor(IRunSettingsProvider runSettingsManager, IEnvironment environment, IOutput output) : base(runSettingsManager, environment) { this.Output = output; }
public TrafficLight(ITrafficLight trafficLight, IInput input, IOutput output) { _trafficLight = trafficLight; _input = input; _output = output; }
public override void PartOne(IInput input, IOutput output) { var nextPassword = PasswordGenerator.GeneratePassword(input.Content.AsString()); output.WriteProperty("Next password", nextPassword); }
private static ListFullyQualifiedTestsArgumentExecutor GetExecutor(ITestRequestManager testRequestManager, IOutput output) { var runSettingsProvider = new TestableRunSettingsProvider(); runSettingsProvider.AddDefaultRunSettings(); var listFullyQualifiedTestsArgumentExecutor = new ListFullyQualifiedTestsArgumentExecutor( CommandLineOptions.Instance, runSettingsProvider, testRequestManager, output ?? ConsoleOutput.Instance); return(listFullyQualifiedTestsArgumentExecutor); }
/// <summary> /// Generates the OUTPUT clause. /// </summary> /// <param name="prev">A predecessor table.</param> /// <param name="outputSource">Is a data source (Inserted or Deleted) of the OUTPUT clause.</param> /// <returns></returns> public static OutputChainer Output(this IOutput prev, OutputSource outputSource) { return(new OutputChainer((Chainer)prev, null, outputSource)); }
/// <summary> /// Finishes this instance and resets the output to its default value. /// </summary> public void Finish() { _Output = null; }
public void SetUp() { consoleOut = new StringWriter(); output = new Output(); uut = new Light(output); }
public TodayWriter(IOutput output) { this._output = output; }
public void Play(IPlayback playbackDevice, IOutput output) { output.WriteLine("Play sound in Mobile"); playbackDevice.Play(); }
/// <summary> /// Default constructor. /// </summary> public Executor(IOutput output) : this(output, TestPlatformEventSource.Instance) { }
public PowerTube(IOutput output) { myOutput = output; }
private void BtnReset_Click(object sender, RoutedEventArgs e) { //txtPreview.Text = ""; txtSource.Text = ""; output = null; }