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


C# FileInfo.GetDirectories方法代码示例

本文整理汇总了C#中System.IO.FileInfo.GetDirectories方法的典型用法代码示例。如果您正苦于以下问题:C# FileInfo.GetDirectories方法的具体用法?C# FileInfo.GetDirectories怎么用?C# FileInfo.GetDirectories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.FileInfo的用法示例。


在下文中一共展示了FileInfo.GetDirectories方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 private static void Main(string[] args) {
     if (args.Length == 0) {
         Console.WriteLine("Find 'Code2Xml.Core' directory due to no arguments.");
         var dir = new FileInfo(Assembly.GetEntryAssembly().Location).Directory;
         while (true) {
             var dirs = dir.GetDirectories("Code2Xml.Core", SearchOption.AllDirectories);
             if (dirs.Length > 0) {
                 args = new[] { dirs[0].FullName };
                 break;
             }
             dir = dir.Parent;
             if (dir == null) {
                 Console.WriteLine("Can't find 'Code2Xml.Core' directory.");
                 args = new[] { Console.In.ReadLine() };
                 break;
             }
         }
     }
     foreach (var arg in args) {
         var path = Path.GetFullPath(arg);
         var dir = Directory.Exists(path) ? path : Path.GetDirectoryName(path);
         var grammarFiles = Directory.GetFiles(dir, "*.g", SearchOption.AllDirectories);
         foreach (var grammarFile in grammarFiles) {
             Console.WriteLine(grammarFile);
             var info = new ProcessStartInfo {
                 FileName = "Antlr3",
                 Arguments = '"' + grammarFile + '"',
                 CreateNoWindow = true,
                 UseShellExecute = true,
                 WorkingDirectory = Path.GetDirectoryName(grammarFile)
             };
             using (var p = Process.Start(info)) {
                 p.WaitForExit();
             }
             var csFiles = Directory.GetFiles(
                     info.WorkingDirectory, "*.cs", SearchOption.TopDirectoryOnly);
             foreach (var file in csFiles) {
                 if (file.EndsWith("Parser.cs")) {
                     Console.WriteLine(file);
                     ParserModifier.Modify(file);
                 } else if (file.EndsWith("Lexer.cs")) {
                     Console.WriteLine(file);
                     LexerModifier.Modify(file);
                 }
             }
         }
         var grammar4Files = Directory.GetFiles(dir, "*.g4", SearchOption.AllDirectories);
         foreach (var grammarFile in grammar4Files) {
             Console.WriteLine(grammarFile);
             Antlr4ParserModifier.Modify(grammarFile);
         }
     }
 }
开发者ID:RainsSoft,项目名称:Code2Xml,代码行数:53,代码来源:Program.cs

示例2: RunBundler

        private void RunBundler(ProjectItem projectItem)
        {
            if (projectItem == null) return;

            try
            {
                if (projectItem.ContainingProject == null) return;

                // make sure this is a valid bundle file type
                if (!IsAllowedExtension(projectItem.Name)) return;

                // make sure the bundler exists
                var directory = new FileInfo(projectItem.ContainingProject.FileName).Directory;
                var bunderDirectory = directory.GetDirectories("bundler").FirstOrDefault();
                if (bunderDirectory == null) return;

                var bundleCommand = bunderDirectory.GetFiles("bundler.cmd").FirstOrDefault();
                if (bundleCommand == null) return;

                // make sure the files are in the bundler folder
                var fileNames = new List<string>();
                for (short i = 0; i < projectItem.FileCount; i += 1)
                    fileNames.Add(projectItem.FileNames[i]);

                if (fileNames.Any(m => m.StartsWith(bunderDirectory.FullName))) return;

                RunBundler(bundleCommand.FullName);
            }
            catch (Exception e)
            {
                // project item probably doesn't have a document
                Debug.WriteLine(e.Message);
            }
        }
开发者ID:ServiceStack,项目名称:Bundler,代码行数:34,代码来源:BundlerRunOnSavePackage.cs

示例3: Init

 private void Init()
 {
     var targetPath = Path.Combine(_pluginPath, _packageName + "." + _packageVersion);
     var plugDir = new FileInfo(targetPath).Directory;
     var catalogs = plugDir.GetDirectories("*", SearchOption.AllDirectories).Select(x => new DirectoryCatalog(x.FullName));
     var directoryAggregate = new AggregateCatalog(catalogs);
     _container = new CompositionContainer(directoryAggregate);
     _container.ComposeParts(this);
     _node = _exports.First();
 }
开发者ID:kevoree,项目名称:kevoree-dotnet-core-bootstrap,代码行数:10,代码来源:NodeRunner.cs

示例4: SetToV2Beta1

 public static void SetToV2Beta1(string/*!*/ platformAssembliesLocation)
 {
     TargetPlatform.TargetVersion = new Version(2, 0, 3600);
     TargetPlatform.GenericTypeNamesMangleChar = '!';
     string dotNetDirLocation = null;
     if (platformAssembliesLocation == null || platformAssembliesLocation.Length == 0)
     {
         DirectoryInfo dotNetDir = new FileInfo(new Uri(typeof(object).Module.Assembly.Location).LocalPath).Directory.Parent;
         dotNetDirLocation = dotNetDir.FullName;
         if (dotNetDirLocation != null) dotNetDirLocation = dotNetDirLocation.ToUpper(System.Globalization.CultureInfo.InvariantCulture);
         DateTime creationTime = DateTime.MinValue;
         foreach (DirectoryInfo subdir in dotNetDir.GetDirectories("v2.0*"))
         {
             if (subdir == null) continue;
             if (subdir.CreationTime < creationTime) continue;
             FileInfo[] mscorlibs = subdir.GetFiles("mscorlib.dll");
             if (mscorlibs != null && mscorlibs.Length == 1)
             {
                 platformAssembliesLocation = subdir.FullName;
                 creationTime = subdir.CreationTime;
             }
         }
     }
     else
         TargetPlatform.PlatformAssembliesLocation = platformAssembliesLocation;
     if (dotNetDirLocation != null && (platformAssembliesLocation == null || platformAssembliesLocation.Length == 0))
     {
         int pos = dotNetDirLocation.IndexOf("FRAMEWORK");
         if (pos > 0 && dotNetDirLocation.IndexOf("FRAMEWORK64") < 0)
         {
             dotNetDirLocation = dotNetDirLocation.Replace("FRAMEWORK", "FRAMEWORK64");
             if (Directory.Exists(dotNetDirLocation))
             {
                 DirectoryInfo dotNetDir = new DirectoryInfo(dotNetDirLocation);
                 DateTime creationTime = DateTime.MinValue;
                 foreach (DirectoryInfo subdir in dotNetDir.GetDirectories("v2.0*"))
                 {
                     if (subdir == null) continue;
                     if (subdir.CreationTime < creationTime) continue;
                     FileInfo[] mscorlibs = subdir.GetFiles("mscorlib.dll");
                     if (mscorlibs != null && mscorlibs.Length == 1)
                     {
                         platformAssembliesLocation = subdir.FullName;
                         creationTime = subdir.CreationTime;
                     }
                 }
             }
         }
     }
     TargetPlatform.PlatformAssembliesLocation = platformAssembliesLocation;
     TargetPlatform.InitializeStandardAssemblyLocationsWithDefaultValues(platformAssembliesLocation);
     TrivialHashtable assemblyReferenceFor = new TrivialHashtable(46);
     for (int i = 0, n = TargetPlatform.FxAssemblyNames.Length; i < n; i++)
     {
         string name = TargetPlatform.FxAssemblyNames[i];
         string version = TargetPlatform.FxAssemblyVersion2Build3600[i];
         string token = TargetPlatform.FxAssemblyToken[i];
         AssemblyReference aref = new AssemblyReference(name + ", Version=" + version + ", Culture=neutral, PublicKeyToken=" + token);
         aref.Location = platformAssembliesLocation + "\\" + name + ".dll";
         //^ assume name != null;
         assemblyReferenceFor[Identifier.For(name).UniqueIdKey] = aref;
     }
     TargetPlatform.assemblyReferenceFor = assemblyReferenceFor;
 }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:64,代码来源:SystemTypes.cs

示例5: Init

 private void Init()
 {
     // Use RegistrationBuilder to set up our MEF parts.
     //var targetPath = Path.Combine(this.pluginPath, packageName + "." + packageVersion);
     var targetPath = _pluginPath;
     var plugDir = new FileInfo(targetPath).Directory;
     var catalogs = plugDir.GetDirectories("*", SearchOption.AllDirectories).Select(x => new DirectoryCatalog(x.FullName));
     var directoryAggregate = new AggregateCatalog(catalogs);
     _container = new CompositionContainer(directoryAggregate);
     _container.ComposeParts(this);
 }
开发者ID:kevoree,项目名称:kevoree-dotnet-model-generator,代码行数:11,代码来源:Runner.cs


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