Exemplo n.º 1
0
        private void AddFolderToDirectoryList(List <JsonDirectory> tmp_jsonDirectories, string[] dirs, int t)
        {
            JsonDirectory m_dir = new JsonDirectory();

            m_dir.dirName = FileManagement.GetDirectoryName(dirs[t]);
            m_dir.dirPath = dirs[t];
            tmp_jsonDirectories.Add(m_dir);
        }
Exemplo n.º 2
0
        private bool ViewableJsonContents(JsonDirectory jsonFileData)
        {
            if (jsonFileData.jsonSize >= 65 || string.IsNullOrEmpty(m_jsonDirData.jsonFilePath))
            {
                return(false);
            }

            return(true);
        }
        private IEnumerator OpenPreview(JsonDirectory dir)
        {
            dir.viewed = true;
            FileManager.ChangeDirectoryProperties(dir);
            FileManager.JsonPreview    = dir;
            FileManager.InstantPreview = true;
            yield return(new WaitForSeconds(0.3f));

            StateMachine.Instance.SetState(StateMachine.State.JsonViewer);
        }
Exemplo n.º 4
0
        //subdir
        private JsonDirectory AssignJsonPathForPreview(string path, string suffix, JsonDirectory m_dir)
        {
            if (FileManagement.ValidateDirectory(path))
            {
                return(ReturnJsonWithFittingSuffix(path, suffix, m_dir));
            }

            LogManager.Instance.Log($"folder doesn't contain valid json contents <br><br>{path}", LogManager.Message.Warning);

            return(m_dir);
        }
Exemplo n.º 5
0
        private void CheckForFileSuffix(FileInfo json, string suffix, JsonDirectory m_dir)
        {
            string jsonFilename = json.Name;

            if (FileManagement.StringEndsWith(jsonFilename, suffix + ".json"))
            {
                //setting up the serializeable JsonDir obj
                m_dir.dirName      = FileManagement.RemoveSuffixFromEnd(json.Name, ".json");
                m_dir.value        = FileManagement.StringToInt(m_dir.dirName);
                m_dir.active       = false;
                m_dir.jsonFilePath = json.FullName;
            }
        }
Exemplo n.º 6
0
        private IEnumerator OpenFile(JsonDirectory jsonDirectory)
        {
            jsonButtonPointer.GetComponent <JsonFileButton>().InitFileButton(jsonDirectory);
            this.jsonName.text = jsonDirectory.dirName;
            string contents = FileManagement.FileContents(jsonDirectory.jsonFilePath);

            yield return(new WaitForEndOfFrame());

            var go = Instantiate(jsonViewerPrefab, Vector3.zero, Quaternion.identity);

            jsonViewerReference = go;
            var jsonDataImporter = go.GetComponent <JsonDataImporter>();

            jsonDataImporter.OpenFile(contents);
        }
Exemplo n.º 7
0
        public void InitFileButton(JsonDirectory jsonFileData)
        {
            m_jsonDirData     = jsonFileData;
            filenameText.text = jsonFileData.dirName;
            bool viewable = ViewableJsonContents(jsonFileData);

            if (ViewDataButton)
            {
                ViewDataButton.SetActive(viewable);
            }

            btnIsOn = m_jsonDirData.active;
            ChangeViewedDisplayStatus(jsonFileData.viewed);
            ChangeSelectionToggleStatus(btnIsOn);
        }
Exemplo n.º 8
0
 public static void ChangeDirectoryProperties(JsonDirectory jsonDirectory)
 {
     jsonDirectories[jsonDirectory.index] = jsonDirectory;
 }
Exemplo n.º 9
0
        private JsonDirectory ReturnJsonWithFittingSuffix(string path, string suffix, JsonDirectory m_dir)
        {
            m_dir.value = 0;

            FileInfo[] jsonFiles = FileManagement.GetJsonsAtPath(path);
            foreach (FileInfo json in jsonFiles)
            {
                CheckForFileSuffix(json, suffix, m_dir);
            }

            return(m_dir);
        }