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


C# DirectoryInfo.Concat方法代码示例

本文整理汇总了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
        }
开发者ID:TormodHystad,项目名称:Bifrost,代码行数:25,代码来源:AssemblyLocator.cs

示例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();
        }
开发者ID:modulexcite,项目名称:framework-1,代码行数:27,代码来源:EndpointConfig.cs

示例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;
        }
开发者ID:modulexcite,项目名称:framework-1,代码行数:20,代码来源:NServiceBusStartupTask.cs

示例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;
        }
开发者ID:Kerbas-ad-astra,项目名称:AlternateResourcePanel,代码行数:33,代码来源:Resources.cs

示例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;
        }
开发者ID:jamesmiles,项目名称:LightBlue,代码行数:22,代码来源:StandaloneAzureBlobContainer.cs

示例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
        }
开发者ID:JoB70,项目名称:Bifrost,代码行数:63,代码来源:AssemblyLocator.cs


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