当前位置: 首页>>代码示例>>C#>>正文


C# Log.LogOutput类代码示例

本文整理汇总了C#中MissionPlanner.Log.LogOutput的典型用法代码示例。如果您正苦于以下问题:C# LogOutput类的具体用法?C# LogOutput怎么用?C# LogOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LogOutput类属于MissionPlanner.Log命名空间,在下文中一共展示了LogOutput类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BUT_firstperson_Click

        private void BUT_firstperson_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
            {
                openFileDialog1.Filter = "*.log|*.log";
                openFileDialog1.FilterIndex = 2;
                openFileDialog1.RestoreDirectory = true;
                openFileDialog1.Multiselect = true;
                try
                {
                    openFileDialog1.InitialDirectory = MainV2.LogDir + Path.DirectorySeparatorChar;
                }
                catch { } // incase dir doesnt exist

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    foreach (string logfile in openFileDialog1.FileNames)
                    {
                        TXT_seriallog.AppendText("\n\nProcessing " + logfile + "\n");
                        this.Refresh();

                        LogOutput lo = new LogOutput();

                        try
                        {
                            TextReader tr = new StreamReader(logfile);

                            while (tr.Peek() != -1)
                            {
                                lo.processLine(tr.ReadLine());
                            }

                            tr.Close();
                        }
                        catch (Exception ex) { CustomMessageBox.Show("Error processing log. Is it still downloading? " + ex.Message); continue; }

                        lo.writeKMLFirstPerson(logfile + "-fp.kml");

                        TXT_seriallog.AppendText("Done\n");
                    }
                }
            }
        }
开发者ID:novakeugene,项目名称:MissionPlanner,代码行数:43,代码来源:LogDownloadMavLink.cs

示例2: but_dflogtokml_Click

        private void but_dflogtokml_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
            {
                openFileDialog1.Filter = "Log Files|*.log;*.bin";
                openFileDialog1.FilterIndex = 2;
                openFileDialog1.RestoreDirectory = true;
                openFileDialog1.Multiselect = true;
                try
                {
                    openFileDialog1.InitialDirectory = MainV2.LogDir + Path.DirectorySeparatorChar;
                }
                catch
                {
                } // incase dir doesnt exist

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    foreach (string logfile in openFileDialog1.FileNames)
                    {
                        LogOutput lo = new LogOutput();
                        try
                        {
                            StreamReader tr;

                            if (logfile.ToLower().EndsWith(".bin"))
                            {
                                string tempfile = Path.GetTempFileName();
                                BinaryLog.ConvertBin(logfile, tempfile);

                                tr = new StreamReader(tempfile);
                            }
                            else
                            {
                                tr = new StreamReader(logfile);
                            }

                            while (!tr.EndOfStream)
                            {
                                lo.processLine(tr.ReadLine());
                            }

                            tr.Close();
                        }
                        catch (Exception ex)
                        {
                            CustomMessageBox.Show("Error processing file. Make sure the file is not in use.\n" + ex);
                        }

                        lo.writeKML(logfile + ".kml");
                    }
                }
            }
        }
开发者ID:Viousa,项目名称:MissionPlanner,代码行数:54,代码来源:FlightData.cs

示例3: but_dflogtokml_Click

        private void but_dflogtokml_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
            {
                openFileDialog1.Filter = "Log Files|*.log;*.bin";
                openFileDialog1.FilterIndex = 2;
                openFileDialog1.RestoreDirectory = true;
                openFileDialog1.Multiselect = true;
                try
                {
                    openFileDialog1.InitialDirectory = Settings.Instance.LogDir + Path.DirectorySeparatorChar;
                }
                catch
                {
                } // incase dir doesnt exist

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    foreach (string logfile in openFileDialog1.FileNames)
                    {
                        LogOutput lo = new LogOutput();
                        try
                        {
                            StreamReader tr;

                            if (logfile.ToLower().EndsWith(".bin"))
                            {
                                using (tr = new StreamReader(logfile))
                                {
                                    GC.Collect();
                                    CollectionBuffer temp = new CollectionBuffer(tr.BaseStream);

                                    uint a = 0;
                                    foreach (var line in temp)
                                    {
                                        lo.processLine(line);
                                        a++;

                                        if ((a % 100000) == 0)
                                            Console.WriteLine(a);
                                    }

                                    temp.Dispose();
                                }
                            }
                            else
                            {
                                using (tr = new StreamReader(logfile))
                                {
                                    while (!tr.EndOfStream)
                                    {
                                        lo.processLine(tr.ReadLine());
                                    }

                                    tr.Close();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            CustomMessageBox.Show("Error processing file. Make sure the file is not in use.\n" + ex);
                        }

                        lo.writeKML(logfile + ".kml");
                    }
                }
            }
        }
开发者ID:denisdifazio,项目名称:MissionPlanner,代码行数:68,代码来源:FlightData.cs

示例4: CreateLog

        void CreateLog(string logfile)
        {
            TextReader tr = new StreamReader(logfile);
            //

            this.Invoke((System.Windows.Forms.MethodInvoker)delegate()
            {
                TXT_seriallog.AppendText("Creating KML for " + logfile + "\n");
            });

            LogOutput lo = new LogOutput();

            while (tr.Peek() != -1)
            {
                lo.processLine(tr.ReadLine());
            }

            tr.Close();

            try
            {
                lo.writeKML(logfile + ".kml");
            }
            catch { } // usualy invalid lat long error
            status = serialstatus.Done;
            updateDisplay();
        }
开发者ID:novakeugene,项目名称:MissionPlanner,代码行数:27,代码来源:LogDownloadMavLink.cs

示例5: comPort_DataReceived

        void comPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            try
            {
                while (comPort.BytesToRead > 0 && threadrun)
                {
                    updateDisplay();

                    string line = "";

                    comPort.ReadTimeout = 500;
                    try
                    {
                        line = comPort.ReadLine(); //readline(comPort);
                        if (!line.Contains("\n"))
                            line = line + "\n";
                    }
                    catch
                    {
                        line = comPort.ReadExisting();
                        //byte[] data = readline(comPort);
                        //line = Encoding.ASCII.GetString(data, 0, data.Length);
                    }

                    receivedbytes += line.Length;

                    //string line = Encoding.ASCII.GetString(data, 0, data.Length);

                    switch (status)
                    {
                        case serialstatus.Connecting:

                            if (line.Contains("ENTER") || line.Contains("GROUND START") || line.Contains("reset to FLY") ||
                                line.Contains("interactive setup") || line.Contains("CLI") || line.Contains("Ardu"))
                            {
                                try
                                {
                                    //System.Threading.Thread.Sleep(200);
                                    //comPort.Write("\n\n\n\n");
                                }
                                catch
                                {
                                }

                                System.Threading.Thread.Sleep(500);

                                // clear history
                                this.Invoke((System.Windows.Forms.MethodInvoker) delegate() { TXT_seriallog.Clear(); });

                                // comPort.Write("logs\r");
                                status = serialstatus.Done;
                            }
                            break;
                        case serialstatus.Closefile:
                            sw.Close();

                            DateTime logtime = new DFLog().GetFirstGpsTime(logfile);

                            if (logtime != DateTime.MinValue)
                            {
                                string newlogfilename = MainV2.LogDir + Path.DirectorySeparatorChar +
                                                        logtime.ToString("yyyy-MM-dd HH-mm-ss") + ".log";
                                try
                                {
                                    File.Move(logfile, newlogfilename);
                                    logfile = newlogfilename;
                                }
                                catch (Exception ex)
                                {
                                    log.Error(ex);
                                    CustomMessageBox.Show(
                                        "Failed to rename file " + logfile + "\nto " + newlogfilename, Strings.ERROR);
                                }
                            }

                            TextReader tr = new StreamReader(logfile);

                            //

                            this.Invoke(
                                (System.Windows.Forms.MethodInvoker)
                                    delegate() { TXT_seriallog.AppendText("Creating KML for " + logfile); });

                            LogOutput lo = new LogOutput();

                            while (tr.Peek() != -1)
                            {
                                lo.processLine(tr.ReadLine());
                            }

                            tr.Close();

                            try
                            {
                                lo.writeKML(logfile + ".kml");
                            }
                            catch
                            {
                            } // usualy invalid lat long error
                            status = serialstatus.Done;
//.........这里部分代码省略.........
开发者ID:duyisu,项目名称:MissionPlanner,代码行数:101,代码来源:LogDownload.cs

示例6: CreateLog

        void CreateLog(string logfile)
        {
            TextReader tr = new StreamReader(logfile);
            //

            LogOutput lo = new LogOutput();

            while (tr.Peek() != -1)
            {
                lo.processLine(tr.ReadLine());
            }

            tr.Close();

            try
            {
                lo.writeKML(logfile + ".kml");
            }
            catch { } // usualy invalid lat long error
        }       
开发者ID:Event38,项目名称:MissionPlanner,代码行数:20,代码来源:FlightData.cs

示例7: but_dflogtokml_Click

        private void but_dflogtokml_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "Log Files|*.log;*.bin";
            openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.Multiselect = true;
            try
            {
                openFileDialog1.InitialDirectory = MainV2.LogDir + Path.DirectorySeparatorChar;
            }
            catch { } // incase dir doesnt exist

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                foreach (string logfile in openFileDialog1.FileNames)
                {
                    LogOutput lo = new LogOutput();
                    try
                    {
                        StreamReader tr;

                        if (logfile.ToLower().EndsWith(".bin"))
                        {
                            var ms = new MemoryStream();
                            var lines = BinaryLog.ReadLog(logfile);
                            foreach (var line in lines) {
                                ms.Write(ASCIIEncoding.ASCII.GetBytes(line),0,line.Length);
                            }
                            ms.Seek(0, SeekOrigin.Begin);
                            tr = new StreamReader(ms);
                        }
                        else
                        {
                            tr = new StreamReader(logfile);
                        }

                        while (!tr.EndOfStream)
                        {
                            lo.processLine(tr.ReadLine());
                        }

                        tr.Close();
                    }
                    catch (Exception ex) { CustomMessageBox.Show("Error processing file. Make sure the file is not in use.\n" + ex.ToString()); }

                    lo.writeKML(logfile + ".kml");

                }
            }
        }
开发者ID:LeoTosti,项目名称:x-drone,代码行数:51,代码来源:FlightData.cs

示例8: but_dflogtokml_Click

        private void but_dflogtokml_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "*.log|*.log";
            openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.Multiselect = true;
            try
            {
                openFileDialog1.InitialDirectory = MainV2.LogDir + Path.DirectorySeparatorChar;
            }
            catch { } // incase dir doesnt exist

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                DialogResult copterlog = CustomMessageBox.Show("Is this a Copter Log?", "", MessageBoxButtons.YesNo);

                foreach (string logfile in openFileDialog1.FileNames)
                {
                    LogOutput lo = new LogOutput();
                    try
                    {
                        TextReader tr = new StreamReader(logfile);

                        while (tr.Peek() != -1)
                        {
                            lo.processLine(tr.ReadLine(), copterlog == DialogResult.Yes);
                        }

                        tr.Close();
                    }
                    catch (Exception ex) { CustomMessageBox.Show("Error processing file. Make sure the file is not in use.\n" + ex.ToString()); }

                    lo.writeKML(logfile + ".kml");

                }
            }
        }
开发者ID:johnath,项目名称:MissionPlanner,代码行数:38,代码来源:FlightData.cs

示例9: BUT_firstperson_Click

        private void BUT_firstperson_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
            {
                openFileDialog1.Filter = "*.log|*.log";
                openFileDialog1.FilterIndex = 2;
                openFileDialog1.RestoreDirectory = true;
                openFileDialog1.Multiselect = true;
                try
                {
                    Directory.CreateDirectory(Settings.Instance.LogDir);
                    openFileDialog1.InitialDirectory = Settings.Instance.LogDir + Path.DirectorySeparatorChar;
                }
                catch
                {
                } // incase dir cannot be created

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    foreach (string logfile in openFileDialog1.FileNames)
                    {
                        AppendSerialLog(Environment.NewLine + Environment.NewLine +
                            string.Format(LogStrings.ProcessingLog, logfile));
                        this.Refresh();

                        LogOutput lo = new LogOutput();

                        try
                        {
                            TextReader tr = new StreamReader(logfile);

                            while (tr.Peek() != -1)
                            {
                                lo.processLine(tr.ReadLine());
                            }

                            tr.Close();
                        }
                        catch (Exception ex)
                        {
                            AppendSerialLog(LogStrings.ErrorProcessingLogfile + Environment.NewLine + ex.Message);
                            continue;
                        }

                        lo.writeKMLFirstPerson(logfile + "-fp.kml");

                        AppendSerialLog(LogStrings.Done);
                    }
                }
            }
        }
开发者ID:ChukRhodes,项目名称:MissionPlanner,代码行数:51,代码来源:LogDownloadMavLink.cs

示例10: CreateLog

        void CreateLog(string logfile)
        {
            TextReader tr = new StreamReader(logfile);
            //
            AppendSerialLog(string.Format(LogStrings.CreatingKmlPrompt, Path.GetFileName(logfile)));

            LogOutput lo = new LogOutput();

            while (tr.Peek() != -1)
            {
                lo.processLine(tr.ReadLine());
            }

            tr.Close();

            try
            {
                lo.writeKML(logfile + ".kml");
            }
            catch
            {
            } // usualy invalid lat long error
            status = SerialStatus.Done;
        }
开发者ID:ChukRhodes,项目名称:MissionPlanner,代码行数:24,代码来源:LogDownloadMavLink.cs

示例11: BUT_redokml_Click

        private void BUT_redokml_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
            {
                openFileDialog1.Filter = "*.log|*.log";
                openFileDialog1.FilterIndex = 2;
                openFileDialog1.RestoreDirectory = true;
                openFileDialog1.Multiselect = true;
                try
                {
                    openFileDialog1.InitialDirectory = Settings.Instance.LogDir + Path.DirectorySeparatorChar;
                }
                catch
                {
                } // incase dir doesnt exist

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    foreach (string logfile in openFileDialog1.FileNames)
                    {
                        TXT_seriallog.AppendText("\n\nProcessing " + logfile + "\n");
                        this.Refresh();
                        LogOutput lo = new LogOutput();
                        try
                        {
                            TextReader tr = new StreamReader(logfile);

                            while (tr.Peek() != -1)
                            {
                                lo.processLine(tr.ReadLine());
                            }

                            tr.Close();
                        }
                        catch (Exception ex)
                        {
                            CustomMessageBox.Show("Error processing file. Make sure the file is not in use.\n" +
                                                  ex.ToString());
                        }

                        lo.writeKML(logfile + ".kml");

                        TXT_seriallog.AppendText("Done\n");
                    }
                }
            }
        }
开发者ID:jmachuca77,项目名称:MissionPlanner,代码行数:47,代码来源:LogDownloadMavLink.cs


注:本文中的MissionPlanner.Log.LogOutput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。