示例#1
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("RuyiNetworkTestResult");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                if (Localconnection != null && __isset.localconnection)
                {
                    field.Name = "localconnection";
                    field.Type = TType.Struct;
                    field.ID   = 1;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await Localconnection.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (Ipaddress != null && __isset.ipaddress)
                {
                    field.Name = "ipaddress";
                    field.Type = TType.Struct;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await Ipaddress.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (Internetconnection != null && __isset.internetconnection)
                {
                    field.Name = "internetconnection";
                    field.Type = TType.Struct;
                    field.ID   = 3;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await Internetconnection.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
示例#2
0
        public async Task <ActionResult> Create(Admin admin)
        {
            if (ModelState.IsValid)
            {
                admin.DateAdded = DateTime.Now;
                admin.Ipaddress = Ipaddress.GetIpaddress();
                db.Admins.Add(admin);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(admin));
        }
示例#3
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("RuyiNetworkTestResult");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (Localconnection != null && __isset.localconnection)
         {
             field.Name = "localconnection";
             field.Type = TType.Struct;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             Localconnection.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Ipaddress != null && __isset.ipaddress)
         {
             field.Name = "ipaddress";
             field.Type = TType.Struct;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             Ipaddress.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Internetconnection != null && __isset.internetconnection)
         {
             field.Name = "internetconnection";
             field.Type = TType.Struct;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             Internetconnection.Write(oprot);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
示例#4
0
        public override string ToString()
        {
            var  sb      = new StringBuilder("RuyiNetworkTestResult(");
            bool __first = true;

            if (Localconnection != null && __isset.localconnection)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("Localconnection: ");
                sb.Append(Localconnection == null ? "<null>" : Localconnection.ToString());
            }
            if (Ipaddress != null && __isset.ipaddress)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("Ipaddress: ");
                sb.Append(Ipaddress == null ? "<null>" : Ipaddress.ToString());
            }
            if (Internetconnection != null && __isset.internetconnection)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("Internetconnection: ");
                sb.Append(Internetconnection == null ? "<null>" : Internetconnection.ToString());
            }
            sb.Append(")");
            return(sb.ToString());
        }
示例#5
0
        private void buttonX6_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Configsave data = DeserializeObject <Configsave>(File.ReadAllBytes(openFileDialog1.FileName));

                Port.Clear();
                Ipaddress.Clear();

                switch (data.BuffType)
                {
                case Protocol.ALL:
                {
                    radioButton1.Checked = true;
                }
                break;

                case Protocol.TCP:
                {
                    radioButton2.Checked = true;
                }
                break;

                case Protocol.UDP:
                {
                    radioButton3.Checked = true;
                }
                break;
                }


                if (data.AllIP)
                {
                    this.radioButton4.Checked = true;
                }
                else
                {
                    this.radioButton5.Checked  = true;
                    this.integerInput1.Enabled = true;
                    //this.ipAddressInput1.Value = ipaddress;

                    foreach (string ip in data.Ipaddress)
                    {
                        this.listViewEx1.Items.Add(new ListViewItem()
                        {
                            Text = ip
                        });
                    }
                }

                if (data.AllPort)
                {
                    this.radioButton6.Checked = true;
                }
                else
                {
                    this.radioButton7.Checked  = true;
                    this.integerInput1.Enabled = true;
                    //  this.integerInput1.Value = port;

                    foreach (int pt in data.Port)
                    {
                        this.listViewEx2.Items.Add(new ListViewItem()
                        {
                            Text = pt.ToString(), Tag = pt
                        });
                    }
                }
            }
        }
示例#6
0
        private void buttonX5_Click(object sender, EventArgs e)
        {
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (radioButton1.Checked)
                {
                    BuffType = Protocol.ALL;
                }
                if (radioButton2.Checked)
                {
                    BuffType = Protocol.TCP;
                }
                if (radioButton3.Checked)
                {
                    BuffType = Protocol.UDP;
                }

                AllIP = radioButton4.Checked;



                if (!radioButton4.Checked)
                {
                    Ipaddress.Clear();

                    foreach (ListViewItem p in listViewEx1.Items)
                    {
                        Ipaddress.Add(p.Text);
                    }
                }


                AllPort = radioButton6.Checked;

                if (!radioButton6.Checked)
                {
                    Port.Clear();
                    foreach (ListViewItem p in listViewEx2.Items)
                    {
                        Port.Add((int)p.Tag);
                    }
                }
                if (this.comboBoxEx1.SelectedItem != null)
                {
                    Encode = this.comboBoxEx1.SelectedItem as Encoding;
                }
                else
                {
                    Encode = Encoding.GetEncoding(this.comboBoxEx1.Text);
                }

                IsOk = true;


                Configsave tmp = new Configsave()
                {
                    BuffType  = BuffType,
                    AllIP     = AllIP,
                    AllPort   = AllPort,
                    Ipaddress = Ipaddress,
                    Port      = Port
                };


                File.WriteAllBytes(saveFileDialog1.FileName, SerializeObject(tmp));
            }
        }
示例#7
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                BuffType = Protocol.ALL;
            }
            if (radioButton2.Checked)
            {
                BuffType = Protocol.TCP;
            }
            if (radioButton3.Checked)
            {
                BuffType = Protocol.UDP;
            }

            AllIP = radioButton4.Checked;



            if (!radioButton4.Checked)
            {
                //Ipaddress = this.ipAddressInput1.Value;

                //if (string.IsNullOrEmpty(Ipaddress))
                //{
                //    MessageBox.Show("请输入IP地址");
                //    return;
                //}

                Ipaddress.Clear();

                foreach (ListViewItem p in listViewEx1.Items)
                {
                    Ipaddress.Add(p.Text);
                }
            }


            AllPort = radioButton6.Checked;

            if (!radioButton6.Checked)
            {
                //   Port = this.integerInput1.Value;

                Port.Clear();
                foreach (ListViewItem p in listViewEx2.Items)
                {
                    Port.Add((int)p.Tag);
                }
            }
            if (this.comboBoxEx1.SelectedItem != null)
            {
                Encode = this.comboBoxEx1.SelectedItem as Encoding;
            }
            else
            {
                Encode = Encoding.GetEncoding(this.comboBoxEx1.Text);
            }



            IsOk = true;
            this.Close();
        }
示例#8
0
    void Wnd1(int id)
    {
        if (focusWindow)
        {
            GUI.FocusWindow(id); GUI.BringWindowToFront(id);
        }
        focusWindow = false;
        bool onMouseOver;

        GUI.BeginGroup(new Rect(8f, 27f, 329f, 81f), "");
        GUI.Box(new Rect(0, 0, 329f, 81f), "");
        GUI.Label(new Rect(17f, 30f, 80f, 21.96f), @"ip address");
        if (vipaddress)
        {
            if (focusIpaddress)
            {
                focusIpaddress = false; GUI.FocusControl("Ipaddress");
            }
            GUI.SetNextControlName("Ipaddress");
            if (rIpaddress)
            {
                GUI.Label(new Rect(103.3f, 30f, 123f, 14f), Ipaddress.ToString());
            }
            else
            {
                try { Ipaddress = GUI.TextField(new Rect(103.3f, 30f, 123f, 14f), Ipaddress, 100); }catch {}
            };
        }
        GUI.Label(new Rect(64.38f, 48f, 32.32333f, 21.96f), @"port");
        if (vport)
        {
            if (focusPort)
            {
                focusPort = false; GUI.FocusControl("Port");
            }
            GUI.SetNextControlName("Port");
            if (rPort)
            {
                GUI.Label(new Rect(103.3f, 48f, 123f, 14f), Port.ToString());
            }
            else
            {
                try { Port = int.Parse(GUI.TextField(new Rect(103.3f, 48f, 123f, 14f), Port.ToString(), 100)); }catch {}
            };
        }
        if (vconnect)
        {
            if (focusConnect)
            {
                focusConnect = false; GUI.FocusControl("Connect");
            }
            GUI.SetNextControlName("Connect");
            bool oldConnect = Connect;
            Connect = GUI.Button(new Rect(244f, 30f, 75f, 32f), new GUIContent(@"Connect", ""));
            if (Connect != oldConnect && Connect)
            {
                Action("Connect"); onButtonClick();
            }
            onMouseOver = new Rect(244f, 30f, 75f, 32f).Contains(Event.current.mousePosition);
            if (oldMouseOverConnect != onMouseOver && onMouseOver)
            {
                onOver();
            }
            oldMouseOverConnect = onMouseOver;
        }
        GUI.EndGroup();
        GUI.BeginGroup(new Rect(8f, 112f, 723f, 355f), "");
        GUI.Box(new Rect(0, 0, 723f, 355f), "");
        if (vServersTable)
        {
            if (focusServersTable)
            {
                focusServersTable = false; GUI.FocusControl("ServersTable");
            }
            GUI.SetNextControlName("ServersTable");
            GUI.Box(new Rect(8f, 48f, 707f, 299f), "");
            sServersTable = GUI.BeginScrollView(new Rect(8f, 48f, 707f, 299f), sServersTable, new Rect(0, 0, 697f, lServersTable.Length * 15f));
            int oldServersTable = iServersTable;
            iServersTable = GUI.SelectionGrid(new Rect(0, 0, 697f, lServersTable.Length * 15f), iServersTable, lServersTable, 1, GUI.skin.customStyles[0]);
            if (iServersTable != oldServersTable)
            {
                Action("ServersTable");
            }
            GUI.EndScrollView();
        }
        GUI.Label(new Rect(0f, 0f, 114.45f, 14f), @"Server List");
        if (vRefresh)
        {
            if (focusRefresh)
            {
                focusRefresh = false; GUI.FocusControl("Refresh");
            }
            GUI.SetNextControlName("Refresh");
            bool oldRefresh = Refresh;
            Refresh = GUI.Button(new Rect(633f, 4.04f, 82f, 21.96f), new GUIContent(@"Refresh", ""));
            if (Refresh != oldRefresh && Refresh)
            {
                Action("Refresh"); onButtonClick();
            }
            onMouseOver = new Rect(633f, 4.04f, 82f, 21.96f).Contains(Event.current.mousePosition);
            if (oldMouseOverRefresh != onMouseOver && onMouseOver)
            {
                onOver();
            }
            oldMouseOverRefresh = onMouseOver;
        }
        if (vserversTitle)
        {
            if (focusServersTitle)
            {
                focusServersTitle = false; GUI.FocusControl("ServersTitle");
            }
            GUI.SetNextControlName("ServersTitle");
            if (rServersTitle)
            {
                GUI.Label(new Rect(8f, 30f, 707f, 14f), ServersTitle.ToString(), GUI.skin.customStyles[2]);
            }
            else
            {
                try { ServersTitle = GUI.TextField(new Rect(8f, 30f, 707f, 14f), ServersTitle, 100, GUI.skin.customStyles[2]); }catch {}
            };
        }
        GUI.EndGroup();
        GUI.Label(new Rect(8f, 27f, 56.61f, 14f), @"Server");
        if (vhostCount)
        {
            if (focusHostCount)
            {
                focusHostCount = false; GUI.FocusControl("HostCount");
            }
            GUI.SetNextControlName("HostCount");
            if (rHostCount)
            {
                GUI.Label(new Rect(550f, 476f, 39f, 14f), HostCount.ToString(), GUI.skin.customStyles[2]);
            }
            else
            {
                try { HostCount = int.Parse(GUI.TextField(new Rect(550f, 476f, 39f, 14f), HostCount.ToString(), 100, GUI.skin.customStyles[2])); }catch {}
            };
        }
        if (GUI.Button(new Rect(739f - 25, 5, 20, 15), "X"))
        {
            enabled = false; onButtonClick(); Action("Close");
        }
    }
示例#9
0
        void sinffer_XYBufferIn(XYBuffer data)
        {
            if (!isStop)
            {
                AllCount = Interlocked.Increment(ref AllCount);

                switch (BuffType)
                {
                case Protocol.TCP:
                {
                    if (data.Type != Protocol.TCP)
                    {
                        return;
                    }
                }
                break;

                case Protocol.UDP:
                {
                    if (data.Type != Protocol.UDP)
                    {
                        return;
                    }
                }
                break;
                }

                if (!AllIP)
                {
                    //if (!data.SourceIP.Equals(Ipaddress, StringComparison.Ordinal) && !data.DestIP.Equals(Ipaddress, StringComparison.Ordinal))
                    //{
                    //    return;
                    //}

                    if (Ipaddress.Find(p => p.Equals(data.SourceIP, StringComparison.Ordinal) || p.Equals(data.DestIP, StringComparison.Ordinal)) == null)
                    {
                        return;
                    }
                }

                if (!AllPort)
                {
                    //if (data.DestPort != Port && data.SourcePort != Port)
                    //    return;

                    bool IsReturn = true;

                    foreach (int pt in Port)
                    {
                        if (data.DestPort == pt || data.SourcePort == pt)
                        {
                            IsReturn = false;
                            break;
                        }
                    }


                    if (IsReturn)
                    {
                        return;
                    }
                }


                data.Id = Count;
                Count   = Interlocked.Increment(ref Count);

                data.HexString = GetHexString(data.Data).ToString().Replace("\r\n", "").Replace('\r', ' ').Replace('\n', ' ');


                data = DeCode(data);


                InsertList(data);
            }
        }