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); }
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); }
//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); }
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; } }
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); }
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); }
public static void ChangeDirectoryProperties(JsonDirectory jsonDirectory) { jsonDirectories[jsonDirectory.index] = jsonDirectory; }
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); }