Example #1
0
        /// <summary>
        ///		Creates all ready drives as folder objects
        ///		if the folder prefab is set.
        /// </summary>
        protected virtual List <ExplorerObject> CreateDrives(
            Transform container,
            Action <ExplorerObject> onInitialize = null)
        {
            if (FolderObject)
            {
                List <ExplorerObject> objects = new List <ExplorerObject>();

                string[] drives = Directory.GetLogicalDrives();

                foreach (string d in drives)
                {
                    if (!new DriveInfo(d).IsReady)
                    {
                        continue;
                    }

                    ExplorerObject newObject = CreateObject(d, FolderObject, ContentContainer, onInitialize, false);
                    if (newObject != null)
                    {
                        objects.Add(newObject);
                    }
                }

                return(objects);
            }

            return(null);
        }
Example #2
0
 /// <summary>
 ///		Calls OnObjectSelected in Explorer.
 /// </summary>
 public void OnSelect(ExplorerObject invoked)
 {
     if (Explorer)
     {
         Explorer.OnObjectSelected(invoked.Path);
     }
 }
Example #3
0
        protected virtual List <ExplorerObject> CreateAndroidDrives(
            Transform transform,
            Action <ExplorerObject> onInitialize = null)
        {
            if (FolderObject)
            {
                List <ExplorerObject> objects = new List <ExplorerObject>();

                string[] drives = new string[]
                {
                    //Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                    AndroidUtilities.GetAndroidExternalStoragePath()
                };

                Debug.LogFormat("Found Drive count: {0}", drives.Length);

                foreach (string d in drives)
                {
                    Debug.LogFormat("Processing Drive: {0}", d);

                    ExplorerObject newObject = CreateObject(d, FolderObject, ContentContainer, onInitialize, false);
                    if (newObject != null)
                    {
                        objects.Add(newObject);
                    }
                }

                return(objects);
            }

            return(null);
        }
        private void ApplyIndenting(ExplorerObject evo)
        {
            float         indenting = (evo.Path.Split('\\', '/').Length - (evo.Path.EndsWith("\\") ? 2 : 1)) * IndentWidth;
            RectTransform rect      = evo.GetComponent <RectTransform>();

            rect.position  = new Vector2(rect.position.x + indenting / 2, rect.position.y);
            rect.sizeDelta = new Vector2(rect.sizeDelta.x - indenting, rect.sizeDelta.y);

            if (indenting > maxIndenting)
            {
                maxIndenting = indenting;
            }
        }
Example #5
0
        /// <summary>
        ///		Creates a new instance of the provided object.
        /// </summary>
        protected virtual ExplorerObject CreateObject(
            string path,
            ExplorerObject explorerObject,
            Transform container,
            Action <ExplorerObject> onInitialize,
            bool evaluatePath = true)
        {
            if (evaluatePath && (HasBlockedAttributes(path) || HasBlockedExtention(path)))
            {
                return(null);
            }

            ExplorerObject newObj = Instantiate(explorerObject, container);

            newObj.Initialize(this, path);
            newObj.gameObject.name = string.Format("({0})_({1})", explorerObject.GetType().ToString(), path);
            onInitialize.SafeInvoke(newObj);

            return(newObj);
        }
Example #6
0
        /// <summary>
        ///		Creates all file objects
        ///		if a file prefab is set.
        /// </summary>
        protected virtual List <ExplorerObject> CreateFiles(
            string path,
            Transform container,
            Action <ExplorerObject> onInitialize = null)
        {
            if (FileObject)
            {
                List <ExplorerObject> objects = new List <ExplorerObject>();

                Utilities.ForeachFileAt(path, (FileInfo info) =>
                {
                    ExplorerObject explorerObject = CreateObject(info.FullName, FileObject, ContentContainer, onInitialize);
                    if (!explorerObject)
                    {
                        objects.Add(explorerObject);
                    }
                });
                return(objects);
            }

            return(null);
        }
Example #7
0
        /// <summary>
        ///		Creates all folder objects
        ///		if a folder prefab is set.
        /// </summary>
        protected virtual List <ExplorerObject> CreateFolders(
            string path,
            Transform container,
            Action <ExplorerObject> onInitialize = null)
        {
            if (FolderObject)
            {
                List <ExplorerObject> objects = new List <ExplorerObject>();

                Utilities.ForeachFolderAt(path, (string p) =>
                {
                    ExplorerObject explorerObject = CreateObject(p, FolderObject, ContentContainer, onInitialize);
                    if (explorerObject != null)
                    {
                        objects.Add(explorerObject);
                    }
                });

                return(objects);
            }

            return(null);
        }