public static ICodeBlock GenerateAfterActivity(ICodeBlock codeBlock, IElement saveObject) { #region Loop through all ReferenceFiles to get their post custom activity code for (int i = 0; i < saveObject.ReferencedFiles.Count; i++) { codeBlock.InsertBlock(ReferencedFileSaveCodeGenerator.GetPostCustomActivityForReferencedFile(saveObject.ReferencedFiles[i])); } #endregion #region Loop through all NamedObjectSaves to get their post custom activity code for (int i = 0; i < saveObject.NamedObjects.Count; i++) { NamedObjectSaveCodeGenerator.GetPostCustomActivityForNamedObjectSave(saveObject, saveObject.NamedObjects[i], codeBlock); } #endregion foreach (PluginManager pluginManager in PluginManager.GetInstances()) { CodeGeneratorPluginMethods.GenerateActivityPluginCode(CodeLocation.AfterStandardGenerated, pluginManager, codeBlock, saveObject); } return codeBlock; }
public override ICodeBlock GenerateDestroy(ICodeBlock codeBlock, SaveClasses.IElement element) { for (int i = 0; i < element.ReferencedFiles.Count; i++) { codeBlock.InsertBlock(GetDestroyForReferencedFile(element, element.ReferencedFiles[i])); } codeBlock._(); return codeBlock; }
public override ICodeBlock GenerateActivity(ICodeBlock codeBlock, SaveClasses.IElement element) { for (int i = 0; i < element.ReferencedFiles.Count; i++) { codeBlock.InsertBlock(GetActivityForReferencedFile(element.ReferencedFiles[i], element)); } return codeBlock; }
private static void WriteConvertToManuallyUpdatedForListNos(ICodeBlock codeBlock, NamedObjectSave nos) { // See if the source type is an Entity EntitySave entitySave = ObjectFinder.Self.GetEntitySave(nos.SourceClassGenericType); bool add = false; ICodeBlock forBlock = new CodeBlockFor(null, "int i = 0; i < " + nos.InstanceName + ".Count; i++"); if (entitySave != null) { forBlock.Line(nos.InstanceName + "[i].ConvertToManuallyUpdated();"); add = true; } else { // See if this type has a built-in way to make it manually updated AssetTypeInfo ati = AvailableAssetTypes.Self.GetAssetTypeFromRuntimeType(nos.SourceClassGenericType); if (ati != null && !string.IsNullOrEmpty(ati.MakeManuallyUpdatedMethod)) { forBlock.Line(ati.MakeManuallyUpdatedMethod.Replace("this", nos.InstanceName + "[i]") + ";"); add = true; } } if (add) { codeBlock.InsertBlock(forBlock); } }