Skip to content

Commit 80a56dd

Browse files
authored
Merge pull request #18 from jimm98y/bugs/fixed-clients-with-same-uri
B Fixed clients with same uri
2 parents fc322fc + 8b7d551 commit 80a56dd

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
55
<Nullable>disable</Nullable>
66
<Title>$(ProjectName)</Title>
7-
<Version>0.1.2</Version>
7+
<Version>0.1.3</Version>
88
<Authors>Lukas Volf</Authors>
99
<Copyright>MIT</Copyright>
1010
<PackageProjectUrl>https://github.com/jimm98y/SharpOnvif</PackageProjectUrl>

src/OnvifClient/OnvifClient.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<ProjectReference Include="..\SharpOnvifClient.DeviceMgmt\SharpOnvifClient.DeviceMgmt.csproj" />
12-
<ProjectReference Include="..\SharpOnvifClient\SharpOnvifClient.csproj" />
11+
<Compile Remove="Properties\**" />
12+
<EmbeddedResource Remove="Properties\**" />
13+
<None Remove="Properties\**" />
1314
</ItemGroup>
1415

1516
<ItemGroup>
16-
<Folder Include="Properties\" />
17+
<ProjectReference Include="..\SharpOnvifClient.DeviceMgmt\SharpOnvifClient.DeviceMgmt.csproj" />
18+
<ProjectReference Include="..\SharpOnvifClient\SharpOnvifClient.csproj" />
1719
</ItemGroup>
1820

1921
</Project>

src/SharpOnvifClient/SimpleOnvifClient.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,18 @@ public void SetCameraUtcNowOffset(TimeSpan utcNowOffset)
6868

6969
public TClient GetOrCreateClient<TClient, TChannel>(string uri, Func<string, TClient> creator) where TClient : ClientBase<TChannel> where TChannel : class
7070
{
71+
string key = $"{typeof(TClient)}|{uri}";
7172
lock (_syncRoot)
7273
{
73-
if (_clients.ContainsKey(uri))
74+
if (_clients.ContainsKey(key))
7475
{
75-
return (TClient)_clients[uri];
76+
return (TClient)_clients[key];
7677
}
7778
else
7879
{
7980
var client = creator(uri);
8081
client.SetOnvifAuthentication(_authentication, _credentials, _legacyAuth);
81-
_clients.Add(uri, client);
82+
_clients.Add(key, client);
8283
return client;
8384
}
8485
}

0 commit comments

Comments
 (0)