From 80dee5974e846ec74fd9459d8a0c15ecac3e465c Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 4 Nov 2017 20:13:10 +0530 Subject: [PATCH] sorting zone output list done. --- DnsServerCore/DnsWebService.cs | 4 ++++ DnsServerCore/Zone.cs | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/DnsServerCore/DnsWebService.cs b/DnsServerCore/DnsWebService.cs index 722f540c..87ad4e30 100644 --- a/DnsServerCore/DnsWebService.cs +++ b/DnsServerCore/DnsWebService.cs @@ -502,6 +502,8 @@ namespace DnsServerCore string[] subZones = _dnsServer.CacheZoneRoot.ListSubZones(domain); DnsResourceRecord[] records = _dnsServer.CacheZoneRoot.GetAllRecords(domain, false); + Array.Sort(subZones); + jsonWriter.WritePropertyName("zones"); jsonWriter.WriteStartArray(); @@ -529,6 +531,8 @@ namespace DnsServerCore { Zone.ZoneInfo[] zones = _dnsServer.AuthoritativeZoneRoot.ListAuthoritativeZones(); + Array.Sort(zones); + jsonWriter.WritePropertyName("zones"); jsonWriter.WriteStartArray(); diff --git a/DnsServerCore/Zone.cs b/DnsServerCore/Zone.cs index bc549386..8909ad74 100644 --- a/DnsServerCore/Zone.cs +++ b/DnsServerCore/Zone.cs @@ -824,7 +824,7 @@ namespace DnsServerCore #endregion - public class ZoneInfo + public class ZoneInfo : IComparable { #region variables @@ -849,6 +849,15 @@ namespace DnsServerCore #endregion + #region public + + public int CompareTo(ZoneInfo other) + { + return this._zoneName.CompareTo(other._zoneName); + } + + #endregion + #region properties public string ZoneName