Example #1
0
        private void BUT_loganalysis_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "*.log|*.log|*.bin|*.bin";
            ofd.ShowDialog();

            if (ofd.FileName != "")
            {
                string newlogfile = null;

                if (ofd.FileName.ToLower().EndsWith(".bin"))
                {
                    var log = MissionPlanner.Log.BinaryLog.ReadLog(ofd.FileName);

                    newlogfile = Path.GetTempPath() + Path.DirectorySeparatorChar + Path.GetTempFileName() + ".log";

                    using (StreamWriter sw = new StreamWriter(newlogfile))
                    {
                        foreach (string line in log)
                        {
                            sw.Write(line);
                        }
                    }

                    ofd.FileName = newlogfile;
                }

                string xmlfile = MissionPlanner.Utilities.LogAnalyzer.CheckLogFile(ofd.FileName);

                if (File.Exists(xmlfile))
                {
                    var out1 = MissionPlanner.Utilities.LogAnalyzer.Results(xmlfile);

                    MissionPlanner.Controls.LogAnalyzer frm = new Controls.LogAnalyzer(out1);

                    frm.Show();
                }
                else
                {
                    CustomMessageBox.Show("Bad input file");
                }

                if (!String.IsNullOrEmpty(newlogfile))
                {
                    File.Delete(newlogfile);
                }
            }
        }
Example #2
0
        private void BUT_loganalysis_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "*.log;*.bin|*.log;*.bin";
            ofd.ShowDialog();

            if (ofd.FileName != "")
            {
                string newlogfile = null;

                if (ofd.FileName.ToLower().EndsWith(".bin"))
                {
                    newlogfile = Path.GetTempFileName() + ".log";

                    BinaryLog.ConvertBin(ofd.FileName, newlogfile);

                    ofd.FileName = newlogfile;
                }

                string xmlfile = MissionPlanner.Utilities.LogAnalyzer.CheckLogFile(ofd.FileName);

                GC.Collect();

                if (File.Exists(xmlfile))
                {
                    var out1 = MissionPlanner.Utilities.LogAnalyzer.Results(xmlfile);

                    MissionPlanner.Controls.LogAnalyzer frm = new Controls.LogAnalyzer(out1);

                    frm.Show();
                }
                else
                {
                    CustomMessageBox.Show("Bad input file");
                }

                if (!String.IsNullOrEmpty(newlogfile))
                {
                    try
                    {
                        File.Delete(newlogfile);
                    }
                    catch { }
                }
            }
        }
Example #3
0
        private void BUT_loganalysis_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "*.log|*.log";
            ofd.ShowDialog();

            if (ofd.FileName != "")
            {
                string xmlfile = MissionPlanner.Utilities.LogAnalyzer.CheckLogFile(ofd.FileName);

                if (File.Exists(xmlfile))
                {
                    var out1 = MissionPlanner.Utilities.LogAnalyzer.Results(xmlfile);

                    MissionPlanner.Controls.LogAnalyzer frm = new Controls.LogAnalyzer(out1);

                    frm.Show();
                }
                else
                {
                    CustomMessageBox.Show("Bad input file");
                }
            }
        }