示例#1
0
        private void GetHostname(IHostNameProcessor hostnameProcessor)
        {
            Get["/hostname{fullyQualified}"] = parameters =>
            {
                try
                {
                    var fullyQualifiedQuery = this.Bind <fullyQualifiedModel>();
                    var hostname            = hostnameProcessor.GetHostName();
                    if (fullyQualifiedQuery.fullyQualified)
                    {
                        hostname = hostnameProcessor.GetFullyQualifiedHostName();
                    }

                    var HostNameOutput = new MachineInformationResults
                    {
                        result = hostname
                    };
                    return(Response.AsJson(HostNameOutput));
                }
                catch (Exception e)
                {
                    return(HttpStatusCode.InternalServerError);
                }
            };
        }
示例#2
0
 public void GetIPEndpoint(IIpAddressProcessor ipAddressProcessor)
 {
     Get["/ip"] = parameters =>
     {
         var ipAddress      = ipAddressProcessor.GetIPAddress();
         var ipAdressOutput = new MachineInformationResults
         {
             output = ipAddress
         };
         return(Response.AsJson(ipAdressOutput));
     };
 }
示例#3
0
 public void GetOperatingSystem(IOperatingSystemProcessor operatingSystemProcessor)
 {
     Get["/os"] = parameters =>
     {
         var operatingSystem       = operatingSystemProcessor.GetOperatingSystem();
         var operatingSystemOutput = new MachineInformationResults
         {
             output = operatingSystem
         };
         return(Response.AsJson(operatingSystemOutput));
     };
 }
示例#4
0
        private void GetHostname(IHostNameProcessor hostnameProcessor)
        {
            Get["/hostname{fullyQualified}"] = parameters =>
            {
                var fullyQualifiedQuery = this.Bind <fullyQualifiedModel>();
                var hostname            = hostnameProcessor.GetHostName();
                if (fullyQualifiedQuery.fullyQualified)
                {
                    hostname = hostnameProcessor.GetFullyQualifiedHostName();
                }

                var HostNameOutput = new MachineInformationResults
                {
                    output = hostname
                };
                return(Response.AsJson(HostNameOutput));
            };
        }
示例#5
0
 public void GetIPEndpoint(IIpAddressProcessor ipAddressProcessor)
 {
     Get["/ip"] = parameters =>
     {
         try
         {
             var ipAddress      = ipAddressProcessor.GetIPAddress();
             var ipAdressOutput = new MachineInformationResults
             {
                 result = ipAddress
             };
             return(Response.AsJson(ipAdressOutput));
         }
         catch (Exception e)
         {
             return(HttpStatusCode.InternalServerError);
         }
     };
 }
 public void GetOperatingSystem(IOperatingSystemProcessor operatingSystemProcessor)
 {
     Get["/os"] = parameters =>
     {
         try
         {
             var operatingSystem       = operatingSystemProcessor.GetOperatingSystem();
             var operatingSystemOutput = new MachineInformationResults
             {
                 result = operatingSystem
             };
             return(Response.AsJson(operatingSystemOutput));
         }
         catch (Exception e)
         {
             return(HttpStatusCode.InternalServerError);
         }
     };
 }