public string CompileFile(string inputPath, OutputStyle outputStyle = OutputStyle.Nested, bool sourceComments = true, IEnumerable<string> additionalIncludePaths = null) { if (outputStyle != OutputStyle.Nested && outputStyle != OutputStyle.Compressed) { throw new ArgumentException("Only nested and compressed output styles are currently supported by libsass."); } string directoryName = Path.GetDirectoryName(inputPath); List<string> includePaths = new List<string> { directoryName }; if (additionalIncludePaths != null) { includePaths.AddRange(additionalIncludePaths); } SassFileContext context = new SassFileContext { InputPath = inputPath, Options = new SassOptions { OutputStyle = (int)outputStyle, SourceComments = sourceComments, IncludePaths = String.Join(";", includePaths), ImagePath = String.Empty } }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return context.OutputString; }
public string Compile(string source, OutputStyle outputStyle = OutputStyle.Nested, bool includeSourceComments = true, int precision = 5, IEnumerable <string> includePaths = null) { SassContext context = new SassContext { SourceString = source, Options = new SassOptions { OutputStyle = (int)outputStyle, IncludeSourceComments = includeSourceComments, IncludePaths = includePaths != null?String.Join(";", includePaths) : String.Empty, Precision = precision, LineFeed = OutputLineFeed ?? (OutputLineFeed = "\r\n"), OmitSourceMappingUrl = OmitSourceMappingUrl } }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return(context.OutputString); }
public Compiler(string path, OutputStyle style) : this(path) { switch (style) { case OutputStyle.Nested: options.OutputStyle = LibSass.Compiler.Options.SassOutputStyle.Nested; break; case OutputStyle.Expanded: options.OutputStyle = LibSass.Compiler.Options.SassOutputStyle.Expanded; break; case OutputStyle.Compressed: options.OutputStyle = LibSass.Compiler.Options.SassOutputStyle.Compressed; break; case OutputStyle.Compact: options.OutputStyle = LibSass.Compiler.Options.SassOutputStyle.Compact; break; default: options.OutputStyle = LibSass.Compiler.Options.SassOutputStyle.Compressed; break; } }
public ReportMaster(string reportName, string outputName, string conn, string emailHost) { ReportFileName = reportName; if (outputName.StartsWith("mailto:")) { OutputFileName = tempfile_base + @"attach.txt"; OutputMode = OutputTypeMode.send_to_email; email_address = outputName.Substring(7).Trim(); } else { OutputFileName = outputName; OutputMode = OutputTypeMode.save_to_file; } ConnString = conn; FormatData = null; FieldNames = null; NameValueMap = null; SqlCommand = null; FormatLinkedValues = null; RecordCount = 0; DetailIndex = -1; OperatingMode = OutputStyle.fixed_width; ParseMode = ParsingMode.normal; DBMode = DatabaseMode.odbc; HeaderRecord = false; paramInput = new ParamInput(); out_lines = new List <string>(); this.emailHost = emailHost; }
public string Compile(string source, OutputStyle outputStyle = OutputStyle.Nested, bool includeSourceComments = true, int precision = 5, IEnumerable<string> includePaths = null) { SassContext context = new SassContext { SourceString = source, Options = new SassOptions { OutputStyle = (int)outputStyle, IncludeSourceComments = includeSourceComments, IncludePaths = includePaths != null ? String.Join(";", includePaths) : String.Empty, Precision = precision, LineFeed = OutputLineFeed ?? (OutputLineFeed = "\r\n"), OmitSourceMappingUrl = OmitSourceMappingUrl } }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return context.OutputString; }
public CompileFileResult CompileFile(string inputPath, OutputStyle outputStyle = OutputStyle.Nested, string sourceMapPath = null, bool includeSourceComments = true, int precision = 5, IEnumerable <string> additionalIncludePaths = null) { string directoryName = Path.GetDirectoryName(inputPath); List <string> includePaths = new List <string> { directoryName }; if (additionalIncludePaths != null) { includePaths.AddRange(additionalIncludePaths); } SassFileContext context = new SassFileContext { // libsass 3.0 expects utf8 path string, but strings in .NET are utf16, so we need to convert it InputPath = Utf16ToUtf8(inputPath), Options = new SassOptions { OutputStyle = (int)outputStyle, IncludeSourceComments = includeSourceComments, IncludePaths = String.Join(";", includePaths), Precision = precision }, OutputSourceMapFile = sourceMapPath }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return(new CompileFileResult(context.OutputString, context.OutputSourceMap)); }
public string Compile(string source, OutputStyle outputStyle = OutputStyle.Nested, SourceCommentsMode sourceComments = SourceCommentsMode.Default, int precision = 5, IEnumerable <string> includePaths = null) { if (outputStyle != OutputStyle.Nested && outputStyle != OutputStyle.Compressed) { throw new ArgumentException("Only nested and compressed output styles are currently supported by libsass."); } SassContext context = new SassContext { SourceString = source, Options = new SassOptions { OutputStyle = (int)outputStyle, SourceCommentsMode = (int)sourceComments, IncludePaths = includePaths != null?String.Join(";", includePaths) : String.Empty, ImagePath = string.Empty, Precision = precision } }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return(context.OutputString); }
public string Compile(string source, OutputStyle outputStyle = OutputStyle.Nested, bool sourceComments = true, IEnumerable<string> includePaths = null) { if (outputStyle != OutputStyle.Nested && outputStyle != OutputStyle.Compressed) { throw new ArgumentException("Only nested and compressed output styles are currently supported by libsass."); } SassContext context = new SassContext { SourceString = source, Options = new SassOptions { OutputStyle = (int)outputStyle, SourceComments = sourceComments, IncludePaths = includePaths != null ? String.Join(";", includePaths) : String.Empty, ImagePath = String.Empty } }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return context.OutputString; }
public CompileFileResult CompileFile(string inputPath, OutputStyle outputStyle = OutputStyle.Nested, string sourceMapPath = null, bool includeSourceComments = true, int precision = 5, IEnumerable<string> additionalIncludePaths = null) { string directoryName = Path.GetDirectoryName(inputPath); List<string> includePaths = new List<string> { directoryName }; if (additionalIncludePaths != null) { includePaths.AddRange(additionalIncludePaths); } SassFileContext context = new SassFileContext { // libsass 3.0 expects utf8 path string, but strings in .NET are utf16, so we need to convert it InputPath = Utf16ToUtf8(inputPath), Options = new SassOptions { OutputStyle = (int)outputStyle, IncludeSourceComments = includeSourceComments, IncludePaths = String.Join(";", includePaths), Precision = precision, LineFeed = OutputLineFeed ?? (OutputLineFeed = "\r\n"), OmitSourceMappingUrl = OmitSourceMappingUrl }, OutputSourceMapFile = sourceMapPath }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return new CompileFileResult(context.OutputString, context.OutputSourceMap); }
public void ProcessLine(string line, int lineNum, List <TextFormat> data, StreamReader sr) { if (line.StartsWith("#Detail Start")) { ProcessDetail(line, sr, lineNum, FormatData); lineNum++; } else if (line.StartsWith("#Header Record#")) { HeaderRecord = true; } else if (line.StartsWith("#Format Start#")) { if (ParseMode == ParsingMode.config) { ParseMode = ParsingMode.normal; } OperatingMode = OutputStyle.fixed_width; if (OutputMode == OutputTypeMode.send_to_email) { OutputFileName = tempfile_base + "attach.txt"; } return; } else if (line.StartsWith("#CSV Start#")) { if (ParseMode == ParsingMode.config) { ParseMode = ParsingMode.normal; } OperatingMode = OutputStyle.csv; if (OutputMode == OutputTypeMode.send_to_email) { OutputFileName = tempfile_base + "attach.csv"; } return; } else if (line.StartsWith("#Config Start#")) { ParseMode = ParsingMode.config; } else if (ParseMode == ParsingMode.config) { ProcessConfigLine(line); } else { FormatData.Add(new TextFormat(line)); lineNum++; } }
private static void SetStyle(string style) { if (!Enum.TryParse(typeof(OutputStyle), style, true, out object obj)) { Console.Error.WriteLine("Invlid output style '" + style + "'"); ShowHelpAndExit(); } Program.style = (OutputStyle)obj; }
public override void Reference(SerializeOption other) { base.Reference(other); CData = ((XmlSerializeOption)other).CData; Declaration = ((XmlSerializeOption)other).Declaration; StartElement = ((XmlSerializeOption)other).StartElement; IgnoreNull = ((XmlSerializeOption)other).IgnoreNull; OutputStyle = ((XmlSerializeOption)other).OutputStyle; }
/// <summary> /// Writes formatted text to the output window followed by a end-of-line, using the specified style. /// </summary> /// <param name="style">The style for the text written.</param> /// <param name="format">The text format string. See string.Format documentation for details.</param> /// <param name="args">Arguments to be used in the string formatting.</param> /// <remarks>After this function ends, the style will be remain what it was before this function was called.</remarks> public void WriteLine(OutputStyle style, string format, params object[] args) { lock (_lock) { OutputStyle oldStyle = Style; Style = style; Plugin.NppIntf.WriteOutputLine(string.Format(format, args)); Style = oldStyle; } }
/// <summary> /// Writes text to the output window followed by a end-of-line, using the specified style. /// </summary> /// <param name="style">The style for the text written.</param> /// <param name="text">The text to be written.</param> /// <remarks>After this function ends, the style will be remain what it was before this function was called.</remarks> public void WriteLine(OutputStyle style, string text) { lock (_lock) { OutputStyle oldStyle = Style; Style = style; Plugin.NppIntf.WriteOutputLine(text); Style = oldStyle; } }
public static void Main(string[] args) { Program.input = Environment.CurrentDirectory; Program.output = Environment.CurrentDirectory; Program.style = OutputStyle.SideBySide; var errors = options.Parse(args); if (errors != null && errors.Count > 0) { ShowHelpAndExit(errors); } var downloader = new Downloader(directory: output, style: style); foreach (var file in Directory.EnumerateFiles(input, "*.dll", SearchOption.AllDirectories)) { Console.Write($"Fetching {file}... "); var res = downloader.DownloadFile(file); if (res == DownloadResult.NotFound) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"Symbols not found"); if (Program.deleteOptions.HasFlag(DeleteOptions.NotFound)) { Delete(file); } } else if (res == DownloadResult.Exists) { Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine($"Symbols already exist"); } else if (res == DownloadResult.Success) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Success"); } else if (res == DownloadResult.NoSymbols) { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("No symbols found"); if (Program.deleteOptions.HasFlag(DeleteOptions.NoSymbols)) { Delete(file); } } Console.ResetColor(); } }
public Downloader( string directory = null, OutputStyle style = OutputStyle.SideBySide, string server = "https://msdl.microsoft.com/download/symbols", int bufferSize = 4096) { this.style = style; this.server = server; this.directory = directory; this.bufferSize = bufferSize; }
/// <summary> /// Gets the style definition object for the specified style number. /// </summary> /// <param name="style">The style number.</param> /// <returns>The style definition object. If it does not exist yet, a new one will be created with default values.</returns> internal static OutputStyleDef GetStyleDef(OutputStyle style) { OutputStyleDef osd; if (_styles.TryGetValue(style, out osd)) { return(osd); } osd = new OutputStyleDef(style); _styles.Add(style, osd); return(osd); }
private OutputStyleDef GetWorkingOutputStyleDef(OutputStyle style) { OutputStyleDef osd; if (_styles.TryGetValue(style, out osd)) { return(osd); } osd = OutputStyleDef.GetStyleDef(style).Clone(); _styles.Add(style, osd); return(osd); }
/////////////////////////////////////////////////////////////////////// public static bool HasFlags( OutputStyle flags, OutputStyle hasFlags, bool all ) { if (all) { return((flags & hasFlags) == hasFlags); } else { return((flags & hasFlags) != OutputStyle.None); } }
public void Write(string fileName, int recordCount, out string result, OutputStyle outputMode, bool headerRecord) { if (outputMode == OutputStyle.fixed_width) { WriteFixedWidth(fileName, recordCount, out result, headerRecord); } else if (outputMode == OutputStyle.csv) { WriteCSV(fileName, recordCount, out result, headerRecord); } else { throw new ArgumentException("Invalid output mode!"); } }
/// <summary> /// 提供将运行时环境信息输出到控制台的方法 /// </summary> /// <param name="information">信息</param> /// <param name="causer">触发者</param> /// <param name="oStyle">输出的类型</param> public static void ConsoleLine(string information, string causer, OutputStyle oStyle) { Console.ResetColor(); switch (oStyle) { case OutputStyle.Normal: Console.WriteLine("[Information]"); Console.WriteLine("触发器:{0}", causer); Console.WriteLine("时间戳:{0}", DateTime.Now.ToString()); Console.WriteLine("工作集:{0:F3} MB", Environment.WorkingSet / 1048576.0); Console.WriteLine("信 息:{0}", information); break; case OutputStyle.Important: Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("[Important]"); Console.WriteLine("触发器:{0}", causer); Console.WriteLine("时间戳:{0}", DateTime.Now.ToString()); Console.WriteLine("工作集:{0:F3} MB", Environment.WorkingSet / 1048576.0); Console.WriteLine("信 息:{0}", information); break; case OutputStyle.Warning: Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[Warning]"); Console.WriteLine("触发器:{0}", causer); Console.WriteLine("时间戳:{0}", DateTime.Now.ToString()); Console.WriteLine("工作集:{0:F3} MB", Environment.WorkingSet / 1048576.0); Console.WriteLine("信 息:{0}", information); break; case OutputStyle.Error: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[Error]"); Console.WriteLine("触发器:{0}", causer); Console.WriteLine("时间戳:{0}", DateTime.Now.ToString()); Console.WriteLine("工作集:{0:F3} MB", Environment.WorkingSet / 1048576.0); Console.WriteLine("信 息:{0}", information); break; case OutputStyle.Simple: default: Console.WriteLine(information); break; } Console.ResetColor(); Console.WriteLine(); }
/// <summary> /// Create string representation based on a predefined style template. /// </summary> /// <param name="style"><see cref="OutputStyle"/></param> /// <returns>String representation of CommandLineArguments.</returns> public string ToString(OutputStyle style) { var sb = new StringBuilder(); foreach (var arg in this) { // Append each argument based on the chosen style template sb.AppendFormat( GetOutputStyleTemplate(style), EncodeArgument(arg.Key), EncodeArgument(arg.Value) ); } return(sb.ToString()); }
public string CompileFile(string inputPath, OutputStyle outputStyle = OutputStyle.Nested, bool sourceComments = true, IEnumerable <string> additionalIncludePaths = null) { if (outputStyle != OutputStyle.Nested && outputStyle != OutputStyle.Compressed) { throw new ArgumentException("Only nested and compressed output styles are currently supported by libsass."); } string directoryName = Path.GetDirectoryName(inputPath); List <string> includePaths = new List <string> { directoryName }; if (additionalIncludePaths != null) { includePaths.AddRange(additionalIncludePaths); } SassFileContext context = new SassFileContext { InputPath = inputPath, Options = new SassOptions { OutputStyle = (int)outputStyle, SourceComments = sourceComments, SourceMapFile = String.Empty, OmitSourceMapUrl = true, SourceMapEmbed = false, SourceMapContents = false, SourceMapRoot = String.Empty, IsIndentedSyntaxSrc = false, IncludePaths = String.Join(";", includePaths), PluginPaths = String.Empty, Indent = String.Empty, Linefeed = String.Empty, Precision = 0 } }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return(context.OutputString); }
public void PostToTextDisplayBox(OutputStyle style, OutputLevel level, string output) { if (mTextDisplayBox != null) { if ((level == OutputLevel.AlwaysShow) || (level == OutputLevel.Verbose && Verbose == true) || (level == OutputLevel.RawData && ShowRawData == true)) { mTextDisplayBox.Invoke(new EventHandler(delegate { mTextDisplayBox.SelectionFont = new Font(mTextDisplayBox.SelectionFont, FontStyle.Bold); mTextDisplayBox.SelectionColor = mOutputColor[(int)style]; mTextDisplayBox.AppendText(output); mTextDisplayBox.ScrollToCaret(); })); } } }
public FormTagSparkExtension(ElementNode node) { _mNode = node; var attributeNode = node.Attributes.SingleOrDefault(x => x.Name == Constants.VALIDATE_ATTRIBUTE); if (attributeNode != null) { var attributeNodeValue = attributeNode.Value.ToLower(); if (attributeNodeValue == "mvc") this.outputStyle = OutputStyle.MVC; else { this.outputStyle = OutputStyle.Default; if (attributeNodeValue != "true") modelName = attributeNode.Value; } } else validate = false; }
public CompileFileResult CompileFile(string inputPath, OutputStyle outputStyle = OutputStyle.Nested, string sourceMapPath = null, SourceCommentsMode sourceComments = SourceCommentsMode.Default, int precision = 5, IEnumerable <string> additionalIncludePaths = null) { if (outputStyle != OutputStyle.Nested && outputStyle != OutputStyle.Compressed) { throw new ArgumentException("Only nested and compressed output styles are currently supported by libsass."); } string directoryName = Path.GetDirectoryName(inputPath); List <string> includePaths = new List <string> { directoryName }; if (additionalIncludePaths != null) { includePaths.AddRange(additionalIncludePaths); } SassFileContext context = new SassFileContext { // libsass 3.0 expects utf8 path string, but strings in .NET are utf16, so we need to convert it InputPath = Utf16ToUtf8(inputPath), Options = new SassOptions { OutputStyle = (int)outputStyle, SourceCommentsMode = (int)sourceComments, IncludePaths = String.Join(";", includePaths), ImagePath = string.Empty, Precision = precision }, OutputSourceMapFile = sourceMapPath }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return(new CompileFileResult(context.OutputString, context.OutputSourceMap)); }
/// <summary> /// Create string template from <see cref="OutputStyle"/> /// </summary> /// <param name="style"><see cref="OutputStyle"/></param> /// <returns>Argument string template.</returns> private static string GetOutputStyleTemplate(OutputStyle style) { switch (style) { case OutputStyle.DoubleDashEquals: default: return(" --{0}={1}"); case OutputStyle.DashEquals: return(" -{0}={1}"); case OutputStyle.SlashColon: return(" /{0}:{1}"); case OutputStyle.SlashEquals: return(" /{0}={1}"); case OutputStyle.SlashSpace: return(" /{0} {1}"); } }
public string Compile(string source, OutputStyle outputStyle = OutputStyle.Nested, bool sourceComments = true, IEnumerable <string> includePaths = null) { if (outputStyle != OutputStyle.Nested && outputStyle != OutputStyle.Compressed) { throw new ArgumentException("Only nested and compressed output styles are currently supported by libsass."); } SassContext context = new SassContext { SourceString = source, Options = new SassOptions { OutputStyle = (int)outputStyle, SourceComments = sourceComments, SourceMapFile = String.Empty, OmitSourceMapUrl = true, SourceMapEmbed = false, SourceMapContents = false, SourceMapRoot = String.Empty, IsIndentedSyntaxSrc = false, IncludePaths = includePaths != null?String.Join(";", includePaths) : String.Empty, PluginPaths = String.Empty, Indent = String.Empty, Linefeed = String.Empty, Precision = 0 } }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return(context.OutputString); }
public string Compile(string source, OutputStyle outputStyle = OutputStyle.Nested, bool sourceComments = true, IEnumerable<string> includePaths = null) { if (outputStyle != OutputStyle.Nested && outputStyle != OutputStyle.Compressed) { throw new ArgumentException("Only nested and compressed output styles are currently supported by libsass."); } SassContext context = new SassContext { SourceString = source, Options = new SassOptions { OutputStyle = (int)outputStyle, SourceComments = sourceComments, SourceMapFile = String.Empty, OmitSourceMapUrl = true, SourceMapEmbed = false, SourceMapContents = false, SourceMapRoot = String.Empty, IsIndentedSyntaxSrc = false, IncludePaths = includePaths != null ? String.Join(";", includePaths) : String.Empty, PluginPaths = String.Empty, Indent = String.Empty, Linefeed = String.Empty, Precision = 0 } }; _sassInterface.Compile(context); if (context.ErrorStatus) { throw new SassCompileException(context.ErrorMessage); } return context.OutputString; }
public ReportMaster(string reportName, string outputName, string conn, StreamReader s, StreamWriter w) { Reader = s; ReportFileName = reportName; OutputFileName = outputName; ConnString = conn; FormatData = null; FieldNames = null; NameValueMap = null; SqlCommand = null; FormatLinkedValues = null; RecordCount = 0; DetailIndex = -1; OperatingMode = OutputStyle.fixed_width; ParseMode = ParsingMode.normal; DBMode = DatabaseMode.odbc; HeaderRecord = false; out_lines = new List <string>(); paramInput = new ParamInput(); Writer = w; }
/// <summary> /// Constructs the style definition with default values. /// </summary> /// <param name="style">The style number.</param> public OutputStyleDef(OutputStyle style) { _style = style; }
/// <summary> /// Gets the style definition object for the specified style number. /// </summary> /// <param name="style">The style number.</param> /// <returns>The style definition object. If it does not exist yet, a new one will be created with default values.</returns> internal static OutputStyleDef GetStyleDef(OutputStyle style) { OutputStyleDef osd; if (_styles.TryGetValue(style, out osd)) return osd; osd = new OutputStyleDef(style); _styles.Add(style, osd); return osd; }
/// <summary> /// Constructs the style definition with default values. /// </summary> /// <param name="style">The style number.</param> public OutputStyleDef(OutputStyle style) { _style = style; }
private static void ValidatePrerenderedContents_of_BlazorWasmApp0(string wwwrootDir, string homeTitle = "Home", string environment = "Prerendering", OutputStyle outputStyle = OutputStyle.AppendHtmlExtension) { var rootIndexHtmlPath = Path.Combine(wwwrootDir, "index.html"); var aboutIndexHtmlPath = outputStyle == OutputStyle.AppendHtmlExtension ? Path.Combine(wwwrootDir, "about.html") : Path.Combine(wwwrootDir, "about", "index.html"); File.Exists(rootIndexHtmlPath).IsTrue(); File.Exists(aboutIndexHtmlPath).IsTrue(); var htmlParser = new HtmlParser(); using var rootIndexHtml = htmlParser.ParseDocument(File.ReadAllText(rootIndexHtmlPath)); using var aboutIndexHtml = htmlParser.ParseDocument(File.ReadAllText(aboutIndexHtmlPath)); // NOTICE: The document title was rendered by the <HeadOutlet> component of .NET 6. rootIndexHtml.Title.Is($"{homeTitle} | Blazor Wasm App 0"); aboutIndexHtml.Title.Is("About | Blazor Wasm App 0"); rootIndexHtml.QuerySelector("h1") !.TextContent.Is(homeTitle); aboutIndexHtml.QuerySelector("h1") !.TextContent.Is("About"); rootIndexHtml.QuerySelector("a") !.TextContent.Is("about"); (rootIndexHtml.QuerySelector("a") as IHtmlAnchorElement) !.Href.Is("about:///about"); aboutIndexHtml.QuerySelector("a") !.TextContent.Is("home"); (aboutIndexHtml.QuerySelector("a") as IHtmlAnchorElement) !.Href.Is("about:///"); rootIndexHtml.QuerySelector(".environment") !.TextContent.Trim().Is($"Environment: {environment}"); }
private OutputStyleDef GetWorkingOutputStyleDef(OutputStyle style) { OutputStyleDef osd; if (_styles.TryGetValue(style, out osd)) return osd; osd = OutputStyleDef.GetStyleDef(style).Clone(); _styles.Add(style, osd); return osd; }
/// <summary> /// Writes text to the output window followed by a end-of-line, using the specified style. /// </summary> /// <param name="style">The style for the text written.</param> /// <param name="text">The text to be written.</param> /// <remarks>After this function ends, the style will be remain what it was before this function was called.</remarks> public void WriteLine(OutputStyle style, string text) { OutputStyle oldStyle = Style; Style = style; Plugin.NppIntf.WriteOutputLine(text); Style = oldStyle; }
internal AssertWriter(PSRuleOption option, Source[] source, PipelineWriter inner, PipelineWriter next, OutputStyle style, string resultVariableName, PSCmdlet cmdletContext, EngineIntrinsics executionContext) : base(inner, option) { _InnerWriter = next; _ResultVariableName = resultVariableName; _CmdletContext = cmdletContext; _ExecutionContext = executionContext; if (!string.IsNullOrEmpty(resultVariableName)) { _Results = new List <RuleRecord>(); } if (style == OutputStyle.AzurePipelines) { _Formatter = new AzurePipelinesFormatter(source, inner); } else if (style == OutputStyle.GitHubActions) { _Formatter = new GitHubActionsFormatter(source, inner); } else if (style == OutputStyle.Plain) { _Formatter = new PlainFormatter(source, inner); } else if (style == OutputStyle.Client) { _Formatter = new ClientFormatter(source, inner); } }
public Compiler(string path, OutputStyle style, string OutputPath) : this(path, style) { this.OutputPath = OutputPath; }
public string ToString(OutputStyle Style) { switch (Style) { case OutputStyle.Pretty: return ValChar[Value + ValOffset] + SuitChar[Suit]; case OutputStyle.Text: return _ValChar[Value + ValOffset] + _SuitChar[Suit]; case OutputStyle.Number: return Number.ToString(); default: return null; } }
public static string ToString(int[] Cards, OutputStyle Style, int StartIndex = 0, int EndIndex = -1) { if (EndIndex < 0) EndIndex = Cards.Length; string s = ""; for (int i = StartIndex; i < EndIndex; i++) { if (i > 0) s += " "; s += new Card(Cards[i]).ToString(Style); } return s; }
public static string ToString(OutputStyle Style, params int[] Cards) { return ToString(Cards, Style); }
private void lstOutputStyles_SelectedIndexChanged(object sender, EventArgs e) { try { if (lstOutputStyles.SelectedItem == null) return; _styleChanging = true; _currentStyle = (OutputStyle)Enum.Parse(typeof(OutputStyle), lstOutputStyles.SelectedItem.ToString()); _currentStyleDef = GetWorkingOutputStyleDef(_currentStyle); // Refresh font list if (string.IsNullOrEmpty(_currentStyleDef.FontName)) { cmbOutputFonts.SelectedIndex = 0; } else { bool found = false; foreach (string f in cmbOutputFonts.Items) { if (f.Equals(_currentStyleDef.FontName, StringComparison.InvariantCultureIgnoreCase)) { cmbOutputFonts.SelectedItem = f; found = true; break; } } if (!found) cmbOutputFonts.SelectedIndex = 0; } // Refresh font size if (_currentStyleDef.Size.HasValue) { txtOutputSize.Text = _currentStyleDef.Size.Value.ToString(); } else { txtOutputSize.Text = string.Empty; } // Font style switch (_currentStyleDef.Bold) { case true: chkBold.CheckState = CheckState.Checked; break; case false: chkBold.CheckState = CheckState.Unchecked; break; default: chkBold.CheckState = CheckState.Indeterminate; break; } switch (_currentStyleDef.Italic) { case true: chkItalic.CheckState = CheckState.Checked; break; case false: chkItalic.CheckState = CheckState.Unchecked; break; default: chkItalic.CheckState = CheckState.Indeterminate; break; } switch (_currentStyleDef.Underline) { case true: chkUnderline.CheckState = CheckState.Checked; break; case false: chkUnderline.CheckState = CheckState.Unchecked; break; default: chkUnderline.CheckState = CheckState.Indeterminate; break; } // Refresh colors clrFore.Color = _currentStyleDef.ForeColor; clrBack.Color = _currentStyleDef.BackColor; _styleChanging = false; } catch (Exception ex) { ShowError(ex); } }
/// <summary> /// Writes formatted text to the output window followed by a end-of-line, using the specified style. /// </summary> /// <param name="style">The style for the text written.</param> /// <param name="format">The text format string. See string.Format documentation for details.</param> /// <param name="args">Arguments to be used in the string formatting.</param> /// <remarks>After this function ends, the style will be remain what it was before this function was called.</remarks> public void WriteLine(OutputStyle style, string format, params object[] args) { OutputStyle oldStyle = Style; Style = style; Plugin.NppIntf.WriteOutputLine(string.Format(format, args)); Style = oldStyle; }
/// <summary> /// Creates a key-path for an output window style. /// The value will be placed under a sub-key for the style number. /// </summary> /// <param name="style">The style number.</param> /// <param name="name">The value name.</param> /// <returns>The resulting key-path.</returns> public static string MakeOwsKeyPath(OutputStyle style, string name) { return(string.Concat(Res.Reg_OutputStylePrefix, style.ToString(), "\\", name)); }
/// <summary> /// Creates a key-path for an output window style. /// The value will be placed under a sub-key for the style number. /// </summary> /// <param name="style">The style number.</param> /// <param name="name">The value name.</param> /// <returns>The resulting key-path.</returns> public static string MakeOwsKeyPath(OutputStyle style, string name) { return string.Concat(Res.Reg_OutputStylePrefix, style.ToString(), "\\", name); }
// Vrácení hodnoty v čitelné podobě prostřednictvím řetězce. public string Get(OutputStyle style) { // Pokud je vyžadován kompaktní výstup, nebo jsme na nule, // je to jednoduché: if (style == OutputStyle.Compact || this.Value == 0) { var obj = UnitRecords.FindAll(w => w.Type == this.Type && w.Conversion == 1); if (obj.Count != 1 && style == OutputStyle.Compact) { throw new Exception(String.Format("Can not print in compact mode, no suffitien unit found for type {0}!", this.Type.ToString())); } if (style == OutputStyle.Compact) { return(this.Value.ToString() + "\u00A0" + obj[0].Unit); } else { if (obj.Count == 1) { return("0\u00A0" + obj[0].Unit); } else { return("0"); } } } // Najdeme si všechny jednotky, které můžeme použít, // a seřadíme je od největší po nejmenší. var records = UnitRecords.FindAll(w => w.Type == this.Type) .OrderByDescending(x => x.Conversion).ToList(); // Pokud nemáme nastavenou jednotku, vytiskneme prostě jen číslo: if (this.Type == MetricType.None) { return(this.Value.ToString()); } // Teď projdeme všechny tyto jednotky a pokusíme se sestavit // čitelný řetězec s použitím těchto jednotek. decimal valueLeft = this.Value; // Pokud jsme v záporu, invertujeme a nastavíme příznak: bool negative = this.Value < 0; if (negative) { valueLeft *= -1; } string output = ""; foreach (UnitRecord record in records) { if (((decimal)record.Conversion <= valueLeft || style == OutputStyle.Full) && (record.DefaultPrint || style == OutputStyle.Expanded || style == OutputStyle.Full)) { int num = (int)(valueLeft / (decimal)record.Conversion); if (output != "") { output += ", "; } int outNum = num; if (negative) { outNum *= -1; } output += outNum.ToString() + "\u00A0" + record.Unit; decimal minus = (decimal)((decimal)(num) * (decimal)(record.Conversion)); valueLeft -= minus; if (valueLeft == 0 && style != OutputStyle.Full) { break; } } } return(output); }