public static int AddMonitor(ExternalMonitor externalMonitor, OutputType output,bool dnsWithParams=false) { string testName = "test ping ololo: ololo;" + Common.GenerateRandomString(5); string tag = tagNew; int[] locationsIds = new int[] { 4, 11 }; ExternalMonitor.TestType testType = ExternalMonitor.TestType.ping; if (dnsWithParams) testType = ExternalMonitor.TestType.dns; var testparams = new Dictionary<string, string>(); if (dnsWithParams) { //testparams.Add("test1", "fffgfygfhgf"); //testparams.Add("test2", "bbb"); //testparams.Add("test3", "dddd"); //testparams.Add("test4", "ffff"); //testparams.Add("test5", "ffff"); testparams.Add("server", "google.com"); testparams.Add("expip", "209.85.148.113"); testparams.Add("expauth", "A"); } var result = externalMonitor.AddMonitor( testType, testName, url, ExternalMonitor.CheckInterval.five, tag, output: output, locationIds: locationsIds, testParams: testparams); return result.testId; }
public void ActivateMonitors_ActivateByTag(OutputType output) { int idMonitorToDelete = AddMonitor(externalMonitor, output); monitorsToDelete.Add(idMonitorToDelete); externalMonitor.ActivateMonitors(tag:tagNew,output:output); }
public void ActivateMonitors_ActivateById(OutputType output) { int idMonitorToDelete = AddMonitor(externalMonitor, output); monitorsToDelete.Add(idMonitorToDelete); externalMonitor.ActivateMonitors(idMonitorToDelete,output); }
private bool GetSetting(OutputType outputType, OutputLevel outputLevel, bool defaultValue) { var settingName = string.Format("{0}{1}", outputType, outputLevel); var data = System.Configuration.ConfigurationManager.AppSettings[settingName]; bool result; return bool.TryParse(data, out result) ? result : defaultValue; }
public static IOutputRepository Get(OutputType type) { switch (type) { case OutputType.Csv: return CsvOutputRepository.Instance; case OutputType.Json: return JsonOutputRepository.Instance; case OutputType.Txt: return TxtOutputRepository.Instance; case OutputType.Xml: return XmlOutputRepository.Instance; case OutputType.Dot: return DotOutputRepository.Instance; case OutputType.None: return NoneOutputRepository.Instance; case OutputType.Markdown: return MarkdownOutputRepository.Instance; case OutputType.Html: return HtmlOutputRepository.Instance; } return JsonOutputRepository.Instance; }
/// <summary> /// Authentication by apiKey, secretKey (optional) and authToken (optional) /// </summary> /// <param name="apiKey">ApiKey of user</param> /// <param name="secretKey">SecretKey. If null, it will be get by ApiKey</param> /// <param name="authToken">AuthToken. If null, it will be get by ApiKey and SecretKey</param> public Authentication(string apiKey, string secretKey = null, string authToken = null, OutputType? output=null) { OutputGlobal = GetOutput(output); this.apiKey = apiKey; this.secretKey = string.IsNullOrEmpty(secretKey) ? GetSecretKey() : secretKey; this.authToken = string.IsNullOrEmpty(authToken) ? GetAuthToken() : authToken; }
public RestResponse GetAgentInfo(int agentId, OutputType output) { var parameters = new Dictionary<String, Object>(); parameters.Add("agentId", agentId); parameters.Add("output", output); return MakeGetRequest(CustomUserAgentAction.agentInfo, parameters); }
public OutputWatcher(OutputType type) { timer = new Timer(); this._OutputType=type; timer.Enabled = true; timer.Interval = 100; if (_OutputType == OutputType.Console) { System.Console.SetOut(writer); System.Console.SetError(writer); } else if (_OutputType == OutputType.Debug) { //TODO } else { throw new ArgumentException("Cannot Find " + _OutputType.ToString() + "!"); } timer.Tick += delegate(object sender, EventArgs e) { if (Document.Text != writer.ToString()) { Document.Text = writer.ToString(); changed = true; } }; Document = new Alsing.SourceCode.SyntaxDocument(); changed = true; }
/// <summary> /// Gets apiKey, secretKey and authToken /// </summary> /// <param name="userName">Name of user</param> /// <param name="password">Password of user</param> /// <param name="output">Set global output (or use exists - JSON by default)</param> public void Authenticate(string userName, string password,OutputType? output=null) { OutputGlobal = GetOutput(output); apiKey = GetApiKey(userName, password, OutputGlobal); secretKey = GetSecretKey(); authToken = GetAuthToken(); }
public Arguments() { Authentication = new Authentication(); OverrideConfig = new Config(); Output = OutputType.Json; UpdateAssemblyInfoFileName = new HashSet<string>(); }
public OutputWindow(Note note, OutputType outputType) { Note = note; OutputType = outputType; InitializeComponent(); }
public Player(List<Player> players, OutputType outputType) { writer = new Output(outputType); writer.Write("Enter the name of the player: "); this.name = Console.ReadLine().Trim(); writer.Write("Enter the piece you want to use: "); this.piece = new Piece(Console.ReadLine().Trim()); while (players.Select(p => p).Where(x => string.Compare(x.Piece.Symbol, this.piece.Symbol) == 0).Count() >= 1) { writer.Write("That piece has already been taken.\nChoose a different piece: "); this.piece = new Piece(Console.ReadLine().Trim()); } writer.Write("Is this player HUMAN or AI: "); do { var playerType = Console.ReadLine().Trim(); PlayerType humanOrNot; if (Enum.TryParse<PlayerType>(playerType.ToUpper(), out humanOrNot)) { this.playerType = humanOrNot; break; } writer.Write("Enter a valid Player Type: [human] or [AI]: "); continue; } while (true); this.order = -1; }
public virtual RestResponse GetMonitorInfo(int monitorId, OutputType? output = null) { var parameters = new Dictionary<string, object>(); parameters.Add(Params.monitorId, monitorId); RestResponse resp = MakeGetRequest(GetAction(MonitorAction.getMonitorInfo), parameters, output: output); return resp; }
public static string GetOuputExtension(OutputType outputType) { if (outputType == OutputType.Library) return ".dll"; else return ".exe"; }
public async void Write(string text, OutputType type) { await RichTextBlock.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Paragraph.Inlines.Add(new Run { Text = text, Foreground = new SolidColorBrush(GetColor(type)) }); ScrollToEnd(); }); }
public virtual RestResponse ActivateMonitors(int[] monitorIds, string tag, OutputType? output = null, Validation? validation = null) { var parameters = new Dictionary<string, object>(); AddIfNotNull(parameters, Params.monitorIds, string.Join(",", monitorIds)); AddIfNotNull(parameters, Params.tag, tag); RestResponse resp = MakePostRequest(GetAction(MonitorAction.activateMonitors), parameters, output: output, validation: validation); return resp; }
/// <summary> /// Send benchmark output to the console.. /// </summary> /// <param name="messageFormat">The message format.</param> /// <returns><see cref="Benchmark"/> instance for chaining.</returns> public Benchmark ToConsole(string messageFormat) { this.currentMessageFormat = messageFormat; this.currentOutputType = OutputType.Console; this.timer.Reset(); this.timer.Start(); return this; }
// Default options public ProgramOptions() { outputName = null; outtype = OutputType.Text; useGPbased = true; enableListing = false; useAT = true; }
private Logger(string name, Level level, OutputType outType, ProgressOutputType progressOutType, Node node) { mName = name; mInheritedLevel = level; mInheritedOutputType = outType; mInheritedProgressOutputType = progressOutType; mNode = node; }
internal void RenderMessage(string msg, OutputType typ) { var output = Output.OutputManager.GenerateMessage(msg); SetOutput(output); Style = GetStyle(typ); if ((output as Control) != null) (output as Control).Foreground = Foreground; }
public void Print(OutputType codeType, string str) { ConsoleColor old_color = Console.ForegroundColor; Console.ForegroundColor = codeScheme.GetColor(codeType); Console.Write(str); Console.ForegroundColor = old_color; }
public FinanceChart(FinanceChartData.ChartDataClass data, String title, OutputType outputType, String outputSubType, String yAxis) { chartData = data; chartName = title; chartOutputType = outputType; chartYAxis = yAxis; chartOutputSubType = outputSubType; InitializeComponent(); }
public void WriteOutput(string jobId, OutputType outputType, dynamic output) { _outputStoreCollection.Save(new OutputStore() { JobId = jobId, OutputType = outputType, Output = output }); }
public void Print(OutputType codeType, string str) { if (!SystemInformation.HighContrast) { textBox.SelectionColor = codeColors[(int)codeType]; } textBox.AppendText(str); }
protected override void Stat(string dbName, OutputType outputType) { string[] dmNames = DimensionNumberTypeBiz.Instance.GetEnabledDimensions("11X5"); DwNumberBiz biz = new DwNumberBiz(dbName); List<DwNumber> numbers = biz.DataAccessor.SelectWithCondition(string.Empty, "Seq", SortTypeEnum.ASC, null); //this.Stat(dbName, outputType, dmNames, numbers); this.StatC5CX(numbers, dbName); }
/// <summary> /// This action is used for contact activating. /// </summary> /// <param name="contactId">id of the contact to activate</param> /// <param name="output">Type of output - XML or JSON</param> /// <param name="validation">HMACSHA1 for checksum validation or token for authToken validation</param> public void ActivateContact(int contactId, OutputType? output = null, Validation? validation = null) { var parameters = new Dictionary<string, object>(); parameters.Add(Params.contactId, contactId); RestResponse response = MakePostRequest(ContactAction.contactActivate, parameters, output: output, validation: validation); Helper.CheckStatus(response, GetOutput(output)); }
/// <summary> /// Calculates the output path for the documentation. /// </summary> /// <param name="outputType"> /// The output type. /// </param> /// <param name="docsPath"> /// The docs path. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> private static string CalculateOutputPath(OutputType outputType, string docsPath) { var outputPath = Path.Combine(docsPath, "html-compiled"); if (outputType == OutputType.Markdown) { outputPath = Path.Combine(docsPath, "markdown-compiled"); } return outputPath; }
private Style GetStyle(OutputType typ) { switch (typ) { case OutputType.Error: return FindResource("ErrorStyle") as Style; case OutputType.Normal: return FindResource("NormalOutputStyle") as Style; case OutputType.Gray:return FindResource("GrayOutputStyle") as Style; } return null; }
public RestResponse GetAgents(String type, bool loadTests, bool loadParams, OutputType output) { var parameters = new Dictionary<String, Object>(); if (type != null) parameters.Add("type", type); parameters.Add("loadTests", loadTests); parameters.Add("loadParams", loadParams); parameters.Add("output", output); return MakeGetRequest(CustomUserAgentAction.getAgents, parameters); ; }
public virtual void DeleteMonitors(int[] monitorIds, OutputType? output = null, Validation? validation = null) { var parameters = new Dictionary<string, object>(); if (monitorIds != null) { parameters.Add(Params.monitorId, string.Join(",", monitorIds)); } RestResponse resp = MakePostRequest(GetAction(MonitorAction.deleteMonitor), parameters, output: output, validation: validation); }
/// <summary> /// Writes a message with a new line to console. /// </summary> public void WriteLine(OutputType type, string format, params object[] parameters) { WriteOutput(type, string.Format(format + Environment.NewLine, parameters)); }
public Task WriteConsoleEx(string buf, OutputType otype, CancellationToken ct) => Task.CompletedTask;
/// <summary> Panel to display Output options </summary> /// <param name="inlineHelp">Should help be displayed?</param> void OutputPanel(bool inlineHelp) { ++EditorGUI.indentLevel; m_editorUtils.EnumPopupLocalized("mOutputType", "OutputType_", m_outputTypeProp, inlineHelp); OutputType outputType = ( OutputType)System.Enum.GetValues(typeof(OutputType)).GetValue(m_outputTypeProp.enumValueIndex); outputBool.target = outputType != OutputType.STRAIGHT; if (EditorGUILayout.BeginFadeGroup(outputBool.faded)) { EditorGUI.BeginChangeCheck(); Object prefab = m_editorUtils.ObjectField("mOutputPrefab", m_outputPrefabProp.objectReferenceValue, typeof(GameObject), false, inlineHelp); if (EditorGUI.EndChangeCheck()) { m_outputPrefabProp.objectReferenceValue = prefab; } if (m_outputPrefabProp != null && m_outputPrefabProp.objectReferenceValue != null) { AudioSource prefabSource = ((GameObject)m_outputPrefabProp.objectReferenceValue).GetComponent <AudioSource>(); if (prefabSource == null) { EditorGUILayout.HelpBox(m_editorUtils.GetContent("PrefabNoSource").text, MessageType.Info); } else { bool spatialize = false; bool spatialblend = false; if (prefabSource.spatialize == false) { spatialize = true; } if (prefabSource.spatialBlend < 1f) { spatialblend = true; } if (spatialize || spatialblend) { EditorGUILayout.HelpBox(m_editorUtils.GetContent("PrefabSettingsWarningPrefix").text + (spatialize ? m_editorUtils.GetContent("PrefabSettingsWarningSpatialize").text : "") + (spatialblend ? m_editorUtils.GetContent("PrefabSettingsWarningSpatialBlend").text : "") , MessageType.Warning); if (m_editorUtils.Button("PrefabSettingsButton")) { prefabSource.spatialize = true; prefabSource.spatialBlend = 1.0f; EditorUtility.SetDirty(m_outputPrefabProp.objectReferenceValue); #if UNITY_2018_3_OR_NEWER PrefabUtility.SavePrefabAsset(prefabSource.gameObject); #else PrefabUtility.ReplacePrefab(prefabSource.gameObject, m_outputPrefabProp.objectReferenceValue); #endif } } } } Rect r = EditorGUILayout.GetControlRect(); float[] vals = new float[2] { m_outputDistanceProp.vector2Value.x, m_outputDistanceProp.vector2Value.y }; EditorGUI.BeginChangeCheck(); EditorGUI.MultiFloatField(r, m_editorUtils.GetContent("mOutputDistance"), new GUIContent[] { new GUIContent(""), new GUIContent("-") }, vals); if (EditorGUI.EndChangeCheck()) { m_outputDistanceProp.vector2Value = new Vector2(vals[0], vals[1]); } m_editorUtils.SliderRange("mOutputVerticalAngle", m_outputVerticalAngleProp, inlineHelp, -180, 180); m_editorUtils.SliderRange("mOutputHorizontalAngle", m_outputHorizontalAngleProp, inlineHelp, -180, 180); m_outputFollowPosition.boolValue = m_editorUtils.Toggle("mOutputFollowPosition", m_outputFollowPosition.boolValue, inlineHelp); EditorGUI.BeginDisabledGroup(!m_outputFollowPosition.boolValue); m_outputFollowRotation.boolValue = m_editorUtils.Toggle("mOutputFollowRotation", m_outputFollowRotation.boolValue, inlineHelp); EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndFadeGroup(); --EditorGUI.indentLevel; }
protected ProxyUnitSyntaxFactory(OutputType outputType, string containingAssembly, ReferenceCollector?referenceCollector) : base(outputType, referenceCollector) =>
static void Main(string[] args) { if (args.Length < 2) { Console.WriteLine("Usage: StbImageResizeSharp.Converter.exe <input_image_file> <output_image_file> [new_width] [new_height]"); Console.WriteLine("Example: StbImageResizeSharp.Converter.exe image.jpg image.png 400 400"); return; } try { OutputType outputType = OutputType.Png; var ext = Path.GetExtension(args[1]); if (string.IsNullOrEmpty(ext)) { throw new Exception("Output file lacks extension. Hence it is not possible to determine output file type"); } if (ext.StartsWith(".")) { ext = ext.Substring(1); } ext = ext.ToLower(); switch (ext) { case "jpg": case "jpeg": outputType = OutputType.Jpg; break; case "png": outputType = OutputType.Png; break; case "tga": outputType = OutputType.Tga; break; case "bmp": outputType = OutputType.Bmp; break; case "hdr": outputType = OutputType.Hdr; break; default: throw new Exception("Output format '" + ext + "' is not supported."); } // Load image ImageResult image; using (var stream = File.OpenRead(args[0])) { image = ImageResult.FromStream(stream); } // Parse new size var newWidth = image.Width; var newHeight = image.Height; if (args.Length >= 3) { newWidth = int.Parse(args[2]); } if (args.Length >= 4) { newHeight = int.Parse(args[3]); } var newData = image.Data; var channels = (int)image.Comp; // Resize if needed if (newWidth != image.Width && newHeight != image.Height) { newData = new byte[newWidth * newHeight * channels]; StbImageResize.stbir_resize_uint8(image.Data, image.Width, image.Height, image.Width * channels, newData, newWidth, newHeight, newWidth * channels, channels); } // Save using (var stream = File.Create(args[1])) { var imageWriter = new ImageWriter(); switch (outputType) { case OutputType.Jpg: imageWriter.WriteJpg(newData, newWidth, newHeight, (StbImageWriteSharp.ColorComponents)channels, stream, 90); break; case OutputType.Png: imageWriter.WritePng(newData, newWidth, newHeight, (StbImageWriteSharp.ColorComponents)channels, stream); break; case OutputType.Tga: imageWriter.WriteTga(newData, newWidth, newHeight, (StbImageWriteSharp.ColorComponents)channels, stream); break; case OutputType.Bmp: imageWriter.WriteBmp(newData, newWidth, newHeight, (StbImageWriteSharp.ColorComponents)channels, stream); break; case OutputType.Hdr: imageWriter.WriteHdr(newData, newWidth, newHeight, (StbImageWriteSharp.ColorComponents)channels, stream); break; } } } catch (Exception ex) { Console.WriteLine(ex); } }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (CodeDomProvider.Expression != null) { targetCommand.AddParameter("CodeDomProvider", CodeDomProvider.Get(context)); } if (CompilerParameters.Expression != null) { targetCommand.AddParameter("CompilerParameters", CompilerParameters.Get(context)); } if (TypeDefinition.Expression != null) { targetCommand.AddParameter("TypeDefinition", TypeDefinition.Get(context)); } if (Name.Expression != null) { targetCommand.AddParameter("Name", Name.Get(context)); } if (MemberDefinition.Expression != null) { targetCommand.AddParameter("MemberDefinition", MemberDefinition.Get(context)); } if (Namespace.Expression != null) { targetCommand.AddParameter("Namespace", Namespace.Get(context)); } if (UsingNamespace.Expression != null) { targetCommand.AddParameter("UsingNamespace", UsingNamespace.Get(context)); } if (Path.Expression != null) { targetCommand.AddParameter("Path", Path.Get(context)); } if (LiteralPath.Expression != null) { targetCommand.AddParameter("LiteralPath", LiteralPath.Get(context)); } if (AssemblyName.Expression != null) { targetCommand.AddParameter("AssemblyName", AssemblyName.Get(context)); } if (Language.Expression != null) { targetCommand.AddParameter("Language", Language.Get(context)); } if (ReferencedAssemblies.Expression != null) { targetCommand.AddParameter("ReferencedAssemblies", ReferencedAssemblies.Get(context)); } if (OutputAssembly.Expression != null) { targetCommand.AddParameter("OutputAssembly", OutputAssembly.Get(context)); } if (OutputType.Expression != null) { targetCommand.AddParameter("OutputType", OutputType.Get(context)); } if (PassThru.Expression != null) { targetCommand.AddParameter("PassThru", PassThru.Get(context)); } if (IgnoreWarnings.Expression != null) { targetCommand.AddParameter("IgnoreWarnings", IgnoreWarnings.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
public CommandResult(int capacity) : base(capacity) { _output = OutputType.Auto; }
public Project ReadProject(Uri uri) { // Resolve if the project has already been parsed Project existing = projects.FirstOrDefault(x => x.Uri == uri); if (existing != null) { return(existing); } // Load the document XmlDocument document = new XmlDocument(); document.Load(uri.ToString()); // Read the root node XmlNode root = document.ChildNodes.FirstOrDefault(x => x.Name == "Project"); if (root == null) { throw new Exception("No root Project element found."); } // Read the configuration IDictionary <string, string> configuration = ReadConfiguration(root, "TargetFramework"); // Read the target framework if (!configuration.TryGetValue("TargetFramework", out string targetFramework)) { throw new Exception($"The project file {uri} does not define a TargetFramework."); } // Read the output type OutputType type = DecodeOutputType(configuration); // Read the project references Uri[] references = root.ChildNodes .Where(x => x.Name == "ItemGroup") .SelectMany(x => x.ChildNodes) .Where(x => x.Name == "ProjectReference") .Select(x => x.ReadAttribute("Include")) .Where(x => !string.IsNullOrWhiteSpace(x)) .Select(x => CreateReferenceUri(uri, x)) .ToArray(); // Create and index the new project instance Project created = new Project { FolderUri = new Uri(uri, "./"), Uri = uri, BinaryUri = GetOutputBinaryUri(uri, targetFramework, type), TargetFramework = targetFramework, Dependencies = references .Select(x => ReadProject(x)) .ToArray() }; projects.Add(created); // Make sure the created project is a dependant of all its references foreach (Project parent in created.Dependencies) { parent.KnownDependants = parent.KnownDependants .Union(new[] { created }) .ToArray(); } return(created); }
public OutputComponent(string name, string value, OutputType outputType) : base(name) { Value = value; OutputType = outputType; }
public override string Output(OutputType type) { return(this.ToString()); }
/// <summary> /// Write the specified table to the TextWriter. /// </summary> /// <param name="writer">The writer to write to</param> /// <param name="table">The table to write</param> /// <param name="outtype">Indicates the format to be produced</param> /// <param name="className">The class name of the generated html table</param> /// <param name="document">Document object if using MigraDoc to generate output, null otherwise </param> private static void WriteTable(TextWriter writer, DataTable table, OutputType outtype, string className, Document document) { bool showHeadings = className != "PropertyTable"; if (outtype == OutputType.html) { if (showHeadings) { writer.WriteLine("<table class='headered'>"); writer.Write("<tr>"); for (int i = 0; i < table.Columns.Count; i++) { writer.Write("<th"); if (i == 0) { writer.Write(" class='col1'"); } writer.Write(">" + table.Columns[i].ColumnName + "</th>"); } } else { writer.WriteLine("<table>"); } foreach (DataRow row in table.Rows) { bool titleRow = Convert.IsDBNull(row[0]); if (titleRow) { writer.Write("<tr class='total'>"); } else { writer.Write("<tr>"); } for (int i = 0; i < table.Columns.Count; i++) { string st; if (titleRow && i == 0) { st = "Total"; } else { st = row[i].ToString(); } writer.Write("<td"); if (i == 0) { writer.Write(" class='col1'"); } writer.Write(">"); writer.Write(st); writer.Write("</td>"); } writer.WriteLine("</tr>"); } writer.WriteLine("</table><br/>"); } else if (outtype == OutputType.rtf) { MigraDoc.DocumentObjectModel.Tables.Table tabl = new MigraDoc.DocumentObjectModel.Tables.Table(); tabl.Borders.Width = 0.75; foreach (DataColumn col in table.Columns) { Column column = tabl.AddColumn(Unit.FromCentimeter(18.0 / table.Columns.Count)); } if (showHeadings) { MigraDoc.DocumentObjectModel.Tables.Row row = tabl.AddRow(); row.Shading.Color = Colors.PaleGoldenrod; tabl.Shading.Color = new Color(245, 245, 255); for (int i = 0; i < table.Columns.Count; i++) { Cell cell = row.Cells[i]; Paragraph paragraph = cell.AddParagraph(); if (i == 0) { paragraph.Format.Alignment = ParagraphAlignment.Left; } else { paragraph.Format.Alignment = ParagraphAlignment.Right; } paragraph.AddText(table.Columns[i].ColumnName); } } foreach (DataRow row in table.Rows) { bool titleRow = Convert.IsDBNull(row[0]); string st; MigraDoc.DocumentObjectModel.Tables.Row newRow = tabl.AddRow(); for (int i = 0; i < table.Columns.Count; i++) { if (titleRow && i == 0) { st = "Total"; newRow.Format.Font.Color = Colors.DarkOrange; newRow.Format.Font.Bold = true; } else { st = row[i].ToString(); } Cell cell = newRow.Cells[i]; Paragraph paragraph = cell.AddParagraph(); if (!showHeadings) { cell.Borders.Style = BorderStyle.None; paragraph.Format.Alignment = ParagraphAlignment.Left; } else if (i == 0) { paragraph.Format.Alignment = ParagraphAlignment.Left; } else { paragraph.Format.Alignment = ParagraphAlignment.Right; } if (showHeadings && i == 0) { paragraph.AddFormattedText(st, TextFormat.Bold); } else { paragraph.AddText(st); } } } document.LastSection.Add(tabl); document.LastSection.AddParagraph(); // Just to give a bit of spacing } else { DataTableUtilities.DataTableToText(table, 0, " ", showHeadings, writer); } }
/// <summary> /// Write the summary report to the specified writer. /// </summary> /// <param name="storage">The data store to query</param> /// <param name="simulationName">The simulation name to produce a summary report for</param> /// <param name="writer">Text writer to write to</param> /// <param name="apsimSummaryImageFileName">The file name for the logo. Can be null</param> /// <param name="outtype">Indicates the format to be produced</param> /// <param name="darkTheme">Whether or not the dark theme should be used.</param> public static void WriteReport( IDataStore storage, string simulationName, TextWriter writer, string apsimSummaryImageFileName, OutputType outtype, bool darkTheme) { Document document = null; RtfDocumentRenderer renderer = null; if (outtype == OutputType.html) { writer.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); writer.WriteLine("<html>"); writer.WriteLine("<head>"); writer.WriteLine("<meta content='text/html; charset=UTF-8; http-equiv='content-type'>"); writer.WriteLine("<style>"); if (darkTheme) { writer.WriteLine("h2 { color:white; } "); writer.WriteLine("h3 { color:white; } "); writer.WriteLine("table { border:1px solid white; }"); } else { writer.WriteLine("h2 { color:darkblue; } "); writer.WriteLine("h3 { color:darkblue; } "); writer.WriteLine("table { border:1px solid black; }"); writer.WriteLine("th { background-color: palegoldenrod}"); writer.WriteLine("tr.total { color:darkorange; }"); } writer.WriteLine("table { border-collapse:collapse; width:100%; table-layout:fixed; text-align:left; }"); writer.WriteLine("table.headered {text-align:right; }"); writer.WriteLine("tr.total { font-weight:bold; }"); writer.WriteLine("table.headered td.col1 { text-align:left; font-weight:bold; }"); writer.WriteLine("td { border:1px solid; }"); writer.WriteLine("th { border:1px solid; text-align:right; }"); writer.WriteLine("th.col1 { text-align:left; }"); writer.WriteLine("</style>"); writer.WriteLine("</head>"); writer.WriteLine("<body>"); writer.WriteLine("<a href=\"#log\">Simulation log</a>"); } else if (outtype == OutputType.rtf) { document = new Document(); renderer = new RtfDocumentRenderer(); // Get the predefined style Normal. Style style = document.Styles["Normal"]; // Because all styles are derived from Normal, the next line changes the // font of the whole document. Or, more exactly, it changes the font of // all styles and paragraphs that do not redefine the font. style.Font.Name = "Arial"; // Heading1 to Heading9 are predefined styles with an outline level. An outline level // other than OutlineLevel.BodyText automatically creates the outline (or bookmarks) // in PDF. style = document.Styles["Heading2"]; style.Font.Size = 14; style.Font.Bold = true; style.Font.Color = Colors.DarkBlue; style.ParagraphFormat.PageBreakBefore = false; style.ParagraphFormat.SpaceAfter = 3; style.ParagraphFormat.SpaceBefore = 16; style = document.Styles["Heading3"]; style.Font.Size = 12; style.Font.Bold = true; style.Font.Color = Colors.DarkBlue; style.ParagraphFormat.SpaceBefore = 10; style.ParagraphFormat.SpaceAfter = 2; // Create a new style called Monospace based on style Normal style = document.Styles.AddStyle("Monospace", "Normal"); System.Drawing.FontFamily monoFamily = new System.Drawing.FontFamily(System.Drawing.Text.GenericFontFamilies.Monospace); style.Font.Name = monoFamily.Name; Section section = document.AddSection(); } // Get the initial conditions table. DataTable initialConditionsTable = storage.Reader.GetData(simulationName: simulationName, tableName: "_InitialConditions"); if (initialConditionsTable != null) { // Convert the '_InitialConditions' table in the DataStore to a series of // DataTables for each model. List <DataTable> tables = new List <DataTable>(); ConvertInitialConditionsToTables(initialConditionsTable, tables); // Now write all tables to our report. for (int i = 0; i < tables.Count; i += 2) { // Only write something to the summary file if we have something to write. if (tables[i].Rows.Count > 0 || tables[i + 1].Rows.Count > 0) { string heading = tables[i].TableName; WriteHeading(writer, heading, outtype, document); // Write the manager script. if (tables[i].Rows.Count == 1 && tables[i].Rows[0][0].ToString() == "Script code: ") { WriteScript(writer, tables[i].Rows[0], outtype, document); } else { // Write the properties table if we have any properties. if (tables[i].Rows.Count > 0) { WriteTable(writer, tables[i], outtype, "PropertyTable", document); } // Write the general data table if we have any data. if (tables[i + 1].Rows.Count > 0) { WriteTable(writer, tables[i + 1], outtype, "ApsimTable", document); } } if (outtype == OutputType.html) { writer.WriteLine("<br/>"); } } } } // Write out all messages. WriteHeading(writer, "Simulation log:", outtype, document, "log"); DataTable messageTable = GetMessageTable(storage, simulationName); WriteMessageTable(writer, messageTable, outtype, false, "MessageTable", document); if (outtype == OutputType.html) { writer.WriteLine("</body>"); writer.WriteLine("</html>"); } else if (outtype == OutputType.rtf) { string rtf = renderer.RenderToString(document, Path.GetTempPath()); writer.Write(rtf); } }
internal void Inherit(Level level, OutputType outType, ProgressOutputType progressOutType) { mInheritedLevel = level; mInheritedOutputType = outType; mInheritedProgressOutputType = progressOutType; }
protected virtual void AsyncStatAll(Category category, OutputType outputType) { this.asyncStatDlgt.BeginInvoke(category.DbName, outputType, null, null); }
public CommandResult() : base() { _output = OutputType.Auto; }
public OutputRecord(Nonterminal expression, OutputType outputType, int position) { Expression = expression; OutputType = outputType; Position = position; }
protected virtual void Stat(string dbName, OutputType outputType) { }
/// <summary> /// Outputs to <see cref="Debug.WriteLine(String)"/>. /// </summary> /// <param name="value">Value to be output to log.</param> /// <param name="outputType">Output type.</param> public static void Log(string value, OutputType outputType = OutputType.Default) { Debug.WriteLine(outputType == OutputType.Timestamp ? $"[] {value}" : value); }
/// <summary> /// Parse the commandline arguments. /// </summary> /// <param name="args">Commandline arguments.</param> private void ParseCommandLine(string[] args) { for (int i = 0; i < args.Length; ++i) { string arg = args[i]; if (null == arg || 0 == arg.Length) // skip blank arguments { continue; } if ('-' == arg[0] || '/' == arg[0]) { string parameter = arg.Substring(1); if ("ext" == parameter) { if (!CommandLine.IsValidArg(args, ++i)) { this.messageHandler.Display(this, WixErrors.TypeSpecificationForExtensionRequired("-ext")); return; } this.extensionList.Add(args[i]); } else if ("nologo" == parameter) { this.showLogo = false; } else if ("notidy" == parameter) { this.tidy = false; } else if ("o" == parameter || "out" == parameter) { string path = CommandLine.GetFileOrDirectory(parameter, this.messageHandler, args, ++i); if (!String.IsNullOrEmpty(path)) { if (path.EndsWith("\\") || path.EndsWith("/")) { this.outputDirectory = path; } else { this.outputFile = path; } } else { return; } } else if ("sct" == parameter) { this.suppressCustomTables = true; } else if ("sdet" == parameter) { this.suppressDroppingEmptyTables = true; } else if ("sras" == parameter) { this.suppressRelativeActionSequencing = true; } else if ("sui" == parameter) { this.suppressUI = true; } else if ("swall" == parameter) { this.messageHandler.Display(this, WixWarnings.DeprecatedCommandLineSwitch("swall", "sw")); this.messageHandler.SuppressAllWarnings = true; } else if (parameter.StartsWith("sw")) { string paramArg = parameter.Substring(2); try { if (0 == paramArg.Length) { this.messageHandler.SuppressAllWarnings = true; } else { int suppressWarning = Convert.ToInt32(paramArg, CultureInfo.InvariantCulture.NumberFormat); if (0 >= suppressWarning) { this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg)); } this.messageHandler.SuppressWarningMessage(suppressWarning); } } catch (FormatException) { this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg)); } catch (OverflowException) { this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg)); } } else if ("wxall" == parameter) { this.messageHandler.Display(this, WixWarnings.DeprecatedCommandLineSwitch("wxall", "wx")); this.messageHandler.WarningAsError = true; } else if (parameter.StartsWith("wx")) { string paramArg = parameter.Substring(2); try { if (0 == paramArg.Length) { this.messageHandler.WarningAsError = true; } else { int elevateWarning = Convert.ToInt32(paramArg, CultureInfo.InvariantCulture.NumberFormat); if (0 >= elevateWarning) { this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg)); } this.messageHandler.ElevateWarningMessage(elevateWarning); } } catch (FormatException) { this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg)); } catch (OverflowException) { this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg)); } } else if ("v" == parameter) { this.messageHandler.ShowVerboseMessages = true; } else if ("x" == parameter) { this.exportBasePath = CommandLine.GetDirectory(parameter, this.messageHandler, args, ++i); // If a directory was not provided, skip the parameter. if (String.IsNullOrEmpty(this.exportBasePath)) { return; } // Always use the actual value provided on the command-line so the authoring // matches what they typed on the command-line. this.exportBasePath = args[i]; } else if ("xo" == parameter) { this.outputXml = true; } else if ("?" == parameter || "help" == parameter) { this.showHelp = true; return; } else { this.invalidArgs.Add(parameter); } } else { if (null == this.inputFile) { this.inputFile = CommandLine.VerifyPath(this.messageHandler, arg); if (String.IsNullOrEmpty(this.inputFile)) { return; } // guess the output type based on the extension of the input file if (OutputType.Unknown == this.outputType) { string extension = Path.GetExtension(this.inputFile).ToLower(CultureInfo.InvariantCulture); switch (extension) { case ".msi": this.outputType = OutputType.Product; break; case ".msm": this.outputType = OutputType.Module; break; case ".msp": this.outputType = OutputType.Patch; break; case ".mst": this.outputType = OutputType.Transform; break; case ".exe": this.outputType = OutputType.Bundle; break; case ".pcp": this.outputType = OutputType.PatchCreation; break; default: this.messageHandler.Display(this, WixErrors.UnexpectedFileExtension(Path.GetFileName(this.inputFile), ".msi, .msm, .msp, .mst, .exe, .pcp")); return; } } } else if (null == this.outputFile && null == this.outputDirectory) { this.outputFile = CommandLine.VerifyPath(this.messageHandler, arg); if (String.IsNullOrEmpty(this.outputFile)) { return; } } else { this.messageHandler.Display(this, WixErrors.AdditionalArgumentUnexpected(arg)); } } } }
/// <inheritdoc /> public string[] GenerateImportStrings(OutputType type) { var strings = type.UsedTypes.Select(usedType => GetImportString(type, usedType)); return(strings.ToArray()); }
/// <summary> /// Outputs to <see cref="Debug.WriteLine(Object)"/>. /// /// ObjectDumper: http://stackoverflow.com/questions/852181/c-printing-all-properties-of-an-object&lt;/cref /// </summary> /// <param name="value">Value to be output to log.</param> /// <param name="outputType">Output type.</param> public static void Log(object value, OutputType outputType = OutputType.Default) { Debug.WriteLine(outputType == OutputType.Timestamp ? $"[] " : ""); }
public OutputLine(OutputType pType, string pLine) { Type = pType; Line = pLine; }
protected virtual void SyncStatAll(Category category, OutputType outputType) { this.Stat(category.DbName, outputType); }
public void ProcessRequest(HttpContext context) { String response = String.Empty; String operation = context.Request.QueryString["op"]; String startRow = context.Request.QueryString["startRow"]; String batchSize = context.Request.QueryString["batchSize"]; String nameBankID = context.Request.QueryString["nameBankID"]; String name = context.Request.QueryString["name"]; String startDate = context.Request.QueryString["startDate"]; String endDate = context.Request.QueryString["endDate"]; String callback = context.Request.QueryString["callback"]; String format = context.Request.QueryString["format"]; OutputType outputType = OutputType.Xml; if (format == "json") { outputType = OutputType.Json; } try { if (String.Compare(operation, "NameCount", true) == 0) { ServiceResponse <int> serviceResponse = new ServiceResponse <int>(); serviceResponse.NameResult = this.NameCount(startDate, endDate); response = serviceResponse.Serialize(outputType); } else if (String.Compare(operation, "NameList", true) == 0) { ServiceResponse <CustomGenericList <Name> > serviceResponse = new ServiceResponse <CustomGenericList <Name> >(); serviceResponse.NameResult = this.NameList(startRow, batchSize, startDate, endDate); response = serviceResponse.Serialize(outputType); } else if (String.Compare(operation, "NameGetDetail", true) == 0) { ServiceResponse <Name> serviceResponse = new ServiceResponse <Name>(); serviceResponse.NameResult = this.NameGetDetail(nameBankID); response = serviceResponse.Serialize(outputType); } else if (String.Compare(operation, "NameSearch", true) == 0) { ServiceResponse <CustomGenericList <Name> > serviceResponse = new ServiceResponse <CustomGenericList <Name> >(); serviceResponse.NameResult = this.NameSearch(name); response = serviceResponse.Serialize(outputType); } } catch (Exception ex) { ServiceResponse <string> serviceResponse = new ServiceResponse <string>(); serviceResponse.Status = "error"; serviceResponse.ErrorMessage = ex.Message; serviceResponse.NameResult = ex.Message; response = serviceResponse.Serialize(outputType); } // Include any specified callback function in JSON responses if ((callback != null) && (callback != String.Empty) && outputType == OutputType.Json) { response = callback + "(" + response + ");"; } context.Response.ContentType = "text/plain"; context.Response.Write(response); }
/// <summary> /// Create documentation output specification. /// </summary> /// <param name="rootPath"> /// The root path. /// </param> /// <param name="outputPath"> /// The output path. /// </param> /// <param name="outputType"> /// The output type. /// </param> /// <param name="debugMode"></param> /// <returns> /// The <see cref="IDocsOutput"/>. /// </returns> private static IDocsOutput CreateDocumentationOutputSpecification(string rootPath, string outputPath, OutputType outputType, bool debugMode) { if (outputType == OutputType.Markdown) { return(new MarkdownDocsOutput { ContentType = OutputType.Markdown, OutputPath = outputPath, RootUrl = "http://ravendb.net/docs/", }); } if (outputType == OutputType.Html) { IDocsOutput output = new HtmlDocsOutput { ContentType = OutputType.Html, OutputPath = outputPath, PageTemplate = File.ReadAllText( Path.Combine(rootPath, @"Tools\html-template.html")), RootUrl = "http://ravendb.net/docs/", ImagesPath = debugMode ? "images/" : null }; return(output); } return(null); }
internal static extern Result FMOD_System_GetOutput(IntPtr systemHandle, ref OutputType outputType);
public Output(OutputType t) { type = t; }
public void SetTitle(OutputType outs) { ((ZedGraphControl)histogramGrid).GraphPane.Title = "Гистограмма " + outs.ToString(); }
public virtual string GetFileName(OutputType type) => _options.PathSegmentNamingStrategy.Resolve(type.Name.Name);
/// <summary> /// Writes output of the given type to the user interface with /// the given foreground and background colors. Also includes /// a newline if requested. /// </summary> /// <param name="outputString"> /// The output string to be written. /// </param> /// <param name="includeNewLine"> /// If true, a newline should be appended to the output's contents. /// </param> /// <param name="outputType"> /// Specifies the type of output to be written. /// </param> /// <param name="foregroundColor"> /// Specifies the foreground color of the output to be written. /// </param> /// <param name="backgroundColor"> /// Specifies the background color of the output to be written. /// </param> public abstract void WriteOutput( string outputString, bool includeNewLine, OutputType outputType, ConsoleColor foregroundColor, ConsoleColor backgroundColor);