public bool enumerate(List <FileAbstraction> files, List <FolderAbstraction> folders) { try { string[] sFolders = System.IO.Directory.GetDirectories(folderPath); string[] sFiles = System.IO.Directory.GetFiles(folderPath); foreach (string sFo in sFolders) { string[] pathParts = sFo.Split('\\'); string name = pathParts[pathParts.Length - 1]; FolderAbstraction newFoA = new FolderAbstraction(sFo, name); folders.Add(newFoA); } foreach (string sFi in sFiles) { string[] pathParts = sFi.Split('\\'); string name = pathParts[pathParts.Length - 1]; FileAbstraction newFiA = new FileAbstraction(sFi, name, Color.red, 3); files.Add(newFiA); } return(true); } catch (System.Exception e) { return(false); } }
public void jumpClick() { string path = folderText.text; string[] split = path.Split('\\'); FolderAbstraction fa = new FolderAbstraction(path, split[split.Length - 1]); this.GetComponent <EnvironmentHandler>().changeFolder(fa); }
public void changeFolder(FolderAbstraction fa) { d_Player.transform.position = new Vector3(0, 1, 0); currentFolder = new FolderAbstraction(fa.folderPath, fa.folderName); folderList = new List <FolderAbstraction>(); fileList = new List <FileAbstraction>(); destroyEnv(); createEnv(); }
GameObject createDoor(FolderAbstraction fa) { GameObject door = Instantiate(d_Door); door.transform.Find("Text").GetComponent <TextMesh>().text = fa.folderName; fa.selfDoor = door; door.GetComponent <FolderAbstraction>().clone(fa); return(door); }
public bool moveToFolder(FileAbstraction fiA, FolderAbstraction foA) { if (!System.IO.File.Exists(foA.folderPath + "\\" + fiA.fileName)) { System.IO.File.Move(fiA.filePath, foA.folderPath + "\\" + fiA.fileName); return(true); } else { return(false); } }
void OnCollisionEnter(Collision other) { Debug.LogError("Collided:" + this.gameObject.GetComponent <Rigidbody>().name + " : " + other.gameObject.name + " + " + other.gameObject.transform.parent.name); if (other.gameObject.name == "Face" && other.gameObject.transform.parent.name == "Door(Clone)") { this.gameObject.transform.position = new Vector3(0, 1, 0); FolderAbstraction fa = other.gameObject.transform.parent.gameObject.GetComponent <FolderAbstraction>(); Debug.LogError(fa.folderName); this.gameObject.GetComponent <EnvironmentHandler>().changeFolder(fa); } }
public void prepFolderDetails() { if (Object.Equals(currentFolder, null) || currentFolder.folderPath.ToUpper() == "ROOT") { Debug.LogError("istrue"); string[] Drives = System.IO.Directory.GetLogicalDrives(); foreach (string d in Drives) { FolderAbstraction fa = new FolderAbstraction(d, d); folderList.Add(fa); } createDoors(folderList, 2f); GetComponent <GUIHandler>().setFolderText("Root"); } else { Debug.LogError("iselse"); FolderAbstraction fa = new FolderAbstraction("Root", "Root"); folderList.Add(fa); fa = new FolderAbstraction(currentFolder.folderPath + "\\..\\", ".."); folderList.Add(fa); fa = new FolderAbstraction(currentFolder.folderPath + "\\.\\", "."); folderList.Add(fa); if (!currentFolder.enumerate(fileList, folderList)) { currentFolder = null; prepFolderDetails(); } else { createDoors(folderList, 2f); GetComponent <GUIHandler>().setFolderText(currentFolder.folderPath); } } }
public void clone(FolderAbstraction fa) { folderPath = fa.folderPath; folderName = fa.folderName; selfDoor = fa.selfDoor; }