Ejemplo n.º 1
0
    private void RefreshFolders(DirectoryInfo d)
    {
        DirectoryInfo[] dirs = d.GetDirectories();
        foreach (DirectoryInfo dir in dirs)
        {
#if !UNITY_EDITOR
            if (dir.Name.StartsWith("_"))
            {
                continue;
            }
#endif

            GameObject element = Instantiate(fseFolder) as GameObject;
            element.SetActive(true);

            element.GetComponent <FSEFolder>().SetName(dir.Name);
            element.GetComponent <FSEFolder>().SetPath(dir.FullName);

            element.transform.SetParent(fseFolder.transform.parent, false);

            string passPath = dir.FullName + ".password";
            if (File.Exists(passPath))
            {
                string         jsonString = ReadFile(passPath);
                FSPasswordInfo pass       = FSPasswordInfo.CreateFromJSON(jsonString);
                element.GetComponent <FSEFolder>().SetPasswordInfo(pass);
                element.GetComponent <FSEFolder>().Lock();
            }
        }
    }
Ejemplo n.º 2
0
    private void RefreshFiles(DirectoryInfo d)
    {
        FileInfo[] files = d.GetFiles();
        foreach (FileInfo file in files)
        {
            GameObject element = null;
            if (file.Name.EndsWith(".png") || file.Name.ToLower().EndsWith(".jpg"))
            {
                element = Instantiate(fseImage) as GameObject;
                element.SetActive(true);

                element.GetComponent <FSEImage>().SetName(file.Name);
                element.GetComponent <FSEImage>().SetPath(basePath + ApplicationModel.GetFileSysHead() + appendedPath + "/" + file.Name);

                element.transform.SetParent(fseImage.transform.parent, false);

                string passPath = file.FullName + ".password";
                if (File.Exists(passPath))
                {
                    string         jsonString = ReadFile(passPath);
                    FSPasswordInfo pass       = FSPasswordInfo.CreateFromJSON(jsonString);
                    element.GetComponent <FSEImage>().SetPasswordInfo(pass);
                    element.GetComponent <FSEImage>().Lock();
                }
            }
            else if (file.Name.EndsWith(".txt"))
            {
                element = Instantiate(fseTextfile) as GameObject;
                element.SetActive(true);

                element.GetComponent <FSETextfile>().SetName(file.Name);
                element.GetComponent <FSETextfile>().SetPath(basePath + ApplicationModel.GetFileSysHead() + appendedPath + "/" + file.Name);

                element.transform.SetParent(fseTextfile.transform.parent, false);

                string passPath = file.FullName + ".password";
                if (File.Exists(passPath))
                {
                    string         jsonString = ReadFile(passPath);
                    FSPasswordInfo pass       = FSPasswordInfo.CreateFromJSON(jsonString);
                    element.GetComponent <FSETextfile>().SetPasswordInfo(pass);
                    element.GetComponent <FSETextfile>().Lock();
                }
            }
            else if (file.Name.EndsWith(".mp4"))
            {
                element = Instantiate(fseVideo) as GameObject;
                element.SetActive(true);

                element.GetComponent <FSEVideo>().SetName(file.Name);
                element.GetComponent <FSEVideo>().SetPath(basePath + ApplicationModel.GetFileSysHead() + appendedPath + "/" + file.Name);

                element.transform.SetParent(fseVideo.transform.parent, false);

                string passPath = file.FullName + ".password";
                if (File.Exists(passPath))
                {
                    string         jsonString = ReadFile(passPath);
                    FSPasswordInfo pass       = FSPasswordInfo.CreateFromJSON(jsonString);
                    element.GetComponent <FSEVideo>().SetPasswordInfo(pass);
                    element.GetComponent <FSEVideo>().Lock();
                }
            }
            else if (file.Name.EndsWith(".wav")) //  || file.Name.EndsWith(".mp3"))
            {
                element = Instantiate(fseAudio) as GameObject;
                element.SetActive(true);

                element.GetComponent <FSEAudio>().SetName(file.Name);
                element.GetComponent <FSEAudio>().SetPath(basePath + ApplicationModel.GetFileSysHead() + appendedPath + "/" + file.Name);

                element.transform.SetParent(fseAudio.transform.parent, false);

                string passPath = file.FullName + ".password";
                if (File.Exists(passPath))
                {
                    string         jsonString = ReadFile(passPath);
                    FSPasswordInfo pass       = FSPasswordInfo.CreateFromJSON(jsonString);
                    element.GetComponent <FSEAudio>().SetPasswordInfo(pass);
                    element.GetComponent <FSEAudio>().Lock();
                }
            }
            else
            {
                //Debug.Log("File System Manager - Ignoring File: "+file.Name+" (Unhandled Filetype)");
            }
        }
    }
Ejemplo n.º 3
0
 public void SetPasswordInfo(FSPasswordInfo password)
 {
     this.password = password;
 }