Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe Program.cs /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationCore.dll"
- using System;
- using System.Windows;
- namespace DumpClipboard
- {
- class Program
- {
- [STAThread]
- static void Main(string[] args)
- {
- // http://msdn.microsoft.com/en-us/library/system.windows.clipboard.aspx
- IDataObject dataObject = Clipboard.GetDataObject();
- foreach (var dataFormat in dataObject.GetFormats(autoConvert: true))
- {
- Console.WriteLine("* Data format: {0}", dataFormat);
- }
- Array textDataFormats = Enum.GetValues(typeof(TextDataFormat));
- for (int i = 0; i < textDataFormats.Length; ++i)
- {
- TextDataFormat textFormat = (TextDataFormat) textDataFormats.GetValue(i);
- if (Clipboard.ContainsText(textFormat))
- {
- String data = Clipboard.GetText(textFormat);
- Console.WriteLine("* Clipboard data as {0}", textFormat);
- foreach (Char c in data.ToCharArray())
- {
- Console.Write("{0:X4} ", Convert.ToInt32(c));
- }
- Console.WriteLine();
- }
- else
- {
- Console.WriteLine("* Clipboard data is not {0}", textFormat);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment