Exemple #1
0
    public void ShowFullDirectory(string path)
    {
        HideDirectory();

        // Create a DirectoryInfo variable linked to the path of an external directory
        DirectoryInfo dir = new DirectoryInfo(path);

        // If the path is already a ".pdf" file, skip creating the 3D browser, and lets convert the file into a presentation
        if (dir.Extension == ".pdf")
        {
            presentationManager.GetNewPDF(path);
            HideDirectory();
        }
        else
        {
            directoryOpen = true;
            // Create an array of FileInfo based on all the files in the DirectoryInfo
            FileInfo[]      files   = dir.GetFiles("*.pdf");
            DirectoryInfo[] folders = dir.GetDirectories("*");

            // Initialize the row and column count for the VR browser
            int row    = 0;
            int column = 0;

            // Lets grab all the FOLDERS in the directory and assign a clickable button to that directory path
            foreach (DirectoryInfo f in folders)
            {
                PlaceButton(row, column, f.Name, f.FullName);

                row++;

                // If there are too many buttons in a row, start a new column
                if (row == filesPerRow)
                {
                    row = 0;
                    column++;
                }
            }

            // Lets grab all the FILES in the directory and assign a clickable button to that directory path
            foreach (FileInfo f in files)
            {
                PlaceButton(row, column, f.Name, f.FullName);

                row++;

                if (row == filesPerRow)
                {
                    row = 0;
                    column++;
                }
            }

            directoryText.SetActive(true);
            directoryText.GetComponent <TextMeshPro>().text = "Current Directory: /n" + dir.ToString();
        }
    }