Exemple #1
0
        private static bool PIAUp()
        {
            try
            {
                NetworkInterface ni = NetworkInterface.GetAllNetworkInterfaces()[0];

                foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (NI.Description.Contains("TAP-Windows"))
                    {
                        GatewayIPAddressInformationCollection addr = NI.GetIPProperties().GatewayAddresses;
                        if (addr.Count() > 0)
                        {
                            return(true);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ShowBalloon("Network", e);
            }

            return(false);
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Noticiasid,Imagensid")] NI nI)
        {
            if (id != nI.Imagensid)
            {
                return(RedirectToAction("Index"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nI);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NIExists(nI.Imagensid))
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Imagensid"]  = new SelectList(_context.Imagens, "Id", "Id", nI.Imagensid);
            ViewData["Noticiasid"] = new SelectList(_context.Noticias, "Id", "Corpo", nI.Noticiasid);
            return(View(nI));
        }
Exemple #3
0
        public static IPAddress GetExternalIPv4ByUnicastAddress()
        {
            // Loop through each network interface in the system
            foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
            {
                // Loop through each gateway address for the current network interface
                IPInterfaceProperties IPIP = NI.GetIPProperties();
                foreach (GatewayIPAddressInformation GIPAddress in IPIP.GatewayAddresses)
                {
                    // Ensure gateway is IPv4, and not IPAddress.ANY or IPAddress.NONE
                    if ((GIPAddress.Address.AddressFamily == AddressFamily.InterNetwork) && (GIPAddress.Address.ToString() != IPAddress.Any.ToString()) && (GIPAddress.Address.ToString() != IPAddress.None.ToString()))
                    {
                        // Gateway is valid, so loop through each unicast address for the current network interface
                        foreach (UnicastIPAddressInformation UIPAddress in NI.GetIPProperties().UnicastAddresses)
                        {
                            // Ensure unicast address is IPv4, and not IPAddress.ANY or IPAddress.NONE
                            if ((UIPAddress.Address.AddressFamily == AddressFamily.InterNetwork) && (UIPAddress.Address.ToString() != IPAddress.Any.ToString()) && (UIPAddress.Address.ToString() != IPAddress.None.ToString()))
                            {
                                if (!IsPrivateIP(UIPAddress.Address))
                                {
                                    return(UIPAddress.Address);
                                }
                            }
                        }
                        break;
                    }
                }
            }

            return(IPAddress.None);
        }
Exemple #4
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     Clipboard.SetText(linkLabel1.Text);
     NI.BalloonTipText  = "Текст: " + linkLabel1.Text;
     NI.BalloonTipTitle = "Фрагмент, сохраненный в буфере обмена";
     NI.BalloonTipIcon  = ToolTipIcon.Info;
     NI.Icon            = this.Icon;
     NI.Visible         = true;
     NI.ShowBalloonTip(1000);
 }
Exemple #5
0
 public frmAddressBook()
 {
     InitializeComponent();
     NI.ShowBalloonTip(10000, "BitDNS launched", "BitDNS has been started and will close itself with bitmessage when done", ToolTipIcon.Info);
     BMA[] AA = AddressBook.Addresses;
     foreach (BMA A in AA)
     {
         lvEntries.Items.Add(A.Label).SubItems.Add(A.Address);
     }
 }
Exemple #6
0
    public static void OnStatSet(NetworkConnection conn, SetStatMessage Stat)
    {
        NetworkIdentity.spawned.TryGetValue(Stat.NetId, out NetworkIdentity NI);
        Type T = GetType(Stat.type);

        UnityEngine.Component Comp = NI.GetComponent(T);
        FieldInfo             FI   = T.GetField(Stat.field);

        Debug.Log(FI.Name + " " + FI.FieldType + " " + FI.GetValue(Comp));
        Debug.Log(Stat.value);
        FI.SetValue(Comp, Convert.ChangeType(Stat.value, FI.FieldType));
    }
Exemple #7
0
 private void frmAddressBook_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (e.CloseReason == CloseReason.UserClosing)
     {
         e.Cancel = true;
         this.Hide();
     }
     else
     {
         NI.Dispose();
     }
 }
Exemple #8
0
 void Device_IPodConnected(SharePodLib.IPod iPodin)
 {
     if (MessageBox.Show("iPod/iPhone detected ! Do you want to connected to it ?", "iPod/iPhone detected", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
     {
         this.iPod          = iPodin;
         NI.BalloonTipIcon  = ToolTipIcon.Info;
         NI.BalloonTipText  = "Device connected.";
         NI.BalloonTipTitle = "Device connected";
         NI.ShowBalloonTip(3);
         //statusIpod.Text = iPod.DeviceInfo.SerialNumber.ToString();
     }
 }
Exemple #9
0
 public bool GetConectableAdapter(out NetworkInterface a)
 {
     foreach (NetworkInterface NI in NetworkInterfaces.Values)
     {
         if (!NI.Connected || NI.GetType() == typeof(GroupAdapter))
         {
             a = NI;
             return(true);
         }
     }
     a = null;
     return(false);
 }
Exemple #10
0
        public async Task <IActionResult> Create([Bind("Noticiasid,Imagensid")] NI nI)
        {
            if (ModelState.IsValid)
            {
                _context.Add(nI);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Imagensid"]  = new SelectList(_context.Imagens, "Id", "Id", nI.Imagensid);
            ViewData["Noticiasid"] = new SelectList(_context.Noticias, "Id", "Corpo", nI.Noticiasid);
            return(View(nI));
        }
        private void btn_updateSpeed_Click(object sender, EventArgs e)
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                return;
            }

            NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface NI in interfaces)
            {
                Console.WriteLine(" Bytes sent: {0}", NI.GetIPv4Statistics().BytesSent);
                Console.WriteLine(" Bytes received: {0}", NI.GetIPv4Statistics().BytesReceived);
            }
        }
Exemple #12
0
        static void Stack101()
        {
            Console.Write("\nStack - 101 ");
            Engine engine = CreateEngine();

            Variable sgs_dummy_var = engine.NullVar();

            engine.PushNull();
            engine.Push(true);
            engine.Push(1337);
            engine.Push(13.37);
            engine.Push("what is this");
            engine.PushArray(0);
            engine.Push((IntPtr)1);
            engine.Push(engine);
            engine.Push(sgs_dummy_var);

            Assert(engine.StackSize(), 9);
            Assert(engine.ItemType(0), VarType.Null);
            Assert(engine.ItemType(1), VarType.Bool);
            Assert(engine.ItemType(2), VarType.Int);
            Assert(engine.ItemType(3), VarType.Real);
            Assert(engine.ItemType(4), VarType.String);
            Assert(engine.ItemType(5), VarType.Object);
            Assert(engine.ItemType(6), VarType.Ptr);
            Assert(engine.ItemType(7), VarType.Thread);
            Assert(engine.ItemType(8), VarType.Null);

            Assert(engine.StackItem(1).var.data.B, 1);
            Assert(engine.StackItem(2).var.data.I, 1337);
            Assert(engine.StackItem(3).var.data.R, 13.37);
            Assert(NI.GetString(engine.StackItem(4).var), "what is this");
            Assert(engine.StackItem(6).var.data.P, (IntPtr)1);
            Assert(engine.StackItem(7).var.data.T, engine.ctx);
            try
            {
                NoteTest();
                engine.Pop(10);
                ExpectUnreached();
            }
            catch (SGSException e) { Assert(e.resultCode, RC.EBOUNDS); }
            engine.Pop(9);
            Assert(engine.StackSize(), 0);

            DestroyEngine(engine);
        }
Exemple #13
0
        /// <summary>Looks for the mac address of this instance</summary>
        /// <returns>The mac address</returns>
        public static PhysicalAddress GetMacAddress()
        {
            if (_Address == null)
            {
                foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (NI.NetworkInterfaceType == NetworkInterfaceType.Ethernet && NI.OperationalStatus == OperationalStatus.Up)
                    {
                        _Address = NI.GetPhysicalAddress();

                        break;
                    }
                }
            }

            return(_Address);
        }
        private void CardsList()
        {
            Dictionary <string, IPAddress> cmdSource = new Dictionary <string, IPAddress>();

            foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
            {
                foreach (UnicastIPAddressInformation IP in NI.GetIPProperties().UnicastAddresses)
                {
                    if (IP.Address.AddressFamily == AddressFamily.InterNetwork)
                    {
                        cmdSource.Add(IP.Address.ToString() + " - " + NI.Description, IP.Address);
                    }
                }
            }
            ComeAdapterCmbBox.DataSource    = new BindingSource(cmdSource, null);
            ComeAdapterCmbBox.DisplayMember = "Key";
            ComeAdapterCmbBox.ValueMember   = "Value";
        }
        void KartlariListele()
        {
            Dictionary <string, IPAddress> cmbKaynak = new Dictionary <string, IPAddress>();

            foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
            {
                foreach (UnicastIPAddressInformation IP in NI.GetIPProperties().UnicastAddresses)
                {
                    if (IP.Address.AddressFamily == AddressFamily.InterNetwork)
                    {
                        cmbKaynak.Add(IP.Address.ToString() + " - " + NI.Description, IP.Address);
                    }
                }
            }

            cmbNetworks.DataSource    = new BindingSource(cmbKaynak, null);
            cmbNetworks.DisplayMember = "Key";
            cmbNetworks.ValueMember   = "Value";
        }
Exemple #16
0
 private void getAdapterAddress()
 {
     this._wifiIP = String.Empty;
     this._lanIP  = String.Empty;
     foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
     {
         if (NI.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
         {
             foreach (UnicastIPAddressInformation IP in NI.GetIPProperties().UnicastAddresses)
             {
                 if (IP.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork && IP.IsDnsEligible && !NI.Description.Contains("Virtual"))
                 {
                     this._wifiIP = IP.Address.ToString();
                     break;
                 }
             }
         }
         else if (NI.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
         {
             foreach (UnicastIPAddressInformation IP in NI.GetIPProperties().UnicastAddresses)
             {
                 if (IP.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork && IP.IsDnsEligible && !NI.Description.Contains("Virtual"))
                 {
                     //USB Wireless Network Adapter Will be Here
                     if (NI.Description.Contains("Wireless") && NI.Description.Contains("802.11"))
                     {
                         this._wifiIP = IP.Address.ToString();
                     }
                     else
                     {
                         this._lanIP = IP.Address.ToString();
                         break;
                     }
                 }
             }
         }
     }
     if (this._wifiIP.Length > 0 || this._lanIP.Length > 0)
     {
         this.printJSLog("IP Address " + (this._wifiIP.Length > 0?" WIFI:" + this._wifiIP:"") + (this._lanIP.Length > 0?"  Ethernet:" + this._lanIP:""));
     }
 }
        /// <summary>
        /// Combobox Doldur
        /// </summary>
        public static void ComboBoxFill(ComboBox comboBox)
        {
            //Aktif IP adresleri bulunup combobox a ekleniyor.
            Dictionary <string, IPAddress> comboFill = new Dictionary <string, IPAddress>();

            foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
            {
                foreach (UnicastIPAddressInformation IP in NI.GetIPProperties().UnicastAddresses)
                {
                    if (IP.Address.AddressFamily == AddressFamily.InterNetwork)
                    {
                        comboFill.Add(IP.Address.ToString() + " - " + NI.Description, IP.Address);
                    }
                }
            }

            comboBox.DataSource    = new BindingSource(comboFill, null);
            comboBox.DisplayMember = "Key";
            comboBox.ValueMember   = "Value";
        }
Exemple #18
0
    public static void Main()
    {
        string _wifiIP = String.Empty;
        string _lanIP  = String.Empty;

        foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
        {
            if (NI.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
            {
                foreach (UnicastIPAddressInformation IP in NI.GetIPProperties().UnicastAddresses)
                {
                    if (IP.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork && IP.IsDnsEligible && !NI.Description.Contains("Virtual"))
                    {
                        _wifiIP = IP.Address.ToString();
                        break;
                    }
                }
            }
            else if (NI.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
            {
                foreach (UnicastIPAddressInformation IP in NI.GetIPProperties().UnicastAddresses)
                {
                    if (IP.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork && IP.IsDnsEligible && !NI.Description.Contains("Virtual"))
                    {
                        //USB NetWork Adapter will Here
                        if (NI.Description.Contains("Wireless") && NI.Description.Contains("802."))
                        {
                            _wifiIP = IP.Address.ToString();
                        }
                        else
                        {
                            _lanIP = IP.Address.ToString();
                            break;
                        }
                    }
                }
            }
        }
        System.Console.WriteLine("\nNetwork Adapter Addresses : " + _wifiIP + " " + _lanIP + "\n");
    }
Exemple #19
0
        static private List <UdpClient> GetUdpClients()
        {
            List <UdpClient> Result = new List <UdpClient>();

            try
            {
                // Loop through each network interface in the system
                foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
                {
                    // Loop through each gateway address for the current network interface
                    IPInterfaceProperties IPIP = NI.GetIPProperties();
                    foreach (GatewayIPAddressInformation GIPAddress in IPIP.GatewayAddresses)
                    {
                        // Ensure gateway is IPv4, and not IPAddress.ANY or IPAddress.NONE
                        if ((GIPAddress.Address.AddressFamily == AddressFamily.InterNetwork) && (GIPAddress.Address.ToString() != IPAddress.Any.ToString()) && (GIPAddress.Address.ToString() != IPAddress.None.ToString()))
                        {
                            // Gateway is valid, so add new UdpClient
                            try
                            {
                                UdpClient  Client         = new UdpClient();
                                IPEndPoint RemoteEndPoint = new IPEndPoint(GIPAddress.Address, 5351);
                                Client.Connect(RemoteEndPoint);
                                Result.Add(Client);
                            }
                            catch
                            {
                                // Ignore, don't want a single gateway failure to abort all gateway lookups
                            }
                            break;
                        }
                    }
                }
            }
            catch
            {
                // Ignore, indicates windows system call failure
            }

            return(Result);
        }
Exemple #20
0
        static private List <UdpClient> GetUdpClients()
        {
            List <UdpClient> Result = new List <UdpClient>();

            // Loop through each network interface in the system
            foreach (NetworkInterface NI in NetworkInterface.GetAllNetworkInterfaces())
            {
                // Loop through each gateway address for the current network interface
                IPInterfaceProperties IPIP = NI.GetIPProperties();
                foreach (GatewayIPAddressInformation GIPAddress in IPIP.GatewayAddresses)
                {
                    // Ensure gateway is IPv4, and not IPAddress.ANY or IPAddress.NONE
                    if ((GIPAddress.Address.AddressFamily == AddressFamily.InterNetwork) && (GIPAddress.Address.ToString() != IPAddress.Any.ToString()) && (GIPAddress.Address.ToString() != IPAddress.None.ToString()))
                    {
                        // Gateway is valid, so loop through each unicast address for the current network interface
                        foreach (UnicastIPAddressInformation UIPAddress in NI.GetIPProperties().UnicastAddresses)
                        {
                            // Ensure unicast address is IPv4, and not IPAddress.ANY or IPAddress.NONE
                            if ((UIPAddress.Address.AddressFamily == AddressFamily.InterNetwork) && (UIPAddress.Address.ToString() != IPAddress.Any.ToString()) && (UIPAddress.Address.ToString() != IPAddress.None.ToString()))
                            {
                                try
                                {
                                    Result.Add(new UdpClient(new IPEndPoint(UIPAddress.Address, 0)));
                                }
                                catch
                                {
                                    // Ignore
                                }
                            }
                        }
                        break;
                    }
                }
            }

            return(Result);
        }
Exemple #21
0
        private void button1_Click(object sender, EventArgs e)
        {
            string conString = "data source=DESKTOP-S86R5UP;initial catalog=Ali-2;integrated security=True;MultipleActiveResultSets=True;";

            using (SqlConnection connection = new SqlConnection(conString))
            {
                connection.Open();
                using (SqlCommand command = new SqlCommand(
                           "insert into Person (first_name, last_name, national_id, age, city) values('" + Fname.Text + "', '" + Lname.Text + "', '"
                           + NI.Text + "', '" + Ag.Text + "', '" + Ci.Text + "');",
                           connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        MessageBox.Show("Data inserted");
                        Fname.Text = "";
                        Lname.Text = "";
                        NI.Clear();
                        Ag.Clear();
                        Ci.Clear();
                    }
                }
            }
        }
 public LocalValueFactory(NI.Winter.ServiceProvider srvPrv)
     : base(srvPrv)
 {
 }
 public static extern BOOL ImmNotifyIME(IntPtr hIMC, NI dwAction, CPS dwIndex, int dwValue);
Exemple #24
0
        static void CSharpObjects()
        {
            Console.Write("\nC# object exposure ");
            Engine engine = CreateEngine();

            // test the empty interface
            {
                NI.CreateObject(engine.ctx, IntPtr.Zero, IObjectBase._sgsNullObjectInterface);
                engine.Stat(Stat.XDumpStack);
                engine.Pop(1);
            }

            // init & disown object
            IObject obj = new EmptyObject(engine);

            engine.Push(obj);
            AssertN(obj._sgsObject, IntPtr.Zero);
            engine.Stat(Stat.XDumpStack);               // should have refcount = 2 (one for IObject and one for stack)
            Variable si0 = engine.StackItem(0);

            Assert(engine.Call <string>("typeof", si0), "EmptyObject");
            si0.Release();                // for accurate refcount (otherwise this reference is retained for an unknown amount of time)
            obj.DisownClassObject();      // free IObject reference
            engine.Stat(Stat.XDumpStack); // should have refcount = 1 (stack) and name = <nullObject>
            Assert(engine.Call <string>("typeof", engine.StackItem(0)), "<nullObject>");
            engine.Pop(1);

            // test metamethods
            IObject  obj1    = new FullObject1(engine);
            Variable obj1var = engine.Var(obj1);

            Assert(engine.Call <bool>("tobool", obj1), false);                          // test "convert"(tobool)/ConvertToBool
            Assert(engine.Call <string>("tostring", obj1), "[Full_Object_1]");          // test "convert"(tostring)/ConvertToString
            Assert(engine.Call <string>("dumpvar", obj1), "[this is a FULL OBJECT]\n"); // test "dump"/OnDump

            Assert(obj1var.SetProp("prop1", engine.Var(15)), true);                     // test "setindex"(isprop=true)
            Assert(obj1var.SetProp("prop2", engine.Var(16)), true);
            Assert(obj1var.SetProp("prop3", engine.Var(17)), true);

            AssertVar(obj1var.GetProp("prop1"), engine.Var(15));                   // test "getindex"(isprop=true)
            AssertVar(obj1var.GetProp("prop2"), engine.Var(16.0f));
            AssertVar(obj1var.GetProp("prop3"), engine.Var("17"));
            AssertVar(obj1var.GetProp("invprop1"), null);                 // - HideProperty()
            AssertVar(obj1var.GetProp("invprop2"), engine.Var(234));      // - HideProperty()
            AssertVar(obj1var.GetProp("invprop3"), null);                 // - HideProperty()

            // test method wrapper
            DNMethod dnm1    = new DNMethod(engine, typeof(FullObject1).GetMethod("TestMethod"));
            Variable dnm1var = engine.Var(dnm1);

            Assert(engine.ThisCall <string>(dnm1var, obj1var, "test"), "17|test");
            dnm1.DisownClassObject();

            // test static method wrapper
            DNMethod dnm2    = new DNMethod(engine, typeof(FullObject1).GetMethod("StaticTestMethod"));
            Variable dnm2var = engine.Var(dnm2);

            Assert(engine.Call <string>(dnm2var, "sTest"), "PFX:sTest");
            dnm2.DisownClassObject();

            // test static method dictionary
            Assert(engine.Call <string>("tostring", IObjectBase.CreateStaticDict(engine, typeof(FullObject1))),
                   "{_useProp3=DNMethod,StaticTestMethod=DNMethod,TestMethod=DNMethod,TestMsgMethod=DNMethod}");

            // test static (meta-)object
            Variable movar = engine._GetMetaObject(typeof(FullObject1)).GetVariable();

            AssertVar(movar, obj1var.GetMetaObj());
            Assert(movar.GetProp("_useProp3").ConvertToString(), "SGScript.DNMethod(APITest.APITest+FullObject1._useProp3)");
            Assert(movar.GetProp("pfxstr").GetString(), "PFX:");

            // test instance meta object lookup
            Assert(obj1var.GetProp("_useProp3").ConvertToString(), "SGScript.DNMethod(APITest.APITest+FullObject1._useProp3)");
            Assert(obj1var.GetProp("pfxstr").GetString(), "PFX:");
            Assert(obj1var.GetMetaObj().SetProp("pfxstr", engine.Var("[PFX]:")), true);
            Assert(obj1var.GetMetaObj().GetProp("pfxstr").GetString(), "[PFX]:");
            Assert(obj1var.GetProp("pfxstr").GetString(), "[PFX]:");

            // register type
            engine.SetGlobal("FullObject1", engine._GetMetaObject(typeof(FullObject1)).GetVariable());

            // test extension method
            engine.Exec("function FullObject1.customMethod( txt ){ return this.pfxstr .. txt; }");
            AssertN(obj1var.GetMetaObj().GetProp("customMethod"), null);
            Assert(engine.ThisCall <string>("customMethod", obj1var, "cmTest"), "[PFX]:cmTest");

            // test method messaging
            engine.ThisCall <Nothing>("TestMsgMethod", obj1var, 121, 754);

            DestroyEngine(engine);
            FullObject1.pfxstr = "PFX:";             // restore
        }
Exemple #25
0
        /// <summary>
        /// Create a new DNS resolver client.
        /// </summary>
        /// <param name="ManualDNSServers">A list of manually configured DNS servers to query.</param>
        /// <param name="SearchForIPv4DNSServers">If yes, the DNS client will query a list of DNS servers from the IPv4 network configuration.</param>
        /// <param name="SearchForIPv6DNSServers">If yes, the DNS client will query a list of DNS servers from the IPv6 network configuration.</param>
        public DNSClient(IEnumerable <IPSocket> ManualDNSServers,
                         Boolean SearchForIPv4DNSServers = true,
                         Boolean SearchForIPv6DNSServers = true)

        {
            this._DNSCache        = new DNSCache();
            this.RecursionDesired = true;
            this.QueryTimeout     = TimeSpan.FromSeconds(23.5);

            _DNSServers = new List <IPSocket>(ManualDNSServers);

            #region Search for IPv4/IPv6 DNS Servers...

            if (SearchForIPv4DNSServers)
            {
                _DNSServers.AddRange(NetworkInterface.
                                     GetAllNetworkInterfaces().
                                     Where(NI => NI.OperationalStatus == OperationalStatus.Up).
                                     SelectMany(NI => NI.GetIPProperties().DnsAddresses).
                                     Where(IPAddress => IPAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).
                                     Select(IPAddress => new IPSocket(new IPv4Address(IPAddress), new IPPort(53))));
            }

            if (SearchForIPv6DNSServers)
            {
                _DNSServers.AddRange(NetworkInterface.
                                     GetAllNetworkInterfaces().
                                     Where(NI => NI.OperationalStatus == OperationalStatus.Up).
                                     SelectMany(NI => NI.GetIPProperties().DnsAddresses).
                                     Where(IPAddress => IPAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6).
                                     Select(IPAddress => new IPSocket(new IPv6Address(IPAddress), new IPPort(53))));
            }

            #endregion

            #region Reflect ResourceRecordTypes

            this._RRLookup = new Dictionary <UInt16, ConstructorInfo>();

            FieldInfo       TypeIdField;
            ConstructorInfo Constructor;

            foreach (var _ActualType in typeof(ADNSResourceRecord).
                     Assembly.GetTypes().
                     Where(type => type.IsClass &&
                           !type.IsAbstract &&
                           type.IsSubclassOf(typeof(ADNSResourceRecord))))
            {
                TypeIdField = _ActualType.GetField("TypeId");

                if (TypeIdField == null)
                {
                    throw new ArgumentException("Constant field 'TypeId' of type '" + _ActualType.Name + "' was not found!");
                }

                Constructor = _ActualType.GetConstructor(new Type[2] {
                    typeof(String), typeof(Stream)
                });

                if (Constructor == null)
                {
                    throw new ArgumentException("Constructor<String, Stream> of type '" + _ActualType.Name + "' was not found!");
                }

                _RRLookup.Add((UInt16)TypeIdField.GetValue(_ActualType), Constructor);
            }

            #endregion
        }
Exemple #26
0
        private void mini_Load(object sender, EventArgs e)
        {
            comboBox1.Text = Properties.Settings.Default.LANG;
            if (System.IO.File.Exists(Application.StartupPath + @"\ConnectString.TTOR") == true)
            {
                string s1 = AL.Decoding(System.IO.File.ReadAllText(Application.StartupPath + @"\ConnectString.TTOR"));
                EditConnect(s1);
            }
            else
            {
                EditConnect("Server=ALEXALL;Database=AA7;User Id=ALEXALL;Password=ALEXALL;");
                System.IO.File.WriteAllText(Application.StartupPath + @"\ConnectString.TTOR", "Server=ALEXALL;Database=AA7;User Id=ALEXALL;Password=ALEXALL;", Encoding.UTF8);
            }
            try
            {
                if (Properties.Settings.Default.LANG == "")
                {
                    Properties.Settings.Default.LANG = "RU";
                    Properties.Settings.Default.Save();
                }
                try
                {
                    if (Properties.Settings.Default.LANG == "BE")
                    {
                        btnStart.Text     = "Пачаць";
                        btnCreate.Text    = "Стварыць";
                        NI.BalloonTipText = "Пачакайце, CAVA запускаецца";
                    }
                    else if (Properties.Settings.Default.LANG == "EN")
                    {
                        btnStart.Text     = "Start";
                        btnCreate.Text    = "Create";
                        NI.BalloonTipText = "Please wait, CAVA is loaded.";
                    }
                    NI.ShowBalloonTip(10);
                    // TODO: данная строка кода позволяет загрузить данные в таблицу "cAVA_DATADataSet.Update". При необходимости она может быть перемещена или удалена.
                    this.updateTableAdapter.Fill(this.cAVADataSet.Update);
                    // TODO: данная строка кода позволяет загрузить данные в таблицу "cAVADataSet.Computers". При необходимости она может быть перемещена или удалена.
                    this.computersTableAdapter.Fill(this.cAVADataSet.Computers);
                    if (updateDataGridView.RowCount == 1)
                    {
                        updateTableAdapter.Insert(0, "", true);
                        CAVATableAdapter.Update(ref updateTableAdapter, ref cAVADataSet, "Update");
                    }

                    Properties.Settings.Default.Close = 0;
                    Properties.Settings.Default.Save();

                    if (Properties.Settings.Default.DelUpdate.Length > 0)
                    {
                        try
                        {
                            System.IO.File.Delete(Properties.Settings.Default.DelUpdate);
                            Properties.Settings.Default.DelUpdate = "";
                            Properties.Settings.Default.Save();
                            MessageBox.Show("Подождите, идёт удаление файлов установки...", "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Ошибка удаления файлов UPDATER" + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    if (Properties.Settings.Default.Id < 1)
                    {
                        SetId();
                    }
                    else
                    {
                        if (computersDataGridView.RowCount == 0)
                        {
                            InsertComputer();
                        }
                        bool Is = false;
                        for (int i = 0; i < computersDataGridView.RowCount; i++)
                        {
                            if (G(computersId, i) == Properties.Settings.Default.Id.ToString())
                            {
                                computersTableAdapter.Fill(cAVADataSet.Computers);
                                computersDataGridView.CurrentCell = computersDataGridView[0, i];
                                Is = true;
                                R(computersConnected, true);
                                R(computersStop, false);
                                computersTableAdapter.Update(cAVADataSet.Computers);
                                break;
                            }
                        }
                        if (Is == false)
                        {
                            SetId();
                        }
                    }
                    timer1.Start();
                    timer2.Start();
                    timer3.Start();
                    Properties.Settings.Default.instrucint = 0;
                    Properties.Settings.Default.Save();
                    ex = Properties.Settings.Default.ex;

                    MethodLoad2();

                    NI.Visible = true;
                }
                catch (Exception ex)
                {
                    timerIsReg.Enabled = false;
                    timer1.Enabled     = false;
                    timer2.Enabled     = false;
                    timer3.Enabled     = false;
                    MessageBox.Show("Нажмите Ок чтобы продолжить." + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    FastCloing = true;
                    EnterSettings es = new EnterSettings();
                    es.i = 1;
                    es.Show();
                }
                NI.Visible = false;    //Убрать Tip
                NI.Visible = true;
            }
            catch (Exception ex)
            {
            }
        }
Exemple #27
0
 private void label11_Click(object sender, EventArgs e)
 {
     NI.BalloonTipTitle = "ALEX ALL";
     NI.BalloonTipText  = "Нажмите, чтобы перейти на сайт";
     NI.ShowBalloonTip(9);
 }
 public LocalValueFactory(NI.Winter.ServiceProvider srvPrv, ITypeConverter typeCnv)
     : base(srvPrv)
 {
     Converter = typeCnv;
 }
 public override string ToString()
 {
     return(Frame.Index + ": I->(" + NI.ToString("0.0") + ", " + VI.ToString("0.0") + ", " + MI.ToString("0.0") + "), J->(" +
            NJ.ToString("0.0") + ", " + VJ.ToString("0.0") + ", " + MJ.ToString("0.0") + ")");
 }
Exemple #30
0
        public static IntPtr AllocInterface( NI.ObjInterface iftemplate, string name )
        {
            byte[] nameBytes = System.Text.Encoding.UTF8.GetBytes( name );

            IntPtr iface = MDL.Alloc( NI.ObjInterfaceSize + nameBytes.Length + 1 );

            IntPtr nameOffset = (IntPtr) ( iface.ToInt64() + NI.ObjInterfaceSize );
            iftemplate.name = nameOffset;

            Marshal.StructureToPtr( iftemplate, iface, false );
            Marshal.Copy( nameBytes, 0, nameOffset, nameBytes.Length );
            Marshal.WriteByte( nameOffset, nameBytes.Length, 0 );

            return iface;
        }
Exemple #31
0
 public Variable( Context c, NI.Variable v, bool acquire = true )
     : base(c)
 {
     var = v;
     if( acquire )
         Acquire();
 }