public void CutTo(IVIDirectory target) { try { string tmppath = Path.Combine(target.FullPath, Systemfile.Name); Debug.Log(FullPath + " ==filecut==> " + tmppath); Systemfile.MoveTo(tmppath); target.Entries.Add(this); } catch (Exception e) { Debug.Log("Failed to move file \"" + Systemfile.FullName + "\" : " + e.ToString()); } }
public IVIEntry CopyTo(IVIDirectory target) { string destinationPath = Path.Combine(target.FullPath, Systemdirectory.Name); Debug.Log(FullPath + " ==dircpy==> " + destinationPath); DirectoryInfo new_dir = DirectoryCopy(FullPath, destinationPath, true); IVIDirectory cpy = new IVIDirectory(new_dir, initial_depth); target.Entries.Add(cpy); return(cpy); }
public IVIEntry CopyTo(IVIDirectory target) { try { string tmppath = Path.Combine(target.FullPath, Systemfile.Name); Debug.Log(FullPath + " ==filecpy==> " + tmppath); IVIFile cpy = new IVIFile(Systemfile.CopyTo(tmppath, true)); target.Entries.Add(cpy); return(cpy); } catch (Exception e) { Debug.Log("Failed to copy file \"" + Systemfile.FullName + "\" : " + e.ToString()); } return(null); }
void Start() { CutDirSrc = new IVIDirectory(CutDirSrcPath, 0); CutDirDst = new IVIDirectory(CutDirDstPath, 0); CpyDirSrc = new IVIDirectory(CpyDirSrcPath, 0); CpyDirDst = new IVIDirectory(CpyDirDstPath, 0); CutFileSrc = new IVIFile(CutFileSrcPath); CpyFileSrc = new IVIFile(CpyFileSrcPath); CutFileDst = new IVIDirectory(CutFileDstPath, 0); CpyFileDst = new IVIDirectory(CpyFileDstPath, 0); CutDirSrc.CutTo(CutDirDst); CpyDirSrc.CopyTo(CpyDirDst); CutFileSrc.CutTo(CutFileDst); CpyFileSrc.CopyTo(CpyFileDst); }
void LogDentries() { foreach (IVIEntry entry in dir.Entries) { if (entry is IVIDirectory) { IVIDirectory edir = entry as IVIDirectory; Debug.Log(edir.Systemdirectory.FullName); } else { IVIFile efile = entry as IVIFile; Debug.Log(efile.Systemfile.FullName); } } }
public long GetLength() { long size = 0; foreach (var element in Entries) { if (element is IVIDirectory) { IVIDirectory elt = element as IVIDirectory; size += elt.GetLength(); } else { IVIFile elt = element as IVIFile; size += elt.Systemfile.Length; } } return(size); }
public void RegenerateChildren(int depth, Transform sysTransform) { // XXX depth is unused ! SetName(); if (Entry is IVIFile) { return; } IVIDirectory dir = Entry as IVIDirectory; foreach (IVIEntry childEntry in dir.Entries) { GameObject go = Instantiate(gameObject, sysTransform); IVIStar child = go.GetComponent <IVIStar>(); child.Children.Clear(); child.Parent = this; child.Entry = childEntry; Children.Add(child); } }
private void HighightFocus() { if (Focus == null) { FocusDisplayName.text = ""; FocusDisplayPath.text = ""; return; } string DisplayName = ""; string DisplayPath = ""; if (Focus.GetComponent <IVIStar> () != null) { if (Focus.GetComponent <IVIStar> ().Entry is IVIFile) { IVIFile file = Focus.GetComponent <IVIStar> ().Entry as IVIFile; DisplayName = file.Systemfile.Name; DisplayPath = file.Systemfile.FullName; } else { IVIDirectory file = Focus.GetComponent <IVIStar> ().Entry as IVIDirectory; DisplayName = file.Systemdirectory.Name; DisplayPath = file.Systemdirectory.FullName; } } else if (Focus.GetComponent <IVIMascotBehaviour> () != null) { IVISession.Mascot.ActivateModesWheel(); } else { DisplayName = Focus.name; DisplayPath = ""; } FocusDisplayName.text = DisplayName; FocusDisplayPath.text = DisplayPath; }
public void CutTo(IVIDirectory target) { if (!Systemdirectory.Exists) { throw new FileLoadException("Unknown directory at : " + Systemdirectory.FullName); } if (!target.Systemdirectory.Exists) { throw new FileLoadException("Unknown directory at : " + target.Systemdirectory.FullName); } string destinationPath = Path.Combine(target.FullPath, Systemdirectory.Name); Debug.Log(FullPath + " ==dircut==> " + destinationPath); DirectoryInfo new_dir = DirectoryCopy(FullPath, destinationPath, true); Systemdirectory.Delete(true); IVIDirectory replace = new IVIDirectory(new_dir, initial_depth); Systemdirectory = replace.Systemdirectory; Entries = replace.Entries; target.Entries.Add(this); }
private void InstantiateStarSystem(Transform parent, IVIDirectory directory, int depth) { foreach (IVIEntry element in directory.Entries) { Transform currentChild = Instantiate(StarPrefab, parent.position, Quaternion.identity, parent); currentChild.gameObject.GetComponent <IVIStar> ().Entry = element; if (element is IVIDirectory) { IVIDirectory childInfo = element as IVIDirectory; currentChild.gameObject.name = childInfo.Systemdirectory.Name; if (depth > 0) { InstantiateStarSystem(currentChild, childInfo, depth - 1); } } else { IVIFile childInfo = element as IVIFile; currentChild.gameObject.name = childInfo.Systemfile.Name; } } }
public void EnterParent() { IVIDirectory curDir = CurrentStar.Entry as IVIDirectory; GameObject parentGo = Instantiate(StarPrefab, transform); NextCurrentStar = parentGo.GetComponent <IVIStar> (); NextCurrentStar.Entry = new IVIDirectory(curDir.Systemdirectory.Parent.FullName, Depth); // XXX This is done in too many places, should be compressed into a function. NextCurrentStar.DoRecursively(Depth, (s, depth) => s.RegenerateChildren(depth, transform)); NextCurrentStar.DoRecursively(s => s.PlaceChildrenAround()); NextCurrentStar.DoRecursively(Depth, (s, depth) => s.ResetDistanceAndScale(level: Depth - depth, sys: this)); NextCurrentStar.DoRecursively(s => s.SetMaterial()); NextCurrentStar.DoRecursively(s => s.SetLight()); foreach (IVIStar child in NextCurrentStar.Children) { if (CurrentStar.Entry.FullPath == child.Entry.FullPath) { child.Children.ForEach(s_ => s_.DoRecursively_ChildrenFirst(s => Destroy(s.gameObject))); child.Children = CurrentStar.Children; child.Children.ForEach(s => s.Parent = child); Destroy(CurrentStar.gameObject); CurrentStar = child; EnterFadeInList.Add(CurrentStar); } else { child.DoRecursively(s => EnterFadeInList.Add(s)); } child.DoRecursively(Depth, (s_, depth) => s_.DoIf(s => depth < 1, s => EnterFadeOutList.Add(s))); child.DoRecursively(Depth, (s_, depth) => s_.DoIf(s => depth < 1, s => EnterDestroyList.Add(s))); } NextCurrentStar.DoRecursively(s => s.SetName()); NextCurrentStar.gameObject.SetActive(false); OnEnterStart(); EnteringChild = false; }
void Start() { IVISession.SecondaryHand.gestureThrowingForward.MaxBeginDistanceFromUser = MaxBeginDistanceFromUser; IVISession.SecondaryHand.gestureThrowingForward.MinVelocityToThrow = MinVelocityToThrow; TrashDirectory = new IVIDirectory(GetTrashPath(), 0); Debug.Log("Trash path : " + TrashDirectory.FullPath); // Créer un GameObject "Selection" qui est un StarSystem. // On ne fait ça qu'une fois. selection = new GameObject("Selection"); selection.transform.SetParent(transform); selection_star_system = selection.AddComponent <IVIStarSystem>(); #if TEST_WITH_FAKE_ENTRIES selection_star_system.InitialPath = @"C:\Users\Documents\test_clipboard"; #else selection_star_system.InitialPath = null; selection_star_system.InitialDir = new IVIDirectory(new List <IVIEntry>()); #endif // On fait Instantiate pour ne pas prendre le Prefab par référence // (on disable son trailrenderer) selection_star_system.StarPrefab = Instantiate(SourceStarSystem.StarPrefab, selection_star_system.transform); selection_star_system.StarPrefab.name = "ClipboardStarPrefab"; selection_star_system.StarPrefab.GetComponent <TrailRenderer> ().enabled = false; selection_star_system.StarPrefab.SetActive(false); selection_star_system.AllowEnteringStars = false; selection_star_system.AllowSweepingStars = false; selection_star_system.L0_Scale = 0.2f /*/8f*/; selection_star_system.L1_Scale = 0.06f /*/8f*/; selection_star_system.L2R_Scale = selection_star_system.L1_Scale / 6f; selection_star_system.L1_OrbitDistance = 0; selection_star_system.L2R_OrbitDistance = 0; // Le clipboard est une hiérarchie "plate", grâce à la façon // dont l'acte de sélection est géré. selection_star_system.Depth = 1; selection_star_system.VisualDepth = 1; }
public void InitChildren(int depth) { depth--; if (depth >= 0) { string[] subdirectories = Directory.GetDirectories(Systemdirectory.FullName); string[] files = Directory.GetFiles(Systemdirectory.FullName); UnityEngine.Assertions.Assert.IsNotNull(this.Entries); this.Entries.Clear(); if (subdirectories.Length >= 1) { foreach (string element in subdirectories) { IVIDirectory subdir = new IVIDirectory(element, depth); bool isHidden = (subdir.Systemdirectory.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden; if (!isHidden || IVISession.DisplayHiddenFiles) { this.Entries.Add(subdir); } } } if (files.Length >= 1) { foreach (string element in files) { IVIFile file = new IVIFile(element); bool isHidden = (file.Systemfile.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden; if (!isHidden || IVISession.DisplayHiddenFiles) { this.Entries.Add(file); } } } } }