mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-11-03 19:17:05 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			736 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			736 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using System.Collections.Generic;
 | 
						|
using Hangfire;
 | 
						|
 | 
						|
namespace API.Helpers.Converters
 | 
						|
{
 | 
						|
    public static class CronConverter
 | 
						|
    {
 | 
						|
        public static readonly IEnumerable<string> Options = new []
 | 
						|
        {
 | 
						|
            "disabled",
 | 
						|
            "daily",
 | 
						|
            "weekly",
 | 
						|
        };
 | 
						|
        public static string ConvertToCronNotation(string source)
 | 
						|
        {
 | 
						|
            var destination = string.Empty;
 | 
						|
            destination = source.ToLower() switch
 | 
						|
            {
 | 
						|
                "daily" => Cron.Daily(),
 | 
						|
                "weekly" => Cron.Weekly(),
 | 
						|
                "disabled" => Cron.Never(),
 | 
						|
                "" => Cron.Never(),
 | 
						|
                _ => destination
 | 
						|
            };
 | 
						|
 | 
						|
            return destination;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |