simeon3000

Photo Galery Date.Time

Jun 1st, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1.             int photoNumber = int.Parse(Console.ReadLine());       
  2.             int day = int.Parse(Console.ReadLine());
  3.             int month = int.Parse(Console.ReadLine());
  4.             int year = int.Parse(Console.ReadLine());
  5.             int hours = int.Parse(Console.ReadLine());
  6.             int mins = int.Parse(Console.ReadLine());
  7.             int photoSize = int.Parse(Console.ReadLine());
  8.             int width = int.Parse(Console.ReadLine());
  9.             int height = int.Parse(Console.ReadLine());
  10.  
  11.             DateTime dt = DateTime.ParseExact
  12.                 ($"{day}/{month}/{year} {hours}:{mins}", "d/M/yyyy H:m", null);
  13.  
  14.  
  15.             Console.WriteLine($"Name: DSC_{photoNumber:d4}.jpg");
  16.             Console.WriteLine($"Date Taken: {dt.ToString("dd'/'MM'/'yyyy HH:mm")}");
  17.  
  18.             if (photoSize < 1000)
  19.                 Console.WriteLine($"Size: {photoSize}B");
  20.             else if (photoSize < 1000000)
  21.                 Console.WriteLine($"Size: {Math.Round(photoSize / 1000.0, 1)}KB");
  22.             else if (photoSize < 1000000000)
  23.                 Console.WriteLine($"Size: {Math.Round(photoSize / 1000000.0, 1)}MB");
  24.            
  25.  
  26.             string orientation = string.Empty;
  27.  
  28.             if (width > height) orientation = "(landscape)";
  29.             else if (width < height) orientation = "(portrait)";
  30.             else orientation = "(square)";
  31.  
  32.             Console.WriteLine($"Resolution: {width}x{height} {orientation}");
Advertisement
Add Comment
Please, Sign In to add comment