c# - Xamarin.Forms Deleting Files at Runtime iOS -


i need store byte[] in memory. need access later. byte[] represents video. following code allow file written memory, accessed memory. when remove method shown below called, can still accessed later.

i have checked pathname same.

        public void storevideo(byte[] video, string filename)         {             var documents = environment.getfolderpath(environment.specialfolder.mydocuments);             var directoryname = path.combine(documents, "videos");             directory.createdirectory(directoryname);             var path = path.combine(directoryname, filename);             file.writeallbytes(path, video);         }          public void removevideo(string filename)         {             var documents = environment.getfolderpath(environment.specialfolder.mydocuments);             var directoryname = path.combine(documents, "videos");             var path = path.combine(directoryname, filename);             file.delete(filename);         }          public byte[] getvideo(string filename)         {             var documents = environment.getfolderpath(environment.specialfolder.mydocuments);             var directoryname = path.combine(documents, "videos");             var path = path.combine(directoryname, filename);              if(file.exists(path))             {                 return file.readallbytes(path);             }             return null;         } 

the answer small brain fart on path being passed file.delete method. run should aware file.delete not throw exception if cannot delete file. should practice wrap file.delete method check file.exists


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -