Esempio n. 1
0
        private bool AddFile(string rawFile)
        {
            bool addFileResult = true;

            string rawFileName = rawFile.Substring(1, rawFile.IndexOf(" ") - 1);;

            if (!string.IsNullOrEmpty(rawFile))
            {
                if (int.TryParse(rawFile.Substring(rawFile.IndexOf(" ")), out int rawFileSize))
                {
                    OWLOSFile owlosNewFile = new OWLOSFile();
                    owlosNewFile.name = rawFileName;
                    owlosNewFile.size = rawFileSize;
                    filesList.Add(owlosNewFile);
                    OnNewFile?.Invoke(this, owlosNewFile);
                    owlosNewFile.networkStatus = NetworkStatus.Online;
                }
                else
                {
                    addFileResult = false;
                }
            }

            return(addFileResult);
        }
Esempio n. 2
0
        public async Task <bool> DeleteFile(string rawFile)
        {
            OWLOSFile file = filesList.FirstOrDefault(f => f.name == rawFile && f.exist);

            if (file != null)
            {
                if (await parentThing.DeleteFile(rawFile))
                {
                    file.FileDeleteInsideSide();
                    return(true);
                }
            }

            return(false);
        }