Exemplo n.º 1
0
        private void ReadBigFile_Click(object sender, RoutedEventArgs e)
        {
            string filePath = @"L:\NET之路\逆天SQL专题\3.大数据专题\BigValues.sql";

            if (!File.Exists(filePath))
            {
                return;
            }
            using (var stream = File.OpenRead(filePath))
            {
                //var encoding = EncodingHelper.GetType(stream);
                var textMain = TextMain.GetTextMain();
                textMain.Show();
                byte[] buffer = new byte[1024 * 1024 * 10];
                while (true)
                {
                    if (!stream.CanRead)
                    {
                        break;
                    }
                    int r = stream.Read(buffer, 0, buffer.Length);
                    textMain.ApendTextLine(Encoding.UTF8.GetString(buffer, 0, buffer.Length));
                    if (r == 0)
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
 public static TextMain GetTextMain()
 {
     if (textMain == null)
     {
         textMain = new TextMain();
     }
     return(textMain);
 }