本文整理汇总了C#中System.IO.Select方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.Select方法的具体用法?C# System.IO.Select怎么用?C# System.IO.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO
的用法示例。
在下文中一共展示了System.IO.Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteClientAssetsDebugMode
public static void WriteClientAssetsDebugMode(HtmlDocument document, bool devMode, string bundleName = "/bundle.js")
{
var stylesheets = new[] {"bootstrap.min.css", "storyteller.css", "font-awesome.min.css", "fixed-data-table.min.css"};
var tags = stylesheets.Select(file =>
{
var path = $"/public/stylesheets/{file}";
return new HtmlTag("link").Attr("rel", "stylesheet").Attr("href", path);
});
document.Head.Append(tags);
var bundleUrl = devMode ? "http://localhost:3001/client/public/javascript/bundle.js" : bundleName;
var scriptTag = new HtmlTag("script").Attr("type", "text/javascript").Attr("src", bundleUrl);
document.Body.Append(scriptTag);
}
示例2: GetFileEncodingTest
public void GetFileEncodingTest()
{
var testFiles = new[]
{
"utf8.yml",
"utf8-explicit-bom.yml",
"utf16be.yml",
"utf16be-explicit-bom.yml",
"utf16le.yml",
"utf16le-explicit-bom.yml",
"utf32be.yml",
"utf32be-explicit-bom.yml",
"utf32le.yml",
"utf32le-explicit-bom.yml"
};
foreach (var fileName in testFiles.Select(f => string.Format(Path.Combine("..", "..", "TestData", f))))
using (TextReader reader = new StreamReader(fileName, StringUtil.GetFileEncoding(fileName)))
Assert.AreEqual("test", reader.ReadLine());
}
示例3: TextTokenTest
public void TextTokenTest()
{
var tokens = new[]
{
new Token( Parser._rule, "<%rule" ),
null,
new Token( Parser._ident, "Test" ),
new Token( Parser._endStatement, "%>" ),
new Token( Parser._end, "<%end%>" )
};
var text = string.Join( "", tokens.Select( t => t != null ? t.value : " " ).ToArray() );
var scanner = new global::WolfGenerator.Core.Parsing.Scanner( new MemoryStream( Encoding.UTF8.GetBytes( text ) ) );
foreach (var expectedTokenValue in tokens.Where( s => s != null ))
{
var actualTokenValue = scanner.Scan();
Assert.That( actualTokenValue.val, Is.EqualTo( expectedTokenValue.value ) );
if (expectedTokenValue.type.HasValue)
Assert.That( actualTokenValue.kind, Is.EqualTo( expectedTokenValue.type.Value ),
"Wrong kind of parsing token" );
}
}
示例4: LoadShaderFromFile
public static bool LoadShaderFromFile(int shaderObj, string fileName, string additionalDefines)
{
var compileStatus = 0;
Sys.DebugLog(GL_LOG_FILENAME, "GL_Loading {0}", fileName);
var version = "#version 150\n";
try
{
if (!string.IsNullOrWhiteSpace(additionalDefines))
{
var bufs = new[] {version, additionalDefines, File.ReadAllText(fileName)};
var lengths = bufs.Select(x => x.Length).ToArray();
GL.ShaderSource(shaderObj, 3, bufs, lengths);
}
else
{
var bufs = new[] {version, File.ReadAllText(fileName)};
var lengths = bufs.Select(x => x.Length).ToArray();
GL.ShaderSource(shaderObj, 2, bufs, lengths);
}
}
catch
{
return false;
}
Sys.DebugLog(GL_LOG_FILENAME, "Source loaded");
GL.CompileShader(shaderObj);
Sys.DebugLog(GL_LOG_FILENAME, "Trying to compile");
GL.GetShader(shaderObj, ShaderParameter.CompileStatus, out compileStatus);
PrintShaderInfoLog(shaderObj);
if(compileStatus != 1)
{
Sys.DebugLog(GL_LOG_FILENAME, "Compilation failed");
return false;
}
else
{
Sys.DebugLog(GL_LOG_FILENAME, "Compilation succeeded");
return true;
}
}