⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rasdisplay.cs

📁 自动投票工具
💻 CS
字号:
/**
 * Copyright©,1995-2006,厦门三五互联科技有限公司
 * FileName:RASDisplay.cs
 * Encoding:UTF-8
 * Version: 1.0
 * Create Date: 01/16/2007 09:53:50
 */

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace Destroy_Vote
{
    /// <summary>
    /// 类名称:RASDisplay
    /// 作  者:Administrator
    /// 说  明:// TODO: 在此添加类的简要说明
    /// 创建日期:01/16/2007 09:53:50
    /// </summary>
    public class RASDisplay
    {
        // Fields
        private bool m_connected;
        private IntPtr m_ConnectedRasHandle;
        private string m_ConnectionName;
        private string[] m_ConnectionNames;
        private string m_duration;
        private double m_RX;
        private double m_TX;

        /// <summary>
        /// 默认构造函数
        /// </summary>
        public RASDisplay()
        {
            this.m_connected = true;
            new RAS();
            RASCONN rasconn1 = new RASCONN();
            rasconn1.dwSize = Marshal.SizeOf(typeof(RASCONN));
            rasconn1.hrasconn = IntPtr.Zero;
            int num1 = 0;
            int num2 = 0;
            num1 = Marshal.SizeOf(typeof(RASCONN));
            if (RAS.RasEnumConnections(ref rasconn1, ref num1, ref num2) != 0)
            {
                this.m_connected = false;
            }
            else
            {
                if (num2 > 0)
                {
                    RasStats stats1 = new RasStats();
                    this.m_ConnectedRasHandle = rasconn1.hrasconn;
                    this.m_ConnectionName = rasconn1.szEntryName;
                    int num4 = 0;
                    int num5 = 0;
                    int num6 = 0;
                    num4 = (stats1.dwConnectionDuration / 0x3e8) / 0xe10;
                    num5 = ((stats1.dwConnectionDuration / 0x3e8) / 60) - (num4 * 60);
                    num6 = ((stats1.dwConnectionDuration / 0x3e8) - (num5 * 60)) - (num4 * 0xe10);
                    this.m_duration = string.Concat(new object[] { num4, " hours ", num5, " minutes ", num6, " secs" });
                    this.m_TX = stats1.dwBytesXmited;
                    this.m_RX = stats1.dwBytesRcved;
                }
                else
                {
                    this.m_connected = false;
                }
                int num7 = 1;
                int num8 = 0;
                int num9 = 0;
                RasEntryName[] nameArray1 = null;
                num8 = Marshal.SizeOf(typeof(RasEntryName));
                num9 = num7 * num8;
                nameArray1 = new RasEntryName[num7];
                nameArray1[0].dwSize = num8;
                RAS.RasEnumEntries(null, null, nameArray1, ref num9, out num7);
                if (num7 > 1)
                {
                    nameArray1 = new RasEntryName[num7];
                    for (int num10 = 0; num10 < nameArray1.Length; num10++)
                    {
                        nameArray1[num10].dwSize = num8;
                    }
                    RAS.RasEnumEntries(null, null, nameArray1, ref num9, out num7);
                }
                this.m_ConnectionNames = new string[nameArray1.Length];
                if (num7 > 0)
                {
                    for (int num11 = 0; num11 < nameArray1.Length; num11++)
                    {
                        this.m_ConnectionNames[num11] = nameArray1[num11].szEntryName;
                    }
                }
            }
        }

        public int Connect(string Connection)
        {
            int num1 = 0;
            uint num2 = 2;
            return RAS.InternetDial(IntPtr.Zero, Connection, num2, ref num1, 0);
        }


        [DllImport("wininet.dll", CharSet = CharSet.Auto)]
        public static extern bool DeleteUrlCacheEntry(DEL_CACHE_TYPE type);

        public void Disconnect()
        {
            RAS.RasHangUp(this.m_ConnectedRasHandle);
        }


        public double BytesReceived
        {
            get
            {
                if (!this.m_connected)
                {
                    return 0;
                }
                return this.m_RX;
            }
        }

        public double BytesTransmitted
        {
            get
            {
                if (!this.m_connected)
                {
                    return 0;
                }
                return this.m_TX;
            }
        }

        public string ConnectionName
        {
            get
            {
                if (!this.m_connected)
                {
                    return "";
                }
                return this.m_ConnectionName;
            }
        }

        public string[] Connections
        {
            get
            {
                return this.m_ConnectionNames;
            }
        }

        public string Duration
        {
            get
            {
                if (!this.m_connected)
                {
                    return "";
                }
                return this.m_duration;
            }
        }

        public bool IsConnected
        {
            get
            {
                return this.m_connected;
            }
        }
 

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -