Skip to content

Commit 6f77b5b

Browse files
committed
得啦, 不写网络扫描了, 准备发布
1 parent ee01cb5 commit 6f77b5b

7 files changed

Lines changed: 132 additions & 6 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFrameworks>net8.0-windows;net481</TargetFrameworks>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<UseWPF>true</UseWPF>
9+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
10+
<LangVersion>12</LangVersion>
11+
<ApplicationManifest>app.manifest</ApplicationManifest>
12+
13+
<Authors>SlimeNull</Authors>
14+
<Version>1.2.1</Version>
15+
<Copyright>(C) SlimeNull</Copyright>
16+
<ApplicationIcon>Assets/Icon.ico</ApplicationIcon>
17+
18+
</PropertyGroup>
19+
20+
<PropertyGroup>
21+
<DefineConstants>$(DefineConstants);FEATURE_SCAN</DefineConstants>
22+
</PropertyGroup>
23+
24+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows|AnyCPU'">
25+
<DefineConstants>$(DefineConstants);FEATURE_SCAN;QAQ</DefineConstants>
26+
</PropertyGroup>
27+
28+
<ItemGroup>
29+
<None Remove="Icon32.png" />
30+
<None Remove="Icon64.png" />
31+
<None Remove="NativeMethods.txt" />
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<AdditionalFiles Include="NativeMethods.txt" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<Content Include="Assets\Icon.ico" />
40+
</ItemGroup>
41+
42+
<ItemGroup>
43+
<Win64AvCodecDllFile Include="Assets\FFmpeg\win-x64\avcodec.dll" />
44+
<Win64SwResampleDllFile Include="Assets\FFmpeg\win-x64\swresample.dll" />
45+
<Win64SwScaleDllFile Include="Assets\FFmpeg\win-x64\swscale.dll" />
46+
<Win64AvUtilDllFile Include="Assets\FFmpeg\win-x64\avutil.dll" />
47+
48+
<Win32AvCodecDllFile Include="Assets\FFmpeg\win-x86\avcodec.dll" />
49+
<Win32SwResampleDllFile Include="Assets\FFmpeg\win-x86\swresample.dll" />
50+
<Win32SwScaleDllFile Include="Assets\FFmpeg\win-x86\swscale.dll" />
51+
<Win32AvUtilDllFile Include="Assets\FFmpeg\win-x86\avutil.dll" />
52+
</ItemGroup>
53+
54+
<Target Name="NET8_CopyFFmpegDLLs" AfterTargets="AfterBuild" Condition="'$(TargetFramework)'=='net8.0-windows'">
55+
<Copy SourceFiles="@(Win64AvCodecDllFile)" DestinationFolder="$(OutDir)runtimes\win-x64\native\" />
56+
<Copy SourceFiles="@(Win64SwResampleDllFile)" DestinationFolder="$(OutDir)runtimes\win-x64\native\" />
57+
<Copy SourceFiles="@(Win64SwScaleDllFile)" DestinationFolder="$(OutDir)runtimes\win-x64\native\" />
58+
<Copy SourceFiles="@(Win64AvUtilDllFile)" DestinationFolder="$(OutDir)runtimes\win-x64\native\" />
59+
<Copy SourceFiles="@(Win32AvCodecDllFile)" DestinationFolder="$(OutDir)runtimes\win-x86\native\" />
60+
<Copy SourceFiles="@(Win32SwResampleDllFile)" DestinationFolder="$(OutDir)runtimes\win-x86\native\" />
61+
<Copy SourceFiles="@(Win32SwScaleDllFile)" DestinationFolder="$(OutDir)runtimes\win-x86\native\" />
62+
<Copy SourceFiles="@(Win32AvUtilDllFile)" DestinationFolder="$(OutDir)runtimes\win-x86\native\" />
63+
</Target>
64+
65+
<Target Name="NETFW_CopyFFmpegDLLs" AfterTargets="AfterBuild" Condition="'$(TargetFramework)'=='net481'">
66+
<Copy SourceFiles="@(Win64AvCodecDllFile)" DestinationFolder="$(OutDir)dll\x64" />
67+
<Copy SourceFiles="@(Win64SwResampleDllFile)" DestinationFolder="$(OutDir)dll\x64" />
68+
<Copy SourceFiles="@(Win64SwScaleDllFile)" DestinationFolder="$(OutDir)dll\x64" />
69+
<Copy SourceFiles="@(Win64AvUtilDllFile)" DestinationFolder="$(OutDir)dll\x64" />
70+
<Copy SourceFiles="@(Win32AvCodecDllFile)" DestinationFolder="$(OutDir)dll\x86" />
71+
<Copy SourceFiles="@(Win32SwResampleDllFile)" DestinationFolder="$(OutDir)dll\x86" />
72+
<Copy SourceFiles="@(Win32SwScaleDllFile)" DestinationFolder="$(OutDir)dll\x86" />
73+
<Copy SourceFiles="@(Win32AvUtilDllFile)" DestinationFolder="$(OutDir)dll\x86" />
74+
</Target>
75+
76+
<ItemGroup>
77+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
78+
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
79+
<PrivateAssets>all</PrivateAssets>
80+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
81+
</PackageReference>
82+
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
83+
<PackageReference Include="EleCho.WpfSuite" Version="0.4.1" />
84+
<PackageReference Include="SkiaSharp" Version="2.88.8" />
85+
<PackageReference Include="SharpDX.Direct3D11" Version="4.2.0" />
86+
<PackageReference Include="SharpDX.DXGI" Version="4.2.0" />
87+
</ItemGroup>
88+
89+
<ItemGroup Condition="'$(TargetFramework)'=='net481'">
90+
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
91+
</ItemGroup>
92+
93+
<ItemGroup>
94+
<ProjectReference Include="..\LibScreenCapture\LibScreenCapture.csproj" />
95+
<ProjectReference Include="..\Sdcb.FFmpeg\Sdcb.FFmpeg.csproj" />
96+
</ItemGroup>
97+
98+
<ItemGroup>
99+
<Resource Include="Assets\Icon32.png" />
100+
<Resource Include="Assets\Icon64.png" />
101+
</ItemGroup>
102+
103+
</Project>

Sn.ScreenBroadcaster/Sn.ScreenBroadcaster.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
</PropertyGroup>
1919

20+
<PropertyGroup>
21+
<!--<DefineConstants>$(DefineConstants);FEATURE_SCAN</DefineConstants>-->
22+
</PropertyGroup>
23+
2024
<ItemGroup>
2125
<None Remove="Icon32.png" />
2226
<None Remove="Icon64.png" />

Sn.ScreenBroadcaster/Translations/EN_US.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<s:String x:Key="String.General">General</s:String>
1313
<s:String x:Key="String.Address">Address</s:String>
1414
<s:String x:Key="String.Port">Port</s:String>
15+
<s:String x:Key="String.ServersNearby">Servers Nearby</s:String>
1516
<s:String x:Key="String.Capturing">Capturing</s:String>
1617
<s:String x:Key="String.CaptureMethod">Capture Method</s:String>
1718
<s:String x:Key="String.Screen">Screen</s:String>
@@ -40,6 +41,11 @@
4041
<s:String x:Key="String.Option">Option</s:String>
4142
<s:String x:Key="String.Exit">Exit</s:String>
4243
<s:String x:Key="String.Help">Help</s:String>
44+
45+
<s:String x:Key="String.RequestControl">Request Control</s:String>
46+
<s:String x:Key="String.RelinquishControl">Relinquish Control</s:String>
47+
<s:String x:Key="String.ControlMode">Control Mode</s:String>
48+
<s:String x:Key="String.ViewMode">View Mode</s:String>
4349

4450
<s:String x:Key="String.GrantControlPermission">Grant control permission</s:String>
4551
<s:String x:Key="String.Tip">Tip</s:String>

Sn.ScreenBroadcaster/Translations/ZH_HANS.xaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<s:String x:Key="String.General">常规</s:String>
1313
<s:String x:Key="String.Address">地址</s:String>
1414
<s:String x:Key="String.Port">端口</s:String>
15+
<s:String x:Key="String.ServersNearby">附近的服务端</s:String>
1516
<s:String x:Key="String.Capturing">捕捉</s:String>
1617
<s:String x:Key="String.CaptureMethod">捕捉方式</s:String>
1718
<s:String x:Key="String.Screen">屏幕</s:String>
@@ -40,7 +41,12 @@
4041
<s:String x:Key="String.Option">选项</s:String>
4142
<s:String x:Key="String.Exit">退出</s:String>
4243
<s:String x:Key="String.Help">帮助</s:String>
43-
44+
45+
<s:String x:Key="String.RequestControl">请求控制</s:String>
46+
<s:String x:Key="String.RelinquishControl">放弃控制</s:String>
47+
<s:String x:Key="String.ControlMode">控制模式</s:String>
48+
<s:String x:Key="String.ViewMode">查看模式</s:String>
49+
4450
<s:String x:Key="String.GrantControlPermission">授权控制</s:String>
4551
<s:String x:Key="String.Tip">提示</s:String>
4652
<s:String x:Key="String.NowYouCanControl">现在你可以控制远程计算机了.</s:String>

Sn.ScreenBroadcaster/Views/ClientWindow.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
BorderThickness="0 0 0 1"
2727
BorderBrush="{StaticResource {x:Static SystemColors.ActiveBorderBrushKey}}">
2828
<MenuItem Header="{StaticResource String.Action}">
29-
<MenuItem Header="Request Control"
29+
<MenuItem Header="{StaticResource String.RequestControl}"
3030
Command="{Binding RequestControlCommand}"
3131
Visibility="{Binding CanControl,Converter={StaticResource InvertBooleanToVisibilityConverter}}" />
32-
<MenuItem Header="Relinquish Control"
32+
<MenuItem Header="{StaticResource String.RelinquishControl}"
3333
Command="{Binding RelinquishControlCommand}"
3434
Visibility="{Binding CanControl,Converter={StaticResource BooleanToVisibilityConverter}}"/>
3535
</MenuItem>
@@ -39,10 +39,10 @@
3939
BorderBrush="{StaticResource {x:Static SystemColors.ActiveBorderBrushKey}}">
4040
<ws:ConditionalControl Condition="{Binding CanControl}">
4141
<ws:ConditionalControl.ContentWhenTrue>
42-
<TextBlock Text="Control Mode"/>
42+
<TextBlock Text="{StaticResource String.ControlMode}"/>
4343
</ws:ConditionalControl.ContentWhenTrue>
4444
<ws:ConditionalControl.ContentWhenFalse>
45-
<TextBlock Text="View Mode"/>
45+
<TextBlock Text="{StaticResource String.ViewMode}"/>
4646
</ws:ConditionalControl.ContentWhenFalse>
4747
</ws:ConditionalControl>
4848
<Separator Background="{StaticResource {x:Static SystemColors.ActiveBorderBrushKey}}"/>

Sn.ScreenBroadcaster/Views/MainWindow.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@
143143
<TextBlock Text="{StaticResource String.Port}" />
144144
<TextBox Text="{Binding Port,UpdateSourceTrigger=PropertyChanged}"
145145
InputMethod.IsInputMethodEnabled="False"/>
146+
</StackPanel>
147+
<StackPanel Visibility="{Binding AvailableServers.Count,Converter={StaticResource NumberIsNotZeroToVisibilityConverter}}">
148+
<TextBlock Text="{StaticResource String.ServersNearby}" />
146149
<ComboBox IsEditable="True"
147150
ItemsSource="{Binding AvailableServers}"/>
148151
</StackPanel>

Sn.ScreenBroadcaster/Views/MainWindow.xaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,9 @@ private void Start()
403403

404404
ClientCanControl = null;
405405
BroadcastTask = Task.WhenAll(
406+
#if FEATURE_SCAN
406407
BroadcastLoop(),
408+
#endif
407409
NetworkLoop(),
408410
CaptureLoop(),
409411
StatusLoop()
@@ -509,8 +511,8 @@ private Task BroadcastLoop()
509511
{
510512
while (!cancellationToken.IsCancellationRequested)
511513
{
512-
await Task.Delay(3000, cancellationToken);
513514
await udpClient.SendAsync(broadcastMessage, broadcastMessage.Length, remoteEndPoint);
515+
await Task.Delay(3000, cancellationToken);
514516
}
515517
}
516518
catch (OperationCanceledException)
@@ -1134,7 +1136,9 @@ private async Task StatusLoop()
11341136

11351137
private void Window_Loaded(object sender, RoutedEventArgs e)
11361138
{
1139+
#if FEATURE_SCAN
11371140
_ = QueryServersLoop();
1141+
#endif
11381142
}
11391143

11401144
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)

0 commit comments

Comments
 (0)