public static bool NavMenuInitialize() { try { var jsonConfigFile = new JSONConfigurationManager <NavMenuModel>(); MasterMenu.NavMenu = jsonConfigFile.ReadConfig(WebConfig.NavMenuConfigUrl); return(true); } catch (Exception) { return(false); } }
public static bool NavMenuSave() { try { //MasterMenu.Initialize(@"http://localhost:60180"); var jsonConfigFile = new JSONConfigurationManager <NavMenuModel>(MasterMenu.NavMenu); jsonConfigFile.WriteConfig(WebConfig.NavMenuConfigUrl); return(true); } catch (Exception) { return(false); } }
/// <summary> /// save the config file to the path, after done the operations. /// </summary> /// <returns>true if not error occured in try block.</returns> private bool SaveLog(SyncLog log) { JSONConfigurationManager <SyncLog> logManager = new JSONConfigurationManager <SyncLog>(log); try { logManager.WriteConfig(_path); return(true); } catch (Exception ex) { ExceptionHandling.LogException(ex); return(false); } }
/// <summary> /// force read the file in the path, should return null if not found. /// </summary> /// <returns></returns> private SyncLog FetchLog() { SyncLog log; JSONConfigurationManager <SyncLog> logManager = new JSONConfigurationManager <SyncLog>(); try { log = logManager.ReadConfig(_path); if (log == null) { log = new SyncLog(); } return(log); } catch (Exception ex) { ExceptionHandling.LogException(ex); log = new SyncLog(); return(log); } }