public T DeserializeObjFromFile <T>(string varFileName) { T t = default(T); if (string.IsNullOrEmpty(varFileName)) { return(t); } string filePath = ResContext.GetSavePath() + "/" + varFileName; byte[] bytes = null; try { bytes = File.ReadAllBytes(filePath); } catch (Exception e) { Helper.Log(e.Message); } if (bytes == null || bytes.Length == 0) { Helper.Log("LocalCfg DeserializeObjFromFile:Error caused by null file bytes,path: " + filePath); return(t); } return(DeserializeObjFromBytes <T>(bytes)); }
/// <summary> /// 判断DB文件是否存在 /// </summary> /// <returns></returns> private bool IsDbExist() { string filePath = "{0}database/{1}"; filePath = Helper.Format(filePath, ResContext.GetSavePath(), DATABASE_NAME); if (File.Exists(filePath)) { return(true); } else { return(false); } }