public static bool TryLoadFile(string path, out RMSConfig config) { try { config = JsonConvert.DeserializeObject <RMSConfig>(File.ReadAllText(path)); return(true); } catch (Exception ex) { logger.Warn(ex, "error loading config file"); config = null; return(false); } }
static void Main(string[] args) { #if DEBUG Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); #endif var config = RMSConfig.LoadFile("Config.json"); var scheduler = new Scheduler(); foreach (var dt in config.UpdateCycleDT) { scheduler.Add(dt, OnUpdateCycle); } var archive = new CalendarArchive("cals.zip", config.EncodingEnc); var server = new ICalServer(config.Server_port) .UseEncoding(config.EncodingEnc); if (config.Server_prefixes != null) { server.UseSpecificPrefixes(config.Server_prefixes.ToArray()); } server.Start(); }