本文整理汇总了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
}
示例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
}
示例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;
}