Exemplo n.º 1
0
 /// <summary>
 /// Reads a character from the console component
 /// </summary>
 /// <returns>The character read</returns>
 public char Read()
 {
     Reading = true;
     KeyMan.Focus(this);
     while (Reading)
     {
         ;             //Wait for user to enter input
     }
     KeyMan.Unfocus();
     return((char)In.Read());
 }
Exemplo n.º 2
0
        /// <summary>
        /// 将后面size字节的数据拷贝到st中
        /// </summary>
        /// <param name="st"></param>
        /// <param name="size"></param>
        public void CopyTo(StreamTool st, int size, byte[] swap)
        {
            var total  = size;
            var batchN = swap.Length;

            while (total > 0)
            {
                var step = total > batchN ? batchN : total;
                In.Read(swap, 0, step);
                st.Out.Write(swap, 0, step);
                total -= step;
            }
        }
Exemplo n.º 3
0
    static int Int()
    {
        var n = 0;

        while (true)
        {
            var c = In.Read() - '0';
            if (0 <= c)
            {
                n = 10 * n + c;
            }
            else
            {
                return(n);
            }
        }
    }
Exemplo n.º 4
0
 /// <include file='doc\Console.uex' path='docs/doc[@for="Console.Read"]/*' />
 public static int Read()
 {
     try {
         return(In.Read());
     }
     catch (IOException e) {
         // Assume that this happened because In was an invalid handle.
         if (Marshal.GetHRForException(e) == Win32Native.MakeHRFromErrorCode(Win32Native.ERROR_INVALID_HANDLE))
         {
             // Set in to something that will give us EOF semantics.
             _in = TextReader.Synchronized(StreamReader.Null);
         }
         else
         {
             throw;
         }
     }
     return(-1);
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            OutputEncoding = GetEncoding("UTF-8");

            WriteLine("Hello World!");
            WriteLine(ReadName() + "\n");

            DateTime localDate = DateTime.Now;
            DateTime utcDate   = DateTime.UtcNow;

            String[] cultureNames = { "pl-PL", "en-US", "en-GB", "pt-PT", "de-AT", "ru-RU" };

            foreach (var cultureName in cultureNames)
            {
                var culture = new CultureInfo(cultureName);
                WriteLine("{0}", culture.NativeName);
                WriteLine(" Local date and time {0}, {1:G}", localDate.ToString(culture), localDate.Kind);
                WriteLine(" UTC date and time: {0}, {1:G}\n", utcDate.ToString(culture), utcDate.Kind);
            }
            In.Read();
        }
Exemplo n.º 6
0
 protected void CharInput(int lineno)
 {
     CheckNullCharacter(lineno);
     SecondPerson.Value = In.Read();
 }
Exemplo n.º 7
0
 public static int Read()
 {
     return(In.Read());
 }
Exemplo n.º 8
0
 // Read a character from the standard input stream.
 public static int Read()
 {
     NormalMode();
     return(In.Read());
 }
Exemplo n.º 9
0
 public virtual int Read() => In.Read();
Exemplo n.º 10
0
 public static int Read()
 {
     return In.Read();
 }