Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions SCADA/Program/BatchCoreService/DAService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ClientDriver;
using ClientDriver;
using DatabaseLib;
using DataService;
using System;
Expand Down Expand Up @@ -399,7 +399,7 @@ void InitServerByDatabase()
dataReader.NextResult();
while (dataReader.Read())
{
AddDriver(dataReader.GetInt16(0), dataReader.GetNullableString(1), dataReader.GetNullableString(2), dataReader.GetNullableString(3));
AddDriver(dataReader.GetInt16(0), dataReader.GetNullableString(1), dataReader.GetNullableString(2), dataReader.GetNullableString(3));
}

dataReader.NextResult();
Expand Down Expand Up @@ -1205,7 +1205,7 @@ public void SaveCachedData(object stateInfo)
var tempData = (HistoryData[])stateInfo;
if (tempData.Length == 0) return;
DateTime startTime = tempData[0].TimeStamp;
DateTime endTime = tempData[tempData.Length - 1].TimeStamp;
DateTime endTime = tempData[^1].TimeStamp;
//Thread.Sleep(TimeSpan.FromMinutes(10));
int count = 0;
while (true)
Expand Down
4 changes: 2 additions & 2 deletions SCADA/Program/CoreApp/DataService/DataService/Eval.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -627,7 +627,7 @@ public int WriteTag(string tagName, object value)

private bool IsConstant(string str, out object value)
{
if (str.Length > 1 & str[0] == '\'' && str[str.Length - 1] == '\'')
if (str.Length > 1 & str[0] == '\'' && str[^1] == '\'')
{
value = str.Trim('\'');
return true;
Expand Down
10 changes: 5 additions & 5 deletions SCADA/Program/CoreApp/DataService/GateWay/DAService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ClientDriver;
using ClientDriver;
using DatabaseLib;
using DataService;
using Microsoft.Extensions.Logging;
Expand All @@ -20,7 +20,7 @@
namespace BatchCoreService
{

public class DAService : IDataServer, IAlarmServer
public class DAService : IDataServer, IAlarmServer
{
const int PORT = 6543;

Expand Down Expand Up @@ -180,10 +180,10 @@ public DAService()
{
var loggerFactory = new LoggerFactory();
Func<string, LogLevel, bool> filter = (category, level) => true;
loggerFactory.AddProvider( new ConsoleLoggerProvider(filter, false));
loggerFactory.AddProvider(new ConsoleLoggerProvider(filter, false));
loggerFactory.AddProvider(new DebugLoggerProvider(filter));
Log = loggerFactory.CreateLogger(SERVICELOGSOURCE);
InitServerByXml();
InitServerByXml();
_scales = new List<Scaling>();
_drivers = new SortedList<short, IDriver>();
_alarmList = new List<AlarmItem>(ALARMLIMIT + 10);
Expand Down Expand Up @@ -1184,7 +1184,7 @@ public void SaveCachedData(object stateInfo)
var tempData = (HistoryData[])stateInfo;
if (tempData.Length == 0) return;
DateTime startTime = tempData[0].TimeStamp;
DateTime endTime = tempData[tempData.Length - 1].TimeStamp;
DateTime endTime = tempData[^1].TimeStamp;
//Thread.Sleep(TimeSpan.FromMinutes(10));
int count = 0;
while (true)
Expand Down
4 changes: 2 additions & 2 deletions SCADA/Program/CoreTest/WindowHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
Expand Down Expand Up @@ -66,7 +66,7 @@ private static void BindingControl(ITagLink taglink, List<TagNodeHandle> valueCh
}
}
var r = tagConn as ITagReader;
var key = strs[strs.Length - 1];
var key = strs[^1];
try
{
var action = r.SetTagReader(key, eval.Eval(v.Value));
Expand Down
4 changes: 2 additions & 2 deletions SCADA/Program/DataService/Eval.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -631,7 +631,7 @@ public int WriteTag(string tagName, object value)

private bool IsConstant(string str, out object value)
{
if (str.Length > 1 & str[0] == '\'' && str[str.Length - 1] == '\'')
if (str.Length > 1 & str[0] == '\'' && str[^1] == '\'')
{
value = str.Trim('\'');
return true;
Expand Down
10 changes: 5 additions & 5 deletions SCADA/Program/LinkableControlDesignTime/TagComplexEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Windows.Forms;

namespace HMIControl.VisualStudio.Design
Expand Down Expand Up @@ -48,7 +48,7 @@ public TagComplexEditor(ITagReader tag)
{
InitializeComponent();
_tag = tag;

}

void dataGridView1_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
Expand Down Expand Up @@ -99,7 +99,7 @@ private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs
break;
case "+''":
string txt = coolTextBox1.Text;
if (!string.IsNullOrEmpty(txt) && txt[0] != '\'' && txt[txt.Length - 1] != '\'')
if (!string.IsNullOrEmpty(txt) && txt[0] != '\'' && txt[^1] != '\'')
coolTextBox1.Text = "'" + txt + "'";
else
coolTextBox1.Text = txt.Trim('\'');
Expand Down Expand Up @@ -311,7 +311,7 @@ private void toolStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs
case "''":
{
string txt = coolTextBox1.SelectedText;
if (!string.IsNullOrEmpty(txt) && txt[0] != '\'' && txt[txt.Length - 1] != '\'')
if (!string.IsNullOrEmpty(txt) && txt[0] != '\'' && txt[^1] != '\'')
coolTextBox1.SelectedText = "'" + txt + "'";
else
coolTextBox1.SelectedText = txt.Trim('\'');
Expand All @@ -320,7 +320,7 @@ private void toolStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs
case "( )":
{
string txt = coolTextBox1.SelectedText;
if (!string.IsNullOrEmpty(txt) && txt[0] != '(' && txt[txt.Length - 1] != ')')
if (!string.IsNullOrEmpty(txt) && txt[0] != '(' && txt[^1] != ')')
coolTextBox1.SelectedText = "(" + txt + ")";
}
break;
Expand Down
6 changes: 3 additions & 3 deletions SCADA/Program/LinkableControlDesignTime/TagWriteEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

Expand Down Expand Up @@ -117,13 +117,13 @@ private void toolStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs
switch (sign)
{
case "''":
if (!string.IsNullOrEmpty(txt) && txt[0] != '\'' && txt[txt.Length - 1] != '\'')
if (!string.IsNullOrEmpty(txt) && txt[0] != '\'' && txt[^1] != '\'')
coolTextBox1.Text = "'" + txt + "'";
else
coolTextBox1.Text = txt.Trim('\'');
break;
case "( )":
if (!string.IsNullOrEmpty(txt) && txt[0] != '(' && txt[txt.Length - 1] != ')')
if (!string.IsNullOrEmpty(txt) && txt[0] != '(' && txt[^1] != ')')
coolTextBox1.Text = "(" + txt + ")";
break;
case "+":
Expand Down