diff --git a/CobProgAid/CobProgAid/CodeChanger.cs b/CobProgAid/CobProgAid/CodeChanger.cs new file mode 100644 index 0000000..cb7674a --- /dev/null +++ b/CobProgAid/CobProgAid/CodeChanger.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CobProgAid +{ + public class CodeChanger + { + + public event UpdHandler Updated; + public EventArgs e = null; + public delegate void UpdHandler(CodeChanger m, EventArgs e); + + //------------------------------------------- + private string template; + private string filename; + private string progname; + + public string Template + { + get { + return template; + } + set + { + template = value; + process(); + } + } + public string CodeOut { get; set; } + + public string FileName + { + get + { + return filename; + } + set + { + filename = value; + process(); + } + } + public string ProgName + { + get + { + return progname; + } + + set + { + progname = value; + process(); + } + } + + private void process() + { + string workText = Template; + if (filename!=null&&filename != "") + { + workText = workText.Replace("XXXXX", filename); + } + if (filename != null && progname != null && progname != "" && filename != "") + { + workText = workText.Replace("YYYYYYY", progname); + workText = workText.Replace("TO" + filename.Trim(), progname); + workText = workText.Replace("$FNL", progname.Length.ToString("00")); + } + CodeOut = workText; + Updated(this, e); + } + } +}