예제 #1
0
        /// <summary>
        /// Provides a formatted prompt, then reads a single line of text from the
        /// console.
        /// </summary>
        /// <param name="fmt">
        ///         A format string as described in <a
        ///         href="../util/Formatter.html#syntax">Format string syntax</a>.
        /// </param>
        /// <param name="args">
        ///         Arguments referenced by the format specifiers in the format
        ///         string.  If there are more arguments than format specifiers, the
        ///         extra arguments are ignored.  The maximum number of arguments is
        ///         limited by the maximum dimension of a Java array as defined by
        ///         <cite>The Java&trade; Virtual Machine Specification</cite>.
        /// </param>
        /// <exception cref="IllegalFormatException">
        ///          If a format string contains an illegal syntax, a format
        ///          specifier that is incompatible with the given arguments,
        ///          insufficient arguments given the format string, or other
        ///          illegal conditions.  For specification of all possible
        ///          formatting errors, see the <a
        ///          href="../util/Formatter.html#detail">Details</a> section
        ///          of the formatter class specification.
        /// </exception>
        /// <exception cref="IOError">
        ///         If an I/O error occurs.
        /// </exception>
        /// <returns>  A string containing the line read from the console, not
        ///          including any line-termination characters, or <tt>null</tt>
        ///          if an end of stream has been reached. </returns>
        public String ReadLine(String fmt, params Object[] args)
        {
            String line = null;

            lock (WriteLock)
            {
                lock (ReadLock)
                {
                    if (fmt.Length() != 0)
                    {
                        Pw.Format(fmt, args);
                    }
                    try
                    {
                        char[] ca = Readline(false);
                        if (ca != null)
                        {
                            line = new String(ca);
                        }
                    }
                    catch (IOException x)
                    {
                        throw new IOError(x);
                    }
                }
            }
            return(line);
        }
예제 #2
0
 /// <summary>
 /// Provides a formatted prompt, then reads a password or passphrase from
 /// the console with echoing disabled.
 /// </summary>
 /// <param name="fmt">
 ///         A format string as described in <a
 ///         href="../util/Formatter.html#syntax">Format string syntax</a>
 ///         for the prompt text.
 /// </param>
 /// <param name="args">
 ///         Arguments referenced by the format specifiers in the format
 ///         string.  If there are more arguments than format specifiers, the
 ///         extra arguments are ignored.  The maximum number of arguments is
 ///         limited by the maximum dimension of a Java array as defined by
 ///         <cite>The Java&trade; Virtual Machine Specification</cite>.
 /// </param>
 /// <exception cref="IllegalFormatException">
 ///          If a format string contains an illegal syntax, a format
 ///          specifier that is incompatible with the given arguments,
 ///          insufficient arguments given the format string, or other
 ///          illegal conditions.  For specification of all possible
 ///          formatting errors, see the <a
 ///          href="../util/Formatter.html#detail">Details</a>
 ///          section of the formatter class specification.
 /// </exception>
 /// <exception cref="IOError">
 ///         If an I/O error occurs.
 /// </exception>
 /// <returns>  A character array containing the password or passphrase read
 ///          from the console, not including any line-termination characters,
 ///          or <tt>null</tt> if an end of stream has been reached. </returns>
 public char[] ReadPassword(String fmt, params Object[] args)
 {
     char[] passwd = null;
     lock (WriteLock)
     {
         lock (ReadLock)
         {
             try
             {
                 EchoOff = echo(false);
             }
             catch (IOException x)
             {
                 throw new IOError(x);
             }
             IOError ioe = null;
             try
             {
                 if (fmt.Length() != 0)
                 {
                     Pw.Format(fmt, args);
                 }
                 passwd = Readline(true);
             }
             catch (IOException x)
             {
                 ioe = new IOError(x);
             }
             finally
             {
                 try
                 {
                     EchoOff = echo(true);
                 }
                 catch (IOException x)
                 {
                     if (ioe == null)
                     {
                         ioe = new IOError(x);
                     }
                     else
                     {
                         ioe.AddSuppressed(x);
                     }
                 }
                 if (ioe != null)
                 {
                     throw ioe;
                 }
             }
             Pw.Println();
         }
     }
     return(passwd);
 }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string kad;
            int    pw;

            kad = Convert.ToString(Kad.Text);
            pw  = Convert.ToInt32(Pw.Text);
            if (pw == 1234 || kad == "admin")
            {
                Form yeni = new Form();
                yeni.Show();
                this.Hide();
            }
            else
            {
                label3.Text    = "Hatalı Giriş...";
                label3.Visible = true;
                Kad.Clear();
                Pw.Clear();
            }
        }
예제 #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Pw.Length != 0)
            {
                hash ^= Pw.GetHashCode();
            }
            if (Result != 0)
            {
                hash ^= Result.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #5
0
 /// <summary>
 /// Flushes the console and forces any buffered output to be written
 /// immediately .
 /// </summary>
 public void Flush()
 {
     Pw.Flush();
 }