fork download
  1. using System;
  2. using System.IO;
  3. using System.Windows.Forms;
  4.  
  5. namespace Clipboard
  6. {
  7. public class Test
  8. {
  9. [STAThread]
  10. public static void Main()
  11. {
  12. System.Windows.Forms.IDataObject o = System.Windows.Forms.Clipboard.GetDataObject();
  13. System.Console.WriteLine(o == null);
  14. foreach(string s in o.GetFormats()){
  15. FileStream fs = new FileStream(Path.Combine("D:\\hogefuga",s.Replace('/','_')),System.IO.FileMode.CreateNew);
  16. Object obj = o.GetData(s);
  17. string s1 = obj as string;
  18. if(s1 != null){
  19. System.IO.StreamWriter sw = new StreamWriter(fs,System.Text.Encoding.UTF8);
  20. sw.WriteLine(s1);
  21. sw.Flush();
  22. sw.Close();
  23. continue;
  24. }
  25.  
  26. MemoryStream ms = obj as MemoryStream;
  27. if(ms != null){
  28. ms.CopyTo(fs);
  29. fs.Flush();
  30. fs.Close();
  31. continue;
  32. }
  33.  
  34. byte[] barray = obj as byte[];
  35. if(barray != null){
  36. fs.Write(barray,0,barray.Length);
  37. fs.Flush();
  38. fs.Close();
  39. continue;
  40. }
  41. System.Console.WriteLine(s);
  42. }
  43. System.Console.WriteLine("fin");
  44. System.Windows.Forms.Clipboard.Clear();
  45.  
  46. }
  47.  
  48. }
  49. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty