当前位置: 首页>>代码示例>>C#>>正文


C# Config.GetAbsoluteInputFile方法代码示例

本文整理汇总了C#中Config.GetAbsoluteInputFile方法的典型用法代码示例。如果您正苦于以下问题:C# Config.GetAbsoluteInputFile方法的具体用法?C# Config.GetAbsoluteInputFile怎么用?C# Config.GetAbsoluteInputFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Config的用法示例。


在下文中一共展示了Config.GetAbsoluteInputFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TrackCompile

        /// <summary>Tracks an event to ApplicationInsights.</summary>
        public static void TrackCompile(Config config)
        {
            #if !DEBUG
            string fileName = config.GetAbsoluteInputFile();
            string extension = System.IO.Path.GetExtension(fileName).ToLowerInvariant();

            _telemetry.TrackEvent(extension);
            #endif
        }
开发者ID:DayLightDancer,项目名称:WebCompiler,代码行数:10,代码来源:Telemetry.cs

示例2: TrackCompile

        /// <summary>Tracks an event to ApplicationInsights.</summary>
        public static void TrackCompile(Config config)
        {
#if !DEBUG
            if (Enabled)
            {
                string extension = config.GetAbsoluteInputFile().Extension.ToUpperInvariant();
                _telemetry.TrackEvent(extension);
            }
#endif
        }
开发者ID:PaulVrugt,项目名称:WebCompiler,代码行数:11,代码来源:Telemetry.cs

示例3: Adjust

        public static string Adjust(string content, Config config)
        {
            string cssFileContents = content;
            string absoluteOutputPath = config.GetAbsoluteOutputFile();

            // apply the RegEx to the file (to change relative paths)
            var matches = _rxUrl.Matches(cssFileContents);

            // Ignore the file if no match
            if (matches.Count > 0)
            {
                string cssDirectoryPath = Path.GetDirectoryName(config.GetAbsoluteInputFile());

                if (!Directory.Exists(cssDirectoryPath))
                    return cssFileContents;

                foreach (Match match in matches)
                {
                    string quoteDelimiter = match.Groups[1].Value; //url('') vs url("")
                    string relativePathToCss = match.Groups[2].Value;

                    // Ignore root relative references
                    if (relativePathToCss.StartsWith("/", StringComparison.Ordinal))
                        continue;

                    //prevent query string from causing error
                    var pathAndQuery = relativePathToCss.Split(new[] { '?' }, 2, StringSplitOptions.RemoveEmptyEntries);
                    var pathOnly = pathAndQuery[0];
                    var queryOnly = pathAndQuery.Length == 2 ? pathAndQuery[1] : string.Empty;

                    string absolutePath = GetAbsolutePath(cssDirectoryPath, pathOnly);

                    if (string.IsNullOrEmpty(absoluteOutputPath))
                        continue;

                    string serverRelativeUrl = FileHelpers.MakeRelative(absoluteOutputPath, absolutePath);

                    if (!string.IsNullOrEmpty(queryOnly))
                        serverRelativeUrl += "?" + queryOnly;

                    string replace = string.Format("url({0}{1}{0})", quoteDelimiter, serverRelativeUrl);

                    cssFileContents = cssFileContents.Replace(match.Groups[0].Value, replace);
                }
            }

            return cssFileContents;
        }
开发者ID:DayLightDancer,项目名称:WebCompiler,代码行数:48,代码来源:CssRelativePathAdjuster.cs


注:本文中的Config.GetAbsoluteInputFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。