/// <summary>
 /// Place byte[] on the clipboard, this assumes you already locked the clipboard.
 /// </summary>
 /// <param name="clipboardAccessToken">IClipboardLock</param>
 /// <param name="bytes">bytes to place on the clipboard</param>
 /// <param name="format">string with the format to place the bytes under</param>
 public static void SetAsBytes(this IClipboardAccessToken clipboardAccessToken, byte[] bytes, string format)
 {
     clipboardAccessToken.SetAsBytes(bytes, ClipboardFormatExtensions.MapFormatToId(format));
 }
 /// <summary>
 /// This places delayed rendered content on the clipboard, don't forget to subscribe to ClipboardNative.OnRenderFormat
 /// </summary>
 /// <param name="clipboardAccessToken">The IClipboardAccessToken</param>
 /// <param name="format">string with the clipboard format</param>
 public static void SetDelayedRenderedContent(this IClipboardAccessToken clipboardAccessToken, string format)
 {
     SetDelayedRenderedContent(clipboardAccessToken, ClipboardFormatExtensions.MapFormatToId(format));
 }
 /// <summary>
 /// Retrieve the content for the specified format.
 /// You will need to "lock" (OpenClipboard) the clipboard before calling this.
 /// </summary>
 /// <param name="clipboardAccessToken">IClipboardLock</param>
 /// <param name="format">string with the format to retrieve the content for</param>
 /// <returns>byte array</returns>
 public static byte[] GetAsBytes(this IClipboardAccessToken clipboardAccessToken, string format)
 {
     return(clipboardAccessToken.GetAsBytes(ClipboardFormatExtensions.MapFormatToId(format)));
 }
Beispiel #4
0
 /// <summary>
 /// Get a string from the clipboard, this assumes you already locked the clipboard.
 /// This always takes the CF_UNICODETEXT format, as Windows automatically converts
 /// </summary>
 /// <param name="clipboardAccessToken">IClipboardLock</param>
 /// <param name="format">string with the clipboard format</param>
 /// <returns>string</returns>
 public static string GetAsUnicodeString(this IClipboardAccessToken clipboardAccessToken, string format)
 {
     return(clipboardAccessToken.GetAsUnicodeString(ClipboardFormatExtensions.MapFormatToId(format)));
 }
Beispiel #5
0
 /// <summary>
 /// Place string on the clipboard, this assumes you already locked the clipboard.
 /// </summary>
 /// <param name="clipboardAccessToken">IClipboardLock</param>
 /// <param name="text">string to place on the clipboard</param>
 /// <param name="format">string with the clipboard format to use</param>
 public static void SetAsUnicodeString(this IClipboardAccessToken clipboardAccessToken, string text, string format)
 {
     clipboardAccessToken.SetAsUnicodeString(text, ClipboardFormatExtensions.MapFormatToId(format));
 }
Beispiel #6
0
 /// <summary>
 /// Set the content for the specified format.
 /// You will need to "lock" (OpenClipboard) the clipboard before calling this.
 /// </summary>
 /// <param name="clipboardAccessToken">IClipboardLock</param>
 /// <param name="format">string with the format to set the content for</param>
 /// <param name="stream">MemoryStream with the content</param>
 /// <param name="size">long with the size, if the stream is not seekable</param>
 public static void SetAsStream(this IClipboardAccessToken clipboardAccessToken, string format, Stream stream, long?size = null)
 {
     clipboardAccessToken.SetAsStream(ClipboardFormatExtensions.MapFormatToId(format), stream, size);
 }
Beispiel #7
0
 /// <summary>
 /// Retrieve the content for the specified format.
 /// You will need to "lock" (OpenClipboard) the clipboard before calling this.
 /// </summary>
 /// <param name="clipboardAccessToken">IClipboardLock</param>
 /// <param name="format">string with the format to retrieve the content for</param>
 /// <returns>MemoryStream</returns>
 public static Stream GetAsStream(this IClipboardAccessToken clipboardAccessToken, string format)
 {
     return(clipboardAccessToken.GetAsStream(ClipboardFormatExtensions.MapFormatToId(format)));
 }
 /// <summary>
 /// Test if the specified format is available on the clipboard
 /// </summary>
 /// <param name="format">string</param>
 /// <returns>bool</returns>
 public static bool HasFormat(string format) => NativeMethods.IsClipboardFormatAvailable(ClipboardFormatExtensions.MapFormatToId(format));