Esempio n. 1
0
        private IEnumerator CompressDataForceLoadingScreen(
            List <string> selectedDirNames, List <string> selectedDirPaths,
            GameObject LoadingScreen)
        {
            LoadingScreen.SetActive(true);

            yield return(new WaitForSeconds(0.2f));

            //date time reference
            string localDate = FileManagement.GetDateTimeText();

            //path to generated or existing zip
            string zip = FileManagement.CompressDirectories(selectedDirPaths);

            //listing files to transfer for subject message
            string filenames = "";
            var    paragraph = FileManagement.GetParagraph();

            foreach (string filename in selectedDirNames)
            {
                var curFilename = filename + paragraph;
                filenames += curFilename;
            }

            //setting up share message / text
            string subject = "Retarget " + localDate;
            string text    = "" + "Retarget " + localDate + paragraph + paragraph +
                             "Attached Files: " + paragraph + filenames;

            LoadingScreen.SetActive(false);

            //share data
            FileManagement.ShareZip(zip, subject, text);
        }
Esempio n. 2
0
 private static void GetFileSizes(List <JsonDirectory> tmp_jsonDirectories, int i)
 {
     if (FileManagement.ValidatePath(tmp_jsonDirectories[i].jsonFilePath))
     {
         tmp_jsonDirectories[i].jsonSize = (int)FileManagement.GetFileSize(tmp_jsonDirectories[i].jsonFilePath);
     }
 }
        public void SelectTodaysFiles()
        {
            if (FileManager.JsonDirectories.Count == 0)
            {
                return;
            }

            string daytime = FileManagement.GetDateTime();
            var    curTime = FileManagement.StringToInt(daytime);
            string today   = FileManagement.RemoveLengthFromEnd(curTime.ToString(), 6);

            for (int i = 0; i < FileManager.JsonDirectories.Count; i++)
            {
                string day = FileManagement.RemoveLengthFromEnd(
                    FileManager.JsonDirectories[i].value.ToString(), 6);

                if (today == day)
                {
                    ChangeSelectionStatus(i, true);
                }

                else
                {
                    ChangeSelectionStatus(i, false);
                }
            }
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        private List <JsonDirectory> GetValidDirectories(string persistentPath)
        {
            string[]             dirs = FileManagement.GetDirectories(persistentPath);
            List <JsonDirectory> tmp_jsonDirectories = new List <JsonDirectory>();

            AddValidFoldersToDirectoryList(dirs, tmp_jsonDirectories);
            return(tmp_jsonDirectories);
        }
Esempio n. 6
0
 private void AddValidFoldersToDirectoryList(string[] dirs, List <JsonDirectory> tmp_jsonDirectories)
 {
     for (int t = 0; t < dirs.Length; t++)
     {
         if (!FileManagement.StringEndsWith(dirs[t], "Gallery") && !FileManagement.StringEndsWith(dirs[t], "nity") && !FileManagement.StringEndsWith(dirs[t], "il2cpp"))
         {
             AddFolderToDirectoryList(tmp_jsonDirectories, dirs, t);
         }
     }
 }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
 private void GetJsonForPreviewByName(List <JsonDirectory> tmp_jsonDirectories, int i)
 {
     foreach (string suffix in suffixes)
     {
         if (FileManagement.StringEndsWith(tmp_jsonDirectories[i].dirName, suffix))
         {
             //create new dir obj pointing to json and overwrite previous jsonDir
             var updatedDir = AssignJsonPathForPreview(tmp_jsonDirectories[i].dirPath, suffix, tmp_jsonDirectories[i]);
             tmp_jsonDirectories[i] = updatedDir;
         }
     }
 }
Esempio n. 10
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;
            }
        }
Esempio n. 11
0
        //delete selected files
        public void OnDeleteSelectedFiles(List <JsonDirectory> JsonDirectories)
        {
            List <string> selectedFiles = GetSelectedDirectories(JsonDirectories);

            if (selectedFiles.Count <= 0)
            {
                return;
            }

            else
            {
                FileManagement.DeleteDirectories(selectedFiles);
            }
        }
Esempio n. 12
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);
        }
Esempio n. 13
0
        public GameObject InstantiatePopup()
        {
            //new popup
            var popup = Instantiate(popupPrefab, Vector3.zero, Quaternion.identity);
            var m_pop = popup.GetComponent <PopUpDisplay>();

            //message
            var para = FileManagement.GetParagraph();

            m_pop.text = $"Wow, such empty!{para}Please record something to {para}preview and share files";
            m_pop.type = PopUpDisplay.PopupType.Static;

            //transforms
            popup.transform.localScale = Vector3.one;
            m_pop.DisplayPopup(parent);

            //reference for cleanup
            return(popup);
        }
        public IEnumerator OnInitRetargeting()
        {
            //folder to store files
            string curTime = FileManagement.GetDateTime();

            folderPath = $"{persistentPath}/{curTime}_{prefixs[0].j_Prefix()}";
            FileManagement.CreateDirectory(folderPath);

            //time to create dir
            yield return(waitForFrame);

            //initialize trackers
            InitTrackers(folderPath, "/" + curTime);

            //time to init - starting at frame 1 because of the delay
            yield return(waitForFrame);

            frame = 1;
            OnEnableTracking();
        }
Esempio n. 15
0
        void Start()
        {
            br = FileManagement.GetParagraph();

            if (inputHandler == null)
            {
                inputHandler = GameObject.FindGameObjectWithTag("interfaceManager").GetComponent <InputHandler>();
            }

            TrackingStateChanged += OnTrackingStateChanged;
            ClearCached();

            if (PlayerPrefsHandler.Instance.GetInt("hints", -1) == -1)
            {
                type = TrackingType.none;
            }

            //init the tracking type
            switch (type)
            {
            case TrackingType.PlaneTracking:
                InitPlaneTrackingReferences();
                //start to use the time enum
                m_timeStamp = Time.time;
                trackTime   = true;
                break;

            case TrackingType.FaceTracking:
                InitFaceTrackingReferences();
                m_timeStamp = Time.time;
                trackTime   = true;
                break;

            case TrackingType.none:
                DisableSessionHints();
                trackTime = false;
                break;
            }

            timeState = TimeState.None;
        }
Esempio n. 16
0
        public static void PurgeOrphanZips()
        {
            try
            {
                FileInfo[] zipFiles = FileManagement.GetZipsAtPath(FilebrowserManager.persistentPath);

                if (zipFiles.Length > 0)
                {
                    Debug.Log("Purging " + zipFiles.Length + " orphan zips");
                    foreach (FileInfo zip in zipFiles)
                    {
                        FileManagement.DeleteFile(zip.FullName);
                    }
                }
            }

            catch (Exception e)
            {
                Debug.LogWarning("Cannot purge zips in certain circumstance");
                Debug.Log(e);
            }
        }
Esempio n. 17
0
 private void Start()
 {
     trackingState = TrackingState.Pendling;
     inputHandler  = this.gameObject.GetComponent <InputHandler>();
     paragraph     = FileManagement.GetParagraph();
 }