示例#1
0
        public bool Creat()
        {
            Cmds.Clear();
            string setting = allow + " ssid=\"" + Name + "\" key=" + Password;

            if (Name.Length > 0)
            {
                if (Password.Length < 8 || Password.Length > 12)
                {
                    return(false);
                }
                Cmds.Add(setting);
                Cmds.Add(show);
                try
                {
                    Runcmd();
                    //if (string.IsNullOrEmpty(IP))
                    //{
                    //    IP = "192.168.196.1";
                    //}
                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
                throw new FormatException("The password length can not be less than 8 more than 12");
            }
        }
示例#2
0
        internal void Load(BinaryReader br)
        {
            int ver   = br.ReadInt32();
            int count = br.ReadInt32();

            lock (this)
            {
                while (count-- > 0)
                {
                    string  name = br.ReadString();
                    SoftCmd cmd  = new SoftCmd();
                    cmd.Load(br);
                    Cmds.Add(name, cmd);
                }
                count = br.ReadInt32();
                while (count-- > 0)
                {
                    ulong user = br.ReadUInt64();
                    Inbox inb  = new Inbox();
                    inb.Load(br);
                    Msgs.Add(user, inb);
                }
                ShowChanges = br.ReadBoolean();
                count       = br.ReadInt32();
                while (count-- > 0)
                {
                    string name  = br.ReadString();
                    string value = br.ReadString();
                    Vars.Add(name, value);
                }
                SetLanguage(br.ReadString());
                MusicChannel  = ver >= 1 ? br.ReadString() : "";
                CommandPrefix = ver >= 2 ? br.ReadString() : ">";
            }
        }
示例#3
0
        private void Disallow()
        {
            string setting = disallow;

            Cmds.Clear();
            Cmds.Add(setting);
            try
            {
                Runcmd();
            }
            catch { }
        }
示例#4
0
        private bool setWifiIP(string wifiAdapter, string ip)
        {
            string IPSetting = setIP1 + wifiAdapter + "\" static " + ip;

            Cmds.Clear();
            Cmds.Add(IPSetting);
            try
            {
                Runcmd();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#5
0
        public bool StartAp()
        {
            string setting = start;

            Cmds.Clear();
            Cmds.Add(setting);
            try
            {
                Runcmd();
                WiFiStatus = WiFiStatus.Running;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#6
0
        public bool StopAp()
        {
            string setting = stop;

            Cmds.Clear();
            Cmds.Add(setting);
            try
            {
                Runcmd();
                WiFiStatus = WiFiStatus.Stop;
                return(true);
            }
            catch
            {
                return(false);
            }
        }