static void Load() { try { if (!File.Exists(DEFAULT_CONF_FILE)) { return; } conf = new SunfishConfiguration(); conf = JsonNet.Deserialize <SunfishConfiguration>(File.ReadAllText(DEFAULT_CONF_FILE)); if (conf.Services == null) { conf.Services = new List <SunfishServiceConfiguration>(); } sroot.ShowMenu = conf.SunfishRoot; foreach (SunfishServiceConfiguration ssc in conf.Services) { srvs.Add(SunfishService.Instance(ssc)); } if (conf.Active) { //Bypass set active check conf.Active = false; SetActive(true); } } catch { } }
public static SunfishService AddService(SunfishServiceConfiguration ssc) { SunfishService s; srvs.Add(s = SunfishService.Instance(ssc)); conf.Services.Add(ssc); return(s); }
public static SunfishService ReplaceService(SunfishService sold, SunfishServiceConfiguration ssc) { SunfishService s = SunfishService.Instance(ssc); int i = srvs.IndexOf(sold); if (i < 0) { srvs.Add(s); } else { srvs[i] = s; } i = conf.Services.IndexOf(ssc); if (i < 0) { conf.Services.Add(ssc); } return(s); }