public void Write(string text, string additionalInformation, OutputTypes outputTypes) { string output = String.Format("[{0}] {1} : {2}\r\n", EnumReader.GetText(outputTypes), DateTime.Now.ToLongTimeString(), text); File.AppendAllText(filename, output); }
/// <summary> /// Overload constructor with parameters. /// </summary>> public ExportReport(long projectId, Guid?projectUid, LiftBuildSettings liftBuildSettings, FilterResult filter, long filterID, Guid?callid, bool cellSizeRq, string callerID, CoordType coordtype, DateTime dateFromUTC, DateTime dateToUTC, double tolerance, bool timeStampRequired, bool restrictSize, bool rawData, BoundingExtents3D prjExtents, bool precheckOnly, OutputTypes outpuType, Machine[] machineList, bool includeSrvSurface, string fileName, ExportTypes exportType, UserPreferences userPrefs) { ProjectId = projectId; ProjectUid = projectUid; LiftBuildSettings = liftBuildSettings; Filter = filter; FilterID = filterID; CallId = callid; CellSizeRequired = cellSizeRq; CallerId = callerID; CoordType = coordtype; DateFromUTC = dateFromUTC; DateToUTC = dateToUTC; ExportType = exportType; Filename = fileName; IncludeSurveydSurface = includeSrvSurface; MachineList = machineList; OutputType = outpuType; Precheckonly = precheckOnly; ProjectExtents = prjExtents; RawData = rawData; RestrictSize = restrictSize; TimeStampRequired = timeStampRequired; Tolerance = tolerance; UserPrefs = userPrefs; }
private List <IClientLeafSubGrid> GetSubGrids(CoordType coordType, OutputTypes outputType, bool isRawDataAsDBaseRequired, out CSVExportRequestArgument requestArgument, out ISiteModel siteModel, string tagFileDirectory = "ElevationMappingMode-KettlewellDrive") { siteModel = SetupSiteAndRequestArgument(coordType, outputType, isRawDataAsDBaseRequired, tagFileDirectory, out requestArgument); var overrides = requestArgument.Overrides; var liftParams = requestArgument.LiftParams; var utilities = DIContext.Obtain <IRequestorUtilities>(); var gridDataType = outputType == OutputTypes.PassCountLastPass || outputType == OutputTypes.VedaFinalPass ? GridDataType.CellProfile : GridDataType.CellPasses; var requestors = utilities.ConstructRequestors(null, siteModel, requestArgument.Overrides, requestArgument.LiftParams, utilities.ConstructRequestorIntermediaries(siteModel, requestArgument.Filters, false, gridDataType), AreaControlSet.CreateAreaControlSet(), siteModel.ExistenceMap); requestors.Should().NotBeNull(); requestors.Length.Should().Be(1); // Request sub grids from the model var requestedSubGrids = new List <IClientLeafSubGrid>(); siteModel.ExistenceMap.ScanAllSetBitsAsSubGridAddresses(x => { var requestSubGridInternalResult = requestors[0].RequestSubGridInternal(x, true, false); if (requestSubGridInternalResult.requestResult == ServerRequestResult.NoError) { requestedSubGrids.Add(requestSubGridInternalResult.clientGrid); } }); requestedSubGrids.Count.Should().Be(tagFileDirectory == "ElevationMappingMode-KettlewellDrive" ? 18 : 9); return(requestedSubGrids); }
public HMIMushroomButton() { this.TextRectangle = new Rectangle(); this.m_ButtonColor = ButtonColors.RedMushroom; this.m_LegendPlate = LegendPlates.Large; this.m_OutputType = OutputTypes.MomentarySet; this.sf = new StringFormat(); this.TextBrush = new SolidBrush(Color.Black); }
public CodecCapabilities(int maxWidth, int maxHeight, int[] depths, int[] passes, OutputTypes output) { this.maxWidth = maxWidth; this.maxHeight = maxHeight; this.depths = depths; this.passes = passes; this.outputTypes = output; }
/// <param name="outputSelection">Defaults to all output types if not specified</param> public OutputDescription Compile(string[] contractFilePaths, OutputType?outputSelection = null, CompileErrorHandling errorHandling = CompileErrorHandling.ThrowOnError, Dictionary <string, string> soliditySourceFileContent = null) { var outputs = outputSelection == null ? OutputTypes.All : OutputTypes.GetItems(outputSelection.Value); return(Compile(contractFilePaths, outputs, errorHandling, soliditySourceFileContent)); }
/// <summary> /// Fetches the appropriate object file writer for the specified object type. /// </summary> /// <param name="outType">The type of file to output.</param> /// <returns>A data writer for that file type.</returns> public IObjectFileWriter GetWriterForObjectType(OutputTypes outType) { if (!m_WriterTypes.TryGetValue(outType, out IObjectFileWriter writer)) { throw new ArgumentException("Unsupported output type passed to GetWriterForObjectType"); } return(writer); }
protected void ManagerThreadMethod() { OutputTypes prevOutputType = OutputTypes.NONE; while (Running) { try { // Depending on current control set, pick right agent var newOutputType = BFFManager.CurrentControlSet.ProcessDescriptor.OutputType; if (newOutputType != prevOutputType) { prevOutputType = newOutputType; switch (newOutputType) { case OutputTypes.RAW_MEMORY_READ: // Start Rawmemory RawMemory.Start(); CurrentOutputsAgent = RawMemory; // Stop others MAMEWin.Stop(); MAMENet.Stop(); break; case OutputTypes.MAME_WIN: // Start MAME Win MAMEWin.Start(); CurrentOutputsAgent = MAMEWin; // Stop others RawMemory.Stop(); MAMENet.Stop(); break; case OutputTypes.MAME_NET: // Start MAME Net MAMENet.Start(); CurrentOutputsAgent = MAMENet; // Stop others MAMEWin.Stop(); RawMemory.Stop(); break; case OutputTypes.NONE: default: MAMENet.Stop(); MAMEWin.Stop(); RawMemory.Stop(); break; } } } catch (Exception ex) { Log("Outputs got exception " + ex.Message, LogLevels.IMPORTANT); } Thread.Sleep(64); } Log("Outputs manager terminated", LogLevels.IMPORTANT); }
public void ResultToJson() { string json = "[{\"you\":\"Dave\",\"AGE\":18},{\"you\":\"Bob\",\"AGE\":19},{\"you\":\"John\",\"AGE\":20}]"; OutputTypes outputTypes = new OutputTypes(); string val = outputTypes.ResultToJson(Reader); Assert.IsTrue(!string.IsNullOrWhiteSpace(val)); Assert.IsTrue(val == json); }
public void PassCountExportRequest_Successful( Guid projectUid, FilterResult filter, string fileName, CoordType coordType, OutputTypes outputType, bool restrictOutputSize, bool rawDataAsDBase) { var userPreferences = new UserPreferences(); var request = new CompactionPassCountExportRequest( projectUid, filter, fileName, coordType, outputType, userPreferences, restrictOutputSize, rawDataAsDBase, null, null); request.Validate(); }
private static void Write(OutputTypes outputTypes, string additionalInformation, string text, params object[] parameters) { if ((outputTypes & outputLevel) > 0) { string outputText = String.Format(text, parameters); foreach (IOutputListener listener in listeners) { listener.Write(outputText, additionalInformation, outputTypes); } } }
public void VetaExportRequest_Successful( Guid projectUid, FilterResult filter, string fileName, CoordType coordType, OutputTypes outputType, string[] machineNames) { var userPreferences = new UserPreferences(); var request = new CompactionVetaExportRequest( projectUid, filter, fileName, coordType, outputType, userPreferences, machineNames, null, null); request.Validate(); }
///<summary> ///Retrieve file extension needed for output type ///</summary> private static string OutputTypeToExtension(OutputTypes outputType) { // This will eventually have a few more. switch (outputType) { case OutputTypes.Json: return(".json"); default: return(".txt"); } }
public void Write(string text, string additionalInformation, OutputTypes outputTypes) { if (table.InvokeRequired) { WriteDelegate write = new WriteDelegate(Write); table.Invoke(write, text, additionalInformation, outputTypes); } else { Bitmap icon = new Bitmap(1, 1); Color foreColor = Color.Black; if (outputTypes == OutputTypes.Information) { icon = Resources.information16; foreColor = Color.Black; } if (outputTypes == OutputTypes.Warning) { icon = Resources.warning16; foreColor = Color.Orange; } if (outputTypes == OutputTypes.Error) { icon = Resources.error16; foreColor = Color.Red; } if (outputTypes == OutputTypes.Debug) { icon = Resources.data16; foreColor = Color.Green; } if (table.TableModel.Rows.Count > historyLength) { table.TableModel.Rows.RemoveAt(0); } Cell cellIcon = new Cell("", icon); cellIcon.Editable = false; Cell cellTimeStamp = new Cell(DateTime.Now.ToLongTimeString()); cellTimeStamp.Editable = false; cellTimeStamp.ForeColor = foreColor; Cell cellText = new Cell(text); cellText.Editable = false; cellText.ForeColor = foreColor; cellText.Tag = additionalInformation; table.TableModel.Rows.Add(new Row(new Cell[] { cellIcon, cellTimeStamp, cellText })); table.EnsureVisible(table.TableModel.Rows.Count - 1, 0); } }
public ApplicationArguments(bool shouldDisplayApplicationHelpInstructions, int numberOfMessagesToWrite, int numberOfMillisecondsToRunFor, OutputTypes outputType, string standardOutputString, string standardErrorString, int exitCode, bool shouldThrowException, string exceptionMessage, int delayBetweenMessagesInMilliseconds) { ShouldDisplayApplicationHelpInstructions = shouldDisplayApplicationHelpInstructions; NumberOfMessagesToWrite = numberOfMessagesToWrite; NumberOfMillisecondsToRunFor = numberOfMillisecondsToRunFor; OutputType = outputType; StandardOutputString = standardOutputString ?? throw new ArgumentNullException(nameof(standardOutputString)); StandardErrorString = standardErrorString ?? throw new ArgumentNullException(nameof(standardErrorString)); ExitCode = exitCode; ShouldThrowException = shouldThrowException; ExceptionMessage = exceptionMessage ?? throw new ArgumentNullException(nameof(exceptionMessage));; DelayBetweenMessagesInMilliseconds = delayBetweenMessagesInMilliseconds; }
public void VetaExportRequest_FilenameUnSuccessful( Guid projectUid, FilterResult filter, string fileName, CoordType coordType, OutputTypes outputType, string[] machineNames) { var userPreferences = new UserPreferences(); var request = new CompactionVetaExportRequest( projectUid, filter, fileName, coordType, outputType, userPreferences, machineNames, null, null); var validate = new ValidFilenameAttribute(256); var result = validate.IsValid(request.FileName); Assert.False(result); }
internal void Write(DiscoveryResult result, OutputTypes type, string outputPath, string htmlTitle) { switch (type) { case OutputTypes.Html: case OutputTypes.Xml: case OutputTypes.Json: case OutputTypes.Graphviz: if (string.IsNullOrWhiteSpace(outputPath)) { Console.Error.WriteLine($"output type {type} require specifying {nameof(outputPath)}"); return; } break; } switch (type) { case OutputTypes.Html: WriteAsHtmlToFile(result, outputPath, htmlTitle); break; case OutputTypes.Xml: WriteAsXmlToFile(result, outputPath); break; case OutputTypes.Json: WriteAsJsonToFile(result, outputPath); break; case OutputTypes.Graphviz: WriteAsGraphvizToFile(result, outputPath); break; case OutputTypes.ConsoleJson: WriteAsJsonToConsole(result); break; case OutputTypes.ConsoleXml: WriteAsXmlToConsole(result); break; case OutputTypes.ConsoleGraphviz: WriteAsGraphvizToConsole(result); break; default: throw new Exception($"Unknown {nameof(type)} '{type}'"); } }
public CSVExportRequestArgument(Guid siteModelUid, IFilterSet filters, string fileName, CoordType coordType, OutputTypes outputType, CSVExportUserPreferences userPreferences, List <CSVExportMappedMachine> mappedMachines, bool restrictOutputSize, bool rawDataAsDBase) { ProjectID = siteModelUid; Filters = filters; FileName = fileName; CoordType = coordType; OutputType = outputType; UserPreferences = userPreferences; MappedMachines = mappedMachines; RestrictOutputSize = restrictOutputSize; RawDataAsDBase = rawDataAsDBase; }
public void GetFileName_NoDate(OutputTypes outputType, string extension) { var ukprn = 1234; var jobId = 5678; var fileName = "FileName"; var reportServiceContextMock = new Mock <IReportServiceContext>(); reportServiceContextMock.SetupGet(c => c.Ukprn).Returns(ukprn); reportServiceContextMock.SetupGet(c => c.JobId).Returns(jobId); var result = NewService(null).GetFilename(reportServiceContextMock.Object, fileName, outputType, false); result.Should().Be($"{ukprn}/{jobId}/{fileName}.{extension}"); }
public CSVExportFormatter(CSVExportUserPreferences userPreference, OutputTypes outputType, bool isRawDataAsDBaseRequired = false) { UserPreference = userPreference; OutputType = outputType; IsRawDataAsDBaseRequired = isRawDataAsDBaseRequired; NullString = isRawDataAsDBaseRequired ? string.Empty : "?"; SetupUserPreferences(userPreference); _nfiUser = NumberFormatInfo.GetInstance(CultureInfo.InvariantCulture).Clone() as NumberFormatInfo; _nfiUser.NumberDecimalSeparator = userPreference.DecimalSeparator ?? _nfiUser.NumberDecimalSeparator; _nfiUser.NumberGroupSeparator = userPreference.ThousandsSeparator ?? _nfiUser.NumberGroupSeparator; _nfiUser.NumberDecimalDigits = DefaultDecimalPlaces; _nfiDefault = _nfiUser.Clone() as NumberFormatInfo; // the dp will be altered on this }
public void PassCountExportRequest_UnSuccessful( Guid projectUid, FilterResult filter, string fileName, CoordType coordType, OutputTypes outputType, bool restrictOutputSize, bool rawDataAsDBase, string errorMessage) { var userPreferences = new UserPreferences(); var request = new CompactionPassCountExportRequest( projectUid, filter, fileName, coordType, outputType, userPreferences, restrictOutputSize, rawDataAsDBase, null, null); var ex = Assert.Throws <ServiceException>(() => request.Validate()); Assert.Equal(HttpStatusCode.BadRequest, ex.Code); Assert.Equal(ContractExecutionStatesEnum.ValidationError, ex.GetResult.Code); Assert.Equal(errorMessage, ex.GetResult.Message); }
private ISiteModel SetupSiteAndRequestArgument(CoordType coordType, OutputTypes outputType, bool isRawDataAsDBaseRequired, string tagFileDirectory, out CSVExportRequestArgument requestArgument) { // tagFileDirectory: "Dimensions2018-CaseMachine" - extents match the CSIB constant // "ElevationMappingMode-KettlewellDrive" var tagFiles = Directory.GetFiles(Path.Combine("TestData", "TAGFiles", tagFileDirectory), "*.tag").ToArray(); var siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _); var csvExportUserPreference = new CSVExportUserPreferences(); requestArgument = new CSVExportRequestArgument ( siteModel.ID, new FilterSet(new CombinedFilter()), "the filename", coordType, outputType, csvExportUserPreference, new List <CSVExportMappedMachine>(), false, isRawDataAsDBaseRequired ); return(siteModel); }
public static String OutputExtension(OutputTypes ot) { String extension = string.Empty; switch (ot) { case OutputTypes.Csv: extension = ".csv"; break; case OutputTypes.Txt: extension = ".txt"; break; } return(extension); }
public CompactionVetaExportRequest( Guid projectUid, FilterResult filter, string fileName, CoordType coordType, OutputTypes coordinateOutputType, UserPreferences userPreferences, string[] machineNames, OverridingTargets overrides, LiftSettings liftSettings ) : base(projectUid, filter, fileName, overrides, liftSettings) { CoordType = coordType; OutputType = coordinateOutputType; UserPreferences = userPreferences; MachineNames = machineNames; }
public Logger(string outputFile, OutputTypes types, MessageType outputLevel) { if (outputFile != null) { this.outputFile = outputFile; } if ((int)types < 1 || (int)types > 3) { throw new ArgumentException(); } currentOutputs = types; if ((int)(currentOutputs & OutputTypes.TextFile) > 0) { textWriter = new StreamWriter(this.outputFile, true); outputLevels.Add(OutputTypes.TextFile, outputLevel); textWriter.BaseStream.Position = textWriter.BaseStream.Length; } }
public ScriptNode Build() { var node = new ScriptNode(); node.Type = Type; node.Name = Name; if (OutputTypes.Any()) { node.Category = NodeCategory.Function; } else { node.Category = NodeCategory.Result; } node.InputPins.AddRange(InputPins.Select(_ => _.Clone())); node.OutputPins.AddRange(OutputPins.Select(_ => _.Clone())); return(node); }
public void FormatElevationString (string decimalSeparator, string thousandsSeparator, UnitsTypeEnum units, bool isRawDataAsDBaseRequired, float value, string expectedResult ) { var userPreferences = new UserPreferences() { DecimalSeparator = decimalSeparator, ThousandsSeparator = thousandsSeparator, Units = (int)units }; var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); OutputTypes outputType = OutputTypes.PassCountLastPass; var formatter = new CSVExportFormatter(csvUserPreference, outputType, isRawDataAsDBaseRequired); var result = formatter.FormatElevation(value); result.Should().Be(expectedResult); }
public void CellPassDateToString (string dateSeparator, string timeSeparator, string decimalSeparator, OutputTypes outputType, string value, double timeZoneOffset, string expectedResult) { DateTime valueDateTime = DateTime.SpecifyKind(DateTime.Parse(value), DateTimeKind.Utc); var userPreferences = new UserPreferences( "", dateSeparator, timeSeparator, ",", decimalSeparator, timeZoneOffset, 0, 1, 0, 1, 1, 1); var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); var formatter = new CSVExportFormatter(csvUserPreference, outputType, false); var result = formatter.FormatCellPassTime(valueDateTime); result.Should().Be(expectedResult); }
internal Runner Compile(string rules) { Contract.Requires(!string.IsNullOrWhiteSpace(rules)); log.Trace("Rules: {0}", rules); // input params ParameterExpression input = Expression.Parameter(typeof(Input), "input"); Contract.Assert(input != null); ParameterExpression param = Expression.Parameter(typeof(Event), "event"); Contract.Assert(param != null); // result ParameterExpression result = Expression.Variable(typeof(Output), "result"); var expressions = new List <Expression>(); expressions.AddRange(OutputTypes.Select(t => Expression.Assign(t.Value, Expression.Constant(0)))); foreach (var line in rules.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { if (string.IsNullOrWhiteSpace(line) || comments.Any(c => line.StartsWith(c))) { log.Debug("Comment Line: {0}", line); continue; } log.Debug("Processing line"); var operation = ProcessLine(param, line, input); expressions.Add(operation); log.Debug("Done w/ line"); } var creator = typeof(Output).GetMethod("Create", BindingFlags.Static | BindingFlags.Public); expressions.Add(Expression.Assign(result, Expression.Call(creator, OutputTypes.Values))); BlockExpression block = Expression.Block( OutputTypes.Values.Concat(new[] { result }), expressions ); return(Expression.Lambda <Func <Input, Event, Output> >(block, input, param).Compile()); }
public CompactionPassCountExportRequest( Guid projectUid, FilterResult filter, string fileName, CoordType coordType, OutputTypes outputType, UserPreferences userPreferences, bool restrictOutputSize, bool rawDataAsDBase, OverridingTargets overrides, LiftSettings liftSettings ) : base(projectUid, filter, fileName, overrides, liftSettings) { CoordType = coordType; OutputType = outputType; UserPreferences = userPreferences; RestrictOutputSize = restrictOutputSize; RawDataAsDBase = rawDataAsDBase; }
/// <summary> /// Constructor for deserialization. /// </summary> /// <param name="info">info is the serialization info to deserialize with</param> /// <param name="context">context is the context in which to deserialize...?</param> protected ScriptNode(SerializationInfo info, StreamingContext context) { mName = info.GetString("NodeName"); mInputType = (ScriptNode.InputTypes)Enum.Parse(typeof(ScriptNode.InputTypes), info.GetString("InputType")); mOutputType = (ScriptNode.OutputTypes)Enum.Parse(typeof(ScriptNode.OutputTypes), info.GetString("OutputType")); }
private void SetDefaults() { _outputType = OutputTypes.AsciiArmor; }
public RequireLoginAttribute(ISecurityManager securityManager, OutputTypes output) { this.SecurityManager = securityManager; this.Output = output; }