public static bool ReadControlerConfig(string jsonPath, out ControlerConfig cControlerConfig) { cControlerConfig = null; try { if (!System.IO.File.Exists(jsonPath)) { return(false); } bool status; string jsonText; status = ReadFileDataUTF8(jsonPath, out jsonText); if (!status) { return(false); } cControlerConfig = JsonConvert.DeserializeObject <ControlerConfig>(jsonText); } catch (System.Exception ex) { return(false); } return(true); }
/// <summary> /// 取得ControlerConfig.dat資料 (路徑:IP:Globaltek\TE_Config\ControlerConfig.dat) /// </summary> /// <param name="cControlerConfig"></param> /// <returns></returns> public static bool GetControlerConfigData(out ControlerConfig cControlerConfig) { cControlerConfig = new ControlerConfig(); try { string ControlerConfig_dat = "ControlerConfig.dat"; string ControlerConfig_Path = string.Format(@"{0}\{1}\{2}\{3}", CaxEnv.GetGlobaltekEnvDir(), "TE_Config", "Config", ControlerConfig_dat); if (!System.IO.File.Exists(ControlerConfig_Path)) { MessageBox.Show("路徑:" + ControlerConfig_Path + "不存在"); return(false); } CaxPublic.ReadControlerConfig(ControlerConfig_Path, out cControlerConfig); } catch (System.Exception ex) { return(false); } return(true); }