Apply Rider recommendations

This commit is contained in:
2022-04-09 16:47:17 +02:00
parent f6d8b2c988
commit 807fa0ee54
19 changed files with 29 additions and 38 deletions

View File

@@ -1,8 +1,6 @@
using VAR.Toolbox.Code.Bots;
namespace VAR.Toolbox.Code
namespace VAR.Toolbox.Code.Bots
{
public class AutomationBotFactory: BaseFactory<IAutomationBot>
public abstract class AutomationBotFactory: BaseFactory<IAutomationBot>
{
}
}

View File

@@ -12,12 +12,12 @@ namespace VAR.Toolbox.Code.Bots
return null;
}
public void Init(VAR.Toolbox.Code.IOutputHandler output, IConfiguration config)
public void Init(IOutputHandler output, IConfiguration config)
{
output.Clean();
}
public Bitmap Process(Bitmap bmpInput, VAR.Toolbox.Code.IOutputHandler output)
public Bitmap Process(Bitmap bmpInput, IOutputHandler output)
{
return bmpInput;
}

View File

@@ -6,8 +6,8 @@ namespace VAR.Toolbox.Code.Bots
public interface IAutomationBot: INamed
{
IConfiguration GetDefaultConfiguration();
void Init(VAR.Toolbox.Code.IOutputHandler output, IConfiguration config);
Bitmap Process(Bitmap bmpInput, VAR.Toolbox.Code.IOutputHandler output);
void Init(IOutputHandler output, IConfiguration config);
Bitmap Process(Bitmap bmpInput, IOutputHandler output);
string ResponseKeys();
}
}

View File

@@ -38,7 +38,7 @@ namespace VAR.Toolbox.Code.Bots
return defaultConfiguration;
}
public void Init(VAR.Toolbox.Code.IOutputHandler output, IConfiguration config)
public void Init(IOutputHandler output, IConfiguration config)
{
int gridWidth = config.Get("GridWidth", DefaultGridWidth);
int gridHeight = config.Get("GridHeight", DefaultGridHeight);
@@ -59,7 +59,7 @@ namespace VAR.Toolbox.Code.Bots
output.AddLine($"TetrisBot: Starting {DateTime.UtcNow:s}");
}
public Bitmap Process(Bitmap bmpInput, VAR.Toolbox.Code.IOutputHandler output)
public Bitmap Process(Bitmap bmpInput, IOutputHandler output)
{
_grid.SampleFromBitmap(bmpInput);
SearchShape();
@@ -549,7 +549,7 @@ namespace VAR.Toolbox.Code.Bots
}
}
public void Print(VAR.Toolbox.Code.IOutputHandler output)
public void Print(IOutputHandler output)
{
for (int y = 0; y < ShapeSize; y++)
{

View File

@@ -3,7 +3,7 @@ using System.Text;
namespace VAR.Toolbox.Code
{
public class HexUtils
public static class HexUtils
{
public static byte[] HexStringToBytes(string input)
{

View File

@@ -3,7 +3,7 @@ using System.IO;
namespace VAR.Toolbox.Code
{
public class Logger
public static class Logger
{
/// <summary>
/// Obtiene el StreamWriter de salida

View File

@@ -4,7 +4,7 @@ using VAR.Toolbox.Code.Windows;
namespace VAR.Toolbox.Code
{
public class Mouse
public static class Mouse
{
public static void Move(int dx, int dy)
{

View File

@@ -1,4 +1,4 @@
namespace VAR.Toolbox.Code.ProxyCmdExecutors
{
public class ProxyCmdExecutorFactory : BaseFactory<IProxyCmdExecutor> { }
public abstract class ProxyCmdExecutorFactory : BaseFactory<IProxyCmdExecutor> { }
}

View File

@@ -15,8 +15,8 @@ namespace VAR.Toolbox.Code.ProxyCmdExecutors
public bool ExecuteCmd(string cmd, IOutputHandler outputHandler)
{
string parameters = string.Format(" /node:\"{0}\" process call create \"cmd.exe /c \\\"{1}\\\"\"",
_configWMIC.Replace("\"", "\\\""), cmd.Replace("\"", "\\\""));
string parameters =
$" /node:\"{_configWMIC.Replace("\"", "\\\"")}\" process call create \"cmd.exe /c \\\"{cmd.Replace("\"", "\\\"")}\\\"\"";
Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;

View File

@@ -1,4 +1,4 @@
namespace VAR.Toolbox.Code.TextCoders
{
public class TextCoderFactory : BaseFactory<ITextCoder> { }
public abstract class TextCoderFactory : BaseFactory<ITextCoder> { }
}

View File

@@ -1,4 +1,4 @@
namespace VAR.Toolbox.Code.WorkLog
{
public class WorkLogImporterFactory : BaseFactory<IWorkLogImporter> { }
public abstract class WorkLogImporterFactory : BaseFactory<IWorkLogImporter> { }
}

View File

@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VAR.Toolbox")]
[assembly: AssemblyCopyright("Copyright © VAR 2017-2018")]
[assembly: AssemblyCopyright("Copyright © VAR 2017-2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View File

@@ -92,8 +92,7 @@ namespace VAR.Toolbox.UI.Tools
private void SetCountdown(DateTime dateTime, DateTime now)
{
TimeSpan timeSpan = dateTime - now;
lblCountdown.Text = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", timeSpan.Days, timeSpan.Hours,
timeSpan.Minutes, timeSpan.Seconds);
lblCountdown.Text = $"{timeSpan.Days:00}:{timeSpan.Hours:00}:{timeSpan.Minutes:00}:{timeSpan.Seconds:00}";
}
private void CheckTime(CheckBox chk, DateTime dtSuspendAtCustom, DateTime now)

View File

@@ -1,4 +1,4 @@
namespace VAR.ScreenAutomation
namespace VAR.Toolbox.UI.Tools.ScreenAutomation
{
partial class FrmAutomationBotParams
{

View File

@@ -6,7 +6,7 @@ using System.Windows.Forms;
using VAR.Toolbox.Code.Configuration;
using VAR.Toolbox.Controls;
namespace VAR.ScreenAutomation
namespace VAR.Toolbox.UI.Tools.ScreenAutomation
{
public partial class FrmAutomationBotParams : Frame
{
@@ -69,7 +69,7 @@ namespace VAR.ScreenAutomation
get
{
if (columnName == "Key" && Parent != null && Parent.Any(
x => x.Key == this.Key && !ReferenceEquals(x, this)))
x => x.Key == Key && !ReferenceEquals(x, this)))
{
return "duplicate key";
}

View File

@@ -1,4 +1,4 @@
namespace VAR.ScreenAutomation
namespace VAR.Toolbox.UI.Tools.ScreenAutomation
{
partial class FrmScreenAutomation
{

View File

@@ -10,9 +10,9 @@ using VAR.Toolbox.Controls;
// ReSharper disable LocalizableElement
namespace VAR.ScreenAutomation
namespace VAR.Toolbox.UI.Tools.ScreenAutomation
{
public partial class FrmScreenAutomation : Frame, Toolbox.UI.IToolForm
public partial class FrmScreenAutomation : Frame, IToolForm
{
public string ToolName => "ScreenAutomation";

View File

@@ -104,16 +104,12 @@ namespace VAR.Toolbox.UI.Tools.WorkLog
currentCulture.DateTimeFormat.CalendarWeekRule, currentCulture.DateTimeFormat.FirstDayOfWeek);
if (week != null && week != weekCurrent)
{
strDays.Add(string.Format(" [{0:00}] -- {1} h",
week,
tsWeek.TotalHours));
strDays.Add($" [{week:00}] -- {tsWeek.TotalHours} h");
tsWeek = new TimeSpan(0);
}
TimeSpan tsDay = dictDaysHours[dateDayCurrent];
strDays.Add(string.Format("[{0:00}] {1:yyyy-MM-dd} -- {2} h",
weekCurrent, dateDayCurrent,
tsDay.TotalHours));
strDays.Add($"[{weekCurrent:00}] {dateDayCurrent:yyyy-MM-dd} -- {tsDay.TotalHours} h");
tsTotal += tsDay;
tsWeek += tsDay;
week = weekCurrent;
@@ -124,9 +120,7 @@ namespace VAR.Toolbox.UI.Tools.WorkLog
if (tsWeek.TotalHours > 0)
{
strDays.Add(string.Format(" [{0:00}] -- {1} h",
week,
tsWeek.TotalHours));
strDays.Add($" [{week:00}] -- {tsWeek.TotalHours} h");
}
lsbDays.Items.Clear();