fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6.  
  7. namespace TextRoll
  8. {
  9. static class Program
  10. {
  11. [STAThread]
  12. static void Main()
  13. {
  14. Application.EnableVisualStyles();
  15. Application.SetCompatibleTextRenderingDefault(false);
  16. Application.Run(new Form1());
  17. }
  18. }
  19. public class Form1 : Form
  20. {
  21. RichTextBox log = new RichTextBox();
  22. List<string> roll = new List<string>();
  23. public Form1()
  24. {
  25. log.Location = new Point(0, 0);
  26. this.AutoScaleDimensions = new SizeF(6F, 12F);
  27. this.AutoScaleMode = AutoScaleMode.Font;
  28. this.ClientSize = new System.Drawing.Size(800, 400);
  29. this.Controls.Add(log);
  30. log.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
  31. log.AllowDrop = true;
  32. log.DragEnter += _DragEnter;
  33. log.DragDrop += _DragDrop;
  34. log.Size = this.ClientSize;
  35. }
  36. private void _DragEnter(object sender, DragEventArgs e)
  37. {
  38. e.Effect = DragDropEffects.None;
  39. if (!e.Data.GetDataPresent(DataFormats.FileDrop)) return;
  40. string[] fn = (string[])e.Data.GetData(DataFormats.FileDrop, false);
  41. if (fn.Length < 1) return;
  42. e.Effect = DragDropEffects.Copy;
  43. }
  44. private void _DragDrop(object sender, DragEventArgs e)
  45. {
  46. string[] fn = (string[])e.Data.GetData(DataFormats.FileDrop, false);
  47. if (fn.Length < 1) return;
  48. using (StreamReader fs = new StreamReader(fn[0]))
  49. { while (fs.Peek() > -1) texroll(fs.ReadLine()); }
  50. }
  51. private void texroll(string st)
  52. {
  53. roll.Add(st);
  54. if (roll.Count > 80) roll.RemoveAt(0);
  55. log.Text = string.Join("\n", roll.ToArray());
  56. Application.DoEvents();
  57. }
  58. }
  59. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(5,22): error CS0234: The type or namespace name `Forms' does not exist in the namespace `System.Windows'. Are you missing `System.Windows.Forms' assembly reference?
prog.cs(19,22): error CS0246: The type or namespace name `Form' could not be found. Are you missing an assembly reference?
prog.cs(21,1): error CS0246: The type or namespace name `RichTextBox' could not be found. Are you missing an assembly reference?
prog.cs(36,40): error CS0246: The type or namespace name `DragEventArgs' could not be found. Are you missing an assembly reference?
prog.cs(44,39): error CS0246: The type or namespace name `DragEventArgs' could not be found. Are you missing an assembly reference?
Compilation failed: 5 error(s), 0 warnings
stdout
Standard output is empty