public static GetFiles ( string path, string searchPattern = "*.cs" ) : Entitas.Migration.MigrationFile[] | ||
path | string | |
searchPattern | string | |
return | Entitas.Migration.MigrationFile[] |
public MigrationFile[] Migrate(string path) { var properties = MigrationUtils.GetFiles(path, "Entitas.properties"); for (int i = 0; i < properties.Length; i++) { var file = properties[i]; //Entitas.Unity.VisualDebugging.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator/ //Entitas.Unity.VisualDebugging.TypeDrawerFolderPath = Assets/Editor/TypeDrawer/ file.fileContent = file.fileContent.Replace("Entitas.Unity.CodeGenerator.GeneratedFolderPath", "Entitas.CodeGenerator.GeneratedFolderPath"); file.fileContent = file.fileContent.Replace("Entitas.Unity.CodeGenerator.Pools", "Entitas.CodeGenerator.Pools"); file.fileContent = file.fileContent.Replace("Entitas.Unity.CodeGenerator.EnabledCodeGenerators", "Entitas.CodeGenerator.EnabledCodeGenerators"); } const string pattern = @".CreateSystem<(?<system>\w*)>\(\s*\)"; var sources = MigrationUtils.GetFiles(path) .Where(file => Regex.IsMatch(file.fileContent, pattern)) .ToArray(); for (int i = 0; i < sources.Length; i++) { var file = sources[i]; file.fileContent = Regex.Replace( file.fileContent, pattern, match => ".CreateSystem(new " + match.Groups["system"].Value + "())" ); } return(properties.Concat(sources).ToArray()); }
public MigrationFile[] Migrate(string path) { var files = MigrationUtils.GetFiles(path); var migratedFiles = new List <MigrationFile>(); migratedFiles.AddRange(updateNamespace(files, "Entitas.Unity.VisualDebugging", "Entitas.VisualDebugging.Unity.Editor")); return(migratedFiles.ToArray()); }
public MigrationFile[] Migrate(string path) { var files = MigrationUtils.GetFiles(path); var migratedFiles = new List <MigrationFile>(); migratedFiles.AddRange(updateNamespace(files, "Entitas.CodeGenerator.Api", "Entitas.CodeGeneration.Attributes")); migratedFiles.AddRange(updateNamespace(files, "Entitas.Unity.VisualDebugging", "Entitas.VisualDebugging.Unity")); migratedFiles.AddRange(updateNamespace(files, "Entitas.Unity.Blueprints", "Entitas.Blueprints.Unity")); return(migratedFiles.ToArray()); }
public MigrationFile[] Migrate(string path) { var files = MigrationUtils.GetFiles(path) .Where(file => Regex.IsMatch(file.fileContent, EXECUTE_PATTERN)) .ToArray(); for (int i = 0; i < files.Length; i++) { files[i].fileContent = Regex.Replace(files[i].fileContent, EXECUTE_PATTERN, EXECUTE_REPLACEMENT, RegexOptions.Multiline); } return(files); }
public MigrationFile[] Migrate(string path) { var files = MigrationUtils.GetFiles(path) .Where(file => file.fileContent.Contains(POOL_PATTERN_1) || file.fileContent.Contains(COMPONENT_PATTERN)) .ToArray(); for (int i = 0; i < files.Length; i++) { var file = files[i]; file.fileContent = file.fileContent.Replace(POOL_PATTERN_1, REPLACEMENT + POOL_PATTERN_1); file.fileContent = file.fileContent.Replace(POOL_PATTERN_2, REPLACEMENT + POOL_PATTERN_2); file.fileContent = file.fileContent.Replace(COMPONENT_PATTERN, REPLACEMENT + COMPONENT_PATTERN); } return(files); }
public MigrationFile[] Migrate(string path) { var files = MigrationUtils.GetFiles(path) .Where(file => Regex.IsMatch(file.fileContent, TRIGGER_PATTERN) || Regex.IsMatch(file.fileContent, EVENT_TYPE_PATTERN)) .ToArray(); for (int i = 0; i < files.Length; i++) { var file = files[i]; file.fileContent = Regex.Replace(file.fileContent, TRIGGER_END_PATTERN, match => match.Value + " }", RegexOptions.Multiline); file.fileContent = Regex.Replace(file.fileContent, EVENT_TYPE_PATTERN_END, match => match.Value + " }", RegexOptions.Multiline); file.fileContent = Regex.Replace(file.fileContent, TRIGGER_PATTERN, TRIGGER_REPLACEMENT, RegexOptions.Multiline); file.fileContent = Regex.Replace(file.fileContent, EVENT_TYPE_PATTERN, EVENT_TYPE_REPLACEMENT, RegexOptions.Multiline); } return(files); }
public MigrationFile[] Migrate(string path) { var files = MigrationUtils.GetFiles(path); for (int i = 0; i < files.Length; i++) { var file = files[i]; file.fileContent = migrateBase(file.fileContent); file.fileContent = migrateTrigger(file.fileContent); file.fileContent = migrateToFilter(file.fileContent); file.fileContent = migrateSetPoolsSetPool(file.fileContent); file.fileContent = migrateExecute(file.fileContent); } return(files); }
public MigrationFile[] Migrate(string path) { var files = MigrationUtils.GetFiles(path) .Where(file => Regex.IsMatch(file.fileContent, TRIGGER_PATTERN)) .ToArray(); for (int i = 0; i < files.Length; i++) { var file = files[i]; var eventTypeMatch = Regex.Match(file.fileContent, EVENT_TYPE_PATTERN, RegexOptions.Multiline); var eventType = eventTypeMatch.Groups["eventType"].Value; file.fileContent = Regex.Replace(file.fileContent, EVENT_TYPE_PATTERN, string.Empty, RegexOptions.Multiline); file.fileContent = Regex.Replace(file.fileContent, TRIGGER_PATTERN, match => string.Format(TRIGGER_REPLACEMENT_FORMAT, match.Groups["matcher"].Value, eventType), RegexOptions.Multiline); } return(files); }