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


C# System.IO.DirectoryInfo.GetDirectories方法代码示例

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


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

示例1: LoadCaptureFolder

        public static List<System.IO.DirectoryInfo> LoadCaptureFolder(string Path)
        {
            if(!System.IO.Directory.Exists(Path)) return null;

            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(Path);
            return new List<System.IO.DirectoryInfo>(dir.GetDirectories());
        }
开发者ID:DefStevo,项目名称:defstevo-collection,代码行数:7,代码来源:CaptureManager.cs

示例2: XCopy

		/// for an example:XCopy("c:\a\", "d:\b\");
		/// <summary>Copy source script to report folder</summary>
		/// <param name="sourceDir">sourceDir</param>
		/// <param name="targetDir">targetDir</param>
		public static void XCopy(string sourceDir, string targetDir)
		
    	{
		   //If the source directory exists.
		   if (System.IO.Directory.Exists(sourceDir))
		   {
		       //If the source directory does not exist, create it.
		       if (!System.IO.Directory.Exists(targetDir))
		       System.IO.Directory.CreateDirectory(targetDir);
		       //Get data from sourcedir.
		       System.IO.DirectoryInfo sourceInfo = new System.IO.DirectoryInfo(sourceDir);
		       //Copy the files.
		       System.IO.FileInfo[] files = sourceInfo.GetFiles();
		       foreach (System.IO.FileInfo file in files)
		       {
		           System.IO.File.Copy(sourceDir + "\\" + file.Name, targetDir + "\\" + file.Name, true);
		       }
		       //Copy the dir.
		       System.IO.DirectoryInfo[] dirs = sourceInfo.GetDirectories();
		       foreach (System.IO.DirectoryInfo dir in dirs)
		       {
		          string currentSource = dir.FullName;
		          string currentTarget = dir.FullName.Replace(sourceDir, targetDir);
		          System.IO.Directory.CreateDirectory(currentTarget);
		          //recursion
		          XCopy(currentSource, currentTarget);
		        }
		      }
		   }
开发者ID:YouwenYao,项目名称:NformTestMain,代码行数:33,代码来源:TestCaseDriver.cs

示例3: OnEnd

        public override bool OnEnd(object data)
        {
            HDFGlue tool = new HDFGlue();
             tool.AppName = "convert.2.hdf5.exe";
             tool.AppPath = @"..\Run.1\convert\";
             tool.WorkingDirectory = @"..\Run.1\convert\";

             bool res = true;
             MohidRunEngineData mre = (MohidRunEngineData)data;
             string cumulativeFolder = @"..\cumulative\";

             tool.Output = cumulativeFolder + "basin.refevtp.hdf5";
             tool.Is3DFile = false;
             tool.FilesToGlue.Clear();

             System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(mre.storeFolder.Path);
             foreach (System.IO.DirectoryInfo g in dir.GetDirectories())
             {

            if (System.IO.File.Exists(g.FullName + System.IO.Path.DirectorySeparatorChar + "basin.refevtp.hdf5"))
               tool.FilesToGlue.Add(g.FullName + System.IO.Path.DirectorySeparatorChar + "basin.refevtp.hdf5");
             }
             if (tool.FilesToGlue.Count > 0)
            if (tool.Glue() != 0) res = false;
             return res;
        }
开发者ID:JauchOnGitHub,项目名称:csharptoolbox,代码行数:26,代码来源:Class1.cs

示例4: LoadDirectory

        public ActionResult LoadDirectory(string dir)
        {
            dir = HttpUtility.UrlDecode(dir);
            StringBuilder builder = new StringBuilder();
            builder.AppendLine("<ul class=\"jqueryFileTree\" style=\"display: none;\">\n");
            if (dir == "%root%")
            {
                // list drives
                bool first = true;
                foreach (var drive in System.IO.DriveInfo.GetDrives())
                {
                    if (drive.DriveType != System.IO.DriveType.Fixed)
                        continue;
                    builder.AppendLine(AddDirectory(drive.Name, drive.RootDirectory.FullName, first, "directory hdd"));
                    first = false;
                }
            }
            else
            {
                System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dir);
                try
                {
                    foreach (System.IO.DirectoryInfo di_child in di.GetDirectories())
                    {
                        builder.AppendLine(AddDirectory(di_child.Name, di_child.FullName));
                    }
                }
                catch (Exception) { /* might not have access to that folder */ }
            }
            builder.AppendLine("</ul>");

            return Content(builder.ToString());
        }
开发者ID:JonnyCam,项目名称:NextPvrWebConsole,代码行数:33,代码来源:FileController.cs

示例5: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            string katalognavn = tbxKatalognavn.Text.Trim();

            // Viser brugen af DirectoryInfo til at hente info for et katalog

            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(katalognavn);         // objekt med information for det angive katalognavn
            
            if (dir.Exists)                                                                 // tjek om katalog findes
            {
                textBox2.Text = dir.CreationTime.ToString() + Environment.NewLine;


                System.IO.DirectoryInfo[] subDirs = dir.GetDirectories();                   // Hent underliggende kataloginformationer for det angive katalog 

                foreach (System.IO.DirectoryInfo dirInfo in subDirs)
                {
                    textBox2.Text = textBox2.Text + "Name:<" + dirInfo.Name + "> Extension:<" + dirInfo.Extension +">" + Environment.NewLine;
                }
                

                dataGridView1.DataSource = subDirs;     // vis elementerne i grid formatet for demo af alle properties
            }
            else
                textBox2.Text = "Katalog findes ikke";
        }
开发者ID:caddeo,项目名称:SocketEksamenForberedelse,代码行数:26,代码来源:FormDemo.cs

示例6: DirectoriesNamesGet

		public string[] DirectoriesNamesGet(string sFolder)
		{
			List<string> aResult = new List<string>();
			System.IO.DirectoryInfo[] aDirectories;
			System.IO.DirectoryInfo cDir = new System.IO.DirectoryInfo(sFolder);
			aDirectories = cDir.GetDirectories();
			aResult.AddRange(from cFInfo in aDirectories select cFInfo.Name);
			return aResult.ToArray();
		}
开发者ID:ratsil,项目名称:bethe.ingenie,代码行数:9,代码来源:Classes.cs

示例7: FileSystemNode

 public FileSystemNode(string path)
 {
     Directory = new System.IO.DirectoryInfo(path);
     Text = Directory.Name;
     foreach (var d in Directory.GetDirectories())
     {
         Nodes.Add(new FileSystemNode(d.FullName));
     }
 }
开发者ID:ShibataAkihiro,项目名称:pulldownexplorer,代码行数:9,代码来源:Form1.cs

示例8: DumpGossipData

        private void DumpGossipData()
        {
            var CMSG_GOSSIP_HELLO = 0x17B;
            var CMSG_GOSSIP_SELECT_OPTION = 0x17C;
            var SMSG_GOSSIP_MESSAGE = 0x17D;
            var SMSG_GOSSIP_COMPLETE = 0x17E;
            var SMSG_GOSSIP_POI = 0x224;
            var SMSG_ITEM_QUERY_SINGLE_RESPONSE = 0x058;
            var SMSG_ITEM_NAME_QUERY_RESPONSE = 0x2C5;
            var SMSG_GAMEOBJECT_QUERY_RESPONSE = 0x05F;
            var SMSG_CREATURE_QUERY_RESPONSE = 0x061;
            var SMSG_ITEM_TEXT_QUERY_RESPONSE = 0x244;
            var SMSG_ITEM_QUERY_MULTIPLE_RESPONSE = 0x059;
            var SMSG_NAME_QUERY_RESPONSE = 0x051;
            var SMSG_NPC_TEXT_UPDATE = 0x180;
            var SMSG_PAGE_TEXT_QUERY_RESPONSE = 0x05B;
            var SMSG_PET_NAME_QUERY_RESPONSE = 0x053;
            var SMSG_QUEST_POI_QUERY_RESPONSE = 0x1E4;

            var query = GetBaseOpcodeQuery(false);

            query.Append(string.Format("{0},", CMSG_GOSSIP_HELLO));
            query.Append(string.Format("{0},", CMSG_GOSSIP_SELECT_OPTION));
            query.Append(string.Format("{0},", SMSG_GOSSIP_MESSAGE));
            query.Append(string.Format("{0},", SMSG_GOSSIP_POI));
            query.Append(string.Format("{0},", SMSG_GOSSIP_COMPLETE));
            query.Append(string.Format("{0},", SMSG_ITEM_NAME_QUERY_RESPONSE));
            query.Append(string.Format("{0},", SMSG_ITEM_QUERY_MULTIPLE_RESPONSE));
            query.Append(string.Format("{0},", SMSG_ITEM_QUERY_SINGLE_RESPONSE));
            query.Append(string.Format("{0},", SMSG_GAMEOBJECT_QUERY_RESPONSE));
            query.Append(string.Format("{0},", SMSG_NAME_QUERY_RESPONSE));
            query.Append(string.Format("{0},", SMSG_ITEM_TEXT_QUERY_RESPONSE));
            query.Append(string.Format("{0},", SMSG_PAGE_TEXT_QUERY_RESPONSE));
            query.Append(string.Format("{0},", SMSG_PET_NAME_QUERY_RESPONSE));
            query.Append(string.Format("{0},", SMSG_QUEST_POI_QUERY_RESPONSE));
            query.Append(string.Format("{0},", SMSG_NPC_TEXT_UPDATE));
            query.Append(string.Format("{0}", SMSG_CREATURE_QUERY_RESPONSE));
            query.Append(")");

            var directoryinfo = new System.IO.DirectoryInfo(@"E:\HFS\WOWDEV\SNIFFS_CLEAN\");

            var directories = directoryinfo.GetDirectories().OrderByDescending(t => t.Name.IntValueOrZero());

            foreach (var dir in directories)
            {
                var files = dir.GetFiles("*.sqlite").OrderBy(t => t.Name);

                foreach (var file in files)
                {
                    ProcessFile(file, query.ToString());
                }
            }

            MaximusParserX.Dump.SQL.GossipHandler.DumpToSQLFile();
            MaximusParserX.Dump.SQL.QueryResponseHandler.DumpToSQLFile();
        }
开发者ID:RaptorFactor,项目名称:devmaximus,代码行数:56,代码来源:frmDump.cs

示例9: BuildXml

		protected override void BuildXml()
		{
			if ( !this.CurrentFolder.CheckAcl( AccessControlRules.FolderView ) )
			{
				ConnectorException.Throw( Errors.Unauthorized );
			}
			
			// Map the virtual path to the local server path.
			string sServerDir = this.CurrentFolder.ServerPath;

			System.IO.DirectoryInfo oDir = new System.IO.DirectoryInfo( sServerDir );
			if ( !oDir.Exists )
			{
				ConnectorException.Throw( Errors.FolderNotFound );
				return;
			}

			// Create the "Folders" node.
			XmlNode oFoldersNode = XmlUtil.AppendElement( this.ConnectorNode, "Folders" );

			System.IO.DirectoryInfo[] aSubDirs = oDir.GetDirectories();

			for ( int i = 0 ; i < aSubDirs.Length ; i++ )
			{
				string sSubDirName = aSubDirs[ i ].Name;

				if ( Config.Current.CheckIsHiddenFolder( sSubDirName ) )
					continue;

				int aclMask = Config.Current.AccessControl.GetComputedMask( this.CurrentFolder.ResourceTypeName, this.CurrentFolder.ClientPath + sSubDirName + "/" );

				if ( ( aclMask & (int)AccessControlRules.FolderView ) != (int)AccessControlRules.FolderView )
					continue;

				// Create the "Folders" node.
				XmlNode oFolderNode = XmlUtil.AppendElement( oFoldersNode, "Folder" );
				XmlUtil.SetAttribute( oFolderNode, "name", sSubDirName );
				try
				{
					XmlUtil.SetAttribute( oFolderNode, "hasChildren", aSubDirs[ i ].GetDirectories().Length > 0 ? "true" : "false" );
				}
				catch
				{
					// It was not possible to verify if it has children. Assume "yes".
					XmlUtil.SetAttribute( oFolderNode, "hasChildren", "true" );
				}
				XmlUtil.SetAttribute( oFolderNode, "acl", aclMask.ToString() );
			}
		}
开发者ID:yschulmann,项目名称:Anglodeals,代码行数:49,代码来源:GetFoldersCommandHandler.cs

示例10: IsInstalledTo

 /// <summary>
 /// Returns true if the specified directory contains a valid Cortex Command installation.
 /// </summary>
 /// <param name="directory">The directory to check for a CC installation.</param>
 public static bool IsInstalledTo(string directory)
 {
     if (String.IsNullOrEmpty(directory))
         return false;
     var directoryInfo = new System.IO.DirectoryInfo(directory);
     if (!directoryInfo.Exists)
         return false;
     var files = directoryInfo.GetFiles();
     if (!files.Any(x => x.Name == "Cortex Command.exe"))
         return false;
     var directories = directoryInfo.GetDirectories();
     if (!directories.Any(x => x.Name == "Base.rte"))
         return false;
     return true;
 }
开发者ID:SneakyMax,项目名称:Cortex-Command-Mod-Manager,代码行数:19,代码来源:CortexCommand.cs

示例11: TraverseDirectories

        private static void TraverseDirectories(string pathDirectory, XElement rootElement)
        {
            System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(pathDirectory);
            System.IO.DirectoryInfo[] dirs = directory.GetDirectories();

            foreach (var dir in dirs)
            {
                XElement dirElement = new XElement("dir", new XAttribute("name", dir.Name));
                if (dir.GetDirectories().Any())
                {
                    TraverseDirectories(dir.FullName, dirElement);
                }
                TraverseFiles(dir.FullName, dirElement);
                rootElement.Add(dirElement);
            }
        }
开发者ID:glifada,项目名称:TelerikAcademy,代码行数:16,代码来源:TraversDirectoryXDocument.cs

示例12: ConfigWindow

        public ConfigWindow()
        {
            InitializeComponent();

            List<CultureInfo> cultures = new List<CultureInfo>();
            System.IO.FileInfo fi = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(fi.Directory.FullName);
            foreach (var folder in  di.GetDirectories())
            {
                try
                {
                    cultures.Add(new CultureInfo(folder.Name));

                }
                catch
                {

                }
            }

            //cultures.Sort((x, y) => x.DisplayName.CompareTo(y.DisplayName));

            LanguageOptions = cultures;

            this.DataContext = this;
            //HeaderImage = MainWindow.LoadImage("settings.png");

            IvonaRegions = new List<string>();
            IvonaRegions.Add("eu-west-1");
            IvonaRegions.Add("us-east-1");
            IvonaRegions.Add("us-west-2");

            SampleRates = new List<int>();
            SampleRates.Add(8000);
            SampleRates.Add(11025);
            SampleRates.Add(16000);
            SampleRates.Add(22050);
            SampleRates.Add(32000);
            SampleRates.Add(44100);
            SampleRates.Add(48000);

            BitsPerSamples = new List<int>();
            BitsPerSamples.Add(8);
            BitsPerSamples.Add(16);
            BitsPerSamples.Add(24);
        }
开发者ID:CaffeineAU,项目名称:TTSTranslator,代码行数:46,代码来源:ConfigWindow.xaml.cs

示例13: TraverseDirectories

        private static void TraverseDirectories(string pathDirectory, XmlWriter writer)
        {
            System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(pathDirectory);
            System.IO.DirectoryInfo[] dirs = directory.GetDirectories();

            foreach (var dir in dirs)
            {
                writer.WriteStartElement("dir");
                writer.WriteAttributeString("name", dir.Name);
                if (dir.GetDirectories().Any())
                {
                    TraverseDirectories(dir.FullName, writer);
                }
                TraverseFiles(dir.FullName, writer);
                writer.WriteEndElement();
            }
        }
开发者ID:glifada,项目名称:TelerikAcademy,代码行数:17,代码来源:TraversDirectoryToXmlFile.cs

示例14: GetDBDirectory

        private static string GetDBDirectory()
        {
            System.IO.DirectoryInfo currentDirectory = new System.IO.DirectoryInfo(Application.ExecutablePath).Parent;

            while (currentDirectory != null)
            {
                System.IO.DirectoryInfo[] childDirectories = currentDirectory.GetDirectories();
                foreach (System.IO.DirectoryInfo childDir in childDirectories)
                {
                    if (childDir.Name == "Data")
                    {
                        return childDir.FullName;
                    }
                }
                currentDirectory = currentDirectory.Parent;
            }
            return "";
        }
开发者ID:opherg,项目名称:Janus-GridEx-Tutorials,代码行数:18,代码来源:Program.cs

示例15: RequestChildNodes

 public override void RequestChildNodes(TreeNodePath parent, System.Windows.Forms.TreeViewCancelEventArgs e)
 {
     if (parent.Path == null) return;
     //
     System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(parent.Path);
     // check persmission
     new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.PathDiscovery, directory.FullName).Demand();
     //
     foreach (System.IO.DirectoryInfo dir in directory.GetDirectories())
     {
         if ((dir.Attributes & System.IO.FileAttributes.System) == System.IO.FileAttributes.System)
         {
             continue;
         }
         if ((dir.Attributes & System.IO.FileAttributes.Hidden) == System.IO.FileAttributes.Hidden)
         {
             continue;
         }
         TreeNodePath newNode = this.CreateTreeNode(parent, dir.Name, dir.FullName, false,false, false);
         //
         try
         {
             if (dir.GetDirectories().GetLength(0) > 0)
             {
                 newNode.AddDummyNode();
             }
         }
         catch(System.UnauthorizedAccessException)
         {
             // eat the exception
         }
         catch(System.Exception ex)
         {
             throw ex;
         }
     }
     if (ShowFiles)
     {
         foreach (System.IO.FileInfo file in directory.GetFiles())
         {
             this.CreateTreeNode(parent.Nodes, parent, file.Name, file.FullName, true, false, false);
         }
     }
 }
开发者ID:ArsenShnurkov,项目名称:TreeViewFolderBrowser,代码行数:44,代码来源:TreeViewFolderBrowserDataProvider.cs


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