/// <summary> /// Searches the js in path. /// </summary> /// <param name="path">The path.</param> /// <param name="root">if set to <c>true</c> [root].</param> /// <returns>the value</returns> private IList <string> SearchJsInPath(string path, bool root, string mainFolder) { var foundFiles = new List <string>(); if (root) { foreach (var file in System.IO.Directory.GetFiles(path)) { foundFiles.Add(file); } } foreach (var directory in System.IO.Directory.GetDirectories(path).OrderBy(c => c)) { var directoryName = new System.IO.DirectoryInfo(directory).Name; if (root && !directoryName.Equals("services") && !directoryName.Equals("components") && !directoryName.Equals(mainFolder)) { continue; } foreach (var file in System.IO.Directory.GetFiles(directory).Where(f => f.EndsWith(".js")).OrderBy(c => c)) { foundFiles.Add(file); } foundFiles.AddRange(SearchJsInPath(directory, false, null)); } return(foundFiles); }
public void GetDefaultDrive() { // Get the default drive's path var drivePath = new System.IO.DirectoryInfo(Environment.SystemDirectory).Root.Name; var driveInfoPath = new System.IO.DriveInfo(drivePath); Assert.IsTrue(drivePath != null); var drive = BrowseItemFromPath.InitItem(drivePath); //// drive.LoadProperties(); Assert.IsTrue(drive != null); Assert.IsTrue(drivePath.Equals(drive.PathFileSystem, StringComparison.InvariantCulture)); Assert.IsFalse(string.IsNullOrEmpty(drive.Name)); //Assert.IsTrue(string.Compare(drive.Name, driveInfoPath.VolumeLabel, true) == 0); Assert.IsTrue(string.Compare(drive.ParseName, driveInfoPath.Name, true) == 0); Assert.IsFalse(string.IsNullOrEmpty(drive.LabelName)); Assert.IsFalse(drive.IsSpecialParseItem); Assert.IsTrue(string.IsNullOrEmpty(drive.PathSpecialItemId)); Assert.IsTrue(string.Compare(drive.ParseName, drive.PathFileSystem, true) == 0); //// Assert.IsTrue((drive.ItemType & DirectoryItemFlags.FileSystemDirectory) != 0); //// Assert.IsTrue((drive.ItemType & DirectoryItemFlags.Drive) != 0); //// Assert.IsTrue(drive.ParentIdList.Size > 0); //// Assert.IsTrue(drive.ChildIdList.Size > 0); //// Assert.IsFalse(string.IsNullOrEmpty(drive.IconResourceId)); }
private string CheckDirectory(string a_fileName) { try { String str = new System.IO.DirectoryInfo(a_fileName).FindExistingDirectory(); if (str.Equals("")) { str = AppDomain.CurrentDomain.BaseDirectory + "Examples"; } return str; } catch (Exception) { return string.Empty; } }