Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System;
  2. using System.Drawing;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5.  
  6. namespace ScreenRes
  7. {
  8. class Program
  9. {
  10.  
  11. private static string GetWallpaperFilename(Rectangle res, string domain)
  12. {
  13. int[] AcceptedWidth = { 1024, 1280, 1366, 1440, 1920 };
  14. int[] AcceptedHeight = { 768, 1024, 900, 1080, 1200 };
  15.  
  16. if (AcceptedHeight.Contains(res.Height) && AcceptedWidth.Contains(res.Width))
  17. {
  18. //Si on possède un fond d'écran à la résolution exacte de l'écran...
  19. return String.Format("{0}_{1}x{2}.JPG", domain, res.Width, res.Height);
  20. }
  21. else
  22. {
  23. //Sinon, on fournit un fond d'écran standard
  24. return "AD_defaultRes.JPG";
  25.  
  26. }
  27.  
  28. }
  29.  
  30.  
  31. static void Main(string[] args)
  32. {
  33.  
  34. if (Environment.UserDomainName != "NEPTUNE")
  35. {
  36. Console.WriteLine("Pas le bon domaine");
  37. Console.ReadLine();
  38. }
  39. else
  40. {
  41. Rectangle resolution = Screen.PrimaryScreen.Bounds;
  42.  
  43. Console.WriteLine(GetWallpaperFilename(resolution, Environment.UserDomainName));
  44. Console.ReadLine();
  45. }
  46.  
  47.  
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement