From a194b634aa6852569f51797901f679e37fffae4b Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 6 Mar 2021 16:28:18 +0530 Subject: [PATCH] DnsServerInternal: code refactoring done. added new interface methods. --- .../Dns/Applications/DnsServerInternal.cs | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/DnsServerCore/Dns/Applications/DnsServerInternal.cs b/DnsServerCore/Dns/Applications/DnsServerInternal.cs index 77106a32..b8492ce1 100644 --- a/DnsServerCore/Dns/Applications/DnsServerInternal.cs +++ b/DnsServerCore/Dns/Applications/DnsServerInternal.cs @@ -17,6 +17,8 @@ along with this program. If not, see . */ +using DnsApplicationCommon; +using System; using System.Threading.Tasks; using TechnitiumLibrary.Net.Dns; using TechnitiumLibrary.Net.Proxy; @@ -28,16 +30,18 @@ namespace DnsServerCore.Dns.Applications #region variables readonly DnsServer _dnsServer; - readonly string _packagePath; + readonly string _appName; + readonly string _applicationFolder; #endregion #region constructor - public DnsServerInternal(DnsServer dnsServer, string packagePath) + public DnsServerInternal(DnsServer dnsServer, string appName, string applicationFolder) { _dnsServer = dnsServer; - _packagePath = packagePath; + _appName = appName; + _applicationFolder = applicationFolder; } #endregion @@ -47,11 +51,25 @@ namespace DnsServerCore.Dns.Applications return _dnsServer.DirectQueryAsync(question, timeout); } + public void WriteLog(string message) + { + LogManager log = _dnsServer.LogManager; + if (log != null) + log.Write("DNS App [" + _appName + "]: " + message); + } + + public void WriteLog(Exception ex) + { + LogManager log = _dnsServer.LogManager; + if (log != null) + log.Write("DNS App [" + _appName + "]: " + ex.ToString()); + } + public string ServerDomain { get { return _dnsServer.ServerDomain; } } - public string PackageFolder - { get { return _packagePath; } } + public string ApplicationFolder + { get { return _applicationFolder; } } public IDnsCache DnsCache { get { return _dnsServer.DnsCache; } }