Beispiel #1
0
        private void InitializeTelnet()
        {
            Cursor.Current = Cursors.WaitCursor;
            try {
                tc       = new TelnetConnection(AuthVars.HOSTNAME, AuthVars.PORT);
                response = tc.Login(AuthVars.USERNAME, AuthVars.PASSWORD, AuthVars.TIMEOUT);
                string prompt = response.TrimEnd();
                prompt = response.Substring(prompt.Length - 1, 1);
                if (prompt != "$" && prompt != ">")
                {
                    throw new Exception("Connection failed");
                }

                prompt = string.Empty;
                if (!string.IsNullOrEmpty(response))
                {
                    txtResponse.AppendText("Initializing completed..." + Environment.NewLine);
                    txtResponse.AppendText("Connected...");
                    txtResponse.AppendText(Environment.NewLine);
                    txtResponse.AppendText(Environment.NewLine);
                    txtResponse.AppendText(Environment.NewLine);

                    txtResponse.AppendText("Welcome To Huawei Wimax Tools...");
                    txtResponse.AppendText(Environment.NewLine);
                    txtResponse.AppendText("Huawei Wimax Tools...");
                    txtResponse.AppendText(Environment.NewLine);
                    txtResponse.AppendText("Version : v.1.0.0");
                    txtResponse.AppendText(Environment.NewLine);
                    txtResponse.AppendText("Copyright © MarianzK®. 2012");
                    txtResponse.AppendText(Environment.NewLine);
                    txtResponse.AppendText("All Rights Reserved. 2012");
                    SetConnection(true);
                }
                else
                {
                    SetConnection(false);
                }
            } catch {
                SetErrorStatus("Error in connecting the wimax.", true);
            } finally {
                Cursor.Current = Cursors.Default;
            }
        }