Exemplo n.º 1
0
        public void VernieuwHuidigeIPGegevens(bool adapterIsLan)// true = lan  - false = wifi
        {
            IPClass IPData = Functions.IPDetails.GetAdapterIPConfig(adapterIsLan);

            currentIP.Text      = IPData.IPAddress;
            currentSubnet.Text  = IPData.Subnetmask;
            currentGateway.Text = IPData.Gateway;
        }
Exemplo n.º 2
0
        public static IPClass GetAdapterIPConfig(bool NICisLAN)
        {
            NetworkInterface[] listOFAllNetworkinterfaces = NetworkInterface.GetAllNetworkInterfaces();
            string             SelectedNICName;
            IPClass            CurrentIPData = new IPClass();

            if (NICisLAN)
            {
                SelectedNICName = Properties.Settings.Default.LANnaam;  //naam van LAN adapter
            }
            else
            {
                SelectedNICName = Properties.Settings.Default.NICnaam; //naam van WIFI adapter
            }
            foreach (var NetworkInterface in listOFAllNetworkinterfaces)
            {
                if (NetworkInterface.Name == SelectedNICName)
                {
                    try
                    {
                        var listOfAddresses = NetworkInterface.GetIPProperties().UnicastAddresses;
                        var bla             = listOfAddresses[listOfAddresses.Count - 1]; //get last entry in the list. Last one is always the correct one. Regartless of DHCP or Manaual
                        CurrentIPData.IPAddress  = bla.Address.ToString();
                        CurrentIPData.Subnetmask = bla.IPv4Mask.ToString();
                        try
                        {
                            CurrentIPData.Gateway = NetworkInterface.GetIPProperties().GatewayAddresses[0].Address.ToString(); //if no gateway is set this will give a error.
                        }
                        catch (Exception)
                        {
                            CurrentIPData.Gateway = "Niet bekend";
                        }
                    }
                    catch { CurrentIPData = GetAdapterIPConfig(NICisLAN); }
                    break;
                }
            }
            return(CurrentIPData);
        }
Exemplo n.º 3
0
        /*
         *
         * public IActionResult About()
         * {
         *  _logger.LogInformation("Enter About headless ***** ");
         *     headless
         *      apiVersion: v1
         *      kind: Service
         *      metadata:
         *        name: headless-service
         *      spec:
         *        clusterIP: None # <--
         *        selector:
         *          app: api
         *        ports:
         *          - protocol: TCP
         *            port: 80
         *            targetPort: 80
         *
         *
         *  string connectionString = "";
         #if DEBUG
         *  System.Net.IPAddress[] ipAddresses = Dns.GetHostAddresses("localhost");
         #else
         *  _logger.LogInformation("About be4 DNS.getHostAddresses ***** ");
         *  System.Net.IPAddress[] ipAddresses = Dns.GetHostAddresses("headless-service.default.svc.cluster.local");
         *   _logger.LogInformation("About After DNS.getHostAddresses ***** ");
         #endif
         *
         *
         *
         *  if (ipAddresses.Length == 0)
         *      _logger.LogInformation("this addresses r 0");
         *  else
         *      _logger.LogInformation("the IP addresses are  " + ipAddresses.Length.ToString());
         *
         *  foreach (IPAddress ip in ipAddresses)
         *  {
         *      _logger.LogInformation("this is one IP: " + ip.ToString());
         *      if (String.IsNullOrEmpty(connectionString))
         *          connectionString = "mongodb://";
         *      else
         *          connectionString += ",";
         *      connectionString += $"{ip.ToString()}:27017";
         *  }
         *  connectionString += "/database";
         *  //var client = new MongoClient(connectionString);
         *
         *
         *
         *  return View();
         * }
         *
         */
        public IActionResult About()
        {
            _logger.LogInformation("Enter About headless ***** ");

            string dave = @"apiVersion: v1
            kind: Service
            metadata:
              name: headless - service
            spec:
                    clusterIP: None # <--
              selector:
                app: api
              ports:
                -protocol: TCP
                 port: 80
                  targetPort: 80";

            _logger.LogInformation(dave);


            string connectionString = "";

#if DEBUG
            System.Net.IPAddress[] ipAddresses = Dns.GetHostAddresses("localhost");
#else
            _logger.LogInformation("About be4 DNS.getHostAddresses ***** ");
            System.Net.IPAddress[] ipAddresses = Dns.GetHostAddresses("headless-service.default.svc.cluster.local");
            _logger.LogInformation("About After DNS.getHostAddresses ***** ");
#endif

            List <IPClass> ipclass = new List <IPClass>();


            if (ipAddresses.Length == 0)
            {
                _logger.LogInformation("this addresses r 0");
            }
            else
            {
                _logger.LogInformation("the IP addresses are  " + ipAddresses.Length.ToString());
            }

            foreach (IPAddress ip in ipAddresses)
            {
                IPClass ipc = new IPClass();
                ipc.IPAddr = ip.ToString();
                ipclass.Add(ipc);

                _logger.LogInformation("this is one IP: " + ip.ToString());
                if (String.IsNullOrEmpty(connectionString))
                {
                    connectionString = "mongodb://";
                }
                else
                {
                    connectionString += ",";
                }
                connectionString += $"{ip.ToString()}:27017";
            }
            connectionString += "/database";
            //var client = new MongoClient(connectionString);

            if (ipclass.Count() == 0)
            {
                IPClass ipc = new IPClass();
                ipc.IPAddr = "no Headeless Resulution";
                ipclass.Add(ipc);
                IPClass ipc1 = new IPClass();
                ipc1.IPAddr = dave;
                ipclass.Add(ipc1);
                ViewData["ipdata"] = ipclass;
            }
            else
            {
                IPClass ipc1 = new IPClass();
                ipc1.IPAddr = dave;
                ipclass.Add(ipc1);
                ViewData["ipdata"] = ipclass;
            }
            return(View());
        }
Exemplo n.º 4
0
 public static ItemProperty BonusLevelSpell(IPClass classType, IPSpellLevel spellLevel)
 => NWScript.ItemPropertyBonusLevelSpell((int)classType, (int)spellLevel);
Exemplo n.º 5
0
 public static ItemProperty LimitUseByClass(IPClass classType)
 => NWScript.ItemPropertyLimitUseByClass((int)classType);
Exemplo n.º 6
0
        public string Add2IP(string IP, long Offset)
        {
            IPClass clsIP = new IPClass(IP, "255.255.255.0");

            return(clsIP.Add2IP(IP, Offset));
        }
Exemplo n.º 7
0
        public string GetIPBCast(string IP, string Subnet)
        {
            IPClass clsIP = new IPClass(IP, Subnet);

            return(clsIP.IPBCast);
        }
Exemplo n.º 8
0
 public static ItemProperty LimitUseByClass(IPClass classType)
 {
     return(NWScript.ItemPropertyLimitUseByClass((int)classType) !);
 }