本文整理汇总了C#中ILibraryManager.GetLibraryInformation方法的典型用法代码示例。如果您正苦于以下问题:C# ILibraryManager.GetLibraryInformation方法的具体用法?C# ILibraryManager.GetLibraryInformation怎么用?C# ILibraryManager.GetLibraryInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILibraryManager
的用法示例。
在下文中一共展示了ILibraryManager.GetLibraryInformation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
public void Configure(IBuilder app, ILibraryManager libManager, IApplicationShutdown shutdown)
{
var web = libManager.GetLibraryInformation("Runt.Web");
Console.WriteLine("Path: " + web.Path);
Console.WriteLine("Name: " + web.Name);
var fileSystem = new PhysicalFileSystem(Path.GetDirectoryName(web.Path));
app.UseServices(services =>
{
services.AddSignalR();
services.AddSingleton<IEditor, Editor>();
});
app.UseSignalR("/io", typeof(RuntConnection), new ConnectionConfiguration
{
EnableJSONP = false
});
app.UseDefaultFiles(new DefaultFilesOptions
{
FileSystem = fileSystem
});
app.UseStaticFiles(new StaticFileOptions
{
FileSystem = fileSystem,
ContentTypeProvider = contentTypeProvider,
ServeUnknownFileTypes = true
});
app.UseDirectoryBrowser(new DirectoryBrowserOptions
{
FileSystem = fileSystem
});
}
示例2: KestrelEngine
public KestrelEngine(ILibraryManager libraryManager, IApplicationShutdown appShutdownService)
{
AppShutdown = appShutdownService;
Threads = new List<KestrelThread>();
Listeners = new List<Listener>();
Memory = new MemoryPool();
Libuv = new Libuv();
var libraryPath = default(string);
if (libraryManager != null)
{
var library = libraryManager.GetLibraryInformation("Microsoft.AspNet.Server.Kestrel");
libraryPath = library.Path;
if (library.Type == "Project")
{
libraryPath = Path.GetDirectoryName(libraryPath);
}
if (Libuv.IsWindows)
{
var architecture = IntPtr.Size == 4
? "x86"
: "amd64";
libraryPath = Path.Combine(
libraryPath,
"native",
"windows",
architecture,
"libuv.dll");
}
else if (Libuv.IsDarwin)
{
libraryPath = Path.Combine(
libraryPath,
"native",
"darwin",
"universal",
"libuv.dylib");
}
else
{
libraryPath = "libuv.so.1";
}
}
Libuv.Load(libraryPath);
}
示例3: GetExportsRecursive
public static ILibraryExport GetExportsRecursive(
ICache cache,
ILibraryManager manager,
ILibraryExportProvider libraryExportProvider,
ILibraryKey target,
Func<ILibraryInformation, bool> include)
{
var dependencyStopWatch = Stopwatch.StartNew();
Logger.TraceInformation("[{0}]: Resolving references for '{1}' {2}", typeof(ProjectExportProviderHelper).Name, target.Name, target.Aspect);
var references = new Dictionary<string, IMetadataReference>(StringComparer.OrdinalIgnoreCase);
var sourceReferences = new Dictionary<string, ISourceReference>(StringComparer.OrdinalIgnoreCase);
// Walk the dependency tree and resolve the library export for all references to this project
var stack = new Queue<Node>();
var processed = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var rootNode = new Node
{
Library = manager.GetLibraryInformation(target.Name, target.Aspect)
};
stack.Enqueue(rootNode);
while (stack.Count > 0)
{
var node = stack.Dequeue();
// Skip it if we've already seen it
if (!processed.Add(node.Library.Name))
{
continue;
}
if (include(node.Library))
{
var libraryExport = libraryExportProvider.GetLibraryExport(target
.ChangeName(node.Library.Name)
.ChangeAspect(null));
if (libraryExport != null)
{
if (node.Parent == rootNode)
{
// Only export sources from first level dependencies
ProcessExport(cache, libraryExport, references, sourceReferences);
}
else
{
// Skip source exports from anything else
ProcessExport(cache, libraryExport, references, sourceReferences: null);
}
}
}
foreach (var dependency in node.Library.Dependencies)
{
var childNode = new Node
{
Library = manager.GetLibraryInformation(dependency, null),
Parent = node
};
stack.Enqueue(childNode);
}
}
dependencyStopWatch.Stop();
Logger.TraceInformation("[{0}]: Resolved {1} references for '{2}' in {3}ms",
typeof(ProjectExportProviderHelper).Name,
references.Count,
target.Name,
dependencyStopWatch.ElapsedMilliseconds);
return new LibraryExport(
references.Values.ToList(),
sourceReferences.Values.ToList());
}
示例4: GetExportsRecursive
public static ILibraryExport GetExportsRecursive(
ILibraryManager manager,
ILibraryExportProvider libraryExportProvider,
string name,
FrameworkName targetFramework,
string configuration,
bool dependenciesOnly)
{
var dependencyStopWatch = Stopwatch.StartNew();
Trace.TraceInformation("[{0}]: Resolving references for '{1}'", typeof(ProjectExportProviderHelper).Name, name);
var references = new Dictionary<string, IMetadataReference>(StringComparer.OrdinalIgnoreCase);
var sourceReferences = new Dictionary<string, ISourceReference>(StringComparer.OrdinalIgnoreCase);
// Walk the dependency tree and resolve the library export for all references to this project
var stack = new Queue<Node>();
var processed = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var rootNode = new Node
{
Library = manager.GetLibraryInformation(name)
};
stack.Enqueue(rootNode);
while (stack.Count > 0)
{
var node = stack.Dequeue();
// Skip it if we've already seen it
if (!processed.Add(node.Library.Name))
{
continue;
}
bool isRoot = node.Parent == null;
if (!dependenciesOnly || (dependenciesOnly && !isRoot))
{
var libraryExport = libraryExportProvider.GetLibraryExport(node.Library.Name, targetFramework, configuration);
if (libraryExport == null)
{
// TODO: Failed to resolve dependency so do something useful
Trace.TraceInformation("[{0}]: Failed to resolve dependency '{1}'", typeof(ProjectExportProviderHelper).Name, node.Library.Name);
}
else
{
if (node.Parent == rootNode)
{
// Only export sources from first level dependencies
ProcessExport(libraryExport, references, sourceReferences);
}
else
{
// Skip source exports from anything else
ProcessExport(libraryExport, references, sourceReferences: null);
}
}
}
foreach (var dependency in node.Library.Dependencies)
{
var childNode = new Node
{
Library = manager.GetLibraryInformation(dependency),
Parent = node
};
stack.Enqueue(childNode);
}
}
dependencyStopWatch.Stop();
Trace.TraceInformation("[{0}]: Resolved {1} references for '{2}' in {3}ms",
typeof(ProjectExportProviderHelper).Name,
references.Count,
name,
dependencyStopWatch.ElapsedMilliseconds);
return new LibraryExport(
references.Values.ToList(),
sourceReferences.Values.ToList());
}