Exemple #1
0
        static void Main(string[] args)
        {
            IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForAssembly();

            IsolatedStorageFileStream isoFile = new IsolatedStorageFileStream("myfile.txt", FileMode.Create, isoStore);
            Console.WriteLine(isoFile.GetType().GetField("m_FullPath", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(isoFile).ToString());

            StreamWriter sw = new StreamWriter(isoFile);

            sw.WriteLine("This text is written to an isolated storage file.");

            sw.Close();
            isoFile.Close();


            isoFile = new IsolatedStorageFileStream("myfile.txt", FileMode.Open, isoStore);


            StreamReader sr = new StreamReader(isoFile);

            Console.WriteLine(sr.ReadToEnd());

            sr.Close();
            isoFile.Close();
        }
Exemple #2
0
        public string BuscarLocalArquivo(string sNomeArquivo, Lugar _onde)
        {
            try
            {
                InstanciaIsolatedStorageFileBusca(_onde);
                string sRetorno = "";
                string[] files = armazenamento.GetFileNames(sNomeArquivo);
                if (files.Count() > 0)
                {
                    arqFileStream = new IsolatedStorageFileStream(sNomeArquivo, FileMode.Open, armazenamento);
                    sRetorno = arqFileStream.GetType().GetField("m_FullPath", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(arqFileStream).ToString();
                }
                return sRetorno;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }