Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused code, fix case #104

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion firewall-utility/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
8 changes: 3 additions & 5 deletions firewall-utility/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/// <summary>
/// Firewall Utility
/// </summary>
internal class Program
internal static class Program
{

/// <summary>
Expand Down Expand Up @@ -95,12 +95,10 @@ private static void Main(string[] args)
if (args.Length == 2)
{
var key = args[0];
int val;
int.TryParse(args[0 + 1], out val);
int.TryParse(args[0 + 1], out var val);
dictionary.Add(key, val);

int socketPort;
if (dictionary.TryGetValue(Socket, out socketPort))
if (dictionary.TryGetValue(Socket, out var socketPort))
{
CreateFirewallRuleForPort(socketPort, SocketRule);
return;
Expand Down
160 changes: 80 additions & 80 deletions firewall-utility/firewall-utility.csproj
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{48E9B838-6430-459B-9B44-D1E3548DF393}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>firewall_utility</RootNamespace>
<AssemblyName>firewall-utility</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AssemblyInfoFilePath>Properties\AssemblyInfo.cs</AssemblyInfoFilePath>
<UpdateAssemblyVersion>True</UpdateAssemblyVersion>
<UpdateAssemblyFileVersion>False</UpdateAssemblyFileVersion>
<UpdateAssemblyInfoVersion>False</UpdateAssemblyInfoVersion>
<AssemblyVersionSettings>None.None.None.Increment</AssemblyVersionSettings>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\build\bin\firewall-utility\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<BaseIntermediateOutputPath>..\build\obj\firewall-utility\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\build\bin\firewall-utility\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<BaseIntermediateOutputPath>..\build\obj\firewall-utility\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<COMReference Include="NetFwTypeLib">
<Guid>{58FBCF7C-E7A9-467C-80B3-FC65E8FCCA08}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.None.Increment" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{48E9B838-6430-459B-9B44-D1E3548DF393}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>firewall_utility</RootNamespace>
<AssemblyName>firewall-utility</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AssemblyInfoFilePath>Properties\AssemblyInfo.cs</AssemblyInfoFilePath>
<UpdateAssemblyVersion>True</UpdateAssemblyVersion>
<UpdateAssemblyFileVersion>False</UpdateAssemblyFileVersion>
<UpdateAssemblyInfoVersion>False</UpdateAssemblyInfoVersion>
<AssemblyVersionSettings>None.None.None.Increment</AssemblyVersionSettings>
<TargetFrameworkProfile/>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\build\bin\firewall-utility\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<BaseIntermediateOutputPath>..\build\obj\firewall-utility\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\build\bin\firewall-utility\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<BaseIntermediateOutputPath>..\build\obj\firewall-utility\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup/>
<ItemGroup>
<Reference Include="System"/>
<Reference Include="System.Core"/>
<Reference Include="System.Xml.Linq"/>
<Reference Include="System.Data.DataSetExtensions"/>
<Reference Include="Microsoft.CSharp"/>
<Reference Include="System.Data"/>
<Reference Include="System.Xml"/>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs"/>
<Compile Include="Properties\AssemblyInfo.cs"/>
</ItemGroup>
<ItemGroup>
<None Include="App.config"/>
</ItemGroup>
<ItemGroup>
<COMReference Include="NetFwTypeLib">
<Guid>{58FBCF7C-E7A9-467C-80B3-FC65E8FCCA08}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.None.Increment"/>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
15 changes: 6 additions & 9 deletions plugin/AndroidRemote/Commands/CoverPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ namespace MusicBeePlugin.AndroidRemote.Commands
[DataContract]
public class CoverPayload
{
private const int CoverReady = 1;
private const int NotFound = 404;
private const int CoverAvailable = 200;

public CoverPayload(string cover, bool include)
{
if (string.IsNullOrEmpty(cover))
Expand All @@ -25,16 +29,9 @@ public CoverPayload(string cover, bool include)
}
}

[DataMember(Name = "status")] public int Status { get; set; }

public const int CoverReady = 1;
public const int NotFound = 404;
public const int CoverAvailable = 200;

[DataMember(Name = "status")]
public int Status { get; set; }

[DataMember(Name = "cover")]
public string Cover { get; set; }
[DataMember(Name = "cover")] public string Cover { get; set; }

public override string ToString()
{
Expand Down
1 change: 0 additions & 1 deletion plugin/AndroidRemote/Commands/InstaReplies/HandlePong.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using MusicBeePlugin.AndroidRemote.Interfaces;
using NLog;

Expand Down
5 changes: 2 additions & 3 deletions plugin/AndroidRemote/Commands/InstaReplies/PingReply.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using MusicBeePlugin.AndroidRemote.Entities;
using MusicBeePlugin.AndroidRemote.Interfaces;
using MusicBeePlugin.AndroidRemote.Interfaces;
using MusicBeePlugin.AndroidRemote.Model.Entities;
using MusicBeePlugin.AndroidRemote.Networking;

namespace MusicBeePlugin.AndroidRemote.Commands.InstaReplies
Expand Down
16 changes: 6 additions & 10 deletions plugin/AndroidRemote/Commands/InstaReplies/RequestCover.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
using MusicBeePlugin.AndroidRemote.Utilities;
using MusicBeePlugin.AndroidRemote.Interfaces;
using MusicBeePlugin.AndroidRemote.Model;
using MusicBeePlugin.AndroidRemote.Model.Entities;
using MusicBeePlugin.AndroidRemote.Networking;
using MusicBeePlugin.AndroidRemote.Utilities;
using static MusicBeePlugin.AndroidRemote.Networking.Constants;

namespace MusicBeePlugin.AndroidRemote.Commands.InstaReplies
{
using Entities;
using Interfaces;
using Model;
using Networking;

internal class RequestCover : ICommand
{
public void Dispose()
{
}

public void Execute(IEvent eEvent)
{
SocketMessage message;
Expand All @@ -27,6 +22,7 @@ public void Execute(IEvent eEvent)
{
message = new SocketMessage(NowPlayingCover, LyricCoverModel.Instance.Cover);
}

SocketServer.Instance.Send(message.ToJsonString(), eEvent.ClientId);
}
}
Expand Down
12 changes: 1 addition & 11 deletions plugin/AndroidRemote/Commands/InstaReplies/RequestLyrics.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
using MusicBeePlugin.AndroidRemote.Utilities;
using MusicBeePlugin.AndroidRemote.Interfaces;

namespace MusicBeePlugin.AndroidRemote.Commands.InstaReplies
{
using Entities;
using Model;
using Interfaces;
using Networking;

internal class RequestLyrics : ICommand
{
public void Dispose()
{

}

public void Execute(IEvent eEvent)
{
Plugin.Instance.RequestNowPlayingTrackLyrics();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using MusicBeePlugin.AndroidRemote.Interfaces;
using MusicBeePlugin.AndroidRemote.Events;
using MusicBeePlugin.AndroidRemote.Interfaces;
using MusicBeePlugin.AndroidRemote.Networking;

namespace MusicBeePlugin.AndroidRemote
namespace MusicBeePlugin.AndroidRemote.Commands.Internal
{
internal class BroadcastEventAvailable : ICommand
{
public void Execute(IEvent eEvent)
{
var broadcastEvent = eEvent.Data as BroadcastEvent;
if (broadcastEvent != null)
{
SocketServer.Instance.Broadcast(broadcastEvent);
}
if (eEvent.Data is BroadcastEvent broadcastEvent) SocketServer.Instance.Broadcast(broadcastEvent);
}
}
}
9 changes: 2 additions & 7 deletions plugin/AndroidRemote/Commands/Internal/ClientConnected.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@

namespace MusicBeePlugin.AndroidRemote.Commands.Internal
{
class ClientConnected:ICommand
internal class ClientConnected : ICommand
{
public void Dispose()
{

}

public void Execute(IEvent eEvent)
{
Authenticator.AddClientOnConnect(eEvent.ClientId);
}
}
}
}
9 changes: 2 additions & 7 deletions plugin/AndroidRemote/Commands/Internal/ClientDisconnected.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@

namespace MusicBeePlugin.AndroidRemote.Commands.Internal
{
class ClientDisconnected:ICommand
internal class ClientDisconnected : ICommand
{
public void Dispose()
{

}

public void Execute(IEvent eEvent)
{
Authenticator.RemoveClientOnDisconnect(eEvent.ClientId);
}
}
}
}
17 changes: 6 additions & 11 deletions plugin/AndroidRemote/Commands/Internal/ForceClientDisconnect.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
namespace MusicBeePlugin.AndroidRemote.Commands.Internal
{
using Interfaces;
using Networking;
using MusicBeePlugin.AndroidRemote.Interfaces;
using MusicBeePlugin.AndroidRemote.Networking;

class ForceClientDisconnect:ICommand
namespace MusicBeePlugin.AndroidRemote.Commands.Internal
{
internal class ForceClientDisconnect : ICommand
{
public void Dispose()
{

}

public void Execute(IEvent eEvent)
{
SocketServer.Instance.KickClient(eEvent.ClientId);
}
}
}
}
Loading