/// <summary> /// Execute Activity /// </summary> /// <param name="context"></param> protected override void Execute(CodeActivityContext context) { var row = Row.Get(context); var sourceText = string.Empty; if ((UTF8.Get(context) ? 1 : 0) + (Unicode.Get(context)? 1 : 0) + (Shift_JIS.Get(context) ? 1 : 0) != 1) { throw new ArgumentException("Invalid choice at Encoding"); } Encoding enc; if (Shift_JIS.Get(context)) { enc = Encoding.GetEncoding(932); } else if (Unicode.Get(context)) { enc = Encoding.Unicode; } else { enc = Encoding.UTF8; } using (var reader = new System.IO.StreamReader(TemplateFile.Get(context), enc)) { sourceText = reader.ReadToEnd(); } foreach (DataColumn c in row.Table.Columns) { sourceText = sourceText.Replace("%%%_" + c.ColumnName + "_%%%", row[c].ToString()); } if (CheckEscapeStringRemining.Get(context)) { var r = new System.Text.RegularExpressions.Regex("^.*%%%_.*_%%%.*$"); if (r.IsMatch(sourceText)) { throw new ApplicationException("Escape Characters is remining."); } } Result.Set(context, sourceText); }