From 7829989b49332e513fa2a0d0e77757d575051590 Mon Sep 17 00:00:00 2001 From: Eli Date: Sun, 31 Jul 2022 22:57:37 -0400 Subject: [PATCH] Cleanup --- Bass.vb | 11 ++--------- ConnectionManagerService.vb | 3 +-- ControlPointManager.vb | 9 ++++----- Encoder.vb | 10 ++-------- HttpRequest.vb | 6 ++---- HttpResponse.vb | 4 ++-- HttpServer.vb | 7 ++----- ItemManager.vb | 6 ++---- MediaReceiverRegistrarService.vb | 4 +--- MediaServerDevice.vb | 7 ++----- MusicBeeInterface.vb | 14 +++++++------- MusicBeeUpnp.vb | 15 +++++++-------- My Project/AssemblyInfo.vb | 21 ++++++++++----------- SplitButtonControl.vb | 6 +++--- SsdpServer.vb | 7 +++---- UpnpControlPoint.vb | 7 ++----- UpnpDevice.vb | 4 ---- UpnpServer.vb | 4 ---- UpnpService.vb | 8 ++++---- UpnpServiceAttributes.vb | 18 ++++++++---------- 20 files changed, 64 insertions(+), 107 deletions(-) diff --git a/Bass.vb b/Bass.vb index d63d1bb..759f5c5 100644 --- a/Bass.vb +++ b/Bass.vb @@ -1,12 +1,5 @@ -Imports System.Text -Imports System.IO -Imports System.Drawing -Imports System.Drawing.Drawing2D -Imports System.Drawing.Imaging +Imports System.Runtime.InteropServices Imports System.Security -Imports System.Runtime.InteropServices -Imports System.Net -Imports System.Net.Sockets Partial Public Class Plugin _ @@ -111,7 +104,7 @@ Partial Public Class Plugin Public origres As Integer Public plugin As Integer Public sample As Integer - Private filenamePtr As IntPtr + Private ReadOnly filenamePtr As IntPtr End Class ' BASS_CHANNELINFO _ diff --git a/ConnectionManagerService.vb b/ConnectionManagerService.vb index 0f7f666..2921eaf 100644 --- a/ConnectionManagerService.vb +++ b/ConnectionManagerService.vb @@ -1,5 +1,4 @@ -Imports System.Text -Imports System.Xml +Imports System.Xml Partial Public Class Plugin _ diff --git a/ControlPointManager.vb b/ControlPointManager.vb index 94c5b1c..dcf67de 100644 --- a/ControlPointManager.vb +++ b/ControlPointManager.vb @@ -1,10 +1,9 @@ -Imports System.Text -Imports System.IO +Imports System.Net +Imports System.Net.Sockets +Imports System.Runtime.InteropServices +Imports System.Text Imports System.Threading Imports System.Xml -Imports System.Runtime.InteropServices -Imports System.Net -Imports System.Net.Sockets Partial Public Class Plugin Private Shared ReadOnly renderingDevices As New List(Of MediaRendererDevice) diff --git a/Encoder.vb b/Encoder.vb index 07bb6fa..4f610bf 100644 --- a/Encoder.vb +++ b/Encoder.vb @@ -1,13 +1,7 @@ -Imports System.Text -Imports System.IO -Imports System.Drawing +Imports System.Drawing Imports System.Drawing.Drawing2D -Imports System.Drawing.Imaging -Imports System.Security Imports System.Runtime.InteropServices -Imports System.Net -Imports System.Net.Sockets -Imports System.Threading +Imports System.Security Partial Public Class Plugin Private MustInherit Class Encoder diff --git a/HttpRequest.vb b/HttpRequest.vb index 8c21083..6e0b8d0 100644 --- a/HttpRequest.vb +++ b/HttpRequest.vb @@ -1,8 +1,6 @@ -Imports System.Text +Imports System.IO Imports System.Net.Sockets -Imports System.Threading -Imports System.Web -Imports System.IO +Imports System.Text Partial Public Class Plugin Private Class HttpRequest diff --git a/HttpResponse.vb b/HttpResponse.vb index 4be506f..c45d5da 100644 --- a/HttpResponse.vb +++ b/HttpResponse.vb @@ -1,6 +1,6 @@ -Imports System.Text -Imports System.IO +Imports System.IO Imports System.Net.Sockets +Imports System.Text Imports System.Xml Partial Public Class Plugin diff --git a/HttpServer.vb b/HttpServer.vb index 77b81af..2ee29e8 100644 --- a/HttpServer.vb +++ b/HttpServer.vb @@ -1,10 +1,7 @@ -Imports System.Text -Imports System.Net +Imports System.Net Imports System.Net.Sockets -Imports System.Threading -Imports System.Xml -Imports System.Threading.Tasks Imports System.Runtime.InteropServices +Imports System.Threading Partial Public Class Plugin Private Delegate Sub HttpRouteDelegate(request As HttpRequest) diff --git a/ItemManager.vb b/ItemManager.vb index 18c21a3..184e267 100644 --- a/ItemManager.vb +++ b/ItemManager.vb @@ -1,8 +1,6 @@ -Imports System.Text -Imports System.IO -Imports System.Threading +Imports System.Collections.ObjectModel +Imports System.Text Imports System.Xml -Imports System.Collections.ObjectModel Partial Public Class Plugin Private Class ItemManager diff --git a/MediaReceiverRegistrarService.vb b/MediaReceiverRegistrarService.vb index f67ee61..0b3ebab 100644 --- a/MediaReceiverRegistrarService.vb +++ b/MediaReceiverRegistrarService.vb @@ -1,6 +1,4 @@ -Imports System.Text - -Partial Public Class Plugin +Partial Public Class Plugin _ _ _ diff --git a/MediaServerDevice.vb b/MediaServerDevice.vb index 9fc7d44..772008b 100644 --- a/MediaServerDevice.vb +++ b/MediaServerDevice.vb @@ -1,10 +1,7 @@ -Imports System.Text -Imports System.Xml +Imports System.Net Imports System.Runtime.InteropServices -Imports System.Reflection Imports System.Threading -Imports System.Net -Imports System.Net.Sockets +Imports System.Xml Partial Public Class Plugin Private NotInheritable Class MediaServerDevice diff --git a/MusicBeeInterface.vb b/MusicBeeInterface.vb index 16e9cd5..577c4d1 100644 --- a/MusicBeeInterface.vb +++ b/MusicBeeInterface.vb @@ -348,9 +348,9 @@ Partial Public Class Plugin MusicBeeStarted = 34 PlayingTracksChanged = 35 PlayingTracksQueueChanged = 36 - PlaylistCreated = 37 - PlaylistUpdated = 38 - PlaylistDeleted = 39 + PlaylistCreated = 37 + PlaylistUpdated = 38 + PlaylistDeleted = 39 End Enum Public Enum CallbackType @@ -524,7 +524,7 @@ Partial Public Class Plugin Archiving = 4 End Enum - _ + Public Enum LibraryCategory Music = 0 Audiobook = 1 @@ -538,9 +538,9 @@ Partial Public Class Plugin AppleDevice = 2 GooglePlay2 = 3 AppleDevice2 = 4 - WebDrivePluginOneDrive = 5 - WebDrivePluginGoogleDrive = 6 - WebDrivePluginDropBox = 7 + WebDrivePluginOneDrive = 5 + WebDrivePluginGoogleDrive = 6 + WebDrivePluginDropBox = 7 End Enum Public Enum DataType diff --git a/MusicBeeUpnp.vb b/MusicBeeUpnp.vb index e3f1349..a7d7466 100644 --- a/MusicBeeUpnp.vb +++ b/MusicBeeUpnp.vb @@ -1,7 +1,7 @@ -Imports System.Runtime.InteropServices -Imports System.Net +Imports System.Net Imports System.Net.NetworkInformation Imports System.Net.Sockets +Imports System.Runtime.InteropServices Imports System.Threading Public Class Plugin @@ -15,12 +15,11 @@ Public Class Plugin Private Shared ReadOnly logLock As New Object Private Shared ReadOnly errorCount As New Dictionary(Of String, Integer)(StringComparer.Ordinal) Private Shared ReadOnly sendDataBarrier As New SemaphoreSlim(4) - Private Shared ignoreNamePrefixes() As String = New String() {} - Private Shared ignoreNameChars As String = Nothing - Private Shared playCountTriggerPercent As Double - Private Shared playCountTriggerSeconds As Integer - Private Shared skipCountTriggerPercent As Double - Private Shared skipCountTriggerSeconds As Integer + Private Shared ReadOnly ignoreNameChars As String = Nothing + Private Shared ReadOnly playCountTriggerPercent As Double + Private Shared ReadOnly playCountTriggerSeconds As Integer + Private Shared ReadOnly skipCountTriggerPercent As Double + Private Shared ReadOnly skipCountTriggerSeconds As Integer Private Shared logCounter As Integer = 0 Private Shared hostAddresses() As IPAddress Private Shared subnetMasks()() As Byte diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 9e7ba4d..4542aec 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -1,5 +1,4 @@ -Imports System -Imports System.Reflection +Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following @@ -8,17 +7,17 @@ Imports System.Runtime.InteropServices ' Review the values of the assembly attributes - - - - - - + + + + + + 'The following GUID is for the ID of the typelib if this project is exposed to COM - + ' Version information for an assembly consists of the following four values: ' @@ -31,5 +30,5 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/SplitButtonControl.vb b/SplitButtonControl.vb index f0cee16..09b0fd1 100644 --- a/SplitButtonControl.vb +++ b/SplitButtonControl.vb @@ -1,6 +1,6 @@ -Imports System.Drawing +Imports System.ComponentModel +Imports System.Drawing Imports System.Windows.Forms.VisualStyles -Imports System.ComponentModel Partial Public Class Plugin Private NotInheritable Class SplitButton @@ -12,7 +12,7 @@ Partial Public Class Plugin Private isSplitMenuVisible As Boolean Private isMouseEntered As Boolean Private splitMenuStrip As ContextMenuStrip - Private textFlags As TextFormatFlags = TextFormatFlags.Default + Private ReadOnly textFlags As TextFormatFlags = TextFormatFlags.Default Private Shared ReadOnly borderSize As Integer = SystemInformation.Border3DSize.Width * 2 Public Sub New() diff --git a/SsdpServer.vb b/SsdpServer.vb index df855bf..24b9ae4 100644 --- a/SsdpServer.vb +++ b/SsdpServer.vb @@ -1,9 +1,8 @@ -Imports System.Text -Imports System.Threading +Imports System.Net Imports System.Net.Sockets -Imports System.Net -Imports System.Net.NetworkInformation Imports System.Runtime.InteropServices +Imports System.Text +Imports System.Threading Partial Public Class Plugin Private Class SsdpServer diff --git a/UpnpControlPoint.vb b/UpnpControlPoint.vb index 319a40f..ca5d67d 100644 --- a/UpnpControlPoint.vb +++ b/UpnpControlPoint.vb @@ -1,9 +1,6 @@ -Imports System.Text -Imports UPNPLib -Imports System.Xml -Imports System.IO -Imports System.Net +Imports System.Net Imports System.Net.Sockets +Imports UPNPLib Partial Public Class Plugin Private Class UpnpControlPoint diff --git a/UpnpDevice.vb b/UpnpDevice.vb index fa27585..f142df3 100644 --- a/UpnpDevice.vb +++ b/UpnpDevice.vb @@ -1,8 +1,4 @@ Imports System.Xml -Imports System.Text -Imports System.Runtime.Remoting.Messaging -Imports System.Reflection -Imports System.Globalization Partial Public Class Plugin Private MustInherit Class UpnpDevice diff --git a/UpnpServer.vb b/UpnpServer.vb index 7a79168..c8e6573 100644 --- a/UpnpServer.vb +++ b/UpnpServer.vb @@ -1,9 +1,5 @@ Imports System.Text Imports System.Xml -Imports System.IO -Imports System.Net -Imports System.Net.NetworkInformation -Imports System.Net.Sockets Partial Public Class Plugin Private Class UpnpServer diff --git a/UpnpService.vb b/UpnpService.vb index 4bc3acb..44389f6 100644 --- a/UpnpService.vb +++ b/UpnpService.vb @@ -1,8 +1,8 @@ -Imports System.Text -Imports System.Xml -Imports System.IO -Imports System.Reflection +Imports System.IO Imports System.Net +Imports System.Reflection +Imports System.Text +Imports System.Xml Partial Public Class Plugin Private MustInherit Class UpnpService diff --git a/UpnpServiceAttributes.vb b/UpnpServiceAttributes.vb index 5c1b924..1c91431 100644 --- a/UpnpServiceAttributes.vb +++ b/UpnpServiceAttributes.vb @@ -1,13 +1,11 @@ -Imports System.Text - -Partial Public Class Plugin +Partial Public Class Plugin _ Private NotInheritable Class UpnpServiceVariable Inherits Attribute - Private m_name As String - Private m_dataType As String - Private m_sendEvents As Boolean - Private m_allowedValue As String() + Private ReadOnly m_name As String + Private ReadOnly m_dataType As String + Private ReadOnly m_sendEvents As Boolean + Private ReadOnly m_allowedValue As String() Public Sub New(name As String, dataType As String, sendEvents As Boolean, ParamArray allowedValue As String()) m_name = name @@ -48,9 +46,9 @@ Partial Public Class Plugin _ Private NotInheritable Class UpnpServiceArgument Inherits Attribute - Private m_index As Integer - Private m_name As String - Private m_relatedStateVariable As String + Private ReadOnly m_index As Integer + Private ReadOnly m_name As String + Private ReadOnly m_relatedStateVariable As String Public Sub New(index As Integer, name As String, relatedStateVariable As String) m_index = index