您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * libcaca .NET bindings for libcaca
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
  4. * 2007 Sam Hocevar <sam@@hocevar.net>
  5. * All Rights Reserved
  6. *
  7. * This library is free software. It comes without any warranty, to
  8. * the extent permitted by applicable law. You can redistribute it
  9. * and/or modify it under the terms of the Do What the Fuck You Want
  10. * to Public License, Version 2, as published by Sam Hocevar. See
  11. * http://www.wtfpl.net/ for more details.
  12. */
  13. using System;
  14. using System.Runtime.InteropServices;
  15. using System.Security;
  16. using System.Drawing;
  17. namespace Caca
  18. {
  19. /* Static libcaca stuff that does not fit in any object */
  20. public static class Libcaca
  21. {
  22. [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
  23. SuppressUnmanagedCodeSecurity]
  24. private static extern int caca_rand(int min, int max);
  25. public static int Rand(int min, int max)
  26. {
  27. return caca_rand(min, max);
  28. }
  29. [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
  30. SuppressUnmanagedCodeSecurity]
  31. private static extern IntPtr caca_get_version();
  32. public static string getVersion()
  33. {
  34. return Marshal.PtrToStringAnsi(caca_get_version());
  35. }
  36. }
  37. }