Esempio n. 1
0
        private Guid SaveLog(String log, CrashInfoType infoType, Guid?id = null)
        {
            var crashId = id ?? Guid.NewGuid();

            try
            {
                IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
                if (!store.DirectoryExists(Constants.CrashDirectoryName))
                {
                    store.CreateDirectory(Constants.CrashDirectoryName);
                }

                String     filename = string.Format("{0}{1}.log", infoType.ToString(), crashId);
                FileStream stream   = store.CreateFile(Path.Combine(Constants.CrashDirectoryName, filename));
                using (StreamWriter writer = new StreamWriter(stream))
                {
                    writer.Write(log);
                }
                stream.Close();
            }
            catch
            {
                // Ignore all exceptions
            }
            return(crashId);
        }
Esempio n. 2
0
 private Guid SaveLog(String log, CrashInfoType infoType, Guid? id = null)
 {
     var crashId = id ?? Guid.NewGuid();
     try
     {
         IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
         if (!store.DirectoryExists(Constants.CrashDirectoryName))
         {
             store.CreateDirectory(Constants.CrashDirectoryName);
         }
         
         String filename = string.Format("{0}{1}.log", infoType.ToString(), crashId);
         FileStream stream = store.CreateFile(Path.Combine(Constants.CrashDirectoryName, filename));
         using (StreamWriter writer = new StreamWriter(stream))
         {
             writer.Write(log);
         }
         stream.Close();
     }
     catch
     {
         // Ignore all exceptions
     }
     return crashId;
 }