refactor: Tidying, resolving warnings

This commit is contained in:
Chris Cameron
2021-05-20 17:09:12 -04:00
parent f328598f63
commit 8b848e5127
5 changed files with 9 additions and 16 deletions

View File

@@ -43,7 +43,7 @@ namespace ICD.Common.Utils.Csv
#region Methods to read Csv data #region Methods to read Csv data
/// <summary> /// <summary>
/// Parse a Csv stream into IEnumerable<string[]>, while permitting embedded newlines /// Parse a Csv stream into IEnumerable&lt;string[]&gt;, while permitting embedded newlines
/// </summary> /// </summary>
/// <param name="inStream">The stream to read</param> /// <param name="inStream">The stream to read</param>
/// <param name="settings">The Csv settings to use for this parsing operation (Default: Csv)</param> /// <param name="settings">The Csv settings to use for this parsing operation (Default: Csv)</param>
@@ -127,7 +127,6 @@ namespace ICD.Common.Utils.Csv
work.Append(settings.TextQualifier); work.Append(settings.TextQualifier);
i++; i++;
p2 = -1; p2 = -1;
continue;
} }
} }
@@ -224,10 +223,9 @@ namespace ICD.Common.Utils.Csv
// If we are starting a new field, is this field text qualified? // If we are starting a new field, is this field text qualified?
if ((c == settings.TextQualifier) && (work.Length == 0)) if ((c == settings.TextQualifier) && (work.Length == 0))
{ {
int p2; while (true)
while (true)
{ {
p2 = line.IndexOf(settings.TextQualifier, i + 1); int p2 = line.IndexOf(settings.TextQualifier, i + 1);
// If no closing qualifier is found, this string is broken; return failure. // If no closing qualifier is found, this string is broken; return failure.
if (p2 < 0) if (p2 < 0)

View File

@@ -21,7 +21,7 @@ namespace ICD.Common.Utils.Csv
/// <summary> /// <summary>
/// If the first row in the file is a header row, this will be populated /// If the first row in the file is a header row, this will be populated
/// </summary> /// </summary>
public string[] Headers = null; public string[] Headers;
#endregion #endregion

View File

@@ -88,7 +88,7 @@ namespace ICD.Common.Utils.Csv
/// <summary> /// <summary>
/// Standard comma-separated value (Csv) file settings that permit rendering of NULL values /// Standard comma-separated value (Csv) file settings that permit rendering of NULL values
/// </summary> /// </summary>
public static readonly CsvReaderSettings CSV_PERMIT_NULL = new CsvReaderSettings() public static readonly CsvReaderSettings CSV_PERMIT_NULL = new CsvReaderSettings
{ {
AllowNull = true, AllowNull = true,
NullToken = "NULL" NullToken = "NULL"
@@ -97,7 +97,8 @@ namespace ICD.Common.Utils.Csv
/// <summary> /// <summary>
/// Standard tab-separated value (TSV) file settings /// Standard tab-separated value (TSV) file settings
/// </summary> /// </summary>
public static readonly CsvReaderSettings TSV = new CsvReaderSettings() { public static readonly CsvReaderSettings TSV = new CsvReaderSettings
{
FieldDelimiter = '\t' FieldDelimiter = '\t'
}; };
} }

View File

@@ -232,7 +232,6 @@ namespace ICD.Common.Utils
{ {
#if SIMPLSHARP #if SIMPLSHARP
// Can't do fancy tables so don't bother drawing the top row // Can't do fancy tables so don't bother drawing the top row
return;
#else #else
builder.Append(DOWN_RIGHT).Append(HORIZONTAL); builder.Append(DOWN_RIGHT).Append(HORIZONTAL);
@@ -259,7 +258,6 @@ namespace ICD.Common.Utils
{ {
#if SIMPLSHARP #if SIMPLSHARP
AppendSeparator(builder, columnWidths); AppendSeparator(builder, columnWidths);
return;
#else #else
builder.Append(UP_RIGHT).Append(HORIZONTAL); builder.Append(UP_RIGHT).Append(HORIZONTAL);

View File

@@ -12,16 +12,13 @@ namespace ICD.Common.Utils
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
public sealed class ThreadedWorkerQueue<T> public sealed class ThreadedWorkerQueue<T>
{ {
private readonly PriorityQueue<T> m_Queue; private readonly PriorityQueue<T> m_Queue;
private readonly SafeCriticalSection m_QueueSection; private readonly SafeCriticalSection m_QueueSection;
private readonly SafeCriticalSection m_ProcessSection; private readonly SafeCriticalSection m_ProcessSection;
private readonly Action<T> m_ProcessAction; private readonly Action<T> m_ProcessAction;
/// <summary> /// <summary>
/// /// Constructor.
/// </summary> /// </summary>
/// <param name="processItemAction">Action to process the dequeued items</param> /// <param name="processItemAction">Action to process the dequeued items</param>
public ThreadedWorkerQueue([NotNull] Action<T> processItemAction) public ThreadedWorkerQueue([NotNull] Action<T> processItemAction)
@@ -36,7 +33,6 @@ namespace ICD.Common.Utils
m_ProcessAction = processItemAction; m_ProcessAction = processItemAction;
} }
#region Queue Methods #region Queue Methods
/// <summary> /// <summary>
@@ -140,7 +136,7 @@ namespace ICD.Common.Utils
private void Enqueue(Action enqueueAction) private void Enqueue(Action enqueueAction)
{ {
m_QueueSection.Execute(() => enqueueAction()); m_QueueSection.Execute(enqueueAction);
ThreadingUtils.SafeInvoke(ProcessQueue); ThreadingUtils.SafeInvoke(ProcessQueue);
} }