You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Image.cs 914 B

8 years ago
1234567891011121314151617181920212223242526272829303132
  1. using System.IO;
  2. namespace Discord
  3. {
  4. /// <summary>
  5. /// An image that will be uploaded to Discord.
  6. /// </summary>
  7. public struct Image
  8. {
  9. public Stream Stream { get; }
  10. /// <summary>
  11. /// Create the image with a Stream.
  12. /// </summary>
  13. /// <param name="stream">This must be some type of stream with the contents of a file in it.</param>
  14. public Image(Stream stream)
  15. {
  16. Stream = stream;
  17. }
  18. #if FILESYSTEM
  19. /// <summary>
  20. /// Create the image from a file path.
  21. /// </summary>
  22. /// <remarks>
  23. /// This file path is NOT validated, and is passed directly into a <see cref="File.OpenRead(string)"/>
  24. /// </remarks>
  25. /// <param name="path">The path to the file.</param>
  26. public Image(string path)
  27. {
  28. Stream = File.OpenRead(path);
  29. }
  30. #endif
  31. }
  32. }