public static void Main(string[] args) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); UnrealTypes.Load(); AssemblyRewriter rewriter = new AssemblyRewriter(); if (System.Diagnostics.Debugger.IsAttached && args.Length == 0) { ManagedUnrealReflectionBase.UpdateSerializerCode(); //RunTests(rewriter); } AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; foreach (string filePath in args) { ProcessAssembly(rewriter, filePath); additionalAssemblySearchPath = null; } stopwatch.Stop(); Console.WriteLine("AssemblyRewriter finished " + stopwatch.Elapsed); Console.ReadLine(); }
private static void SetAllMetaData(IntPtr obj, ManagedUnrealReflectionBase field, UMeta.Target target) { if (!FBuild.WithEditor || !metaDataEnabled || field == null || string.IsNullOrEmpty(field.Path)) { return; } IntPtr outermost = Native_UObjectBaseUtility.GetOutermost(obj); IntPtr metadata = outermost == IntPtr.Zero ? IntPtr.Zero : Native_UPackage.GetMetaData(outermost); if (metadata == IntPtr.Zero) { return; } Dictionary <FName, string> values = null; if (!metaDataMap.TryGetValue(field.Path.ToLower(), out values)) { values = new Dictionary <FName, string>(); } switch (target) { // Class / interface case UMeta.Target.Class: case UMeta.Target.Interface: // See GetMetadataKeyword (Engine\Source\Programs\UnrealHeaderTool\Private\BaseParser.cpp) // "NotBlueprintable" removes "NotBlueprintable" and adds "IsBlueprintBase=false" // "Blueprintable" and adds "IsBlueprintBase=true" // "BlueprintInternalUseOnly" adds "BlueprintType" if (!values.ContainsKey(UMeta.GetKeyName(MDClass.IsBlueprintBase))) { if (values.ContainsKey(UMeta.GetKeyName(MDClass.Blueprintable))) { values[UMeta.GetKeyName(MDClass.IsBlueprintBase)] = "true"; } else if (values.ContainsKey(UMeta.GetKeyName(MDClass.NotBlueprintable))) { values[UMeta.GetKeyName(MDClass.IsBlueprintBase)] = "false"; } } MetaDataMergeClassCategories(metadata, obj, values); break; } SetMetaDataBlueprintability(values, target, field as ManagedUnrealTypeInfo); using (TArrayUnsafe <FName> keysUnsafe = new TArrayUnsafe <FName>()) using (TArrayUnsafe <string> valuesUnsafe = new TArrayUnsafe <string>()) { keysUnsafe.AddRange(values.Keys.ToArray()); valuesUnsafe.AddRange(values.Values.ToArray()); Native_UMetaData.SetObjectValues(metadata, obj, keysUnsafe.Address, valuesUnsafe.Address); } }
protected void WriteObject(BinaryWriter writer, ManagedUnrealReflectionBase obj) { if (obj == null) { writer.Write(false); } else { writer.Write(true); obj.Serialize(writer); } }
private static void LateAddMetaData(ManagedUnrealReflectionBase field, IntPtr nativeField, string key) { FName keyName = new FName(key); using (FStringUnsafe displayNameUnsafe = new FStringUnsafe()) { Native_UField.GetMetaDataF(nativeField, ref keyName, ref displayNameUnsafe.Array); string displayName = displayNameUnsafe.Value; if (!string.IsNullOrEmpty(displayName)) { LateAddMetaData(field.Path, keyName, displayName, false); } } }
public static void Main(string[] args) { if (!args.Any()) { Console.Error.WriteLine("Error: No input files. Add file path to dll as argument."); Environment.Exit(2); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); UnrealTypes.Load(); AssemblyRewriter rewriter = new AssemblyRewriter(); if (Debugger.IsAttached) { ManagedUnrealReflectionBase.UpdateSerializerCode(); //RunTests(rewriter); } AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; foreach (string filePath in args) { Console.WriteLine("Processing file: " + filePath); if (!ProcessAssembly(rewriter, filePath)) { Environment.ExitCode = 3; break; } additionalAssemblySearchPath = null; } stopwatch.Stop(); Console.WriteLine("AssemblyRewriter finished " + stopwatch.Elapsed); if (ManagedUnrealModuleInfo.NumWarnings > 0) { Console.WriteLine("!!!!!! " + ManagedUnrealModuleInfo.NumWarnings + " warning(s) whilst running AssemblyRewriter"); ManagedUnrealModuleInfo.NumWarnings = 0; } }
public static void Main(string[] args) { if (!args.Any()) { Console.Error.WriteLine($"Error: No input files. Add file path to dll as argument."); Environment.Exit(2); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); UnrealTypes.Load(); AssemblyRewriter rewriter = new AssemblyRewriter(); if (System.Diagnostics.Debugger.IsAttached) { ManagedUnrealReflectionBase.UpdateSerializerCode(); //RunTests(rewriter); } AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; foreach (string filePath in args) { Console.WriteLine($"Processing file: {filePath}"); var success = ProcessAssembly(rewriter, filePath); if (!success) { Environment.ExitCode = 3; } additionalAssemblySearchPath = null; } stopwatch.Stop(); Console.WriteLine("AssemblyRewriter finished " + stopwatch.Elapsed); Console.ReadLine(); }