예제 #1
0
        public override async Task SdkAfterFinish(List <Package> packages, List <GenericTypes.UEStruct> missing)
        {
            var basicHeader = new BasicHeader();
            var basicCpp    = new BasicCpp();

            // Copy Include File
            basicHeader.Process(IncludePath);
            basicCpp.Process(IncludePath);

            var text = new CorrmStringBuilder();

            text += $"#pragma once{Utils.NLine}{Utils.NLine}";
            text += $"// ------------------------------------------------ \\\\{Utils.NLine}";
            text += $"// Sdk Generated By ( Unreal Finder Tool By CorrM ) \\\\{Utils.NLine}";
            text += $"// ------------------------------------------------ \\\\{Utils.NLine}";
            text += $"// Name: {Generator.GameName.Trim()}, Version: {Generator.GameVersion}{Utils.NLine}{Utils.NLine}";
            text += $"{Utils.NLine}";

            text += $"#include <set>{Utils.NLine}";
            text += $"#include <string>{Utils.NLine}";
            text += $"#include \"SDK/{basicHeader.FileName}\"{Utils.NLine}";

            // Check for missing structs
            if (missing.Count > 0)
            {
                string missingText = string.Empty;

                // Init File
                IncludeFile <CppLang> .CreateFile(Path.GetDirectoryName(Generator.SdkPath), "MISSING.h");

                foreach (var s in missing)
                {
                    IncludeFile <CppLang> .AppendToSdk(Path.GetDirectoryName(Generator.SdkPath), "MISSING.h", GetFileHeader(true));

                    missingText += $"// {await s.GetFullName()}{Utils.NLine}// ";
                    missingText += $"0x{await s.GetPropertySize():X4}{Utils.NLine}";

                    missingText += $"struct {MakeValidName(await s.GetNameCpp())}{Utils.NLine}{{{Utils.NLine}";
                    missingText += $"\tunsigned char UnknownData[0x{await s.GetPropertySize():X}];{Utils.NLine}}};{Utils.NLine}{Utils.NLine}";
                }

                missingText += GetFileFooter();
                IncludeFile <CppLang> .WriteToSdk(Path.GetDirectoryName(Generator.SdkPath), "MISSING.h", missingText);

                // Append To Sdk Header
                text += $"{Utils.NLine}#include \"SDK/MISSING.h\"{Utils.NLine}";
            }

            text += $"{Utils.NLine}";
            foreach (var package in packages)
            {
                text += $"#include \"SDK/{GenerateFileName(FileContentType.Structs, await package.GetName())}\"{Utils.NLine}";
                text += $"#include \"SDK/{GenerateFileName(FileContentType.Classes, await package.GetName())}\"{Utils.NLine}";

                if (Generator.ShouldGenerateFunctionParametersFile())
                {
                    text += $"#include \"SDK/{GenerateFileName(FileContentType.FunctionParameters, await package.GetName())}\"{Utils.NLine}";
                }
            }

            // Write SDK.h
            IncludeFile <CppLang> .AppendToSdk(Path.GetDirectoryName(Generator.SdkPath), "SDK.h", text);
        }