Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions spkl/SparkleXrm.Tasks/CrmSvcUtil/SourceCodeSplitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ public class SourceCodeSplitter
private const string CustomActions = "CustomActions";
private const string Entities = "Entities";
private const string OptionSets = "OptionSets";
private const string AutogeneratedString = "//------------------------------------------------------------------------------" +
"\n// <auto-generated>" +
"\n// This code was generated by a tool." +
"\n//" +
"\n// Changes to this file may cause incorrect behavior and will be lost if" +
"\n// the code is regenerated." +
"\n// </auto-generated>" +
"\n//------------------------------------------------------------------------------\n";
protected ITrace _trace;

public SourceCodeSplitter(ITrace trace)
Expand Down Expand Up @@ -72,6 +80,8 @@ private void WriteTypeContentToFile(string typeName, string typeNamespace, strin
private string GenerateTypeText(string typeNamespace, string content)
{
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine(AutogeneratedString);

var namespaceContent = !string.IsNullOrWhiteSpace(typeNamespace);
if (namespaceContent)
{
Expand Down
4 changes: 2 additions & 2 deletions spkl/SparkleXrm.Tasks/CrmSvcUtil/SourceCodeTypeExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

public class SourceCodeTypeExtractor
{
private const string ClassPattern = @"([a-zA-Z0-9\(\"",\s\.\)\]\s\n\[:])+public\spartial[a-zA-Z0-9\s:\.,_]+{(?:[^{}]|(?<open>{)|(?<-open>}))+(?(open)(?!))}";
private const string EnumPattern = @"([a-zA-Z0-9\(\"",\s\.\)\]\s\n\[:])+public\senum[a-zA-Z0-9\s_]+{(?:[^{}]|(?<open>{)|(?<-open>}))+(?(open)(?!))}";
private const string ClassPattern = @"([a-zA-Z0-9\(\"",\s\.\)\]\s\n\[::\.,_])+public\spartial[a-zA-Z0-9\s:\.,_]+{(?:[^{}]|(?<open>{)|(?<-open>}))+(?(open)(?!))}";
private const string EnumPattern = @"([a-zA-Z0-9\(\"",\s\.\)\]\s\n\[::\.,_])+public\senum[a-zA-Z0-9\s_]+{(?:[^{}]|(?<open>{)|(?<-open>}))+(?(open)(?!))}";

public List<TypeContainer> ExtractTypes(string input)
{
Expand Down