public static void SaveObjectLocal <T>(T source) where T : class { var basePath = CommonHelper.ExePath; var dirPath = Path.Combine(basePath, "LocalData"); DirFileHelper.CreateDir(dirPath); var serializedstr = JsonConvert.SerializeObject(source); var fileName = string.Format("local_{0}.json", typeof(T).ToString()); var filePath = Path.Combine(dirPath, fileName); DirFileHelper.CreateFile(filePath, serializedstr); }
/// <summary> /// 将生成代码写入文件 /// </summary> /// <param name="filePath">路径</param> /// <param name="code">代码</param> public void WriteCodeBuilder(string filePath, string code) { string filepath = "/CodeMatic/" + filePath; DirFileHelper.CreateFile(filepath, code); }
/// <summary> /// 将生成代码写入文件 /// </summary> /// <param name="filePath">路径</param> /// <param name="code">代码</param> public void WriteCodeBuilder(string filePath, string code) { string filepath = "~/Areas/CodeMaticModule/DataModel/CodeMatic/" + filePath; DirFileHelper.CreateFile(filepath, code); }