pGina.Plugin.LocalMachine.LocalAccount.SMBserver C# (CSharp) Method

SMBserver() private static method

private static SMBserver ( string share, System.Boolean visversa ) : string[]
share string
visversa System.Boolean
return string[]
        private static string[] SMBserver(string share, Boolean visversa)
        {
            string[] ret = { null, null };
            string[] server;
            try
            {
                server = share.Trim('\\').Split('\\');
            }
            catch
            {
                m_logger.DebugFormat("can't split servername {0}", share);
                return ret;
            }

            if (!String.IsNullOrEmpty(server[0]))
            {
                ret[0] = server[0];
                ret[1] = server[0];
                if (!visversa)
                    return ret;
                try
                {
                    IPHostEntry hostFQDN = Dns.GetHostEntry(server[0]);
                    if (hostFQDN.HostName.Equals(server[0], StringComparison.CurrentCultureIgnoreCase))
                    {
                        IPAddress[] hostIPs = Dns.GetHostAddresses(server[0]);
                        ret[1] = hostIPs[0].ToString();
                    }
                    else
                    {
                        ret[1] = hostFQDN.HostName;
                    }
                }
                catch (Exception ex)
                {
                    m_logger.ErrorFormat("can't resolve FQDN of {0}:{1}", server[0], ex.Message);
                    return new string[] { null, null };
                }
            }
            else
                m_logger.DebugFormat("first token of servername {0} is null", share);

            return ret;
        }