本文整理汇总了C#中MissionPlanner.Log.LogOutput.processLine方法的典型用法代码示例。如果您正苦于以下问题:C# LogOutput.processLine方法的具体用法?C# LogOutput.processLine怎么用?C# LogOutput.processLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MissionPlanner.Log.LogOutput
的用法示例。
在下文中一共展示了LogOutput.processLine方法的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");
}
}
}
}
示例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");
}
}
}
}
示例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");
}
}
}
}
示例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();
}
示例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;
//.........这里部分代码省略.........
示例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
}
示例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");
}
}
}
示例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");
}
}
}
示例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);
}
}
}
}
示例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;
}
示例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");
}
}
}
}