Helper.cs 792 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. namespace AipGateway.FileJob.Scheduler
  4. {
  5. internal static class Helper
  6. {
  7. public static (int h, int m) SplitMinutes(long minutes)
  8. {
  9. return ((int)Math.Floor(minutes / 60.0), (int)(minutes % 60));
  10. }
  11. public static int TryInt(string value, int defValue)
  12. {
  13. try
  14. {
  15. int number = int.Parse(value);
  16. return number;
  17. }
  18. catch (FormatException)
  19. {
  20. Console.WriteLine("유효한 숫자 형식이 아닙니다.");
  21. return defValue;
  22. }
  23. catch (Exception ex)
  24. {
  25. Console.WriteLine($"오류 발생: {ex.Message}");
  26. return defValue;
  27. }
  28. }
  29. }
  30. }