Skip to content

Commit 594bc69

Browse files
authored
Merge pull request #771 from ChristianRosewich/master
sync
2 parents a254606 + f1bc527 commit 594bc69

4 files changed

Lines changed: 29 additions & 13 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@
4949
/Avalonia_Apps/.packages/*.nupkg
5050
/.github/upgrades/scenarios/sdk-style-conversion/tasks/01-convert-csv-viewer
5151
/CSharpBible/Libraries/Libraries.Package/artifacts/nuget
52+
/JC-AMS/Core/Resource/Version.inc

JC-AMS/Core.Tests/Core.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.NET.Test.Sdk">
12-
<Version>18.3.0</Version>
12+
<Version>18.7.0</Version>
1313
</PackageReference>
1414
<PackageReference Include="MSTest">
15-
<Version>4.1.0</Version>
15+
<Version>4.3.0</Version>
1616
</PackageReference>
1717
<PackageReference Include="coverlet.collector">
1818
<PrivateAssets>all</PrivateAssets>
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20-
<Version>8.0.1</Version>
20+
<Version>10.0.1</Version>
2121
</PackageReference>
2222
</ItemGroup>
2323

JC-AMS/Core/Core.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
<Version>4.9.1</Version>
3232
</PackageReference>
3333
<PackageReference Include="System.IO.Ports">
34-
<Version>10.0.5</Version>
34+
<Version>10.0.9</Version>
3535
</PackageReference>
3636
<PackageReference Condition="'$(TargetFramework)'=='net60-windows'" Include="System.Data.Common" />
3737
<PackageReference Include="System.ServiceProcess.ServiceController">
38-
<Version>10.0.5</Version>
38+
<Version>10.0.9</Version>
3939
</PackageReference>
4040
<PackageReference Include="System.Management">
41-
<Version>10.0.5</Version>
41+
<Version>10.0.9</Version>
4242
</PackageReference>
4343
<PackageReference Include="System.Text.RegularExpressions">
4444
<Version>4.3.1</Version>

JC-AMS/Core/Core/System/CSubStation.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ public class CSubStation : CPropNotificationClass, IHasParent , IHasID , IXmlSer
8989
/// </summary>
9090
/// <autogeneratedoc />
9191
public static Dictionary<long, CSubStation> SubStations = new Dictionary<long, CSubStation>();
92+
93+
private static readonly object SubStationsSync = new object();
9294
#endregion
9395

9496
#region Interface properties
@@ -137,7 +139,11 @@ public CSubStation(CStation cStation, long idSubstation, string sDescription)
137139
Station = cStation;
138140
this.idSubStation = idSubstation;
139141
Description = sDescription;
140-
SubStations[idSubStation] = this;
142+
143+
lock (SubStationsSync)
144+
{
145+
SubStations[idSubStation] = this;
146+
}
141147
}
142148

143149
/// <summary>
@@ -149,10 +155,13 @@ public CSubStation(CStation cStation, long idSubstation, string sDescription)
149155
/// <autogeneratedoc />
150156
private void OnChangeIdSubStation(long oldId, long newId, string name)
151157
{
152-
if (oldId > 0)
153-
RemoveSubStation(oldId);
154-
if (newId > 0)
155-
SubStations[newId] = this;
158+
lock (SubStationsSync)
159+
{
160+
if (oldId > 0)
161+
SubStations.Remove(oldId);
162+
if (newId > 0)
163+
SubStations[newId] = this;
164+
}
156165
}
157166

158167
/// <summary>
@@ -163,7 +172,10 @@ private void OnChangeIdSubStation(long oldId, long newId, string name)
163172
/// <autogeneratedoc />
164173
private static void RemoveSubStation(long oldId)
165174
{
166-
SubStations.Remove(oldId);
175+
lock (SubStationsSync)
176+
{
177+
SubStations.Remove(oldId);
178+
}
167179
}
168180

169181
#region Interface methods
@@ -249,7 +261,10 @@ public void WriteXml(XmlWriter writer)
249261
/// <autogeneratedoc />
250262
public static CSubStation GetSubStationGetStation(long idSubStation)
251263
{
252-
return SubStations.ContainsKey(idSubStation) ? SubStations[idSubStation] : null;
264+
lock (SubStationsSync)
265+
{
266+
return SubStations.ContainsKey(idSubStation) ? SubStations[idSubStation] : null;
267+
}
253268
}
254269
#endregion
255270
#endregion

0 commit comments

Comments
 (0)