Exemplo n.º 1
0
        /// <summary>
        /// 初始化 <see cref="LogoutSucceededPage"/> 。
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            this.loginActionAddress = $"{this.scriptVariants["httpBase"]}{this.scriptVariants["ctxPath"]}/portalLogin.wlan?{Wlan_eduManager.DateTimeToUnixTimeStamp(base.currentTime)}";
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化 <see cref="LogoutInfoPage"/> 。
        /// </summary>
        public override void Initialize()
        {
            this.scriptVariants = this.scriptVariants ??
                                  Regex.Matches(
                this.document.DocumentNode
                .SelectSingleNode(@"html/head/script")
                ?.InnerText,
                @"var\s+(?<VariantName>\w+?)\s+=\s+(?<VariantValue>(\s|\S)+?);"
                )
                                  .OfType <Match>()
                                  .ToDictionary <Match, string, object>(
                (match => match.Groups["VariantName"].Value),
                (match =>
            {
                string value = match.Groups["VariantValue"].Value;
                if (Regex.IsMatch(value, @"^(-)?\s*\d+$"))
                {
                    return(int.Parse(value));
                }
                else if (Regex.IsMatch(value, @"^\d*\.\d+$"))
                {
                    return(double.Parse(value));
                }
                else if (Regex.IsMatch(value, @"^""[^""]*""$"))
                {
                    return(value.Trim('"'));
                }
                else
                {
                    throw new NotSupportedException();
                }
            })
                );

            this.currentTime        = DateTime.Now;
            this.loginActionAddress = $"{this.scriptVariants["httpBase"]}{this.scriptVariants["ctxPath"]}/portalLogout.wlan?isCloseWindow=N&{Wlan_eduManager.DateTimeToUnixTimeStamp(this.currentTime)}";
        }
Exemplo n.º 3
0
        internal void Run(string userName, string userPwd, bool isAutoLogin, bool cancelAutoLogin)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                Program.manager = Wlan_eduManager.CreateManagerFromRedirection();
            }
            catch (Wlan_eduNotConnectedException)
            {
                throw;
            }
            catch (Exception)
            {
                userName        = null;
                userPwd         = null;
                isAutoLogin     = false;
                cancelAutoLogin = false;


                DateTime currentTime = DateTime.Now;
                Program.manager = new Wlan_eduManager(
                    new LoginInfoPage(string.Empty)
                {
                    wlanAcName     = "0434.0571.571.00",
                    wlanUserIp     = "10.137.188.218",
                    scriptVariants = new Dictionary <string, object>()
                    {
                        { "httpBase", "https://211.138.125.52:7090" },
                        { "ctxPath", "/zmcc" }
                    },
                    currentTime              = currentTime,
                    loginActionAddress       = $"https://211.138.125.52:7090/zmcc/portalLogin.wlan?{Wlan_eduManager.DateTimeToUnixTimeStamp(currentTime)}",
                    fetchTemporaryPwdAddress = $"https://211.138.125.52:7090/zmcc/portalApplyPwd.wlan"
                }
                    );
            }

            var form = new MainForm(userName, userPwd, isAutoLogin, cancelAutoLogin);

            Application.Run(form);
        }