fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11.  
  12. namespace WindowsFormsApplication1
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. FolderBrowserDialog dlg = new FolderBrowserDialog();
  24. if (dlg.ShowDialog() != DialogResult.OK)
  25. {
  26. return;
  27. }
  28.  
  29. textBox1.Text = dlg.SelectedPath;
  30. listBox1.Items.Clear();
  31. Stack<Tuple<string, int>> stack = new Stack<Tuple<string, int>>();
  32. stack.Push(new Tuple<string, int>(dlg.SelectedPath, 0));
  33.  
  34. while (stack.Count > 0)
  35. {
  36. var temp = stack.Pop();
  37. var dir = temp.Item1;
  38. var rank = temp.Item2;
  39.  
  40. listBox1.Items.Add(
  41. new String(' ', rank * 2) +
  42. Path.GetFileName(dir) + "[フォルダ]");
  43.  
  44. var subfs = Directory.GetFiles(dir, "*");
  45. foreach (var f in subfs)
  46. {
  47. listBox1.Items.Add(
  48. new String(' ', (rank + 1) * 2) +
  49. Path.GetFileName(f) + "[ファイル]");
  50. }
  51. if (subfs.Length > 0)
  52. {
  53. listBox1.Items.Add("");
  54. }
  55.  
  56. var subds = Directory.GetDirectories(dir, "*");
  57. foreach (var d in subds)
  58. {
  59. stack.Push(new Tuple<string, int>(d, rank + 1));
  60. }
  61. }
  62. }
  63. }
  64. }
  65.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(9,24): error CS0234: The type or namespace name `Tasks' does not exist in the namespace `System.Threading'. Are you missing an assembly reference?
prog.cs(10,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 3 error(s), 0 warnings
stdout
Standard output is empty