Code formatting. Remove traces of static analysis in drone build
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
12
.drone.yml
12
.drone.yml
@ -4,14 +4,4 @@ steps:
|
||||
- name: build
|
||||
image: mono
|
||||
commands:
|
||||
- msbuild Tidstagning.sln
|
||||
- name: sca
|
||||
image: azimarev/mono-sonarqube-scanner
|
||||
failure: ignore
|
||||
commands:
|
||||
- mono /opt/sonar-scanner-msbuild/SonarScanner.MSBuild.exe begin /k:"tidstagning" /d:sonar.host.url="https://sonarqube.jcktrue.dk" /d:sonar.login="$TOKEN"
|
||||
- msbuild Tidstagning.sln
|
||||
- mono /opt/sonar-scanner-msbuild/SonarScanner.MSBuild.exe sonarscanner end /d:sonar.login="$TOKEN"
|
||||
environment:
|
||||
TOKEN:
|
||||
from_secret: SONARQUBE_TOKEN
|
||||
- msbuild Tidstagning.sln
|
@ -9,7 +9,7 @@ namespace Tidstagning
|
||||
public string SailNumber { get; set; }
|
||||
public DateTime Completed_Time { get; set; }
|
||||
|
||||
|
||||
|
||||
public Entry(string name, string number)
|
||||
{
|
||||
this.Name = name;
|
||||
|
@ -7,7 +7,8 @@ namespace Tidstagning
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
delegate void SetTextCallback(string text);
|
||||
BindingList<Entry> entries = new BindingList<Entry> {
|
||||
BindingList<Entry> entries = new BindingList<Entry>
|
||||
{
|
||||
|
||||
};
|
||||
ResultList liste;
|
||||
@ -22,13 +23,14 @@ namespace Tidstagning
|
||||
while ((deltager = deltager_handle.ReadLine()) != null)
|
||||
{
|
||||
string[] dele = deltager.Split(',');
|
||||
entries.Add(new Entry(dele[0],dele[1]));
|
||||
entries.Add(new Entry(dele[0], dele[1]));
|
||||
}
|
||||
deltager_handle.Dispose();
|
||||
|
||||
comboSoundTime.SelectedIndex = 0;
|
||||
|
||||
foreach (string port in Relay.GetPorts()) {
|
||||
foreach (string port in Relay.GetPorts())
|
||||
{
|
||||
comboComport.Items.Add(port);
|
||||
}
|
||||
|
||||
@ -57,7 +59,7 @@ namespace Tidstagning
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
grid.DataSource = entries;
|
||||
@ -72,7 +74,7 @@ namespace Tidstagning
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtDebug.AppendText( text );
|
||||
this.txtDebug.AppendText(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,15 +87,16 @@ namespace Tidstagning
|
||||
{
|
||||
entries[e.RowIndex].DNF();
|
||||
liste.WriteDNF(entries[e.RowIndex]);
|
||||
|
||||
|
||||
grid.ClearSelection();
|
||||
grid.CurrentCell = null;
|
||||
entries.RemoveAt(e.RowIndex);
|
||||
}
|
||||
if (e.RowIndex >= 0 && e.ColumnIndex == grid.Columns["Complete"].Index) {
|
||||
if (e.RowIndex >= 0 && e.ColumnIndex == grid.Columns["Complete"].Index)
|
||||
{
|
||||
entries[e.RowIndex].Complete();
|
||||
liste.WriteComplete(entries[e.RowIndex]);
|
||||
|
||||
|
||||
grid.ClearSelection();
|
||||
grid.CurrentCell = null;
|
||||
entries.RemoveAt(e.RowIndex);
|
||||
@ -187,7 +190,7 @@ namespace Tidstagning
|
||||
{
|
||||
startprocedure.ReadFile(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + "Startprocedure.txt");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Properties.Settings.Default.AutoStartProcedure = checkStartProcedure.Checked;
|
||||
Properties.Settings.Default.Save();
|
||||
@ -195,7 +198,7 @@ namespace Tidstagning
|
||||
|
||||
private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex > -1 )
|
||||
if (e.RowIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -213,13 +216,13 @@ namespace Tidstagning
|
||||
|
||||
private void grid_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex > -1 )
|
||||
if (e.RowIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
grid.Rows[e.RowIndex].Selected = false;
|
||||
grid.Rows[e.RowIndex].Height = 30;
|
||||
|
||||
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Tidstagning
|
||||
{
|
||||
@ -11,7 +11,7 @@ namespace Tidstagning
|
||||
ResultList log;
|
||||
List<DateTime> signaler;
|
||||
int signalLength = 500;
|
||||
|
||||
|
||||
Timer timer;
|
||||
Int16 idx = 0;
|
||||
|
||||
@ -31,7 +31,8 @@ namespace Tidstagning
|
||||
procedure_handle.Dispose();
|
||||
}
|
||||
|
||||
public void addEntry(string input) {
|
||||
public void addEntry(string input)
|
||||
{
|
||||
string input_filtered = input.Trim();
|
||||
if (input_filtered.Length > 0)
|
||||
{
|
||||
@ -41,7 +42,7 @@ namespace Tidstagning
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Failed to parse: "+ input);
|
||||
Debug.WriteLine("Failed to parse: " + input);
|
||||
}
|
||||
signaler.Sort();
|
||||
}
|
||||
@ -76,7 +77,7 @@ namespace Tidstagning
|
||||
{
|
||||
signaler = new List<DateTime>();
|
||||
idx = 0;
|
||||
if(timer != null)
|
||||
if (timer != null)
|
||||
timer.Dispose();
|
||||
}
|
||||
|
||||
@ -107,7 +108,7 @@ namespace Tidstagning
|
||||
|
||||
if (timeToGo < TimeSpan.Zero)
|
||||
{
|
||||
if(!next())
|
||||
if (!next())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -118,7 +119,7 @@ namespace Tidstagning
|
||||
timer = new System.Threading.Timer(x =>
|
||||
{
|
||||
this.Alarm();
|
||||
}, null, timeToGo, new System.TimeSpan (0));
|
||||
}, null, timeToGo, new System.TimeSpan(0));
|
||||
}
|
||||
|
||||
private void Alarm()
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System.IO.Ports;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
using System.IO.Ports;
|
||||
using System.Threading;
|
||||
namespace Tidstagning
|
||||
{
|
||||
class Relay
|
||||
@ -61,15 +61,17 @@ namespace Tidstagning
|
||||
}
|
||||
}
|
||||
|
||||
private void Set(int output, byte state) {
|
||||
byte[] command = {0xff, 0x01, state};
|
||||
private void Set(int output, byte state)
|
||||
{
|
||||
byte[] command = { 0xff, 0x01, state };
|
||||
if (com.IsOpen)
|
||||
{
|
||||
Debug.WriteLine("COM: " + com.PortName + " Write: 0x" + Convert.ToString(command[2], 16));
|
||||
com.Write(command, 0, 3);
|
||||
}
|
||||
}
|
||||
public void Close() {
|
||||
public void Close()
|
||||
{
|
||||
if (com.IsOpen)
|
||||
{
|
||||
Off(); //Make sure the horn is off before closing the com port...
|
||||
@ -79,15 +81,15 @@ namespace Tidstagning
|
||||
|
||||
public static string[] GetPorts()
|
||||
{
|
||||
string[] ports;
|
||||
|
||||
string[] ports;
|
||||
|
||||
if (SerialPort.GetPortNames().Length != 0)
|
||||
{
|
||||
ports = SerialPort.GetPortNames();
|
||||
}
|
||||
else
|
||||
{
|
||||
ports = new string[]{ "N/A" };
|
||||
ports = new string[] { "N/A" };
|
||||
}
|
||||
return ports;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace Tidstagning
|
||||
public ResultList(string filename, Tidstagning.Form1 log_object)
|
||||
{
|
||||
filename = MakeSafeFilename(filename, '_');
|
||||
filehandle = new System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + filename +"_" + DateTime.Now.ToString(" dd-MM-yyyy HH-mm-ss") + ".txt");
|
||||
filehandle = new System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + filename + "_" + DateTime.Now.ToString(" dd-MM-yyyy HH-mm-ss") + ".txt");
|
||||
filehandle2 = new System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + filename + "_" + DateTime.Now.ToString(" dd-MM-yyyy HH-mm-ss") + ".csv");
|
||||
parentForm = log_object;
|
||||
}
|
||||
@ -26,7 +26,8 @@ namespace Tidstagning
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void WriteHeader(string header) {
|
||||
public void WriteHeader(string header)
|
||||
{
|
||||
this.racenumber = header;
|
||||
Write("----------------------------");
|
||||
Write(header);
|
||||
@ -46,13 +47,13 @@ namespace Tidstagning
|
||||
public void WriteComplete(Entry Boat)
|
||||
{
|
||||
Write("Fuldført! - " + Boat.Name + " - " + Boat.Completed_Time.ToString());
|
||||
WriteCSV(this.racenumber + "," +Boat.SailNumber + "," + Boat.Completed_Time.ToString("HH:mm:ss") + ", ,");
|
||||
WriteCSV(this.racenumber + "," + Boat.SailNumber + "," + Boat.Completed_Time.ToString("HH:mm:ss") + ", ,");
|
||||
}
|
||||
|
||||
public void WriteDNF(Entry Boat)
|
||||
{
|
||||
Write("Udgået! - " + Boat.Name + " - " + Boat.Completed_Time.ToString());
|
||||
WriteCSV(this.racenumber + "," +Boat.SailNumber + "," + "00:00:00,DNC,");
|
||||
WriteCSV(this.racenumber + "," + Boat.SailNumber + "," + "00:00:00,DNC,");
|
||||
}
|
||||
|
||||
public void Write(string textstring)
|
||||
|
@ -1,14 +1,17 @@
|
||||
namespace Tidstagning.Properties {
|
||||
|
||||
|
||||
namespace Tidstagning.Properties
|
||||
{
|
||||
|
||||
|
||||
// This class allows you to handle specific events on the settings class:
|
||||
// The SettingChanging event is raised before a setting's value is changed.
|
||||
// The PropertyChanged event is raised after a setting's value is changed.
|
||||
// The SettingsLoaded event is raised after the setting values are loaded.
|
||||
// The SettingsSaving event is raised before the setting values are saved.
|
||||
internal sealed partial class Settings {
|
||||
|
||||
public Settings() {
|
||||
internal sealed partial class Settings
|
||||
{
|
||||
|
||||
public Settings()
|
||||
{
|
||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
||||
//
|
||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
||||
@ -16,12 +19,14 @@
|
||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
||||
//
|
||||
}
|
||||
|
||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
||||
|
||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e)
|
||||
{
|
||||
// Add code to handle the SettingChangingEvent event here.
|
||||
}
|
||||
|
||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
|
||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
// Add code to handle the SettingsSaving event here.
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user