Guest User

Untitled

a guest
Jul 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10. using MySql.Data.MySqlClient;
  11. using System.Diagnostics;
  12. using System.Threading;
  13.  
  14.         private void browseFilesToolStripMenuItem_Click(object sender, EventArgs e)
  15.         {
  16.           groupBox2.Visible = false;
  17.           groupBox1.Visible = true;
  18.           browseFilesToolStripMenuItem.Enabled = false;
  19.           openFileDialog1.Filter = ".ssd Files Only|*.ssd;";
  20.           openFileDialog1.FilterIndex = 1;
  21.           openFileDialog1.Multiselect = true;
  22.           openFileDialog1.Title = "Open SSD Files";
  23.           if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  24.           {
  25.             timer2.Enabled = true;
  26.             if (openFileDialog1.FileNames.Length > 0 && openFileDialog1.FileNames.Length < 500)
  27.             {
  28.                 int filecounter = 0;
  29.                 label6.Text = openFileDialog1.FileNames.Length.ToString();
  30.                 label7.Text = openFileDialog1.FileNames.Length.ToString();
  31.                 int defsec = openFileDialog1.FileNames.Length * 5;
  32.                 TimeSpan t = TimeSpan.FromSeconds(defsec);
  33.                 string answer = string.Format("{0:D2}h:{1:D2}m:{2:D2}s",
  34.                                         t.Hours,
  35.                                         t.Minutes,
  36.                                         t.Seconds);
  37.                 label23.Text = answer;
  38.              foreach (String file in openFileDialog1.FileNames)
  39.               {
  40.                   Thread.Sleep(2000);
  41.                   label9.Text = file;
  42.               try
  43.                 {
  44.                     String user = textBox2.Text;
  45.                     String date = File.ReadAllLines(label9.Text)[1].Split(' ')[3].Replace(".", "-");
  46.                     String time = File.ReadAllLines(label9.Text)[1].Split(' ')[4].Remove(8);
  47.                     time = time.TrimEnd('.');
  48.                     String latt = File.ReadAllLines(label9.Text)[3].Split(' ')[1].Split(']')[1];
  49.                     latt = latt.Remove(latt.Length - 1);
  50.                     String longi = File.ReadAllLines(label9.Text)[5].Split(' ')[1].Split(']')[1];
  51.                     longi = longi.Remove(longi.Length - 1);
  52.                     String depth = File.ReadAllLines(label9.Text)[6].Split(']')[1];
  53.                     depth = depth.Trim();
  54.                     String xmagcheck = File.ReadAllLines(label9.Text)[11];
  55.                     String xmag;
  56.                     if (xmagcheck.Contains("#CHANNEL"))
  57.                     {
  58.                         xmag = File.ReadAllLines(label9.Text)[10].Split(' ')[1].Split('=')[1];
  59.  
  60.                     }
  61.                     else
  62.                     {
  63.                         xmag = File.ReadAllLines(label9.Text)[11].Split(' ')[1].Split('=')[1];
  64.                     }
  65.                     string connString ="***";
  66.                     MySqlCommand command = conn.CreateCommand();
  67.                     command.CommandText = ****;
  68.                     textBox6.Text += command.CommandText.ToString() + "\r\n";
  69.                     conn.Open();
  70.                     command.ExecuteNonQuery();
  71.                     filecounter++;
  72.                     conn.Close();
  73.                 }
  74.                  catch (Exception ex)
  75.                  {
  76.                      MessageBox.Show("Security error. Please contact your administrator for details.\n\n" +
  77.                          "Error message: " + ex.Message + "\n\n" +
  78.                          "Details (send to Support):\n\n" + ex.StackTrace);
  79.                  }
  80.                }
  81.  
  82.              }
  83.            }
  84.         }
Add Comment
Please, Sign In to add comment