Skip to content

Commit

Permalink
Remove some #region statements
Browse files Browse the repository at this point in the history
  • Loading branch information
supereddie committed Dec 6, 2024
1 parent 8487b3c commit fa2cd05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 44 deletions.
6 changes: 0 additions & 6 deletions src/Common/WindowsAzure/IServiceBusQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace ServiceBusExplorer.WindowsAzure
{
public interface IServiceBusQueue
{
#region Management functions
QueueDescription CreateQueue(QueueDescription description);

QueueDescription CreateQueue(string path);
Expand All @@ -31,20 +30,15 @@ public interface IServiceBusQueue
QueueDescription RenameQueue(string path, string newPath);

QueueDescription UpdateQueue(QueueDescription description);
#endregion

#region Event handlers
delegate void EventHandler(ServiceBusHelperEventArgs args);

event EventHandler OnDelete;

event EventHandler OnCreate;
#endregion

#region Properties
WriteToLogDelegate WriteToLog { get; set; }

string Scheme { get; set; }
#endregion
}
}
47 changes: 9 additions & 38 deletions src/Common/WindowsAzure/ServiceBusQueue.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
#region Using Directives
using Microsoft.ServiceBus.Messaging;
using ServiceBusExplorer.Enums;
using ServiceBusExplorer.Helpers;
using ServiceBusExplorer.Utilities.Helpers;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;

using Microsoft.ServiceBus.Messaging;

using ServiceBusExplorer.Enums;
using ServiceBusExplorer.Helpers;
using ServiceBusExplorer.Utilities.Helpers;

#endregion

// ReSharper disable CheckNamespace
namespace ServiceBusExplorer.WindowsAzure
// ReSharper restore CheckNamespace
{
internal sealed class ServiceBusQueue : IServiceBusQueue
{
#region Private Constants
//***************************
// Constants
//***************************
private const string DefaultScheme = "sb";
private const string CloudServiceBusPostfix = ".servicebus.windows.net";
private const string GermanyServiceBusPostfix = ".servicebus.cloudapi.de";
private const string ChinaServiceBusPostfix = ".servicebus.chinacloudapi.cn";
private const string TestServiceBusPostFix = ".servicebus.int7.windows-int.net";

//***************************
// Messages
//***************************
private const string QueueDescriptionCannotBeNull = "The queue description argument cannot be null.";
private const string PathCannotBeNull = "The path argument cannot be null or empty.";
private const string NewPathCannotBeNull = "The new path argument cannot be null or empty.";
Expand All @@ -41,28 +26,20 @@ internal sealed class ServiceBusQueue : IServiceBusQueue
private const string QueueDeleted = "The queue {0} has been successfully deleted.";
private const string QueueRenamed = "The queue {0} has been successfully renamed to {1}.";
private const string QueueUpdated = "The queue {0} has been successfully updated.";
#endregion

#region Private Fields

private readonly Microsoft.ServiceBus.NamespaceManager namespaceManager;
private readonly Uri namespaceUri;
private readonly string ns;
private readonly string servicePath = string.Empty;

private readonly string servicePath = string.Empty;
private readonly ServiceBusNamespace serviceBusNamespace;
private string scheme = DefaultScheme;
#endregion

#region Public Constructors
public ServiceBusQueue(ServiceBusNamespace serviceBusNamespace, Microsoft.ServiceBus.NamespaceManager namespaceManager)
{
this.serviceBusNamespace = serviceBusNamespace;
this.namespaceManager = namespaceManager;
ns = GetNamespace();
}
#endregion

#region Public Instance Properties

public string Scheme
{
Expand All @@ -77,20 +54,17 @@ public string Scheme
}

public WriteToLogDelegate WriteToLog { get; set; } = (message, async) => { };
#endregion

#region Public Events
public event IServiceBusQueue.EventHandler OnDelete;

public event IServiceBusQueue.EventHandler OnCreate;
#endregion

#region Public Methods
/// <summary>
/// Retrieves an enumerable collection of all queues in the service bus namespace.
/// </summary>
/// <param name="filter">OData filter.</param>
/// <returns>Returns an IEnumerable<QueueDescription/> collection of all queues in the service namespace.
/// Returns an empty collection if no queue exists in this service namespace.</returns>
/// <returns>Returns an IEnumerable<QueueDescription/> collection of all queues in the service namespace, or
/// an empty collection if no queue exists in this service namespace.</returns>
public IEnumerable<QueueDescription> GetQueues(string filter, int timeoutInSeconds)
{
if (namespaceManager != null)
Expand Down Expand Up @@ -352,9 +326,7 @@ public QueueDescription RenameQueue(string path, string newPath)
}
throw new ApplicationException(ServiceBusIsDisconnected);
}
#endregion

#region Private Methods
private QueueDescription GetQueueUsingEntityPath(int timeoutInSeconds)
{
var taskList = new List<Task>();
Expand Down Expand Up @@ -395,6 +367,5 @@ private bool IsCloudNamespace()
uri.Contains(GermanyServiceBusPostfix) ||
uri.Contains(ChinaServiceBusPostfix)));
}
#endregion
}
}

0 comments on commit fa2cd05

Please sign in to comment.