示例#1
0
        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;
        }
示例#2
0
        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);
        }
示例#3
0
        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;
        }
示例#5
0
        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;
        }
示例#6
0
        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));
        }
示例#7
0
        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);
        }
示例#8
0
        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;
        }
示例#9
0
        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++;
            }
        }
示例#11
0
        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;
        }
示例#12
0
        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;
        }
示例#13
0
 /// <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;
     }
 }
示例#14
0
 /// <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;
     }
 }
示例#15
0
        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();
            }
        }
示例#16
0
 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;
 }
示例#17
0
        /// <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);
        }
示例#18
0
        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);
        }
示例#19
0
        ///////////////////////////////////////////////////////////////////////

        public static bool HasFlags(
            OutputStyle flags,
            OutputStyle hasFlags,
            bool all
            )
        {
            if (all)
            {
                return((flags & hasFlags) == hasFlags);
            }
            else
            {
                return((flags & hasFlags) != OutputStyle.None);
            }
        }
示例#20
0
 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!");
     }
 }
示例#21
0
        /// <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();
        }
示例#22
0
        /// <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());
        }
示例#23
0
        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);
        }
示例#24
0
 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();
             }));
         }
     }
 }
示例#25
0
 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;
 }
示例#26
0
        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));
        }
示例#27
0
        /// <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}");
            }
        }
示例#28
0
        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);
        }
示例#29
0
		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;
        }
示例#31
0
 /// <summary>
 /// Constructs the style definition with default values.
 /// </summary>
 /// <param name="style">The style number.</param>
 public OutputStyleDef(OutputStyle style)
 {
     _style = style;
 }
示例#32
0
        /// <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;
        }
示例#33
0
 /// <summary>
 /// Constructs the style definition with default values.
 /// </summary>
 /// <param name="style">The style number.</param>
 public OutputStyleDef(OutputStyle style)
 {
     _style = style;
 }
示例#34
0
    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}");
    }
示例#35
0
        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;
        }
示例#36
0
 /// <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;
 }
示例#37
0
            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);
                }
            }
示例#38
0
 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);
 }
示例#42
0
        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);
            }
        }
示例#43
0
 /// <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;
 }
示例#44
0
 /// <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));
 }
示例#45
0
 /// <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);
 }
示例#46
0
        // 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);
        }