public void SetOldPath(string path) { this.OldPath = path; this.OldCustomCode = string.Empty; if (File.Exists(this.OldPath)) { string code = File.ReadAllText(this.OldPath, Encoding.UTF8); this.OldCustomCode = CodeTemplateInfo.QueryCustomCode(code, "//// custom codes", "//// custom codes end"); } }
public static CodeTemplateInfo Create(CodeTemplateType templateType, string templatePath, string buildPath) { CodeTemplateInfo codeTemplateInfo = new CodeTemplateInfo { TemplateType = templateType, Path = templatePath }; codeTemplateInfo.SetBuildPath(buildPath); if (File.Exists(buildPath)) { codeTemplateInfo.SetOldPath(buildPath); } codeTemplateInfo.FieldCode = string.Empty; return(codeTemplateInfo); }