本文整理汇总了C#中System.IO.DirectoryInfo.Concat方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfo.Concat方法的具体用法?C# DirectoryInfo.Concat怎么用?C# DirectoryInfo.Concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.DirectoryInfo
的用法示例。
在下文中一共展示了DirectoryInfo.Concat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
private void Initialize()
{
#if(SILVERLIGHT)
_assemblies = (from part in Deployment.Current.Parts
where ShouldAddAssembly(part.Source)
let info = Application.GetResourceStream(new Uri(part.Source, UriKind.Relative))
select part.Load(info.Stream)).ToArray();
#else
var codeBase = Assembly.GetExecutingAssembly().CodeBase;
var uri = new Uri(codeBase);
var path = Path.GetDirectoryName(uri.LocalPath);
var files = new DirectoryInfo(path).GetFiles("*.dll");
files.Concat(new DirectoryInfo(path).GetFiles("*.exe"));
var currentAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
foreach (var file in files)
{
var assemblyName = AssemblyName.GetAssemblyName(file.FullName);
if (!currentAssemblies.Any(assembly => Matches(assemblyName, assembly.GetName()))) // AssemblyName.ReferenceMatchesDefinition(assemblyName, assembly.GetName())))
currentAssemblies.Add(Assembly.Load(assemblyName));
}
_assemblies = currentAssemblies.Distinct(new AssemblyComparer()).ToArray();
#endif
}
示例2: Init
public void Init()
{
Bootstrapper.With.Windsor(AssemblyResolver, BootstrapEnvironment.BUS).And.StartupTasks().UsingThisExecutionOrder(s => s
.First<AppDomainAssemblyResolverStartupTask>()
.Then<WindsorSetupStartupTask>()
.Then().TheRest()).Start();
var nserviceBusAssemblies = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory)
.GetFiles("NServiceBus*.dll", SearchOption.AllDirectories)
.Select(file => Assembly.LoadFrom(file.FullName));
container = (IWindsorContainer)Bootstrapper.Container;
var assemblies = nserviceBusAssemblies.Concat(AssemblyResolver.PluginAssembliesByFullName.Values);
Configure.With(assemblies)
.CastleWindsorBuilder(container)
.MsmqTransport()
.IsTransactional(false)
.PurgeOnStartup(false)
.MsmqSubscriptionStorage()
.XmlSerializer()
.UnicastBus()
.LoadMessageHandlers()
.CreateBus()
.Start();
}
示例3: Run
public void Run()
{
var assemblies = new DirectoryInfo(AppDomain.CurrentDomain.DynamicDirectory)
.GetFiles("NServiceBus*.dll", SearchOption.AllDirectories)
.Select(file => Assembly.LoadFrom(file.FullName));
var bus = Configure.With(assemblies.Concat(MvcApplication.AssemblyResolver.PluginAssembliesByFullName.Values))
.Log4Net()
.CastleWindsorBuilder((IWindsorContainer)Bootstrapper.Container)
.XmlSerializer()
.MsmqTransport().IsTransactional(false)
.UnicastBus()
.LoadMessageHandlers()
.CreateBus()
.Start();
MvcApplication.Bus = bus;
}
示例4: LoadIconDictionary
private static Dictionary<String, Texture2D> LoadIconDictionary(String IconFolderName)
{
Dictionary<String, Texture2D> dictReturn = new Dictionary<string, Texture2D>();
Texture2D texLoading;
//Where are the Icons
String strIconPath = string.Format("{0}/{1}", PathPlugin, IconFolderName);
//String strIconDBPath = string.Format("{0}/{1}", DBPathPlugin, IconFolderName);
if (Directory.Exists(strIconPath))
{
//get all the png and tga's
FileInfo[] fileIconsPNG = new System.IO.DirectoryInfo(strIconPath).GetFiles("*.png");
FileInfo[] fileIconsTGA = new System.IO.DirectoryInfo(strIconPath).GetFiles("*.tga");
FileInfo[] fileIcons = fileIconsPNG.Concat(fileIconsTGA).ToArray();
foreach (FileInfo fileIcon in fileIcons)
{
try
{
//load the file from the GameDB
texLoading = new Texture2D(32, 16, TextureFormat.ARGB32, false);
if (LoadImageFromFile(ref texLoading, fileIcon.Name, strIconPath))
dictReturn.Add(fileIcon.Name.ToLower().Replace(".png", "").Replace(".tga", ""), texLoading);
}
catch (Exception)
{
MonoBehaviourExtended.LogFormatted("Unable to load Texture from GameDB:{0}", strIconPath);
}
}
}
return dictReturn;
}
示例5: FindFilesHierarchical
private StandaloneAzureBlobResultSegment FindFilesHierarchical(string prefix, int? maxResults, int numberToSkip)
{
var directories = new DirectoryInfo(_containerDirectory).EnumerateDirectories((prefix ?? "") + "*", SearchOption.TopDirectoryOnly)
.Where(f => !f.Name.EndsWith(".meta"))
.Select(f => (IAzureListBlobItem) new StandaloneAzureBlobDirectory(f.FullName));
var files = new DirectoryInfo(_containerDirectory).EnumerateFiles((prefix ?? "") + "*", SearchOption.TopDirectoryOnly)
.Where(f => !(f.DirectoryName ?? "").EndsWith(".meta"))
.Select(f => (IAzureListBlobItem) new StandaloneAzureBlockBlob(new Uri(f.FullName)));
var combined = directories.Concat(files)
.Skip(numberToSkip)
.Take(maxResults.HasValue ? maxResults.Value : Int32.MaxValue)
.ToList();
var resultSegment = new StandaloneAzureBlobResultSegment(
combined,
new BlobContinuationToken
{
NextMarker = DetermineNextMarker(numberToSkip, combined.Count)
});
return resultSegment;
}
示例6: Initialize
private void Initialize()
{
#if(SILVERLIGHT)
_assemblies = (from part in Deployment.Current.Parts
where ShouldAddAssembly(part.Source)
let info = Application.GetResourceStream(new Uri(part.Source, UriKind.Relative))
select part.Load(info.Stream)).ToArray();
#else
#if(NETFX_CORE)
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var assemblies = new List<Assembly>();
IEnumerable<StorageFile> files = null;
var operation = folder.GetFilesAsync();
operation.Completed = async (r, s) => {
var result = await r;
files = result;
};
while (files == null) ;
foreach (var file in files)
{
if (file.FileType == ".dll" || file.FileType == ".exe")
{
var name = new AssemblyName() { Name = System.IO.Path.GetFileNameWithoutExtension(file.Name) };
try
{
Assembly asm = Assembly.Load(name);
assemblies.Add(asm);
}
catch { }
}
}
_assemblies = assemblies.ToArray();
#else
var codeBase = Assembly.GetExecutingAssembly().CodeBase;
var uri = new Uri(codeBase);
var path = Path.GetDirectoryName(uri.LocalPath);
var files = new DirectoryInfo(path).GetFiles("*.dll");
files.Concat(new DirectoryInfo(path).GetFiles("*.exe"));
var currentAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
foreach (var file in files)
{
try
{
var assemblyName = AssemblyName.GetAssemblyName(file.FullName);
if (!currentAssemblies.Any(assembly => Matches(assemblyName, assembly.GetName())))
currentAssemblies.Add(Assembly.Load(assemblyName));
}
catch (BadImageFormatException)
{
//Just indicates this is not a .NET assembly
}
}
_assemblies = currentAssemblies.Distinct(new AssemblyComparer()).ToArray();
#endif
#endif
}