Example #1
0
        private void ProcessFiles(xmds.xmds xmds, string key, string type)
        {
            // Get a list of all the log files waiting to be sent to XMDS.
            string[] logFiles = Directory.GetFiles(ApplicationSettings.Default.LibraryPath, "*" + type + "*");

            // Track processed files
            int filesProcessed = 0;

            // Loop through each file
            foreach (string fileName in logFiles)
            {
                // Only process as many files in one go as configured
                if (filesProcessed >= ApplicationSettings.Default.MaxLogFileUploads)
                    break;

                // construct the log message
                StringBuilder builder = new StringBuilder();
                builder.Append("<log>");

                foreach (string entry in File.ReadAllLines(fileName))
                    builder.Append(entry);

                builder.Append("</log>");

                if (type == ApplicationSettings.Default.StatsLogFile)
                    xmds.SubmitStats(ApplicationSettings.Default.ServerKey, key, builder.ToString());
                else
                    xmds.SubmitLog(ApplicationSettings.Default.ServerKey, key, builder.ToString());

                // Delete the file we are on
                File.Delete(fileName);

                // Increment files processed
                filesProcessed++;
            }
        }
 static void screenShotXmds_SubmitScreenShotCompleted(object sender, xmds.SubmitScreenShotCompletedEventArgs e)
 {
     if (e.Error != null)
         Trace.WriteLine(new LogMessage("ScreenShot - Take", e.Error.Message), LogType.Error.ToString());
 }